Posts

Web Application Development - Browser Issues

I am sure anyone who have developed/run web application project before know how crucial the application compatible with the mainstream browser in the market. If you search in the google and look for the most rant about browser. It would be no surprise that IE is on top of the list. Ok. this is not a IE bash thread and never intended to be. Because the relation of IE to the development team or business is actually a love and hate sentiment. Why? thanks to IE, development team can focus only compatibility test on IE and ensure if it works there. The rest (not mainstream browser) on the other hand can be ignored (unfortunately, that would mean sayonara to my favorite Mozilla Firefox). To cut the story short, let just explain based on my experience (it could vary on your experience, just my exposure) why people would rant about IE. They said, it is bad, but how bad is bad? Most people would start off "trying" to make the application at least compatible with IE6. Because the older...

Continuous Integration Environment : Parser Error Message: The file XXX does not exist

This is something that definitely continuous integration able to identify. Something to do with ASP.NET web page running well in development but not in the live environment or pre-screen - continuous integration environment. Server Error in '/' Application. -------------------------------------------------------------------------------- Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: The file '/XXX/XXXX.aspx.cs' does not exist. Source Error: Line 1: Line 2: For seasoned developers, if they have started development since .NET 1.1. This is something definitely they familiar with. Because, in the past, all this are not so automated in older version of Visual Studio.NET.So, in this case, it is the CodeFile directive that asking compiler to look for csharp code specify in the aspx file. Th...

Excel 2007 - Printing of excel sheet to fit to page size

The Ms Excel is a different animal when it comes to printing. Because of the nature of the format, you could be selecting only a fraction of page/sheet or workbook to print. For a casual excel user like me, this give inconvenient when all i care is to be able to print what i see on that particular page (or call sheet in excel). Often time, you would see some fraction of the content is being crop out in the print out. Because of exceeded range, you need to resize the columns one by one so then to be able to see the print out in one page. This is time consuming and frustrating. So, after some digging, I found my all time favorite Fit to Page printing function. It is located in "Page Layout" segment.And then, there is a "Scale to Fit" band next to page setup band. (that is another frustration of using newer version of office , all the menu items have been revamped, need time to search for what you want like in the past version). However, this would not wor...

My Experience of Prepaid Wireless Broadband

I do not hook up to internet that often after office hours, only once in a blue moon for research purposes. (after all, i get to connect to internet all day long in the office.) It makes no sense for me to commit to the monthly flat rate plan , and thus I choose prepaid broadband for my non-office hours internet surfing. Ok, I have done quite a bit of survey (that is just me, surveying even on these kind of menial stuff) - (comparison of packages as of today - 3 April 2010) Oh, by the way, I have bought a D-Link WCDMA/HSDPA USB modem to test most of these packages. (No need to lock in to any packages just to get the bundled modem by any operator, it is the same standard HSDPA modem. It would work the same way. In fact, my D-Link modem has additional MicroSD card slot (for storage) and I can use the bundled software to send SMS. So, no need to top-up using my handphone, just the modem will do. ) Digi Limited Edition Prepaid Internet ------------------------------------- RM10 5 days unli...

Roadblocks utilizing ASP.NET 3.5 and ASP.NET AJAX

Below is a listing of known bugs of the ASP.NET 3.5 and ASP.NET AJAX and the resolution. Calendar control extender http://forums.asp.net/p/1110311/2780472.aspx#2780472 Problem: Calendar extender would show random transparent weird popup upon clicking. (unbelievable that this can pass QA in the first place) Resolution: Add a dummy CalendarExtender outside of updatepanel. The calendarextender might need to associate with a dummy invisible textbox and invisble image button too. ----------------------------------------------------------- ASP.NET AJAX CalenderExtender again, this time on the days cells being blocked. Problem: If you have a couple of CalenderExtender in your page and asking UI designer to design the CSS separately. You would be very likely getting this. The problem is the td, tr and div tag being overridden by the CSS . Resolution: Have a more specific CSS for your calendarextender. The rule of CSS is the most specific one prevail.Use this (MyCalendar) in the CssClass attrib...

WCF - Reading from Application Configuration File - config section - system.serviceModel

I can't find any example on the web for this, so i guess it could be helpful. This is a simple example to show a way to read the system.serviceModel configuration section in application/web configuration file. Something like for ConnectionString, there is a straightforward class for that, ConfigurationManager.ConnectionStrings["keyname"].ConnectionString Codes snippet below ServiceModelSectionGroup group = ServiceModelSectionGroup.GetSectionGroup(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)); //suppose if there is only one endpoint if(group.Client.Endpoints.Count < 0) { uri = group.Client.Endpoints[0].Address.AbsoluteUri; }

Stop Symantec Endpoint Protection Weekly Scheduled Scan Momentary

