New JWH Excavation Site

31. January 2009

I was working on some odd and ends projects this morning when a co-worker of mine messaged me about the newly updated CKurl.com site. I took a look, jolted backwards like watching one of those flash vids where you have to look real close to see what is different then a screaming ghoul pops out. Well, that’s when i saw his picture staring back at me, but i will say the whole site did indeed look ‘new’, and had a more professional vibe to it.

I’ve been needing to refresh a few pages I've been contracted to work on, and of course i picked the quickest one that could be updated. Spent about an hour cutting and pasting new CSS div id’s around, and *wa-la* there is a new JWHExcavating.com excavation company website!

jwhexcavating2BEFOREjwhexcavating AFTER

I feel better after having ‘done something’ new too. Anyway, just wanted to give a post out about the new client site, and the new CKurl. If you haven’t checked out CKurl.com then you’re missing out on some neat right-wing blog action (conspiracy theories.)

Business

Subfolder Web.config Overriding Parent (Root) Web.config

21. January 2009

I was setting up a BlogEngine.Net for a local plumbing business and came across an annoying quirk. Adding the blog engine should have been pretty straight forward, drop in the blog engine folder into a website root folder, convert the folder to an application in IIS, change the virtual directory path setting in the web.config in the blog engine folder, and then the plumbing company could start blogging away.

Of course nothing is ever that easy. An error kept showing up that the theme specified within the <Pages> section ‘Theme’ property was not found from the root folders web.config settings. This error showed that the blog engine was trying to load the root folders web.config before loading the blog engine folder, which is expected even though the blog engine folder was set as a .Net 2.0 application through IIS. At that point one would wonder, how do i override or avoid loading the parent web.config settings?

Simple, surround the <system.web> setting of the blog engine folder’s web.config with a <Location> tag. Using the ‘Path’ property simply enter the name of the folder the blog engine is currently residing, and then the blog engine will automatically use only the <system.web> of the web.config found within the blog engine folder. There is also something to be said about ensuring the application pool is set to the classic setting, but that is a whole other conversation.

ASP.Net, Programming

Internet Explorer Kiosk Setting

17. January 2009

While working on a touch screen kiosk i had to do a fair amount of work to figure out the best practices for designing, and building such a system. The biggest and most obvious component, dare i say secret, is that a touch screen Kiosk is nothing more than a standard web page. Yes, your typical web page being run on a machine whose only interface device is mouse clicks triggered by a touch to the screen. The system itself handles all the mappings between the mouse click and coordinates on the page the exact same way as a mouse interface device would. Simple right?

Not so simple when you try to take into account what browser you’ll be running your kiosk with. I’ve seen people write a custom desktop application whose sole purpose is to house an Internet Explorer browser object to create a full-screen browser without any file menu or title bar for the browser. These guys clearly didn’t do their research either because it’s pretty easy to create a full screen kiosk browser interface without the file menu along with disabling the touch screen users from interacting with the browser menus. No code required.

Using Internet Explorer launched with a simple command line parameter will cause the browser to open full screen, no menu options, and will not allow users to exit the browser without direct access to a keyboard. Since most touch screens use a virtual keyboard this doesn’t become a problem, otherwise what’s the point of a touch screen if you have to use a physical keyboard anyway?

Getting straight to it. All that is required to turn the standard Internet Explorer into a Kiosk interface is a the following command line argument for a shortcut to launch Internet Explorer.

"C:\Program Files\Internet Explorer\iexplore.exe" –k
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

Untitled

 

When Internet Explorer opens the browser it will be full-screen, display no file menus/status bar, and will not be able to be exited unless the key combo ALT-F4 or CTRL-W are used to close the browser. This secures the Kiosk environment from malicious users trying to close the browser to directly access the physical touch screen system. Pretty sweet huh? No code, no extra hassle, and now all you have to worry about now is securing your web interface from external non-kiosk activated attacks.

For those who prefer using Firefox, i won’t name names… or even myself, but there are a few add-ons built to provide kiosk functionality to the Firefox browser. Nothing, as I'm aware, built directly into the browser like Internet Explorer, but at least the ability is there at some level.

Programming

My Office

16. January 2009
 

IMAGE_171

I was telling a few friends that haven’t seen the house yet that i moved in without painting one room in the house. I have two weird bedrooms upstairs, one highlighter-pink, and the second yellow with a light blue bottom with an animal border going across separating the two colors. Well, I've been saying how i feel creepy, like i stole some kids room, and i had to post photo proof. I get a giggle out of it, and my wife says she secretly thinks I'm digging the animal border.

