Monday, January 28, 2013

Code : MS SQL vs MYSQL through adapters

It has been a very long time since I changed from Access to using MS SQL, so I decided to go for some thing new for my new apps and sites (none public so far), my choice went to MYSQL, not because it is just free with all features, but because when we go for small hosting plans for mid size sites and apps the chances are that you get more number of databases, bigger database size with MYSQL rather than MS SQL.

MS SQL connectors come by default with Visual Studios however MYSQL Connectors need to be installed and they are freely available at MySQL.

If we are used to using the MS SQL (SQLCE) data adapters style programming then MYSQL is also the same way of programming. Following is a small code portion from my project to show the difference between the SQLCE Adapter and the MYSQL adapter based programming:

Code with MS SQL CE adapter:

Dim Con As SqlCeConnection = New SqlCeConnection(DataSource)
Dim Cmd As SqlCeCommand
Cmd = New SqlCeCommand("INSERT INTO [commentstable]([PageID],[ParentID],[CommentID],[Comment],[CommentTime],[UserName],[UserEmail],[IsApproved]) VALUES (@PageID,@ParentID,@CommentID,@Comment,@CommentTime,@UserName,@UserEmail,@IsApproved)", Con)
Cmd.Parameters.Add(New SqlCeParameter("@PageID",
Cmd.Parameters.Add(New SqlCeParameter("@ParentID",
Cmd.Parameters.Add(New SqlCeParameter("@CommentID",
Cmd.Parameters.Add(New SqlCeParameter("@Comment", SqlDbType.string))
Cmd.Parameters.Add(New SqlCeParameter("@CommentTime", SqlDbType.DateTime2))
Cmd.Parameters.Add(New SqlCeParameter("@UserName", SqlDbType.string))
Cmd.Parameters.Add(New SqlCeParameter("@UserEmail", SqlDbType.string))
Cmd.Parameters.Add(New SqlCeParameter("@IsApproved", SqlDbType.Boolean))
With SomeInsertObject
     Cmd.Parameters("@PageID").Value = .PageID
     Cmd.Parameters("@ParentID").Value = .ParentID
     Cmd.Parameters("@CommentID").Value = .CommentID
     Cmd.Parameters("@Comment").Value = .Comment
     Cmd.Parameters("@CommentTime").Value = .CommentTime
     Cmd.Parameters("@UserName").Value = .UserName
     Cmd.Parameters("@UserEmail").Value = .UserEmail
     Cmd.Parameters("@IsApproved").Value = .IsApproved
End With
If Con.State = System.Data.ConnectionState.Closed Then Con.Open()

Code with the MYSQL CE Adapter:

Dim Con As MySqlConnection = New MySqlConnection(DataSource)

Dim Cmd As MySqlCommand

Cmd = New MySqlCommand("INSERT INTO [commentstable]([PageID],[ParentID],[CommentID],[Comment],[CommentTime],[UserName],[UserEmail],[IsApproved]) VALUES (@PageID,@ParentID,@CommentID,@Comment,@CommentTime,@UserName,@UserEmail,@IsApproved)", Con)

Cmd.Parameters.Add(New MySqlParameter("@PageID", SqlDbType.Int))
Cmd.Parameters.Add(New MySqlParameter("@ParentID", SqlDbType.Int))
Cmd.Parameters.Add(New MySqlParameter("@CommentID", SqlDbType.Int))
Cmd.Parameters.Add(New MySqlParameter("@Comment", SqlDbType.VarChar))
Cmd.Parameters.Add(New MySqlParameter("@CommentTime", SqlDbType.DateTime2))
Cmd.Parameters.Add(New MySqlParameter("@UserName", SqlDbType.VarChar))
Cmd.Parameters.Add(New MySqlParameter("@UserEmail", SqlDbType.VarChar))
Cmd.Parameters.Add(New MySqlParameter("@IsApproved", SqlDbType.TinyInt))
            With SomeInsertObject
                Cmd.Parameters("@PageID").Value = .PageID
                Cmd.Parameters("@ParentID").Value = .ParentID
                Cmd.Parameters("@CommentID").Value = .CommentID
                Cmd.Parameters("@Comment").Value = .Comment
                Cmd.Parameters("@CommentTime").Value = .CommentTime
                Cmd.Parameters("@UserName").Value = .UserName
                Cmd.Parameters("@UserEmail").Value = .UserEmail
                Cmd.Parameters("@IsApproved").Value = .IsApproved
            End With
If Con.State = System.Data.ConnectionState.Closed Then Con.Open()

The only observable difference is that we need to change the name from SQLCE to MYSQL for code portion and some data types like string to varchar etc.


Friday, January 11, 2013

SSD or Disk based HDD – What to buy?

I was planning in going for a SSD, but thought of checking if it is actually faster than the standard disk based Hard disks, with some cost limits in mind.   After thorough search and research on net, I came to know that SSDs are only preferred if more read speed is desired.

My current Hard Disk is 7200.11 16mb cache Seagate Hard Disk and following are the speeds I get from it:

My HDD Speed

However, from research,  the came to a conclusion that I might get double read speed from SSD to that of 7200rpms.

So, alternative is to get 32MB cache hard disks or go for 10000RPM hard drives, SSDs are to be developed to be made economical.

if space with speed is a concern then:

For Gain in Read speed use any Raid version 0,1,5,10,01

If Top write speed is must then use Raid 0

For Good write speed and safety etc use Raid 5,10,01

The disk speed measuring software can be downloaded from here.

Thursday, January 10, 2013

My Shopping Experience for Sankranthi 2013

For a change, I tried India Times Shopping to EBay, I have experience of shopping online with EBay for things like mobiles, speakers, tool sets etc, I also recomemded to buy online for my friends too.

For new year, sankranthi shopping, I planned in for purchasing a Lenovo P700i Mobile phone from, I placed the order on 7th January for a Blue Piece.

On 8th of January, morning, I got a call stating that the selected Blue Piece is out of stock, and they gave option for Fund refund or a White Color Piece, since I need to decide, I asked than to call back in 30 minutes but they never called back.

My Efforts:

  • On 8th January after there call, I started to call them for a follow up on the issue/case, however no one answered the phones.
  • On the same day and next day, they answered two calls of mine, but the answers that are given is Pleasantly requesting me to call back after some time as there servers are down.
  • I tried to make phone contact to them many times on the issue, but the calls are completely answered.
  • On 8th, I used the live chat, no one connected to me till 10 minutes, I closed the chat program, after some time I got the email with Chat Transcript in which it states that help agent joined the chat after 15 minutes.

chat no response

  • On 8th I used the chat program and call also.  No one answered the call but chat was answered this time.  Following the pic of the chat, this time, the help agent confirmed that they would be delivering the white color of phone instead of blue, I was fine with it.

White Chat

  • After the chat I have checked the status page for any update, but none are present, no intimation of color change issue, or any sort that tell me what is going on.
  • So on 9th January, I pinged the help agent again, this time, the agent said that the order is going to go for cancellation, he said nothing about the white color etc, he straight away asked permission for cancellation and the amount would be refunded in less than 10 days.  Following is the chat transcription and I AM NOT SATISFIED WITH THEM.

Cancelled Chat

Finally, the output is, my money is with IndiaTimes Shopping site from 7th to as of date I was writing this post, with order as cancelled.cancellation Hidden Details

Issues I faced or in terms of what I viewed:

  1. Item status like out of stock are not updated regularly, hence cant say if a product really exists
  2. Help support is pathetic.
  3. The employees need a lot of training on understanding some English and Issue at hand rather than copying pasting some random answer like a Teller Machine
  4. Does not have a user friendly UI for pages related to Order book, status etc..
  5. The dates on chat transcript are a bit wrong, they might be server dates etc.


Positive point is that prices are some what competitive, however not all might have bad experience like what I had with them.   Happy Shopping!!!!

Thursday, January 3, 2013

What a College Sir Ji

Below are only my personal views and are not intended for any assessment or hurting any others feelings….Read at your on discretion.

I don’t know what to say, but in short, look at this JOB POST, by a MBA (HR, Marketing, Finance etc.) teaching college which was thought to be great and well reputed college in Vizag and surroundings posted in search for “A candidate suitable for a marketing job”; with a twist asking for ‘1-3 year’ of experience in marketing; I don’t blame them for the post Nyah-Nyah; if the college could not teach and select its students for a Marketing job, with a discount of 1-3 year experience for ITS OWN SELF, how can the companies expect to recruit from such a college and I don’t want to talk more on its internal status.

They need candidates with MIS activities but let me tell you, there is NO MIS or any good excel DB/Storage of data for the MBA department when I studied in the collegeWinking smile.

I pray for a good future for its students (me included).


Tuesday, January 1, 2013

How to use Dot Net Appropriately?

Well this post is intended to starters only like me, even I am a newbie programmer, but I learned/learning lot of new things in how to use .net appropriately, firstly, we need a few things in clarification:

  1. Dot Net is only a library, like how we write our own classes, Microsoft Dot Net Team has written many strongly typed and well designed and managed code libraries.
  2. Instead of each developer creating a code library for his own very task, in which way every developer maintains his/her code library, Microsoft created and maintained a General/yet specific code library which covers mostly all sort of functions. Example:I have a library for string comparer, but every developer used to have the same, Microsoft gave this functionality  in Dot Net library and made it common for all with well typed name.
  3. All soft of Microsoft developed technologies can take use of this, as the library supports VB, C#, F#, C++ and even scripting can take advantage of this like POWERSHELL.
  4. Developer need not include old Dot Net in his installer as basic versions/old versions come preinstalled in windows systems.

When it come to using .NET appropriately, it means, first search if the functionality we need is there/existing in .Net library; for example:

We want to create a code for making sure the object is backed before editing, then saved or discarded based on user wish to save changes, instead of using our own desired names for Method/Functions, >NET gives this features with its own managed library names, and for reference, this functionality is supported by IEditableObjectInterface under System.Components Namespace, more information can be found at MSDN.

Making use of Inheritance and Implements are the greatest methods to follow for any .NET programmer.

All the code libraries in .NET are based on this methods only, like WPF implements INotifyPropertyChanged, and many classes are inherited from base classes.

First thing to do is try to give a read of what Interfaces are given in .NET, mostly the ComponentModel Namespace should do for generic purposes.