The intention of weekly scheduled scan is good, it helps to safeguard and diagnose your computer from malware. It is a setting set by the most system administrator that any computer with endpoint protection installed would need to oblige this and have it scan every week. It is a centralized setting where users can't change it at the user end. However, for an advanced user like myself who knows how to take care of my computer, running a PC scanning even on my peak hours are really intrusive. Therefore, after some trial and error, i notice if I use process explorer to kill the rtvscan.exe while it is running, it would force the scanning to terminate itself. And the best thing is antivirus would still be up and running and no restart required. Probably you would need to enable back the protection at the setting where it would prompt you too. That is all you need to do. (this is my backdoor trick, use it at your own risk.)

Visual Studio .NET 2008 - Some conditional breakpoints not getting triggered and workaround.

If you read some debugging tips or reference on conditional breakpoint. You would notice that what is in the instruction should be straightforward and there is no reason why it won't work when you try it out. However, there are times when you set conditional breakpoint , a very simple one like say in you code, string a[] = {"21", "123", "32", "1234", "sds"}; foreach (string myString in stringArray) { Console.WriteLine("myString = " + myString); //conditional breakpoint set here. } conditional breakpoint set as myString == "1234" but to your surprise, it would not break and stop there. It is a very simple thing you would do but it just seems not working. For most people, they would just set normal breakpoint there and run a few more iterations and bypass the use of the conditional breakpoints but this is not my liking. This is a VS.NET function that I would really like it to work. It is af...

C# 2.0 syntax reference

readonly - member variable of class where can only be initialized once in constructor. yield - contruct return for IEnumerable e.g. IEnumerable GetNumbers() { yield return 1; yield return 2; yield return 3; yield return 4; yield break; } This is return a 1,2,3,4 list. this() - calling class constructor this[] - [] operator override e.g public int this[int i] { get { return 1; } } generic programming //where TbaseClass is use for T calling function class C1<T>:D1 where T:TbaseClass class B1 : C1<myInherittedTbaseClass>

C# pass-by-value and reference type

If you are coming from C/C++ programming background. You would be accustomed with heavy use of pass by reference (or pass by pointer) as a way to improve the performance, update the variable passed in and reducing memory consumption. It is so common, that most C/C++ function written to be efficient would be passing by constant reference (if they do not wish to allow variable passed in get updated) Like void myFunction(const MyClass & param) So, you are rest assured that variable pass in would not get updated. For C#, there is no such thing as const reference. But, there is pass-by-ref, unsafe pointer and pass-by-value. So, to ensure that your variable passed in to function not get updated. You would naturally think of using pass-by-value. However, there is a catch for pass-by-value if your object is of reference type (class, interface, delegate, objet, string) Value type variable store value but reference type variable store references to object. So, even the reference is passe...

Smart Thinking & Lateral Thinking (Edward De Bono)

