ASP.Net - Confirming changes to ListBoxControl

 

Have you got a DropDownList control and do you want to confirm with the user that they want to actually change the value before you perform any processing within the code behind event of the DropDown? (SelectedIndexChanged)

image image

Turns out that this is not a straight forward issue because the DropDownList does not provide us with any client-side events to latch onto. (At least not via the IDE).

Here is my solution:

I inject code in the Page_Load event for the DropDownList using the "Attributes.Add" method available on the DropDownList control object. The code displays a prompt to the user and if they answer No, then the return statement is hit. This code works because the return statement stops the code flow and hence the code-behind event does not get called. (The rest of the code in the script makes sure that the old value of the drop down is reset when the user responds No to the prompt).

example (C#):

const string message = "Are you sure you want to change the value of the drop down?";
const string onChangeScript = "var jsDdlObj = document.getElementById('ddlObjID');" +
"var curIndex = jsDdlObj .selectedIndex;" +
"if (curIndex == 0){curIndex = 1;}else{curIndex=0;}" +
"if (!confirm('" + message + "')){jsDdlObj.selectedIndex=curIndex; return;}";
ddlObj.Attributes.Add("OnChange", onChangeScript);

An important thing to note about the above code is that the DropDown has only 2 values (No,Yes). The code that resets the value uses this information to toggle between these values. If you have more values - then you need to figure out how to set the old value back. (One issue you will face is that when the OnChange event is fired - the old value is erased and what you get is only the new value - so you probably will have to store the current selected index even before the OnChange event is called - so that you have the ability to reset it to that old value.

Thursday, August 28, 2008

PhotoSynth - Denver Skyline at Dusk

My newest PhotoSynth - made with 75 images.

link

PhotoSynths - Downtown Denver

Taken on the 4th day of the Democratic National Convention at Denver. Took these during my walk through the crowds at noon.

link

 

This steam engine train was parked at the Union Station yard.

link

Wednesday, August 27, 2008

FastStone Capture 5.3

fscaptureA good screen capture tool is an important part of any developers toolbox. I love SnagIt - but I have only one license for my home computer. For my other computers I needed to find something free. For the last month I have been using MWSnap. MWSnap is a great tool - but I missed the fact that it does not have built in annotation tools.

I had used FastOne Capture a long time ago - and it was pretty close to SnagIt. Only thing is that the new versions that are available are all shareware versions that time out after 30 days. When I found FastStone Capture 5.3, I almost feel out of my chair! FSC 5.3 is completely free for private and non-commercial use and it never times out. And you can download it from the following site A+ Freeware (FastOne Capture 5.3).

The only thing that I miss in this version of FastOne is that it doesnt automatically post a captured image to the clip-board. (MWSnap and SnagIt both do this). 

Here are some more recommendations for free screen capture tools: http://www.techsupportalert.com/best-free-screen-capture-utility.htm

How to: Open a new window using Response.Redirect

In short - it is not possible - at least not directly. The reason is that Response.Redirect is code that runs server side. And the server does not know anything about the client's windows or frames. Hence you cannot do a Response.Redirect and have it open a new window.Open-new-window

Having said that - there are other ways in which one can accomplish this objective. One can do this by using JavaScript. One can inject javascript into the Response.Redirect method, but I found this unreliable and it did not always parse the URL correctly.

Here is an easier way to do it - using the Response.Write method.

In the code-behind file and in the method from which you wish to spawn a new window - add the following code: (C#)

private void OpenNewWindow(string url, string windowName, string windowParams)
    {
        if (url == null)
            throw new ArgumentNullException("url");
        if (windowName == null)
            windowName = "";
        if (windowParams == null)
            windowParams = "";
        string scriptCode =
            string.Format(
                "<script>window.open('{0}','{1}','{2}');</script>",
                url, windowName, windowParams);
        //write the script out to HTTP Response stream
        Response.Write(scriptCode);
    }

And call it in this manner:

protected void Button1_Click(object sender, EventArgs e)
    {
        const string url = "default.aspx";
        //name of window - leave blank to open each url in a new window
        //use a name to reuse the window
        const string windowName = "";
        //params for a window
        //these params open the url in a popup style window (no toolbar, status bar, etc)
        const string windowParams = "height=760,width=760,status=yes,toolbar=no,menubar=no,location=no,resizable,name=Notes";
        
        OpenNewWindow(url, windowName, windowParams);
    }

Tuesday, August 26, 2008

If you are a programmer, then paste these 5 points on a wall near you.

  • misc_manifesto Never stop learning.
  • Communication is critical.
  • Under promise, over deliver.
  • "I was wrong."
  • If it is not tested it doesn't work.
  • Programming isn't your job, shipping is.

Fatherly Advice To New Programmers

Error generating report - 3126 Reserved Error - Microsoft Access

image

Weirdest error message - found out that one reason that can cause it is a badly formed SQL query that sits behind the report. Fix the query and the error goes away.

If you saw a cow this morning... it was probably pointing north

via PBS

cow200 A researcher used GoogleEarth to study cows grazing and found that they are most likely to be aligned to magnetic north-south when doing so. The same behavior was also seen in deer.

What I found interesting was the way in which GoogleEarth was used in this study.

PBS - Moo North!

Monday, August 25, 2008

Crystal Reports for Visual Studio 2005 - Walkthroughs

Here is a useful (but slightly old) document that describes all the samples and provides walkthroughs and how-tos for common tasks with Crystal Reports in Visual Studio.

http://www.businessobjects.com/global/pdf/dev_zone/cr_vs2005_walkthroughs.pdf

Sunday, August 24, 2008

Get your iPhone off of the power grid

Mobile 2 Energy (M2E) is a startup that is building a charger that will be powered by your movement. Remember the Forever Flashlights that were being sold via infomercials? This new charger seems to be using a similar technology and is based on Faraday's law. M2E is a venture built on research done at the Idaho National Laboratories and its technology finds use not only in every-day consumer products like chargers but also is used by the military.

untitled

According to the company - 2 days of ordinary movement will build enough electricity in the device to be able to charge a mobile phone completely. Not sure when the product will actually be available on the store shelves. What a cool way to go green.

My only wish for this product, is that they should make the charger a little more like a pedometer. That would make it a fun and an useful device.

via M2E’s Motion-Powered Gadget Charger’s Got AC, Too « Earth2Tech

Charger on the M2E website: http://www.m2epower.com/apps/mobile.htm

M2E company website: http://www.m2epower.com/index.htm

Video explaining the technology: http://www.m2epower.com/multimedia/overview.htm

iPhone App - DiskAid

DiskAid

DiskAid DiskAid allows you to copy files onto your iPhone/iPod and treat it like a USB drive. It wont let you copy music or images so that they are accessible from your iPhone/iPod, but you can copy them to move them around to another computer. I like it - because it makes it so you need to carry one less device in your gadget bag.

Works for both Windows and Macs

iPhone - Tips and Tricks

To save an image while you are browsing a web page in iPhone Safari - touch and hold the image. A pop-up menu will appear allowing you to save the image to your phone. Useful!

Take Distorted and Psychedelic iPhone Photos - Wired How-To Wiki

Until today, I thought my iPhone's camera had a bug and I was thinking about taking it back in. Pictures that I took had a weird warping effect. It now turns out that it is a "feature" because of the design of the sensor and the fact that the iPhone doesnt use a physical shutter button.

And now you can use this "feature"/"design" to take artistic distorted and psychedelic photos!

Take Distorted and Psychedelic iPhone Photos - Wired How-To Wiki

The reason? The iPhone has no physical shutter and instead uses photon gating on its CMOS sensor. Some parts of the image are recorded before others, much like with a scanner. The iPhone's CMOS scanner seems to be a lot slower than, say, the CMOS sensor on your Canon point and shoot camera. Therefore, as the camera is recording the image, any changes over that small but significant amount of time are recorded.

iPhone App - Google Earth for iPhone

Earthscape Basic is a 3D viewer for the iPhone (just like Google Earth). I havent tried the app (it costs $10 and that is more than I am willing to pay for a iPhone app at this point). Though this YouTube video of the app running on the iPhone looks awesome.

Earthscape Basic | For iPhone and iPod Touch!

From Theodolites to GIS

Survey of India is the oldest government department in India. Here is an interesting post about one of the complex surveys it took in 1800 to measure the curvature of the earth as well as the Indian sub-continent.

Originally set up in 1767, the Survey of India is the government's oldest department and in charge of all of the its mapping and surveying efforts.  Since coordinating the Great Trigonometric Survey, it has expanded over the years to 23 geospatial data centers and 18 divisions that range in responsibilities from tides to aerial survey.  The agency uses GIS extensively in its mapping activities.

Geography Matters : From Theodolites to GIS

Saturday, August 23, 2008

iPhone - Tips & Tricks - Stop Syncing

If for some reason you don't want your iPhone to auto-sync for just one time, then all you need to do is while you connect your iPhone to your computer, hold down the SHIFT + CTRL keys. iTunes will skip syncing your iPhone for that one time.

iPhone - Tips and Tricks - Headphones

When I first got my iPhone - I ignored the headphones that came with it in the box. I thought that they were similar to the ones that came with my wife's iPod. A couple of days ago while looking for the manual, I took a closer look at head-phones and boy are they different from the normal headphones that come with iPods.

iPhone head-phones have a small rectangular block on the right side ear-pieces wire. This rectangular block is a mic as well as a remote control. You can use it to take a call or reject a call, you can even control music playblack.

mic

Here are the shortcuts that you use with the mic/button.

iPod controls:
Pause a song or video 
Click the mic button once. Click again to resume playback.
Skip to the next song 
Click twice quickly.

iPhone controls:

Answer an incoming call 
Click once.
End the current call
Click once.
Decline an incoming call 
Press and hold for about two seconds, then let go. When you let go, two low beeps confirm you declined the call.
Switch to an incoming or on-hold call and put the current call on hold 
Click once. Click again to switch back to the first call.
Switch to an incoming or on-hold call and end the current call
Press and hold for about two seconds, then let go. When you let go, two low beeps confirm you ended the first call.

Friday, August 22, 2008

Meet the PhotoSynth team

Channel 10 video: Interview with PhotoSynth team.


ShutterSpeed EP04 - The Photosynth Team

This is a very good video as it gives you an over view of how PhotoSynth works. The video also shows how a scientific prototype was converted into an application that runs on almost any machine out there. (The first version took days and ran on a cluster of machines. My synths from 11 images took just a little over a minute on my old machine).

One of the break-throughs that the team used in creating the 3D environment was in figuring out what was the least amount of processing and scene generation that was required to give us a sense of the true 3D environment that the 2D photographs represent. In their case it turned out to be a subset of the blobs used to perform the matching, which were then projected on to planes that represent the location of the images as perceived by the algorithm. (In other words - the algorithm is not trying to determine each plane defined by different objects in the scene - but the big plane that the entire image could be projected onto - it is sort of like trying to figure out where one should place the projector screen - so that the projected image would look as close as possible to the real world).

PhotoSynth ShortCuts

image

from: the ebook Photosynth Guide v6b_CC.pdf

Photo-Synth problem: Not uploading collection

A couple of the collections that I was PhotoSynthing would end up hanging during the upload phase. Even after an hour of waiting - the upload hadn't seemed to have finished.

I then found that PhotoSynth writes a log of what it is doing. When I looked at the log - it said that the collection had finished uploading. But in addition it also had the following message:

"Collection completed (100% synthy), but isn't avialable for viewing yet"

Turns out the PhotoSynth system had a couple of problems in the back-end because of the amount of load that the team's servers were experiencing (link). They are fixing the problem and it should be fixed soon (link). In the mean time - you just need to check the log and if the log says that the collection has been completed - then if you visit the PhotoSynth site after a little while and check your account - you should see your collection there. (It took about 20 minutes for my collection to show up).

(Check out the spelling of "available" in the above log message!!! smile_regular)

Geo-tag your PhotoSynths

In my last post about PhotoSynth, I was complaining about the web-interface for PhotoSynth. One of the complaints was that PhotoSynth does not allow for images to be GeoTagged. Well turns out I was wrong. While editing my second PhotoSynth using the web-interface I found a way to GeoTag the PhotoSynthed images.

image

Just click on the globe shown above. It brings up an interface to Live Maps, which you can use to Geotag the collection.

Check out my newest PhotoSynth - Civic Center Park, Denver.

My very first PhotoSynth

Some of you who have been regular readers of my blog - would have seen my previous posts about Microsoft's PhotoSynth technology. PhotoSynth is truly a ground breaking piece of software that is not just awesome for what it can do (create 3D scenes from a set of your 2d photographs), but also in how it represents the shift in how Microsoft does business. Just 5 years ago all the research that Microsoft did would find its way into some commercial piece of software. (For example a lot of the research into image manipulation would end up into Digital Image - a now discontinued product). Today a piece of software such as PhotoSynth which truly has huge commercial value, has been released to the public totally free of cost. (To boot MS is giving 20gb of space to everyone who signs up for a Live account - a prerequisite to creating PhotoSynths). A lot of this paradigm shift in how Microsoft is operating, I am sure is in no small part attributable to Google. (Though, it does feel like the amount of cool stuff coming out of Google is slowing down and Microsoft is quickly gathering the speed needed to over-take it).

The website itself has much to be desired off. (it is nice for a 0.5 version, but needs more work). It is hard to find cool PhotoSynths and I wish we could geo-code our images - so that people would know which location they represent. What would be even cooler would be that once multiple PhotoSynths for a location are created - they are all merged into one seamless representation of that area. Never-the-less, even in this iteration - this software is truly AWESOME!

Here is a MS Research paper on PhotoTourisim - a precursor to PhotoSynth: http://research.microsoft.com/IVM/PhotoTours/

Also - check out this truly cool video about PhotoSynth that was shown at a TED conference just a little over a year ago.

And here is my first ever PhotoSynth. The PhotoSynth was created with 7 photographs that I took of the Denver City Building while walking home. It took less than a couple of minutes for the PhotoSynth to be created and uploaded to the website.

 

 

Check out this point cloud that PhotoSynth creates from my pictures, which are used to "stitch" the images together.

image

Everytime I take a look at a PhotoSynth and the point cloud that sits behind it - I am truly awestruck. The problem that PhotoSynth solves is not a trivial one and to boot - they have made it work fast as well as accurately. It is truly amazing. PhotoSynth definitely takes photographs to a whole new level

Thursday, August 21, 2008

Blue Planet Run | Water is life. Pass it on.

Blue Planet Run Foundation is dedicated to raising global awareness about the lack of safe drinking water, and funding working solutions today for the billion people living without ready access to this life sustaining resource. Since 2004, the U.S.-based foundation has funded 18 non-governmental organizations worldwide which have in turn implemented 142 sustainable water projects in 14 countries impacting 137 thousand lives. The Foundation's signature awareness and fundraising event is the Blue Planet Run, the first-ever around-the-world relay run.

book-cover

Blue Planet Run provides readers with an extraordinary look at the water problems facing humanity and some of the hopeful solutions being pursued by large and small companies, by entrepreneurs and activists, and by nongovernmental organizations and foundations. By the end of the book, readers are left to form their own conclusions as to whether the human race is capable of taking the steps necessary to solve this global crisis before it’s too late.

You can buy the book ($45) from the foundation's website (link). Or you can check it out as a free PDF book (book)

The book has very good pictures that are extremely thought provoking.

Blue Planet Run | Water is life. Pass it on.

Wednesday, August 20, 2008

iPhone software update - August 19, 2008 (v2.02)

photoApple released an update for the OS for the iPhone on August 19, 2008 (version 2.02). I have had this update for about 24 hours now and found that some of the applications that I had installed - would not load up anymore. Clicking on the application's icon would result in a new window in which the apps looked like they were trying to open. But almost instantly - the apps would crash and I would be returned to the home screen.

I then installed a couple of new apps from the iPhone App store and those were working correctly. So I thought that maybe the update had messed up some settings for the applications that I had installed before running the update. So I uninstalled all the applications that I had installed before the update. (To do this - keep your finger down on one of the app's icons on the home screen. After a couple of seconds - they icons will start wiggling. All applications that can be removed will have a small cross at the top left corner of the icon. Tap the cross to uninstall the application.)

After you uninstall all the apps that don't work anymore - reinstall them. And they should work like before.

Important : When most apps get uninstalled - all the files that were used by the app will also be deleted. So dont do the above step until you have reviewed the data that each app stores and backed up the important ones.

List of apps that failed after updating to v2.02 - Facebook, Google, TipStar. All of them work fine now after being reinstalled.

Update : v2.02 seems to be a LOT more stable. Before I used to experience app failures atleast once a day. Since I installed v2.02, I havent had one app behaving badly. Wooo! Hooo!

Oracle Developer Tools - Errors at start up

Issue 1: ODT does not come up inside Visual Studio.

You get the following error:

Package ‘Oracle Developer Tools for Visual Studio .NET’ has failed
to load properly ( GUID = {D601BB95-E404-4A8E-9F24-5C1A462426CE} ).
Please contact package vendor for assistance. Application restart is
recommended, due to possible environment corruption. Would you like to
disable loading this package in the future? You may use
‘devenv /resetskippkgs’ to re-enable package loading.

The issue stems from a mismatch in DLLs. The easy way to fix this issue is to open a VS.Net Command Prompt. Then CD into the following folder (First close Visual Studio)

C:\oracle\product\10.2.0\client_1\odp.net\bin\2.x

And run the following command which will register the .NET dll into the Global Assembly Cache.

gacutil /i Oracle.DataAccess.dll

You should get the following message - "Assembly successfully added to the cache"

After that restart Visual Studio and click on

image

If you get the "Add Connection" dialog then you are golden!

Issue 2: You are unable to debug stored procedures.

When you attempt to debug stored procedures (which was the main reason I wanted to try out ODT) you get an error message about insufficient priviledges:

image

An error occurred while executing the procedure/function:

ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_DEBUG_JDWP", line 68
ORA-06512: at line 1

To solve the problem, do the following:

  1. Grant the "debug connect privilege" (for 10g databases) to the connected user.
  2. Grant the "debug" and "execute" privilege on the PL/SQL program to the connected user, or
  3. Grant the "debug any procedure" privilege to the connected user.

Check this page for more information about fixing other problems you might run into:

http://www.oracle.com/technology/software/tech/dotnet/odt10202rn.html

Update (08.21.2008) - The product manager for Oracle Dev tools for .NET has this very good post about getting PL/SQL debugging running in Visual Studio (link)

Tuesday, August 19, 2008

iPhone - Make your own ringtones

Do you want free ring-tones for your iPhone? Then why not make it yourself.

Here is what you need to know:

  1. The song you wish to convert to a ringtone must be DRM free
  2. Ringtones should be less than 30 seconds in duration
  3. The format of the song should be ACC. (This is Apple's format)
  4. The extension of the file should be m4r

Once you create a file that obeys all of the above conditions, you should be able to add it as a ringtone to your iPhone.

More information available at index.cgi-page_name=make_custom_iphone_ringtones_without_paying_apple_2;action=display;category=

Sunday, August 17, 2008

iPhone Apps - Bar code scanners

1Have you ever been in a grocery store and wondered if you are getting the best deal on a product that you are putting into your shopping cart? I do all the time, especially with big ticket items like computers, TVs, etc. Wouldn't it be cool if you could read the bar-code and quickly get prices and reviews of off the Internet?

The following software all use the iPhone's built in camera to capture the bar-code and decode them to get information and content from the Internet.

image  Barcode

image NeoReader

image ScanLife

image CheckOut

BarCode will only read and store your bar-codes in a database. (Average rating: 2.5 starts, 47 reviews)

NeoReader goes a step further and allows you to search details about the product that you just scanned. (Average rating: 2.5 stars, 19 reviews)

ScanLife seems to be able to scan only 2D bar codes (EZCodes). Apart from that it also allows you to search for web content based on the item you just scanned. (Average rating: 3 stars, 12 reviews)

CheckOut is the only one that is not free ($4.99). There is a service outage currently with this app. It too allows you to search for online content based on the bar code that you scanned in. (Average rating: 2 Stars, 34 reviews)

If you look at the reviews all of them have some problems. But they do work. And they definitely are a cool idea and an innovative use of phones that have access to the Internet.

(disclaimer: I have not installed any of the above apps on my iPhone. The review is based on the reviews and statistics available on iTunes as of today).

iPhone Apps - File manager

The iPhone does not allow you to take PDF documents with you on the device. You can view PDF files on the Internet - which means that you need an Internet connection. But what do you do if you are flying? or going to an area without any wireless signal? (Personally, I would want to take the Colorado fishing regulations booklet with me when I go fishing in Rocky Mountain Nat'l Park).

One way is to JailBreak your iPhone - but that is not an option that I am particularly fond off.

Another way is to convert your PDF into a special type of a web link (URL) called a URI. (link). Again I am not fond of this approach as there must be a data size limit on how much the Safari can handle as part of a URL.

Files_Portrait_394My aim was to find an application that would allow you to store PDFs on the iPhone and read them even while you are offline.

And I found the answer in Files, an iPhone app. (link). It not only allows you to store PDF files, but also a variety of other ones like: Word Docs, Images,etc.

 

I haven't yet tried the app, as it costs $7.99. I wish it were free or had a try before you buy option. But it has all the features I would have wanted in such an app and more. Files is available for both Windows and Mac machines.

 

FileMagnet: this is another App that allows you to copy and view files on your iPhone/iPod Touch. But it works only for the Mac. (it is also cheaper at $4.99)

iPhone Tips - Taking Screen Shots

Need to take a screen shot of your iPhone or iPod touch.... it is easy.

Press the Home button and while it is pressed - hit the Sleep/Wake button. The screen will flash for a second and an image will be stored to your Photo Album.

 

iphonebuttoninputs

Saturday, August 16, 2008

iTunes - How to play current album

Warning.... before I let you know how to get to the album or artist of the currently playing song.... you will have to go through a few paragraphs of my rant against iTunes...... Skip to the end and the tip is there!

Oh! how I love to hate iTunes! Steve Jobs loves to make money by thinking of his users as being the dumbest lot on this planet..... I hate iTunes.... If I don't like iTunes, why do I use it you ask? Well I just bought me an iPhone and the damn thing wants to only talk to iTunes......

I also hate the way the iPhone treats me like an idiot and doesn't allow me to do anything with it.... I cant copy a song directly to it. I cant copy PDF files onto it. I cant drop mp4 files or make albums of them..... BUT! boy does it have an awesome screen and interface. For just those 2 things, I am willing to stick with the iPhone..... I hope in 2 years (when my contract ends), Windows Mobile has a device that has a screen that is just as cool. (I checked many of the new WM phones - not one in my opinion is close.... but I just love how customizable those machines are)

Anyway's..... so I am stuck with iTunes, at least for the next 2 years. Most of the time I put turn shuffle on and listen to my 3,500 songs and when I hit something that catches my fancy for that day, then I like to go from the currently playing song to the album (or artist) and play all those songs. Seems like a very basic function that all music players should have..... but NOOOOOO, iTunes doesn't have a way to go to the currently playing song! You cannot click on the current song's album to go to a list of all the songs in that album. I was getting very, very frustrated.....

image

The above image shows how a currently playing song looks in the iTunes list. You cannot click on anything except the arrows in the list. And when you do click on the arrow it takes you to the iTunes Internet store. (Why in the world would I want to go to the iTunes store if I already have the song - this is what happens when sales and marketing folk start calling shots on a software, instead of users) It is almost like the developers themselves don't use iTunes to play their songs... otherwise a feature like this would surely have made it into the software over the years.

How to play the songs based on the currently playing song's album or artist:

As I said before - the interface was making me very frustrated and while just randomly hitting keys I found out that if you press "CTRL" and then click on the arrow that normally takes you to iTunes store, iTunes will take you to the browser window with the search criteria filled out. (So it seems, the iTunes developers probably do use the software and have hidden these useful commands from the masses.)

image

If you then play a song from the browser window - iTunes will play all the songs that show up in the list. Not the most intuitive interface.... but it is exactly what I need.

(if you don't see the arrow next to the currently selected/playing song, go to Edit -> Preferences -> General Tab and make sure "Show Links to iTunes Store is checked)

image image

The one thing that I didn't realize is that iTunes, just like Windows Media Player, supports plug-ins/add-ins. So I might just be able to find the right stack of plug-ins that will make iTunes a good media player.

A list of features I am currently looking for:

  • Monitor a list of folders for new songs
  • Remove dead files from iTunes

Do you know of any?

In a later post..... what I love and hate about the iPhone. (the screen, drool, drool, did I say how wonderful it is!)

Tuesday, August 12, 2008

IIS 6.0 Log Files

Ever wondered where IIS6.0 stores the log files for your website?

I did and found out that IIS 6.0 puts them in the following folder:

%SYSTEMROOT%\System32\LogFiles\W3SVC###

The most valuable log files for IIS6 (and their locations) are:

  • HTTP.SYS Error Log - %windir%\System32\LogFiles\HTTPERR (Default location; configurable)
  • IIS Website Log - %windir%\System32\LogFiles\W3SVC# (Default location; configurable) **
  • Event Log (both System and Application)

More information is available in this David Wang's post - http://blogs.msdn.com/david.wang/archive/2005/12/31/HOWTO_Basics_of_IIS6_Troubleshooting.aspx

Fixing 401.x problems with IIS 6.0

Some users on our network were not able to access a web application that we administered. What was weird was that for 98% of the users - the web app worked correctly. They were able to open the web-page and interact with the application.

But for the other 2%, they would be shown a log on window and after trying to log on 3 times - IIS would kick them to a 401.1 error page, with the following information

You are not authorized to view this page

You do not have permission to view this directory or page using the credentials that you supplied.


Please try the following:

  • Contact the Web site administrator if you believe you should be able to view this directory or page.
  • Click the Refresh button to try again with different credentials.

HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.
Internet Information Services (IIS)

The error message was definitely not helpful, other than pointing me in the general direction that it was due to invalid credentials.

David Wang has an excellent post on how to troubleshoot 401.x error issues. (link). Check it out.

Unfortunately, our problem was not covered by any of those listed by David.

After a ton of testing I determined that the problem was because the account that was being used for anonymous login did not have the domain information with it. (eg: domain\anonymous_user). Adding the domain information fixed the problem for the other 2% that were facing the 401.1 error page instead of the web-app's start up page.

At this point I am not sure why this fixed the problem for the 2% who weren't able to access the web-app. It looks like IIS did not know where to go to determine what the anonymous_user credentials were to give access to these "special" users. But these "special" had machines that were configured exactly as the rest of the users. If I find out more information - I will be sure to post it here.

BTW, the anonymous_user account that IIS was using for anonymous logon was a domain account and not a local account.

Update 1:

I found the following commands useful for determining different settings regarding anonymous logon settings with IIS.

1. cscript adsutil.vbs FIND AnonymousUserName

Returns a list of all those websites that have anonymous logon information.

2. cscript adsutil.vbs GET xxxxxxxxxx

Where xxxxxxxxx is one of the values (represents a website) got from running (1), returns the user name that is being used for that website.

3. cscript adsutil.vbs SET xxxxxxxxxxx/AnonymousUserPass NewPass

Where xxxxxxxxxx is one of the values got from running (1). This command changes the password associated with the user id used for Anonymous logon.

And more information regarding how to use the above commands to synchronize anonymous login credentials on IIS read David's post on the topic (link).

Friday, August 08, 2008

Concatenating String Fields in SQL (Oracle)

To concatenate 2 string fields in a select statement use the || operator (C#'s OR)

select firstName || ' ' || lastName as Name from tblNames;

Outputs:

Name

Barack Obama

George Bush

George Washington

Also, string constants are defined by single quotes (')

Thursday, August 07, 2008

FullSizePosters.com - A Denver company

image

I heard about the company in a local magazine article. They are based out of a suburb of Denver (Westminister).

Having checked out their website - I found that they are one of the cheapest printers of full size posters. And the reviews of their service are also very good. Definitely going to give them a try.

FullSizePosters.com Your Pictures as Full Size Posters. Overnight.

The Best States For Business - Forbes.com

Colorado ranks no. 6 in the best states for business as ranked by the Forbes magazine.

2008 Rank 6
2007 Rank 8
Business Costs Rank 35
Labor Rank 1
Regulatory Environment 22
Economic Climate 14
Growth Prospects 1
Quality Of Life 12
   

http://www.forbes.com/2008/07/30/virginia-georgia-utah-biz-cz_kb_0731beststates.html

Montana ranks 24 this year. Last year it was ranked 42nd. I can only see it getting better in Montana.

Wednesday, August 06, 2008

Microsoft Access 2003 - Debug not working!

I was working on a Microsoft Access 2003 application that had Visual Basic code sitting behind the forms that it had. I was able to set break points in the application and the debugger would break when it hit them.

image Then all of a sudden the debugger stopped working. It would not break at break points, nor would I be able to stop program execution using the STOP statement.

At first I thought it might be a bug in the code and so I dropped some MsgBoxes into the code - and they were getting displayed - so that wasn't it.

Googling - the answers to this problem were just not good: export all your code, delete the modules and re add them - I had way to many modules, that this just didn't sound like a path I would like to take. After searching high and low, I figured out the problem had to do with a single check box on the startup page!.

The "Use Access Special Keys" needs to be checked on. (If it isn't for you, set it to checked, hit OK and then close and reopen your Access file - as the setting takes affect only when the database is being started up)

image

Tuesday, August 05, 2008

Access Application - By passing the start up screen

This might be a very basic tip for those of you who have been working with Access for years. But this week I had to open my very first Access application ever. And the application had a startup form - to which it would directly go without allowing me to see the tables, forms, etc that sat behind the application.

For a while, I thought I was locked out. And then..... I clicked on the SHIFT key while opening the database - and viola! the MDB file opened just like any normal Access database file.

I was happy as a Clam at high tide!

Ps: The normal view for Access is called the Database Window.

Also - if you want the Access database to always open to the database window, then you can set it by first opening the MDB file with the shift key depressed. Then change the startup settings by going to Tools->StartUp....

image

Sunday, August 03, 2008

What the hell is business casual?

As I told you in a previous post, I changed jobs in July. At the new job, with the City and County of Denver, we are required to wear business casual.

Now at my previous job we wore just about anything we liked. It had to appear neat and not cheap and that was about it (as can be seen in this picture that I took on the last day of my job with VLS, work wear could be adventure/trail wear).

 P7031508

imageSo to me the idea of wearing formal clothes is pretty alien. So I turned to my trusty friend Google to provide me advice regarding what I could wear to work. And here are the two links I found that best explained the finer sartorial points of "business casual" dressing:

Career Services at Virginia Tech: In simple terms explain what is ok and not ok at work.

Sartorish.com: If the name doesn't say it all, this site goes into the finer points of looking good at work.

Did I forget to tell you? I changed jobs!

Maybe I did.... Its been about 3 weeks now since I left my position as the Lead Engineer for LIDAR Analyst and took up a job with the City and County of Denver as an Applications Developer.

image 

I am jumping from hard-core windows applications to hard-core web-applications. From GIS driven to database driven applications. From a building that housed about 20 people to one that houses about 2000 people.

image

The main reason for my move - a year of working from home had taken its toll on me and my social life..... The new job offers me great opportunities and it is walking distance from my home - so I am able to get a little exercise into my daily routine. smile_regular I am currently assigned to the Department of Human Services and I am excited to be able to work in a place where I can contribute to my community.

I still plan on being involved with GIS as well as LIDAR technologies. So if that is what is your cup of tea, stay tuned to my blog.

Also in addition to getting the usual fare of information on GIS, LIDAR and C#, you will now also see posts on ASP.net, web-application, SQL, AJAX and maybe more.

What is the difference between MVP and MVC patterns?

So what is the difference between MVP (model, view, presenter) and MVC (model view controller) patterns?

image007       image008

 

Here is a good post that goes into just that: Interactive Application Architecture

Using the MVP pattern to create testable web-apps

This post shows how one would use the MVP pattern to create a testable web-application in ASP.net. What I like about it, is that it provides you with a before and after code snippet - which is priceless - as it doesn't just show you how to create a testable app, but also how to use the MVP pattern in the first place.

Definitely a good read.

Cool Visual Studio Tip

via Visual Studio trick to quickly find any file in solution

Did you know that the find box doubles as a Command Window prompt if you just start with a '>' sign.  You can use it to call many of VS's inbuilt methods.

Here is a great tip for finding files in your solution.

First jump up to that box using the keystroke Ctrl+/.  Now type ">of " and follow with the start of a filename.  And like the Suggest feature that we are so used to with Google search, VS populates the drop down with a list of file names that match what you are looking for and when you select the file name, it magically opens in VS ;)

untitled

Don't even think of putting an iPhone code snippet online....

jobs Don't even think of putting an iPhone code snippet online.... For that matter, don't blog about the SDK or even have a user group meeting, cause if you do, you will be in violation of the non-disclosure agreement (NDA).

Here is a good blog post on the restrictive (overly restrictive, IMHO) NDA Honoring your NDA and terms of use and the iPhone SDK

Here is the gist:

  1. You can't post a code snippet that uses the iPhone SDK.
  2. You can't meet with other developers or have a iPhone SDK user group.
  3. You can't write a book on the SDK.
  4. You cannot OpenSource your cool iPhone app.
  5. You obviously cannot sell the iPhone app on your own.... no you must use the iPhone app store!

1196198523233mm1You have got to wonder how Apple expects more developers to come on-board with their new SDK. Especially with the competition heating up (read Google Android and Windows Mobile) you would think Apple would try to make it fun for developers to work with their iPhone platform. Seems like Apple has the myopic view of protecting current revenue streams, instead of trying to get cool apps developed that makes its iPhone platform the only one people would like to have because of the myriad applications available for it. (It is for this very reason that I have never considered an Apple desktop as a replacement for my 3 Windows machines at home).

Apple, will you never learn?

More information:

  • iPhone SDK and free software: not a match
  • Apple’s iPhone contract leaves developers speechless
  • Walking directions in Google Maps

    Google Maps recently added walking directions. And it works great. It ignores one ways and uses pedestrian bridges wherever possible. Check out these screen shots, which show driving directions (left) and walking directions (right).

    image  image

    The above directions are from the University of Montana to the Albertson's shopping center which is located north of the Clark Fork river. When walking directions are chosen, Google Maps correctly shows the shortest path as the one taking the pedestrian bridge across the river.

    Check it out for yourself at this link: Directions from UofM to Albertsons.

    Using Google Maps for public transit on the Go!

    Google Maps has had a great interface that makes it really easy to use public transportation (bus and light rail) for almost a year now (if not longer). Check if your cities public transportation service is part of Google Transit at this coverage page: Google Transit Coverage.

    Denver's public transit system, the Regional Transportation District (RTD-Denver) became a part of the service a few months ago and I have been using this service ever since. It is easy to use and much better than the interface provided at the RTD web page. Here is a screen shot of it in use:

    image

    The web page allows you to specify a time in the future and also shows 3 upcoming departures, allowing you to select the one that would work best for you. In addition Google Maps will also use multiple services to determine the best method for you to get where you are going.

    That's all fine and dandy. But what do you do when you are out of your home and no where near a computer.

    Just this last week I found that Google Maps Mobile supports public transit mapping. So here is a series of images taken from my BlackBerry that shows how to get RTD bus/light rail information while you are on the go. (This should work on any cell phone with a browser on it too, only the steps might be different. I am using a BlackBerry Pearl for this demo).

    gm[1] 

    My BlackBerry home page

    gm[2]

    Selecting the Google Maps application icon

    gm[3]

    Home page of the Google Maps application for BlackBerries.

    gm[4] gm[5]

    Setting up for directions. (Insert a start and destination address - which can be via address or by pointing on the map).

     gm[6] gm[7]

    Clicking on Show directions - will show you the familiar directions list for taking your car to the destination. But hey you like to be green. So you try out the Transit tab.

    gm[9]

    The transit page adds a third option to the standard Start and End points - which allows you to specify the time at which you wish to depart. (You can instead also choose the time at which you wish to arrive at your destination, more on that later).

    gm[10]

    Clicking Show trips will, just like the desktop version, show you the next 3 trips from your start location.

    gm[11] gm[12] gm[13]

    Choosing one of the 3 trips will show you the itinerary for using public transit. (As can be seen from the above screen shots, the route shows you where the bus stop is, as well as factors in walking time to the bus stop into the itinerary.)

    gm[18] gm[14]

    The interface also allows you to quickly find trips starting earlier or later.

    gm[15] gm[16]

    Finally, if you want to determine a trip that is to start on a different date, then you click on the Date & Time button and set up the time at which you wish Google Maps should search for trips. (by default Google Maps searches for trips that are set to start from the current time). Finally you can decide if you wish to get trips that begin from your start point at a given time or if they should be scheduled such that they arrive at the destination at a certain time. (Extremely useful when you are trying to get to work at a certain time and don't want to leave a minute too early.)

    More information is available in this post from Google Blogs, as well as a video that demos it use.

    This is one feature that just aint there in Microsoft's Live Maps.