Thursday, December 20, 2007

Vista DVD/CD Reading Problem - Solved!

Yeah, I've been troubled by this stupid problem for months!

I've tried many DVD-R (plus and minus) as well as many CD-R on my Asus laptop, and it turns out that most CDR are readable and most DVDR isn't. And it seems like those pre-pressed DVD are ok. Well, this is annoying. I've burned a RAM-test disc CDR, it could read in my Vista, but guess what, it can be used to boot up w/o problem!

So, my quest to find the solution to it starts. I tried some weeks earlier, but no success, until I verified that it is not my drive compability issue (the fact that it can be used to boot up), I trust that there must be an issue with Vista, which Microsoft should have an answer for it.

Here goes the solution: simple uninstall the driver and let it install back itself again. The problem lies with the driver, which is probably being replaced or modified by some third party software that you've installed.
(Solution from: http://www.msfn.org/board/index.php?s=&showtopic=89575&view=findpost&p=631718)

Cool, now I'm happy to knock off to bed.

regards,
choongseng

Thursday, November 29, 2007

Debugger for IE - The Debug Bar.

Looks good at first impression, I'll update more on this post when I evaluate it.

The DebugBar V4.1.1 is an Internet Explorer plug-in that brings you new powerful features :

  • DOM Inspector: View DOM Tree and modify tags attributes and css attributes on the fly to test your page
  • HTTP Inspector: View HTTP/S request to check cookies, GET and POST parameters, view server info
  • Javascript Inspector and Javascript Console: View javascript functions for easier debugging, see Javascript and AJAX code
  • HTML Validator: Validate HTML code to correct and optimize your code and html size of your page
  • And many more features: See page cookies, get pixel color on a page, make a page screenshot...
    http://www.debugbar.com/

For Scripting Debugging, there's a post in IE Blog:
http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx

regards,
choongseng

CSS Properties to JavaScript Reference

I love this little page, it helps me alot alot alot in my AJAX development.

http://codepunk.hardwar.org.uk/css2js.htm

The page lists the properties mapping from CSS to Javascript, which is essentially what every javascript developer needs to know! when you deal with DHTML, AJAX, that's what you need.

regards,
choongseng

ASP.NET Controls emiting stylesheet "inline-block"

I'm going (at least hoping) to get perfect codes to feed my little firefox and IE. Thanks for the Error Console in Firefox which let me easily spot out what's wrong that the firefox doesn't handle.

And there it comes, it says cannot parse the "display" value. and I've search up and down in my ASP.NET pages, including the MasterPages for the keyword "display", no luck, I didn't write it!

So, the easiest way is ofcourse, do a search on the source code in Firefox (the source that is after render). and I've found the culprit -- my custom server control is emitting style="display:inline-block", which is automatically being rendered by the ASP.NET base control.

It turns out to be that as long as you set the Width (or Height) of the control and you didn't overrides the Render (instead suppose you are using RenderContents), the ASP.NET Web Control base class will render the IE-friendly but non-standard "display:inline-block" in the control's style (wrapped in SPAN tag).

So the obvious and most easy way out is, to override the render function so that it doesn't emit the buggy stylesheet declaration, but the drawback is that you'll need to write some codes to handle the style sheet in that case.

Cheers.

regards,
choongseng

Saturday, November 24, 2007

Javascript Revisit 2 - IE needs TBODY!

This had been bugging me for an hour and I just couldn't get it work until... I remind of my previous framework's similar situation.

It was the IE TABLE structure, IE DOM will always needs a TBODY for TABLE's body, so this code actually works on Firefox, but not IE:

var tbl=document.createElement("TABLE");
var tr=document.createElement("TR");
var td=document.createElement("TD");
tbl.appendChild(tr);
tr.appendChild(td);
td.innerHTML="You see me!";
document.getElementById("somedivID").appendChild(tbl);

Well, it works perfectly in Firefox, but when executed in IE, there's no error too, but also, there's nothing being displayed in the somedivID's DIV. However, if you do an inspection like this:

var eleDiv=document.getElementById("somedivID");
alert(eleDiv.innerHTML);

This will display the table's code correctly and you'll like me, start scratching your head on what is going on? and then you colleague will tell you to post to MSDN forum and try to get help from there.

Well.. the truth is... as there's something missing, that's TBODY for the TABLE.

var tbl=document.createElement("TABLE");
var tblbody=document.createElement("TBODY");
var tr=document.createElement("TR");
var td=document.createElement("TD");
tbl.appendChild(tblbody);
tblbody.appendChild(tr);
tr.appendChild(td);
td.innerHTML="You see me!";
document.getElementById("somedivID").appendChild(tbl);

And voila, this works.

Hope this helps if you encounter the same issue.

regards,
choongseng

Friday, November 23, 2007

TSQL Tips 1 - Integer Arithmetic to return Float

This will get you "0" intead of "0.01" which you might expect.

SELECT 1/100


This will do the trick:

SELECT 1/cast(100 as float)


regards,
choongseng

AJAX Framework v2!

It was 2 years back where my first AJAX framework had been deployed at my previous company. The framework had a big vision and had achieve a pretty magical result after deployed (and it is still running today, although phasing out probably in another 1 year time).

The unique feature of the framework is that it supports template for multiple items listing. Which you can add/edit/remove a row, entirely on the client side, without having to postback to the server at all. The framework do comes with some drawbacks, it is pretty slow when the page is big and there is some memory leaks which will crash the IE after some many AJAX calls.

With that in mind, I'm now back to my vision to re-create the framework from scratch now, again. This time however, I'll be writing everything from scratch including my AJAX processor page, which previously I've used AJAX Pro. More details will be posted and let's see how it goes.

Another issue is browser compatibility. I wish I can ignore it, but I can't now simply because my users now will be the general internet public. Well, I don't have many PC to test out, but at least I have Firefox and IE7 and I got to ensure it works on both of this.

regards,
choongseng

Wednesday, November 21, 2007

Best Helper - Firefox Error Console

Being a Firefox user for more than 3 years, I had been telling fella peers to adopt the rocking cool browser and praising it for its ease of use, fast and secure features.

However, there's one thing I hate about it, just that little one thing, that's during my development, all my javascript error will just hide away from me and I just had no clue of what had happened. Which in the old days (older days... hehe), when I'm using IE, it will show me on the status bar that there's error in script. That's what I'm looking for, but I just couldn't get that in FireFox, and this had been for years.

But... not until NOW!! It is not a new feature of Firefox, but just a dump user like me which is too used to IE years back, I've discovered the Error Console feature of FireFox. See it for yourself, I trust the these 2 screen shots speaks it all that you need to know about the feature.


Yeah, my javascript writing will be much more joyful rather than pain now! Well.... I should have discovered this 3 years back and my life, perhaps will be different now.

Again, Firefox Rocks Rocks Rocks!

regards,
choongseng

Tuesday, November 20, 2007

Javascript Revisit 1

Just figured out that these are not equal:
<script type="text/javascript" src="cs_jscore.js"></script>
<script type="text/javascript">alert("You see me!");</script>
<script type="text/javascript">alert("Hi, see you again.");</script>
and
<script type="text/javascript" src="cs_jscore.js">
<script type="text/javascript">alert("I never show up!");</script>
<script type="text/javascript">alert("You see me.");</script>
Ever since the term XHTML come to my knowledge, I've maintain the practice to keep the tailing "/" to those single HTML tags like BR and HR, etc.

So I apply the same here, to sort of optimize my script in terms of size and thus the second code snippet up there. And the results are different, or rather, it won't work, at least in my firefox, the "/" closing to the single script tag will result in the subsequent script tag being ignore (since it is regarded as the text in between script tag, which is generally ignored when the src attribute of script is specified.) which it looks towards for the proper closing of script tag.

There goes my 30 mins of debugging time.

regards,
choongseng

AJAX, back to the basics

AJAX is getting hotter nowadays. After 6 months of development work, which I uses conventional ASP.NET postbacks, I'm now back with JSON and AJAX and XML!

This time round I take the time to study each and every single steps in the pipeline in ajax request and what I'm going to do is... create yet another ajax framework of my own!

The very first code of ajax:
function createXMLHttpRequest() {
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
try { return new XMLHttpRequest(); } catch(e) {}
alert("XMLHttpRequest not supported");
return null;
}
The second:
try
{
var xhReq = createXMLHttpRequest();
xhReq.open("GET", "testajaxpage.aspx", true);
xhReq.setRequestHeader("ajax-auth", "anything");
xhReq.onreadystatechange = processResponse;
xhReq.send(null);
}
catch(e)
{
alert("Error In Request:" + e);
}
The third:
function processResponse() {
if (xhReq.readyState != 4) { return; }
var serverResponse = xhReq.responseText;
alert(serverResponse);
}
I ran into an error while setting the setRequestHeader method, which it raise some "... nsIXMLHttpRequest.setRequestHeader error", and googled around then figured out that it had to be set only after opening the HttpRequest.

This link deserves the credits:
http://ajaxpatterns.org/XMLHttpRequest_Call
http://www.webmasterworld.com/forum91/4542.htm

regards,
choongseng

Sunday, September 09, 2007

Yet another IM... powered by Macromedia Flex!

Got this still fresh and hot from Shunjie, cool stuff, try it out at http://airtalkr.com
It had amazed my by its very fast speed in loading ICQ contacts, but still there's some known and annoying bugs which make me very frustrated, but surely it will improve I trust.



regards,
choongseng

UEStudio Backup File Option

Start to try out UEStudio as recommend by my friend Johnson, but had been very annoying when it always save a copy of .bak file on whatever file I use. Look further in the advanced configuration, you can actually turn it off or even dump them to another backup folder.


regards,
choongseng

Thursday, August 09, 2007

Visual Studio 2005 Bug...?

Got this very weird bug in Visual Studio, see if you can spot it? (obvious).

If there is a very good reason why it appears as such, do let me know!


regards,
choongseng

Monday, August 06, 2007

Spam with SPF!

Yet another kind of spam, now manage to pass thru gmail spam filtering and came to my inbox.

Looking at the email header, it seems like they are now smarter to have SPF records set up. Well, but very soon it will be in the RBL.

regards,
choongseng

Monday, July 02, 2007

I don't have a iPhone

hehe... that might make a little hype, if you don't have one too, post a note like this the same to your blog, or you don't have one, post in this post's comments.

Fellas in US are now getting their iPhone, but not for many of us outside of US. Furthermore, geeks are now trying to disassemble the unit, by all means.



More photos on "iPhone Inside":
http://thinksecret.com/archives/iphonetakeapart/
http://www.ifixit.com/Guide/iPhone

regards,
choongseng

Saturday, June 30, 2007

My First PDF Spam Email



An obvious and surprised spam email, first of its kind, in PDF into my inbox.

regards,
choongseng

Tuesday, June 12, 2007

Yet another browser, Safari, now on your Windows Box!

Announced on Apple's annual Worldwide Developers Conference, Safari, the web browser that had been 5 years on Macintosh, now available on Microsoft Windows!

Now on its version 3 on public beta, it seems like the browser war is getting nearer.

The 8MB installer download and installation took me less than 5 minutes on my broadband line.
During the installation, it will ask to install apple software bundle, the apple software updater, I simple install all, just trust Apple won't do any harm to me.

Wow! the feeling is cool, I got safari running on my Vista machine now!


What does this mean to a Developer?... that means, there's no need to buy a Apple to test out how your web application will look like for Mac Users! save some big bucks and time!

Get a peek at what Apple Software Updater will give me, as expected, iTune and Quicktime.

So now, I've Firefox, Safari and Internet Explorer, with Firefox being my favorite, let's see if Safari and do any better.

regards,
choongseng

Monday, June 11, 2007

A Potato-Powered Web Server


See to believe it! It is the smallest web server ever! (erm... maybe not, adding all the potatos).

regards,
choongseng

Wednesday, June 06, 2007

I love WordWeb

I love this message, and I really appreciate WordWeb giving free edition to guys like me that do not down an SUV nor fly more than twice a year.

regards,
choongseng

Monday, June 04, 2007

window.status no longer accessible thru script in IE7

Status Bar Scripting--Scripts will no longer be able to set the status bar text through the window.status and window.defaultStatus methods by default in the Internet and Restricted Zones. This helps prevent attackers from leveraging those methods to spoof the status bar. To revert to previous behavior and allow scripts to set the status bar through window.status and window.defaultStatus, follow these steps:

  1. Open Internet Explorer, click the Tools button, click Internet Options, and then click the Security tab.
  2. Click Internet or Restricted sites, and then click the Custom level button.
  3. Scroll down to Allow status bar updates via script, select Enable.
  4. Click OK until you return to Internet Explorer.

http://msdn2.microsoft.com/en-us/ie/aa740486.aspx

regards,
choongseng

Monday, May 21, 2007

Blackberry Rocks

That's how cool it is if you got a BlackBerry from your company.
Well, but I think it more of suffering than enjoyment if I were to use little keypad for my messages.

regards,
choongseng

MSDN WebApp Crash?


Looks like it is also common to Microsoft, to have the default error screen.

regards,
choongseng

Wednesday, May 16, 2007

Vista Bug....


You guys saw it?... Not connected, yet online...

regards,
choongseng

Wednesday, May 09, 2007

Try Catch and Finally, yes make use of the Finally!

The "Finally" in the Try Catch statement is a great place to close your connection.

Public Sub TestFunction()
Try
Return
Catch ex As Exception
Finally
Console.WriteLine("TestFunction finally called!")
Throw New Exception("Error!")
End Try
End Sub

regards,
choongseng

Remote Desktop Administration


Very annoying warning message like this every time you connect to a non-vista Windows Box?

Here's the solution (permenant):
At registry section HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client,
add a DWORD (32-bit) Value, name AuthenticationLevelOverride with value 0.

Taken from:
http://blogs.vertigo.com/personal/steventap/Blog/Lists/Posts/Post.aspx?ID=3

A more Official solution w/o changing the registry is:
http://blogs.msdn.com/ts/archive/2007/01/22/vista-remote-desktop-connection-authentication-faq.aspx#_Prompted_for_Authentication

In the same page above also explained why sometimes when you connect to a windows box, it prompts the authentication box for user login again.





regards,
choongseng

Tuesday, May 08, 2007

db4o - Open Source Object Database

db4o - Open Source Object Database
http://www.db4o.com

Got heard of this from Johnson, and it looks promising from the site's reviews and comments.

It supports 3 type of query methods:
1) Query-By-Example
2) Native Query
3) SODA Query API

