Thursday, March 07, 2013

SortedSet with duplicate key.

Found a not so expected behavior of SortedSet today.

I did a custom class as such:

        public class MyClass : IComparable
        {
            public string Title { get; set; }
            public string FileName { get; set; }

            public int CompareTo(MyClass other)
            {
                int intTitleCompare = String.CompareOrdinal(this.Title, other.Title);
                return intTitleCompare;
            }

        }

The initial implementation is to use a SortedList/Dictionary and use the Title as key, but it will failed due to my data set having the same Title for multiple files. Thus with the above code, I'm expecting to be able to use SortedSet to have a sorted list of MyClass object while having the "key" being duplicates in the list.

So that did this:
var listOfFiles = new SortedSet();
                listOfFiles.Add(new MyClass()
                    {
                        Title = "cs",
                        FileName = "1.xml"
                    });



                listOfFiles.Add(new MyClass()
                    {
                        Title = "cs",
                        FileName = "2.xml"
                    });

The listOfFiles return me count of 1 instead of 2! This is because the CompareTo function returns 0, and SortedSet will ignore the entry during add.

Wednesday, November 04, 2009

Problem uninstalling Visual Studio 2008

My Visual Studio 2008 Trial came to an end today, as it is the trial Team system, I have to remove it and install the professional version that I have licensed to. But the running the "Remove/Configure" uninstaller doesn't work, it will always failed and no reason given.

Then I found this tool to remove after googling:

And further down the road, I hit another error which says:
Error1310. Error writing to file: C:\Config.Msi Access denied

And no matter what I do, setting the permission doesn't work.
Then I figure out that other users are having some problem if they have the software carbonate installed, which is a file backup software.
So I disabled my iDrive services, and voila, it works!

Hope this helps!

regards,
choongseng

Tuesday, January 20, 2009

Windows 7 Installation Screenshots


Installing Windows 7....


Checking Video Performance...

Installing Updates...



Done!

Here you can see how much space it used up in the Virtual Machine itself.

regards,
choongseng

Javascript converting XML Document to XML String

We can do it easily using XML Document object to load XML String to form an XML Document.
But, to do it the other way, there isn't a direct method  like .OuterXML in Javascript.

All along I've been using like this for my AJAX application

if (xmlDoc.xml!=undefined)   xmlContent = xmlDoc.xml; else   xmlContent = xmlDoc;

While it appears to be working when I send the xmlContent over the AJAX POST Call, recently there had been some error. It appears that webkit based browser like Safari and Chrome do not escape the special characters in the XMLTextNode while IE and Firefox do.

The solution is simple:

function XMLToString(oXML) {   if (window.ActiveXObject) {     return oXML.xml;   } else {     return (new XMLSerializer()).serializeToString(oXML);   } }

regards,
choongseng

Friday, January 16, 2009

4GB Supported in Windows Vista 32-bit SP1


Another reason for you guys to upgrade to Vista if you haven't so. With Windows Vista Service Pack 1, now you can see the full 4GB RAM in your system even if you are running only 32bits version of the Operating System.

Yes, too good to be true, same as most other people out there, I'm excited and happy to have 4GB shown in my laptop, only for the few minutes.


Oh microsoft, I hate it!

Well, RAM is dirt cheap nowadays that I've just upgraded my laptop from 2GB (2 x 1GB sticks) to 4GB (2 x 2GB sticks), and that cost S$60. The prices started to go up somehow, I was told by the shopkeeper that 4 hours ago it was S$28 per 2GB stick.... :-S 

And ofcourse, I bought the Kingston, very cheap RAM.

regards,
choongseng

Thursday, January 15, 2009

Downloaded and Installed Windows 7


I've finally installed the Windows 7 that I've downloaded. There's at least a new feature that you can see at the very first time you install and run Windows 7. That's the homegroup, wow.. now you can create little communities of Computers! See the screenshot for more explaination.

And ofcourse, if you want to give it a try, you can do so:

Btw, this is my installation log:

VPC: 512MB RAM, 20GB Virtual HDD
Start Installation: 10:39pm
Abort Installation: 10:53pm
Reason: Too slow

VPC: 1GB, 20GB Virtual HDD
Put over night to install
And wake up in the morning, everything is up, but it take ages still to start the very first time.

Cheers!

regards,
choongseng