(These are just my own "personal" summary to Edward De Bono smart thinking & lateral thinking materials where I have came across some of his books lately. (for my own reference) Please visit authorized Edward De Bono web sites if you are interested in these topics. http://www.edwdebono.com/) Lateral Thinking - 6 thinking hats White Hat - Based on hard data, facts, figures and numbers Red Hat - Based on hunch, gut feeling emotional point of view Black Hat - Pessimistic, sad & negative view but logical. Yellow Hat - Glad and possitive but logical view. Green Hat - Alternative, creative and sprouting new idea. Blue Hat - Step back and take care of process of thinking. Deciding hats to be used and summarize what have been thought. Critical Thinking - A way to minimize mistake in thinking. Creative Thinking Provocative Operation - Come up with an absurd idea. Then, think of "movement". Movement - Think of ways to make provocative operation / ran...

DOS prompt batch

Was trying out something on batch file, quite interesting though has limited features. But would be a quick way to delivery some solutions. Always check what batch can do before want to write a program for it. Good place to start on batch programming at -> http://www.allenware.com/icsw/icswidx.htm SET MYLOCATION = C:\Folder REM A reversible CD command where you can go back where you REM came from. pushd %MYLOCATION% REM check for file existent if not exist *.txt goto ERROR for %%file in (*txt) do type "%%file" >> mySingleFile.txt IF ERRORLEVEL 1 goto ERROR popd :ERROR echo Error occurredEXIT /B 1

XSL - Altering child attribute with original parent attribute

XML <?xml version="1.0" encoding="utf-8"?> <Items xmlns="http://www.abc.com" xmlns:myns="http://www.abc.com"> <Item attr="1"> <field1>My Content 1</field1> </Item> <Item attr="2"> <field1>My Content 1</field1> </Item> <Item attr="3"> <field1>My Content 1</field1> <field2 innerAttr="a">My Content 2</field2> </Item> </Items> XSL <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:myns="http://www.abc.com" xmlns="http://www.abc.com" > <xsl:output omit-xml-declaration="no" indent="yes"/> <xsl:namespace-alias stylesheet-prefix="#default" result-prefix="#default...

Resumeable Windows File Copying

Recently having need to copy huge files or a whole set of files more often over the network. Thinking of finding a tool like getright. So, this is the tool I found really useful. Robocopy - http://en.wikipedia.org/wiki/Robocopy How it fit my usage is with command like below. robocopy \\source\dir \\destination\dir /W:15 /R:30 /E /Z W = 15 seconds pause should it failed R = Retry of 30 times Z = Restartable mode E = Copying content recursively (including subfolders content) (use /MIR if want to mirror both side of content instead of /E. /MIR would remove the destination file if not found in source)

Adding notepad, command prompt, powershell run here context menu

Create a text file, name it temp.reg. Then, for each application you want to add it context menu. Copy and paste to the temp.reg. Then, just execute the temp.reg by double clicking it. For Powershell -------------- Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\Directory\shell\powershell]@="PowerShell Here"[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'" Command Prompt ----------------- Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt] @="Command Prompt Here" [HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\command] @="C:\\Windows\\system32\\cmd.exe /k pushd %1" Notepad ---------- Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\Edit in Notepad] [HKEY_CLASSES_ROOT\*\shell\Edit in Notepad\command] @="notepad.exe \"%l\""

Searching word/phrase in a very large text file in windows

1. Firstly, you need to have a grep tool (like Unix). For windows, you can try http://www.wingrep.com/ 2. Then, you just search a word/phrase in the text file with simple query or advanced regular expression query in the wingrep. 3. You should be getting the line number in the grep search result. 4. Then, start dos prompt. 5. Type command - "more +123 YourHugeFile.txt" where 123 for example is the line number you wish to see starting from. 6. Then, you should see some content in "more" dos screen. 7. If you wish to scroll line by line in "more", key in "enter/ret". if you wish to go page by page, key in "space" 9 Once you are done, type "CTRL + C" to exit.

Virtual PC setting - resetting MAC address.

In the case where you would want to change the IP address by forcing the DHCP to re-assign a new IP to you Virtual PC. (or in the case you are using the same *.vmc file and you don’t bother to recreate a new one) Stop your virtual machine. Then, in your *.vmc, look for <ethernet_card_address type="bytes">0003FFxxxxxx</ethernet_card_address> Remove the number so the line appears as follows: <ethernet_card_address type="bytes"></ethernet_card_address> After you remove the number, Virtual PC will create a new MAC address the next time you start the virtual machine. And in turn, DHCP will assign u a new IP address for your virtual machine.

SQL server IDENTITY and seed

One can make a column to be auto increment by setting it as identity. CREATE TABLE dbo.MyTable ( MyID int identity(1,1), MyName nvarchar(20) ) One can make it start from certain number by setting the seed identity(1000, 1) So, the first row would have id 1001 One can also increase the seed even with some data in the table say already the record run up to 102. If set seed to 200, the next record id would be 201. (one catch is if seed is 1, it will start with 1. But if seed as 11, it will start at 12.) Also one note is that the seed can not be smaller than the existing one as it would not make any changes. (the existing seed number can be check in the property of the column) For reseting the identity seed. The DBCC command is needed like DBCC CHECKIDENT('MyTable', RESEED, 1) It will attempt to start over from 1 and if found some ID with the same number exist, it will skip that ID and use next number. (This is done by the MSSQL in best effort mode. It is not predictable and guaran...

Getting started powershell

After installing powershell 1.0. The $profile will not be added. The $profile is equivalent to .profile in ksh where it initialized when it started. So, to add it. You need to specify permission first (like below), then, create the $profile. (you can echo $profile to see where the file resides in the windows) Set-ExecutionPolicy RemoteSigned new-item -path $profile -itemtype file -force

Fix login of restored DB (SQL server 2005)

After when restored Database from *.bak file. The associated login will not be restored into the MSSQL. And when trying to create the same login in the security tab in managemement studio. It will prompt Error 15023: User already exists in current database. The off hand workaround that normally one would do would be drop the user in the database user login and recreate again. like USE YourDB GO EXEC sp_dropuser 'YourRestoredDBLogin' GO The better way would be run command below to check the orphan logins. USE YourDB GO EXEC sp_change_users_login 'Report' GO then below to restored the login with command below. It will retain the settings that you have. USE YourDB GO EXEC sp_change_users_login 'Auto_Fix', 'YourRestoredDBLogin', NULL, 'YourRestoredDBLoginPassword' GO Reference: http://blog.sqlauthority.com/2007/02/15/sql-server-fix-error-15023-user-already-exists-in-current-database/