I drink coffee and program. Meh.

Navigation Menu

Linqpad: Using Linqpad as a C# scratchpad

Posted by on Sep 15, 2014 in Blog, Linq | 0 comments

LINQPad is a excellent tool when writing LINQ queries against your database or some form of repository. Not only is it good for writing queries, you could use LINQPad as a scratchpad. Recently, I was tasked into writing a parser for our outbound scheduler service. This service would look into the database and select all current outgoing packets. Once retrieved, the dataset was cast to its respective datatype.  With these packets we commands are embedded into a commands property delimited by semi-colons. Previously, we just put a 1:1 command to command property, so I needed a way to test in quick manner if the parser would work. The parser is pretty simple. As you see I created a string array that held these commands. I would split them based on the character ‘;’. Then I would loop through these commands and output them to the console. I needed to test two versions of this. One with only one command, and another with multiple commands. I supposed I could have written a unit test as well, however, I wanted to illustrate you could use LINQPad for simple logic as this, as well, complex logic.


LINQPad  - C# Scratchpad Demo



Recommended Reading:

List Price: $39.99 USD
New From: $25.09 USD In Stock
Used from: $33.19 USD In Stock

Read More

Does my solution use this dll?

Posted by on Jul 2, 2014 in Visual Studio 2013 | 0 comments

Been a while, but here you go. I am currently working on an application that uses Google’s Maps API. Or current project uses older Subgurim and Reimer dlls that take advantage of the API. But did we actually use both set of dlls in order to use Google’s Map API? A quick way to figure this out is to open your object browser (you can open the object browser from the View menu), find the dll in question, right click it, and select ‘Find Usages’. By doing so, it will show you all occurrences of usage of the dll in question. Comes to show, we do not use Subgurim, but we do Reimer. Time to update that dll and move on with this project.


Visual Studio - Find Usages

Visual Studio – Find Usages



Read More

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

Data Management (Kindle Edition)

By (author): Richard Watson

Kindle Edition: Check Amazon for Pricing Digital Only

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