Wednesday, January 14, 2009

Why I use Google instead of Live Search

I wanted to try out Windows 7 which Microsoft had just released to everyone in Beta form.

So the very first thing, I do a search. And very quickly I get to the download page and I need to login with my live ID, so I logged in and no luck, it gave me a turning bubble and nothing else.

So I guess, for sure I need to use Internet Explorer right?

I turn to my IE8 beta and try my luck with the Live Search (give them a chance right), since it is a Microsoft stuff, I expect to get the link in the top few list.

But.. see for yourself:


Search "Download Windows 7" on google, I got the link to microsoft on the 1st page, 7th link.

Search "Windows 7" on google, I got it on the 3rd link in the 1st page.


I'm sorry Live Search, it clearly shows that I never get to the Microsoft Windows 7 page fron the 1st page of the search result from Live Search. And that means, it is rather a waste of time to search on Live Search in view of this kind of result.

regards,
choongseng

Thursday, October 09, 2008

Maybank2U silly stylesheet mistake

Dear Designers,

Spot the difference!

#OOOOOO vs #000000

http://info.maybank2u.com.sg/index.htm



regards,
choongseng

Google Chrome XMLHttpRequest Behaviour

This little thing had bug me for sometimes and I managed to hunt it down for the past 1 hour.

Apparently, my brilliant AJAX application works perfectly on IE and Firefox, and by surprise, it worked on Opera and Safari as well. But... not on Google's Chrome!

With disappointment and partly also due to the lack of ability for me to debug the javascript codes on Chrome, I've leave it for sometimes.

And finally, it got fixed today!

In a nut shell, this is the finding:
var req = new XMLHttpRequest();
.... setting of url etc ...
var tagValue = "";
req.setRequestHeader("sometag", tagValue);


Basically, when you did this and execute the send function, you'll end up getting a status code of 0. And then, you'll start scratching your head because you won't find the http request in your web server as well.

Workaround?... simply set something to it, for me, I've put it as javascript null, and it simply translate it to string "null".

Hope this will help developers that read this post.

regards,
choongseng

Friday, September 19, 2008

How safe is your Yahoo account?

This is a hot topic these few days.

Sarah Palin, the former Alaska's governer, had her yahoo account being hacked. What the hacker did was simply getting her date of birth and home postal code, and subsequently manage to havest her secret answer from her rally speech. And that secret is "Wasilla high".

Simple enough? yes, that's a perfectly flawed security measure nowadays given that information is everywhere, some disclosed publicly thru speech, blogs and wikis and some acquired via social engineering.

That remind me of the importance of SSO, single sign on. Which essentially an attempt to not only streamline authentication systems, but also avoided a major problem of today's growing number of systems with authentications. I bet you have to remember at least 20 logins for 20 different sites, of which... 18 of them are using the same password!

Ok guys, time to revise my yahoo account's secrets. (and yours too)

regards,
choongseng

Friday, September 05, 2008

JSWare view about Vista

Hmm... I've been using Vista for a year, get used to it, consider usable product though.

regards,
choongseng

Hotmail hate Google Chrome?


It explains it all, Hotmail is very happy if you run Microsoft Internet Explorer, but it is equally happy too if you run Firefox or Apple Safari. BUT.... not Google Chrome!

Let's see when will Hotmail adopt Chrome in the list of compatible browsers.
regards,
choongseng

Wednesday, July 02, 2008

Customer Experience Improvement Program , with a small trick?

This caught me by surprise, the little annoying icon at the icon tray came about after I've installed Vista SP1 over the night.

And look at the screen shot, asking you whether to participate in the Customer Experience Improvement Program. Look carefully, OK Button is disabled. At first sight, I though it designed to default the option to "I don't want to join the program at this time", but with the "OK" button it does seem you suggest that you have no choice but to participate in order to get ride of the annoying tray.

So, I do my usual software testing tricks, and looks like it is a bug! You can simply "workaround" the design of the trick to cheating you into participation by choosing to the first radio button and toggle back to the second one.

regards,
choongseng

Tuesday, July 01, 2008

Vista SP1 is out!

I've my little windows update icon asking for my attention that there are some new updates.

Apparently, it is the long awaited Service Pack 1 for Vista.

Look at this, the installation message is scary.


It reads:

