Friday, December 3, 2010

Limitations of SQLite version 3

Found a good source of Limitations of SQLite embedded database. And I am quite impressed about the numbers that have as a limit in any category. I my opinion those are not limitations Open-mouthed smile. Rather those are supports. You can take a look at this where all the max stuff is listed. Here are few examples, and all are taken from the original site.

Maximum Number Of Rows In A Table

The theoretical maximum number of rows in a table is 264 (18446744073709551616 or about 1.8e+19). This limit is unreachable since the maximum database size of 14 terabytes will be reached first. A 14 terabytes database can hold no more than approximately 1e+13 rows, and then only if there are no indices and if each row contains very little data.

Maximum length of a string or BLOB

The maximum number of bytes in a string or BLOB in SQLite is defined by the preprocessor macro SQLITE_MAX_LENGTH. The default value of this macro is 1 billion (1 thousand million or 1,000,000,000). You can raise or lower this value at compile-time using a command-line option like this:


The current implementation will only support a string or BLOB length up to 231-1 or 2147483647. And some built-in functions such as hex() might fail well before that point. In security-sensitive applications it is best not to try to increase the maximum string and blob length. In fact, you might do well to lower the maximum string and blob length to something more in the range of a few million if that is possible.

During part of SQLite's INSERT and SELECT processing, the complete content of each row in the database is encoded as a single BLOB. So the SQLITE_MAX_LENGTH parameter also determines the maximum number of bytes in a row.

The maximum string or BLOB length can be lowered at run-time using the sqlite3_limit(db,SQLITE_LIMIT_LENGTH,size) interface.

Maximum Number Of Columns

The default setting for SQLITE_MAX_COLUMN is 2000. You can change it at compile time to values as large as 32767. On the other hand, many experienced database designers will argue that a well-normalized database will never need more than 100 columns in a table.

In most applications, the number of columns is small - a few dozen. There are places in the SQLite code generator that use algorithms that are O(N²) where N is the number of columns. So if you redefine SQLITE_MAX_COLUMN to be a really huge number and you generate SQL that uses a large number of columns, you may find that sqlite3_prepare_v2() runs slowly.

The maximum number of columns can be lowered at run-time using the sqlite3_limit(db,SQLITE_LIMIT_COLUMN,size) interface.

Maximum Number Of Tables In A Join

SQLite does not support joins containing more than 64 tables. This limit arises from the fact that the SQLite code generator uses bitmaps with one bit per join-table in the query optimizer.

SQLite uses a very efficient O(N²) greedy algorithm for determining the order of tables in a join and so a large join can be prepared quickly. Hence, there is no mechanism to raise or lower the limit on the number of tables in a join.

Note: I am sure those are pretty good numbers as far as an embedded database can offer.

Friday, November 12, 2010

Prevent WPF Tree View nodes from getting selected.

By default all the nodes of the WPF tree view is selectable. If some how we had a requirement that the roots nodes can not be selected rather only the child nodes will be selectable we need to customize one single property “focusable”. If we set the focusable property of any node to false then the node will not be selectable. pretty small thing but worth sharing because in MSDN forum one developer asked for this.

Bello a simple code sample is given

        <TreeView Height="251" HorizontalAlignment="Left" Margin="45,30,0,0" 
Name="treeView1" VerticalAlignment="Top" Width="197">
<TreeViewItem Header="Yahoo" IsManipulationEnabled="False" Focusable="False">
<TreeViewItem Header="d" />
<TreeViewItem Header="c" />
<TreeViewItem Header="b" />
<TreeViewItem Header="A" />

Hope this will help, Note that if you have some binding with the tree grid and you want to achieve the same as above you might need to use triggers.

Friday, October 8, 2010

Most widely used WPF client application development frameworks

I done some research on WPF client application development frameworks and eventually found out three most used framework and one yet to be mature framework. I thought its worth sharing the research result

1. Prism

Impression : Most advance framework