Anyway, attached to the post is a panorama, as best as i could make it, of my office as it sits. If i had turned the leather chair slightly you could see the color swatches on the desk from the colors I've been choosing from for the new paint job. Until i finalize my color choice, get a corner desk, and have free time the room will remain the same.

Offbeat

Late Night Refuel

13. January 2009
Rockstar_punched fastbreak

It’s one of those nights where I'll be up, probably all night, most of the night anyway, working on a project that needs to go out the doors tomorrow. I mean literally the thing will be boxed and shipped out the door whether I'm done or not. I will be done, but that’s not the point of this post.

It’s late, it’s past 1am, and I'm feeling a bit drained. Time for a pick-me-up in the form of some hard and fast energy snacks. None of that snack on an apple, and drink water so having to pee keeps you awake, no sir, not on my watch. This is a hardcore Twin-R’s night. A Reese & RockStar oh yah, i went there, and it’s a delicious combo.

 

 

But, what about the energy crash you’ll have after you might be wondering. Well, i thought of that, being an engineer, and I've come up with a sure fix for the situations ((Twin-R * 2) = Day + Night), yes, double the stock, and you’ve got enough energy to last all night AND the next day! Well, back to work, I'm sure at that point I'll realize I've only been floating on a peanut butter cloud of caffeine dreams.

Offbeat

Cincinnati SQL User Group

11. January 2009
powershell_2

 

Last Thursday I went to my first Cincinnati SQL user group meeting. The meeting was suggested to me by my co-worker, and the topic was something I've been interested in. When I installed Windows Server 2008 i was excited to see that Powershell was included, it was also on my Vista PC’s, but I never really took the time to check it out.

I had been warned that at this particular meeting a past employee had been given a hard time for being a .Net developer. I thought they were pulling my chain so of course i decided I'm going to wear the .Net shirt that is completely black with the large bold white font .Net on the front.

We get to the meeting and i start to see one by one people heading into MAX training for the meeting. We both get out of the car and head in. First thing i notice is that everyone is dressed nicely and I'm the one in my carheart jacket, .net shirt, and cargo jeans. From there the speaker Arie Jones starts to give background on himself establishing his credentials with good background detail on growing up the computer geek who went to camp, and was one of the young developer of his time during high school. I couldn’t help but note a surprising similarity between his background in mine. I went to a college course on DOS when i was about 9 years old, did co-op in high school when i was 16 becoming the fourth youngest worker at SDRC, and Arie then mentioned he joined the military to do something different. Something i also did in my life, but again that is where the similarities end.

During the presentation we went through the basics of Powershell, that uses it provides, some overall benefits, and really just touched the surface of the technology. What i gained was understanding how to launch Powershell by entering Powershell into the command prompt. From there you can load/include a script into the environment, and then given the ability to call functions defined within the function. It’s pretty easy to load a script file just include the path with “. ./Functions.ps1” and all functions from that script file will be loaded into the environment.

 Untitled

The syntax was what really caught me off guard since Powershell has been touted as bringing .Net to the command line shell scripting level. The syntax is anything but .Net styled, and in fact reminds me heavily of a PHP and C++ hybrid scripting language with Unix styled functionality. Mainly the way all variables are prefixed with $, and how equality checks are done with ‘-eq’ for equals, ‘-le’ less than or equal to, and the general format of the curly bracket and semi-colon syntax. You can pipe things in Powershell as you could in Unix/Linux systems. One friend of mine actually made a comment in jest that Microsoft has finally given something that Unix gave some thirty years ago how novel of them.

From what i can tell initially, keep in mind I'm a complete novice to Powershell, the variables are completely lazy in declaration, just use as you go, and can be either object or simple data type. From there you can make calls to functions only available in .Net assemblies, such as the Reflection namespace, and actually use the functions exposed to that namespace. While there isn’t anything much I can do with Powershell that i couldn’t do in .Net it is nice to know that should i wish i could create some seemingly simple scripts to carry out some tasks without the need to compile and recompile assemblies to do the same. I was thinking of updating my Remote Desktop port changing application to a simple Powershell script, and another one to send an SMS notification in the event my IP address changes to my phone so i could log in remotely to the new address. Again, nothing i couldn’t do with .Net, but merely something to try the new technology out and get at least acquainted.

