Posts

HTML Vector Graphic PATH element

Image
The path is powerful vector graphic element and it can be used drawing lines, curves etc.  We can create complex shapes with using it.  In this example i will show you how we simple draw a line with path element. We have to use SVG element as container and its height and width will be 200 pixels.     By the way coordinate system of the HTML is little bit different from known coordinate system.   Opposite of the known system positive Y axes are down side. Path element has d attribute which is used for line direction curve and for other commands. In our simple example d has M and L. M means move, it also starting point of the path. L means draw line to a point. Our code  generates following output We start with x:20, y:20 point and draw line to x:60, y:20 point and finally draw line to x:60, y:200 point.

d3.js Transitions

Image
The transitions are powerful effects that can be applied on different elements. They are animations and can be used with delay function to overlay animation to time. In the following code i will show you simple transition which will change ā€œpā€ element text color to red in a thousand milliseconds (one second) At first we select ā€œpā€ element and after the selection apply transition function with delay and style.  When we open the page text color of the paragraph will return red. It can be seen in element markup with developer toolbar. <html> <head> <title> D3 Transitions </title> <script src="https://d3js.org/d3.v4.min.js"></script> </head> <body> <p>This is transition test</p> <script type="text/javascript">       d3.selectAll("p").transition().delay(10000).style('color', 'red'); </script> <...

d3.js Introduction

Image
d3.js is a powerful javascript library which can be used in various jobs like data visualisation, game development etc. The most enjoyable part of this library of the speed when you running your script on millions of records. Detailed information, api documentation and examples can be found in https://d3js.org address. In this article i try to show some of features whose are fundamentals of the library.  First of all we will start with adding javascript library reference with following sentence  This is the minified version of the js file which can also be used non-minified version. Purpose of this to minimise page load waiting and data throughput  The following bar-chart was created by d3.js library. I will try to explain how can accomplish this simple bar-chart via d3.js First of all we have to add d3.js file to our html file and add svg html element which is crucial for d3 shapes and other things. SVG element is a html element which came fr...

Getting max record

Image
This short article was written for  group by and max usage.  If you need querying a table which items could have more than one values by max date, you can follow these steps. First of all lets look at our table : As you can see the table has more than one record for each id.  If you want get the values which have max date you should use following query and join. select id,MAX(date) dt from tabletest  group by id This query shows us records which have max date. select t1.* from tabletest t1 inner join ( select id,MAX(date) dt from tabletest group by id ) t2 on t1.id = t2.id and t1.date = t2.dt and this query shows us the values which have max date We used first query in the second query as a table and joined two tables via id and date columns.

sqlplus run a script

Image
When we work Oracle database with our fancy tools (like TOAD, SqlDeveloper), need to run some sql scripts. Toad, SqlDeveloper and other database tools have greate interface for doing these jobs but sometimes sql script can be too big for opening in a tool and running it. You face with memory problem when open too big sql script (200 MB). You can do it this job with sqlplus simple way. First of all you should open command line (in Windows). Command Window As you can see from the screenshot, you can connect database sqlplus "user/password@database" like this. user             : database user password   : database password database     : database which you want to connect. After successfully connected database you should see following screen. To run sql script we should write @{path}{file}. If we have a script in C drive, we should write (Windows): SQL> @C:\test.sql

XML parsing unable to switch the encoding

When i tried to query a ntext column as xml with CAST function i had : XML parsing: line 1, character 55, unable to switch the encoding error. i did some research finally i succeed on it Ex : SELECT colum1, column2, CAST ( REPLACE ( CAST (column3 AS NVARCHAR ( MAX )), 'utf-8','utf-16' ) AS XML ) FROM TABLE1 column3 : is ntext xml data which has at the top of root element 1. Convert ntext to nvarchar for replace function (doesn't accept ntext datatype) 2. Replace 'utf-8' text with 'utf-16' because of SQL Server 2005 restrict 3.Cast result to XML and have fun :)