2. Caliburn

Impression : Advanced  framework

3. Cinch

Impression : Solved particular set of problems and can be used along with other framework

4. WPF Application Framework (WAF)

Impression: Primitive and useful framework to develop MVVM pattern based application

All the application framework used MVVM pattern to develop the applications, I am sure this frameworks are worth learning and will definitely help us in career.

Friday, September 10, 2010

Typical Code Smells

While doing daily development in various project we often found lots of coding standard problem, we just don’t know the appropriate vocabulary for that, Today I am providing a list of all code smells that can be found in codes, We would elaborate and learn about each code smell. the list (rough) is given bellow, if anyone finds more code smell please provide in comment section.

  1. Dead code
  2. Duplicate code
  3. Comment
  4. Long Method
  5. Large Class
  6. Oddball Solution
  7. Primitive Obsession
  8. Switch Statement
  9. Speculative Generality
  10. Long Parameter List
  11. Conditional Complexity
  12. Combinatorial Explosion
  13. Alternative classes with Different Interfaces
  14. Inappropriate Intimacy
  15. Indecent Exposure
  16. Refused Bequest
  17. Black Sheep
  18. Data Class
  19. Solution Sprawl
  20. Feature Envy
  21. Temporary Field

In future post we would discuss mostly all about the smells.

Sunday, August 15, 2010

Is Excel Present in client machine?

In one of our application we had to make sure that whether client have excel installed or not. We tried few codes and have some experience while resolving the solution. Bello the solution code is given to detect if client have excel 2007 installed or not.
The bellow code works fine. But it fails one single time. If the user installed excel but never run it. The registry keys are not built until the user run excel for the first time. so we had to change our message to inform user as “You don’t have excel or you didn’t run it after install, if you have install please run it for the first time and try again” some thing like this.
private static bool IsExcelPresent()
var key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Office");
string[] subKeyNames = key.GetSubKeyNames();
var excelKey = key.OpenSubKey("12.0\\Excel\\");
if(excelKey!=null) return true;
return false;
return false;


Eventually we got rid of the obstacle and found a very interesting component called SpreadsheetGear and used that component. we bypassed all the excel requirement using this component.


There are some more solutions on the web to you guys can also try those. Bellow a yet another code sample is given.


private static bool IsExcelPresent()
Type officeType = Type.GetTypeFromProgID("Excel.Application");
return officeType != null;
catch (Exception ex)
return false;

Another code sample to detect excel which using registry key search


private static bool IsExcelPresent()
RegistryKey key = Registry.ClassesRoot;
RegistryKey excelKey = key.OpenSubKey("Excel.Application");
bool excelInstalled = excelKey == null ? false : true;
return excelInstalled;



Thursday, July 15, 2010

Simple Yet powerful html Content rotator

I found this simple yet powerful html content rotator and using in few of my projects. I think its worth sharing with the community. The library named

jShowOff: a jQuery Content Rotator

You can download the script from this location. It requires two file only, on css which you can copy to your own css file and the other one is of course the java script , there are two distribution for this library, I strongly suggest that you should use the min version.

There are some comprehensive set of examples given in the home page for the library. I would suggest to download and look for this examples.


Best of luck and happy programming.

Thursday, June 10, 2010

Rounded Corner and other stuff in IE7 or IE8

Often we need to have rounded corner support for our html content, filefox, crome, safari and latest version of IE9 have native support for rounded corner for html div and other supported html elements. But Alas! we don’t have support in IE6, IE7 or IE8.

An interesting website is where we can generate rounded border radius. just visit this site and add your desired pixel. It will generate the required css for you.


It’s a copy and pest effort. Now if we need rounded corner in pre IE9 browsers we need some thing out of the box. Then come the custom css and JavaScript libraries and some time html “.htc” behaviors files.

In first option we are going to talk about css3pie it’s a simple yet powerful tool to get some html5 support in old ie browsers. You can download the libraries from its homepage at