Save your work, close all open programs, and then click Install.
The installation might take an hour or more. You cannot use your computer during that time.
Your computer will restart several times during installation.
They should add in one more note, "You should do this when you knock off from work."

regards,
choongseng

Thursday, June 19, 2008

Internet Explorer 8, beta... , isn't any better for now.

Just after the Mozilla Firefox 3 launched, today I try to check how's Microsoft's Internet Explorer progressing. And I've downloaded and installed IE 8 Beta.

Some of the cool features as you can see in the screenshot:
1) The address bar, notice that the domain portion is highlighted by graying out the rest of the address string.
2) The Emulate IE7 toolbox button, you won't have headache now when IE8 doesn't work for you because you can "fall back" to IE7 via this button.

and some other cool features include the IE Developer Toolbar, which will be my essential IE development tool, had revised to have more advanced features.

One very bad thing that really dissappoint me is this -- even simple blog layout went misaligned.

regards,
choongseng

Wednesday, June 18, 2008

Firefox 3, what a disappointment

While I'm a supporter for Firefox 3, it had disappointed me.

First, I've been using the Beta 5 (rev1.9) Firefox weeks before the Download Record day. I though I should be getting some cool stuff today, but nothing more than what I've weeks ago.

Second, see the screen shots below, as far as I can remember, Firefox 2 fixed the issue, but it reappears in Firefox 3 -- the famous DHTML over Flash issue.


You notice that in IE it works, as in the flash didn't block the DHTML menu, and yet Firefox one, the menu is behind the flash.

Update!

After some "investigation", my fella colleague designer Samuel had figured out that adding parameter "wmode=transparent" will do the trick.

Yeah, it works, Firefox still rocks. this is the result by amending the param attributes via DOM inspector in firefox.

Hmm... Well, I'll then replace the disappointment with another issue, the speed issue, which I figured out that certain websites loads much slower in Firefox as compare to IE.

regards,
choongseng

Download Firefox, make it a world record!


I might be a little bit late, but not too late either.

Help Mozilla to set a new world record by downloading the newly launched Firefox 3!

Though as soon as the site is launched for download, it was too overwhelmed and caused it to down for an hour or so.

regards,
choongseng

Tuesday, May 06, 2008

SSL-Explorer: Free 2 Users VPN solution

Sometimes I really like google-ads, it really give links to some cool products. I've spotted this seems promising software from 3sp. It is called the SSL-Explorer, which the following introduction explains it:
SSL-Explorer: Enterprise Edition is a simple to install, yet powerful SSL VPN solution from 3SP Ltd. This product introduces a comprehensive range of security enhanced features designed specifically for the needs of corporate users - from small businesses to large global enterprises.
The download is about 42.4MB and I'm downloading it to give it a try. Will update more with screen shots when I've got it worked.

Get your free 2 users license here now!

regards,
choongseng

Portable Computer Tracker for Windows

Come across this software from the company Turebulence Software.

They've released the Zecop program, which essentially is a piece of software that will send a piece of information containing the IP and a serial number set by the user to the user's email as soon as the software detects that IP had been changed. While this is a pretty easy concept that can be hacked, it isn't common, which means you might got a chance that the theft on the computer while connecting to the net and the program calls back and eventually you get back your laptop!

But I'm sure for expert users, this isn't something promising, but that might be helpful at time though. If you really care about your computer assets physical security, better off get a physical Kensington lock.

Well, a quick google on laptop lock brings me to this software as well, the LaptopLock. The software even bring the security tighter by asking the user to confirm their presence if it didn't detect internet connection for sometime! Well, its website says "It's free for now. It comes with no adware or spyware.", that might probably translate to "We'll charge for it one fine day.".

I've got the Zecop installed, so if you steal my laptop, you know that to do if you don't want me to track you down.

regards,
choongseng

Thursday, April 17, 2008

Try to crack this CAPTCHA?

I've previously posted about CAPTCHA image verification of hotmail and gmail being cracked, or massively being crack by spammer using human effort and training bots.

Happen to download some stuff from rapidshare, and saw this interesting CAPTCHA which probably require even more sophisticated programming work to break it.

I even need some time to figure out where are the cats and dogs! But well, since all the cat patterns are the same, I guess it won't be too hard for bots to recognize them, which will be faster than human eventually.

regards,
choongseng