It looks pretty good, until I read this on the CascadeOnDelete:
"Houston, we have a problem - and there's no simple solution at hand. Currently db4o does not check whether objects to be deleted are referenced anywhere else, so please be very careful when using this feature."

However, as long as you don't make use of this Cascading feature, you are safe from hassle of debugging your apps for some unexpected behavior.

Running out of time and I've used this to built my prototype web apps and it indeed save me lots of time writing SQLs, guess I'll be using it until my data structure and my DAL is out.

regards,
choongseng

No Remote Connect Console on Windows 2000 box

Was hunting up and down why I didn't manage to connect to Win2k servers to its console session. Too bad, no luck for that though:

You cannot use Mstsc.exe with the /CONSOLE switch to connect to a console session on a Windows 2000 Server-based computer
http://support.microsoft.com/kb/311926

Remotely Administering Windows Servers
http://www.windowsnetworking.com/articles_tutorials/Remotely-Administering-Windows-Servers.html

regards,
choongseng

Saturday, May 05, 2007

My Vista Experience

A very self-explanatory screen shot on the very first day of working with Vista. First, it was system slowing down, then Vista screaming at me that some network component is stucked. And while I try a restart attempt, the infamous white wording with blue background shows up.


Wanted to take my camera out and take a shot of the blue monster, but not fast enough (and also don't want to harass my colleagues). But Vista is smart enough to give me this post disaster dialog the next time I boot in.

regards,
choongseng

Wide-screen Issue

Had been quite troubled by the "Wide-Screen" issue last week, where the Windows Form application that I've developed doesn't seem to shows up nicely in some very high resolution and rare screen aspect ratio.

My solution? no choice but to use scripting to adjust the panel according to the border controls, plus some of margin/padding.

Got my new ASUS laptop from my new company, and while starting to install Visual Studio, it's installer screen seems to have the same issue as well!



regards,
choongseng

Saturday, April 07, 2007

http://www.getfirebug.com/

All firefox lovers and developers, this is a must get:
http://www.getfirebug.com/

regards,
choongseng

Thursday, April 05, 2007

CSV2Table Function

This is a simple code which used to read from a CSV file and import to become DataTable.


Public Shared Function CSV2DataTable(ByVal fname As String) As Data.DataTable
Dim f As New System.IO.StreamReader(fname)
Dim strLabel As String = f.ReadLine

Dim dt As New DataTable("CSVTable")
Dim reSplit As New System.Text.RegularExpressions.Regex("\s*[,]?\s*(?(""[^\""]*""|[^,\""]*))", System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.Singleline)
Dim mLabel As System.Text.RegularExpressions.Match = reSplit.Match(strLabel)
While mLabel.Success
dt.Columns.Add(mLabel.Result("${value}").Trim(""""c), GetType(String))
mLabel = mLabel.NextMatch
End While

Dim strDataLine As String = Nothing
While Not f.EndOfStream
strDataLine = f.ReadLine
Dim nrow As Data.DataRow = dt.NewRow
Dim intCnt As Integer = 0
Dim mValue As System.Text.RegularExpressions.Match = reSplit.Match(strDataLine)
While mValue.Success
nrow.Item(intCnt) = mValue.Result("${value}").Trim(""""c)
intCnt += 1
mValue = mValue.NextMatch
End While
dt.Rows.Add(nrow)
End While

Return dt

End Function

Just a basic one hope it helps, if you got suggestion for improvement, just drop me an email.

regards,
choongseng

The weird .NET Date

Dim de As Date = Nothing
If de = Date.MinValue Then
MessageBox.Show("it is min value!")
End If

It explains well... the Date object can never be Nothing, this affects a lot during implementation if the business logic allows "undefined" date. Dataset uses DBNull to tackle the issue.

regards,
choongseng