Well, i do have to share one thing. I of course was called out during the SQL user group presentation, asked about dynamic data pages, and polled about our usage of LINQ. This was shortly after Arie asked whether there were any developers in the room, and of course my buddy and I were the only two. Didn’t help my .Net kind of gave me away on that one, and during the whole presentation besides calling server admin’s ‘Monkeys’ the presenter also seemed to be directly addressing both of us developers throughout the entire thing.

After the presentation i will admit that the lunch was kind of awkward, at least until the one guy from Western Southern came to sit with us, and from then on we were engaged in conversation with the three user group founders. I mostly sat in on the conversation regarding SSIS packages, but it was hard to focus after totally getting swag. I got second dibs of the table full of Microsoft products, books, shirts, and assorted drinking containers. It was awesome, i got a sweet Microsoft thermas AND was given a awesome server center operations manager book. I heard they were going to have the next group meeting on analysis services and i have to admit i hope to make this a regular group to attend, so long as the topics are interesting.

User Groups

Hulu – Watch TV and Movies online for FREE!

7. January 2009
hulu_logo

 

I don’t pay for cable, and i don’t pay for dish. What I do pay for is internet, and it gives me more than enough TV to compensate than both dish or cable ever could. What it gives me is Hulu.com and all the on demand access i want to popular sitcoms, and even shows that are no longer on the air!

Not only does Hulu provide access to standard broadcasting shows Hulu also provides access to cable shows, and even movies. Yes, movies, and no this is not Netflix. This site does not charge anything, and only broadcasts a standard ‘commercial’ during the playing of a show. Considering I can watch what i want, when i want, and wherever i want (bear in mind wireless laptop.)

As i write this i’m watching the Dilbert cartoon series that hasn’t been broadcast in some time. What’s great is i already watched the new series ‘The Legend of the Seeker’ episode 7 before it was even broadcast on standard TV. The shows range from ‘The Family Guy’, ‘Chuck’, and go all the way to the National Geographic shows. Man, i love technology between Pandora online radio and Hulu online TV who needs both a real TV and radio?

Offbeat, Programs & Utilities

Passing and Accessing DataBinder Container DataItems

6. January 2009

When fielding a few questions on the ASP.Net Forums I ran across a question that I’d recently read about going through the ASP.Net 2.0 Wrox book. The question was how do I access the row values from a databound grid without having access to the original data source. The person then went on to ask whether they’d be able to pass the DataBinder class object to the code behind to have access to the static Eval() method for the entire row of data.

Normally in the markup you see most of the databound code examples will have a function that accepts an input value that is called from the markup, passed to the code-behind, and then the code behind will output a formatted value back to the markup. It works well for situations where you need to calculate values quickly without the original data source, or to quickly format values for display purposes on databinding the control to a datasource.

 

Passing a Single Eval DataItem

ASPX

<%# GetTotalValue(Eval("ColumnName")) %>

CS

protected int GetTotalValue(object total)
{
int value = 0;
int.TryParse(Convert.ToString(total), out value);
return value;
}
 

In cases where multiple row values need to be accessible without having to pass each value directly one could simply access the databound row from the code-behind during the binding of the data control. In this case we still have the markup call to the code-behind as seen in the ASPX section below. This time we’re not passing any value(s), but instead we’ll just call them as we need them on the code-behind. Yes, it’s that simple. As you can see below we simply call to the DataBinder.Eval static function, pass in the data container (exposed by the Page,) and then simply supply the name of the column from the datasource we want. This is not limited to a single column, but only to a single row of data at a time.

 

Accessing Multiple DataItems 

ASPX

<%# GetTotalValue() %>

CS

protected int GetTotalValue()
{
int value = 0;
int.TryParse(Convert.ToString(DataBinder.Eval(Page.GetDataItem(), "ColumnName")), out value);
return value;
}
 

The reason this is limited to a single row is that we’re only able to access these values during data binding event, which is indcated per the ‘<%#’ on the markup side indicating that this function will only be called when the form is binding. Each row will call the same function outputting the unique formatting of the columns or calculations being performed on the code-behind calls. There is no need to try to pass the DataBinder, pass the datacontainer, or anything of the sort because it’s already available to us. Now keep in mind that you can’t call the GetTotalValue() anytime you’d like as this function will only work during the the databound event of the control.

.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

ASP.Net, Programming