I drink coffee and program. Meh.

Navigation Menu

QueryString has its limits, try passing data via IRequiresSessionState or IReadOnlySessionState

Posted by on Mar 11, 2014 in Asp.Net, Blog | 0 comments

Oh hey I have a blog, totally forgot about that. Its been busy here lately, but that is no excuse to neglect my blog. So in light of this, I am going to post something I used recently when passing data to a generic handler via query string was just not cutting it. Passing data via query string has limitation in the length of data you can send. Here is a in depth post on these limitations http://stackoverflow.com/questions/812925/what-is-the-maximum-possible-length-of-a-query-string

I’ll sum up these limitations briefly:

  • Internet Explorer
    • 2,038 character limit, boo hiss boo
  • Firefox
    • 65,536, but could work for more
  • Safari
    • 80,000 character limit, but could work for more
  • Opera
    • 190,000 character limit, but could work for more
  • Apache
    • 4,000 character limit, but could work for more
  • IIS – Internet Information Server
    • 16,384, but could work for more
    • IE accepts less, but the server can accept more. Huh?

Since we have to make our web app work with IE there is no choice but to somehow shoe horn our parameters to be passed to generic methods. Instead of using query strings, another approach would be to use the IRequireSessionState or IReadOnlySessionState interface. For my generic handler I used the IReadOnlySessionState interface. In the code behind calling the generic handler, I stuffed the data I needed into session variables, Session["Key"] = value;

For the generic handler, I had it implement the IReadOnlySessionState. I didn’t want it to do anything, but to read those session variables.

Here’s what I did:

So, I can practically send any type of object I wanted to my handlers and processed that data according to business rules. Well, till next time.




Read More

Breakpoints and Tracepoints: What are they?

Posted by on Jan 24, 2014 in Blog, Visual Studio 2013 | 0 comments

So, your in the process of making an app, not just any app, but the most electrifying app that has ever been known to mankind. Before shipping your app, there are a few things you have check on. Is your app intuitive? Does it make sense placing a button on the main page when a swipe gesture could be better? How pretty is your app? We all know apps that look pretty sell well, for instance, take a look at the iPhone Hippies (hipsters and hippies who go ooh and awe for anything that Apple makes). How secure is your app? Is it NSA  proof? Apps dealing with sensitive data needs to be handled accordingly, and by that, I don’t mean by the NSA. Does your app fit the requirements of its demographics? Think of who would be using your app and make all needed features to accommodate that user and keep them happy. A few other things to keep in mind would be the speed of the app (is there a need for speed?), its localization (location based services), internationalization (the more places your app resides the more money you make – North America, South America, Europe and so on), lastly how stable is your app? You won’t know how stable it is unless you test the hell out of it.

What are your options in testing your app then? There are a  couple ways of going about this. One is using Unit Testing and another would be integration testing. The most common form of testing is integration testing. If your a developer more than likely you already have done integration testing.

Integration testing in a nut shell are tests that are not fast nor consistent and heavily depend on other units of the system in order to retrieve an end result. Its all integrated. One part does not work without the help of another. You can think of a car engine as a type of integration. It relies heavily on subsystem after subsystem in order to get it to work. Parts relying on other parts to produce an end result. The car moving would be that end result. Realistically, you would want to perform both types of testing (unit testing and integration testing). Its a lot of work, but the end result is worth it. This post will lead to many other debugging posts using Visual Studio’s debugger and later on to unit testing.

So for starters, let us discuss what a breakpoint and tracepoint is. A brief introduction of both is that a breakpoint tells the debugger, “Hey man, you might want to check this out, line 231. It looks fishy.” When the debugger acknowledges the breakpoint it pauses execution. At that point you can view all local variables in that method, the stack trace, outputs and do some inspection at that point of execution. This pause that the breakpoint initiates is called the break mode.

Tracepoints is the new kid on the block. A tracepoint is a breakpoint, but with hipper clothes and a swagging haircut. The tracepoint sort of looks like Vanilla Ice – To the Extreme, but much more level headed. The tracepoint lets you associate custom actions to the breakpoint. It tells the breakpoint “Alright stop! Collaborate and listen, Ice is back with his brand new invention…”. And all the other breakpoints are like “Ice Ice Baby, too cold, too cold…”. When a tracepoint is hit, the debugger performs whatever action(s) the tracepoint defined, including breaking program execution. I use tracepoints to print out messages of variables to the Output window as execution happens. There are times where I just get tired of stepping through code so I let the tracepoint do the work. Here’s an example of what setting up a tracepoint looks like. You would want to right click, in the source code, where you want to set the tracepoint at, select Breakpoint->Insert Tracepoint.

1-24-2014 3-07-41 PM

1-24-2014 3-05-53 PM

In future posts I’ll discuss what types of breakpoints/tracepoints there are. This is just serving as a little primer/introduction to both. Till next time.




Recommended Reading:

Advanced Windows Debugging (Kindle Edition)

By (author): Mario Hewardt, Daniel Pravat

Kindle Edition: Check Amazon for Pricing Digital Only

Kindle Edition: Check Amazon for Pricing Digital Only