Add what ever border you need and at last include behavior:url(/ that’s it.

Next we are going to see an query based rounded corner support, this is the site where from you can download the library its s single file and required to have query in advance. the use is very easy. bellow an screen shot from original site is given.


Try it you would love it. I am sure lots of you are already using it. Good luck and happy programming.

Thursday, May 6, 2010

Data compare in visual studio 2010

Visual studio 2010 ultimate has many interesting and life saving feature, but let’s face it we can not put together in a single blog, rather today I am going to show you an interesting feature regarding data synchronization. Yes I am talking about “Data Compare”. In one of my blog I have put down few information about Schema comparison,


You can lunch the above window from Data Menu from top menu, after selecting both source database and target database just click on next, in this next screen you can select the database object types “Table” and “View”, select your desired object and then click on finish. The process would take few seconds to finish.

After the process is finished you would be presented with a screen like the bellow window.


After that you can select the command that you would like to perform from quick toolbar of visual studio 2010.


You can choose to sync directly, by pressing the “write updates” command or perhaps “export to editor” to examine and execute the generated query.

Hope this helps to some one. Until next time. Happy programming.

Thursday, April 8, 2010

Using Schema Comparison in visual studio 2010


I am happy to share one of the interesting feature of Microsoft visual studio 2010, and the feature is under data named “Schema Comparison”. I am sure every now and then we need two pretty important stuff regarding database while deploy or test deploy our application’s data and those are

  • Data Synchronization
  • Schema Synchronization

In this particular post we are going to take a look at the schema comparison stuff. I am sure we have used some kind of schema comparison tool before, I my self is a big fan of red get sql belt, which has few really life saving tools and support to ease our life while working with data, but today I am bringing this because visual studio 2010 have same schema comparison option.

Process of Schema Comparison

To compare the database schema you need at least two database, this sounds stupid but still mention it you can select same data source in both target and source, which does not make sense. Any way to lunch the new schema comparison, go to top menu and find “Data” under data we have “Schema Compare” Sub menu under that we have a third level menu named “New Schema Comparison”. After selecting the menu it will bring up a new window where you would define the target database and source database. Bellow a screen shot is been given.


Figure: Schema Comparison Source selection

Please select both source and target database and click on “OK” to start the process after the process is been finish you would see a window like the bellow screen shot on visual studio. its simply the result and mismatch list that database have. And when you select each mismatch item you would see that required sql statement is also shown in object definition section. 


Figure: Schema Comparison Result

And bellow this you can find the entire script needed to update the target database, in “Schema Update Script” window. You can change the action that need to perform in the mismatch window and then click on refresh script option to regenerate the script again.


Figure: Schema Comparison update script

Actions to perform

You can perform the actions using the tool bar on top of the tool bar section or using menu from > data > Schema compare > [and the select any third level menu] to perform you desired action. You have the option to directly sync via write update command or perhaps you can save the generated script on a file using Export to File option. 



Figure: Schema Comparison Actions


A few note before ending the post. This feature is available in Microsoft visual studio 2010 ultimate edition. which is a little bit disappointing for the developers, its such an useful tool and needed badly if we mess with data each day.

Thursday, March 11, 2010

Custom style for your Radio Button,Checkboxes and Select Lists

I was searching for some easy JavaScript code via which I can change the style of html select. Its because we often have requirement to show different style of html select. When I say custom it mean how to entirely change the look and feel of a drop down.

Searching in Google I found couple of solutions to my problem. Most of the design is done via JQuery plugin. among those I find one easy one the link is given bellow.


The usage is pretty simple just add the script in your project and add link to your master page or page.

Then add css for your items. example css is given bellow.

.checkbox, .radio {
width: 19px;
height: 25px;
padding: 0 5px 0 0;
background: url(checkbox.gif) no-repeat;
display: block;
clear: left;
float: left;
.radio {
background: url(radio.gif) no-repeat;
.select {
position: absolute;
width: 158px; /* With the padding included, the width is 190 pixels: the actual width of the image. */
height: 21px;
padding: 0 24px 0 8px;
color: #fff;
font: 12px/21px arial,sans-serif;
background: url(select.gif) no-repeat;
overflow: hidden;
Lastly add css class ‘styled’ tag to the element that you want to make custom. you can customize the script and css to get your designed theme.

"<input type="checkbox" class="styled" /> “

Both script and css is given in the above url. just download and use.


Note: I found a problem while using this. when I use this the auto post back feature of elements are not working. When I have the solutions will share again.

Update: You can find whole lot of html form element customization examples here. Just choose what ever best suites you. “

Best of luck and Happy programming

Thursday, February 4, 2010

Exposing your local IIS to network in Windows XP.


Hi, in this post I am going to share a simple knowledge about IIS. The knowledge is about how to expose local IIS to network, so that other network users in team can access and use the functionality.

In a web application development team we might want to check our web sites not only in our local pc but also from other team members machine. That's why its necessary to expose IIS to network environment. Lets say we have a web application called "myweb" normally while development if we use iis we access the myweb as "http://localhost/myweb" well it works all the time.

Lets say our developers PC is "MYDeveloperPC" we can expose the local IIS to share with team members as "http://MYDeveloperPC/myweb". If we have windows firewall enabled by default its not exposed to network. so we got to expose it explicitly. Bellow I am providing a simple screen cast.

Step 1:

Go to control panel and open windows Firewall. Now switch to advance tab, now select "Local Area Connection" and click on the settings button. After that advance settings tab will popup.

Step 2:

Bellow the advance settings window is displayed. Now select the services you want to expose to network and click ok to commit. That's it your local iis now exposed to network and your team members can access it from there pc.

Key Notes

Its a relatively pretty simple knowledge, almost every developer knows it. But still I took the liberty to share it because, one day one of our senior developer complained that his IIS can not be accessed out side his pc. Then I showed to him, where to pock.

A things must be considered, this post is related to the problem of windows firewall. If third-party firewall is installed in the developer pc. user must allow in the third-party firewall as well.

Best of luck and happy programming.

Thursday, January 7, 2010

Using the Build event of visual studio 2008


Some times we need to execute some custom task just before we build our solution or project, I have no idea how others IDE do that, but recently we have gathered some experience about Visual Studio 2008, and doing these kind of task became pretty easy.

In one of our project we had to use a custom third-party component, the component is easy to incorporate in the project, but we have a problem, the component uses a d-com component which can not be added in the project, but if we keep the com component in bin directory the program runs okay. so our challenge is to copy the component before build in the bin directory of output project from the other projects bin.

Visual Studio 2008 Build Events

In Visual studio 2008 we have two build event, prebuilt event command and post build event command, post build event can be controlled with various parameters for example, post build event will raise when a successful build is happened.


Figure: Visual Studio 2008 Build tab under Project properties

In our particular case we solved our problem in using pre-build event, now let us discuss a little bit more about pre-built event, you can use almost any kind of command in command line, provided that the commands don't require special permissions for executions.

In our case we have used "xcopy" command to solved the problem, there are lot of macro for execution. we used target directory as output macro, and source directory as solution macro, since its a simple problem we set the relative path of the DLL from solution path. worked okay, when we published the project we found that in publish version also contains the DLL, job done with very good time and in a good way.

Post build is almost similar like pre-build except it has some extra control, user can specify when to raise it, in the above screen shot you can see that there is a large combo at the bottom.

Here is a small example command in the for pre-build command.

If we want to copy all output files of a project to a deployment folder after post build event we have to put down the following command in the post build command line,

""xcopy "$(TargetDir)*.*" "c:\output" /S /I /F <NUL:""

Bellow i have put down a pre-build event command line input window with macro.


well that's all for now, please visit the references for more information, best of luck and happy coding.