Read More

App Review: My Fortune Cookie Jar for Windows 8, WindowsPhone, and Android

Posted by on Jan 8, 2014 in App Review, Blog | 0 comments

I decided to mix it up a bit with the content I post. Every now and then I will be reviewing apps that are for Windows 8 and the Windows Phone. I’ll try my best to bring you some informative and entertaining content. This is my first screencast/blog cast/whatever cast review ever. So, without further ado let’s get started.

My Fortune Cookie Jar by Eric J. Oszakiewski is is an app for Windows 8, Windows Phone 8 and Android that gives you a random fortune from an actual fortune cookie that was acquired at an authentic Asian restaurant!


Read More

What is COALESCE (Transact-SQL)?

Posted by on Jan 7, 2014 in Blog, SQL | 0 comments

For the most part, I am blogging these tidbits for my own learning and understanding needs. So with that in mind. What is COALESCE in T-SQL? Well, in essence COALESCE returns the first non-null expression. For instance, let’s take a semi-real world example using a MERGE statement in con-junction of a COALESCE statement.

What I am asking the above statement to do is to perform a MERGE into the personBackup table. A MERGE statement basically synchronizes the two tables by performing an insert, update, or delete statement from the source to target table. Here I am wanting to show which PersonID is inserted or deleted via the COALESCE along with the help of the OUTPUT statement. So, COALESCE goes through the two expressions (inserted.PersonID, deleted.PersonID) and returns the first non-null value, which is then outputted through the OUTPUT statement.

COALESCE is a short form of saying




Recommended Reading:

Kindle Edition: Check Amazon for Pricing Digital Only

Kindle Edition: Check Amazon for Pricing Digital Only
Release date December 17, 2013.

Data Management (Kindle Edition)

By (author): Richard Watson

Kindle Edition: Check Amazon for Pricing Digital Only
Release date December 27, 2013.
Read More

Toggling between properties and events of a control

Posted by on Jan 7, 2014 in Blog, Visual Studio 2013 | 0 comments

Was originally going to call this post “My Visual Studio blonde moment 1: Toggling between properties and events of a control”. But since we need to be politically correct now and days, I decided to call this post my Eureka moment since the word eureka pretty describes how I felt in discovering this:

eu·re·ka - expressing triumph: used to express delight on finding, discovering, or solving something, or on finally succeeding in doing something

In Visual Studio 2013, when you select a control you can toggle between its properties and events to edit. I usually used the source view to do all these things, since intellisense is a godsend. I know it existed before, however, I really never used it. Again intellisense FTW! Below is a screenshot of where you need to find the two magic buttons in Visual Studio to do this. I know, its not rocket science, but there you go.

1-7-2014 9-39-15 AM


By the way, still considering using “My blonde moment”. I don’t know. What do you think?

Read More

Querying a SQL Server XML Datatype field using the SQL LIKE statement

Posted by on Jan 3, 2014 in Blog, SQL | 1 comment

While it’s fresh in my head, I learned a new trick in querying an XML datatype field in SQL Server. Not really a trick, but I was enlightened on how to query a XML datatype field. I was needing to know the data structure of a XML document for some C# code I was working on. I knew what table and column the XML document was stored in, but I was looking for a particular XML document. The XML datatype field could store any form of XML document with many different types of document structures. The XML document I was looking for contained the node “Decimals” in it. Initially I tried the following, but it failed:

The error I received was:

Msg 8116, Level 16, State 1, Line 1
Argument data type xml is invalid for argument 1 of like function.

1-3-2014 11-12-16 AM

Admittedly, I was lazy in writing the query, hoping this would work, but alas it didn’t. So, down to the nitty gritty. If I didn’t know what the structure looked like, but I knew it must contain the node “Decimals”, then how would I go about filtering down the XML documents stored to what I needed? For starters, why don’t we cast the XML datatype field to a VARCHAR? With it cast then for surely I could use the LIKE statement I previously attempted. So, it would go like this:

1-3-2014 11-14-58 AM

Ahh… we are finally getting somewhere. So how does this help then? Well, now I know what the XML document would look like. So, in our case the structure of the document would be:

Now, I need to find all XML documents whose “Decimals” value is greater than 4. We would accomplish this by using the following:

And just like that we have our results. Now I can use these documents with my C# code and continue to be productive.

1-3-2014 11-20-36 AM


I used the following as reference in solving my issue: http://stackoverflow.com/questions/1832987/use-a-like-statment-on-sql-server-xml-datatype

Thanks to @eopdev for pointing me in the right direction. Till next time.


Recommended Reading:

XML in a Nutshell (In a Nutshell (O'Reilly)) (Kindle Edition)

By (author): Elliotte Rusty Harold, W. Scott Means

Kindle Edition: Check Amazon for Pricing Digital Only

Kindle Edition: Check Amazon for Pricing Digital Only

Beginning XML, 5th Edition (Kindle Edition)

By (author): Joe Fawcett, Danny Ayers, Liam R. E. Quin

Kindle Edition: Check Amazon for Pricing Digital Only

Read More
Page 1 of 1412345...10...Last »