Upgraded to Firefox 6

Add Comment | Aug 23, 2011

Not sure am I slow in doing so? But today I just fire up my Firefox and immediately I receive a prompt to upgrade my Firefox 5 to 6. Here is what I seen after successfully upgraded it.

Nothing much special, but i appreciate the good work. But I guess you might notice some changes on the screenshot too.

Enjoy!

 

The Up-to-date page after successfully upgraded to Firefox 6.

Firefox 6 Upgrade Successfull Page

And this is the Add-on manager

Firefox Add-on

[JavaScript in ASP.NET] How to convert the input date to Julian Date for Date Comparison?

Add Comment | Aug 04, 2011

I often find it hard to convert a date string into the date I desired. I'm not sure is it only me or any of you encounter the same problem before. Whenever I tried to do something like:

var myDate = new Date(dateString);

I will always get Today's date, instead of the value i stored in the dateString variable. And most of the time, when people show you sample codes on how to make comparison between date string by converting them into Date, it normally won't work for me.

One of the reason could be I actually get the date string as dd-MMM-yyyy format, for example, if today's date is 4th August 2011, I will get 04-Aug-2011, that's for easy reading. What if you have a Jan 5, 2011 displayed as 05-01-2011, so without knowing the locale, what is your guess? Is it Jan 1, 2011 or May 1, 2011? So 05-Jan-2011 would be clearer if your actual date is Jan 5, 2011.

My methods involve more steps, but at least it's working for me.

This is what I did in the <script> block of my ASP.NET Source:
        
   //I actually put this in a function
   var toDate = document.getElementById('ctl00_ContentPlaceHolder1_txtDateTo')

            var frmDate = document.getElementById('ctl00_ContentPlaceHolder1_txtDateFrom')

            var today = new Date();

            Date.prototype.getJulian = function() {
                return Math.floor((this / 86400000) -
                (this.getTimezoneOffset() / 1440) + 2440587.5);
            }
   
   //To convert from a Date variable, it take more steps, if I try to reduce the steps
   //it will give me the value NaN. I noticed I can't do it this way:
   // var tmpToday = today.format('dd-MMM-yyyy');
   // var julToday = new Date(getDate(tmpToday)).getJulian();
   // These 2 lines are what get me a 'NaN' value
   
   //The actual working codes
   var tmpToday = today.format('dd-MMM-yyyy');
            var tmpjulToday = new Date(getDate(tmpToday));
            var julToday = tmpjulToday.getJulian();
   
            var julToday = today.getJulian();

            var tmpFromDate = new Date(getDate(frmDate.value));
            var tmpToDate = new Date(getDate(toDate.value));

            var julFromDate = tmpFromDate.getJulian();
            var julToDate = tmpToDate.getJulian();
   //End of the function
   
  //Function to convert Date format to M/d/Y format 
  function getDate(inputDtStr) {

            var pos1 = inputDtStr.indexOf(dtCh)
            var pos2 = inputDtStr.indexOf(dtCh, pos1 + 1)
            var strDay = inputDtStr.substring(0, pos1)
            var strMonth = inputDtStr.substring(pos1 + 1, pos2)
            var strYear = inputDtStr.substring(pos2 + 1)
            strYr = strYear

            switch (strMonth) {
                case 'Jan':
                    strMonth = "01";
                    break;
                case 'Feb':
                    strMonth = "02"
                    break;
                case 'Mar':
                    strMonth = "03"
                    break;
                case 'Apr':
                    strMonth = "04"
                    break;
                case 'May':
                    strMonth = "05"
                    break;
                case 'Jun':
                    strMonth = "06"
                    break;
                case 'Jul':
                    strMonth = "07"
                    break;
                case 'Aug':
                    strMonth = "08"
                    break;
                case 'Sep':
                    strMonth = "09"
                    break;
                case 'Oct':
                    strMonth = "10"
                    break;
                case 'Nov':
                    strMonth = "11"
                    break;
                case 'Dec':
                    strMonth = "12"
                    break;
            }

            if (strDay.charAt(0) == "0" && strDay.length > 1) strDay = strDay.substring(1)
            if (strMonth.charAt(0) == "0" && strMonth.length > 1) strMonth = strMonth.substring(1)
            for (var i = 1; i <= 3; i++) {
                if (strYr.charAt(0) == "0" && strYr.length > 1) strYr = strYr.substring(1)
            }
            month = parseInt(strMonth)
            day = parseInt(strDay)
            year = parseInt(strYr)

            var dateVal = month + "/" + day + "/" + year

            return dateVal

        }
  
Why I need Julian Date function? That is because, if I just get the today.getJulian(), and compare with frmDate value, I would always get the result that my frmDate value is earlier than today's date, even though I actually set the frmDate value to be the same as Today's date. Why? Because when you declare a new Date() variable, it actually includes the timestamp, so when you use getJulian() on it, it will get you the Julian date numeric value including the timestamp, which is of course always earlier than your formatted date, e.g. 04-Aug-2011, which is without the timestamp.

Do you have better solution? Please kindly share with me and the rest and we shall make this solution available to everyone who needs it!

Enjoy!

Some Go Resources and Tips to Share

Add Comment | Jul 07, 2011

...Continued from the previous post.

   

If you all are keen, and if you want to play real-time on iPhone with other players, you can download this Panda-Tetsuki client from AppStore, it connects to IGS server, and allow you to play with other players.

   

For those keen on playing on computer, try http://www.gokgs.com/ or 1-day per move (you can make more moves, if your opponents also response to your moves within the same day) mode – http://www.dragongoserver.net or http://nwgo.braindog.org/

   

If you are comfortable with Chinese interface, you can play at http://weiqi.sports.tom.com and this site is very popular and a lot of good players (also a lot of bad players, not that they play badly, it's the they bully weaker players, some high-dan players create low kyu account to crush weak players too, they call those players as landmine), and sometime you see pro players giving lessons there, otherwise, try http://www.eweiqi.com , or http://weiqi.sina.com.cn (and of course, there's free online learning materials on http://weiqi.sports.tom.com too, it's in Chinese. )

   

eWeiqi has less landmines though. But Tom is a more popular Go server.

   

There is one Go server that integrates multi-country servers into one (sort of link them up in a Go network), and everyone get their own Country segment, while also able to play with players from other countries, it's a collaboration between China, Japan, and Korea. Chinese and Korean servers normally have a lot of strong players. (It could be Sina server, I can't really remember)

   

If you follow the modern Chinese Go development, you will noticed that there's someone like "Sai" in "Hikaru no Go" that plays on the Internet before, he had beaten all the pro players playing online (for those Chinese pro players who did play Go online), and no one knows who is he yet, and he also disappeared out of sudden after creating a lot of hoo-hah in Go world.

   

By the way, those Go games played in Hikaru no Go are actually the real game records of those professional Go players, it's not fictitious. Here's the list on Sensei's Library (http://senseis.xmp.net/ a good English resources for Go):

   

http://senseis.xmp.net/?HikaruNoGo%2FGames

   

(Note: as indicated in the list, a few games are unidentified yet, maybe if they asked the author of the Hikaru No Go and/or Umeza Yukari they might know it better)

   

And lastly, if you can't get your opponent to review your games, and you can't find anyone else do review for/with you, you can request for a review here:

   

http://gtl.xmp.net/services/requestreview/

   

Enjoy and have fun learning and playing Go!

   

Find me on KGS or Tom, if I'm available, we can play a bit, nick on these two servers is mychew. Nick used on IGS is jenson, so do Dragon Go Server (http://www.dragongoserver.net) and Northwest Go Server (http://nwgo.braindog.org).

   

I've temporarily shutdown my Go forums, will try to create a new one again using different forum engine (as the previous one give me a lot of problems in terms of forum maintenance). And I have a Go room in KGS, it sounds a bit odd and funny though, and it happens to be the name of a green tea canned drink company too - Heave & Earth Go Club. It's under the Club category.

My Journey with Go and Programming

Add Comment | Jul 05, 2011

My dear fellow programmers/developers, how you kill your time while you're not coding? Some people go jogging, some listen to their favourite tracks, some catch movies, some read, and the list goes on and on.

   

For me, one of the stuff I enjoy doing is Go. So what the heck is this Go, you may ask (of course if you're already playing and enjoying it, you won't need to ask me). Go is an ancient board game carrying the 5000 years history with it, while still keep getiing improved on the rules and styles of game opening, counterattacks, and etc. It's a board game played by two players, one of them playing with black stones, and another white, with black playing first.

   

Just why so much fun with Go? Why bother about knowing this since I'm not interested? Well, I guess you will get hooked to it once you start learning the beauty of Go, and the fun of indulging in games with others. It's played on a board with 19x19 grid lines. I won't tell you too much of the nature of it and the gameplay, as I will be listing out some great sites for you to explore.

   

It's more fun when you explore more on your own, isn't it?

   

I started learned about the existence of this game since childhood. That's when I was watching drama series from China, and I found the game interesting and fascinating. But nowhere near my place has people playing it or selling the game set. Maybe it's just not as popular yet. So I ended up learning Chinese Chess, which I enjoyed playing it to a certain extend, and even challenge classmates and neighbours. And later on, I get bored with it, and my friend introduce me to a world of Chess (International Chess), and I get hooked up to Chess very quickly. I even participated in inter-school tournaments, which later on had my interest spread to District Level, and finally founded our very first Chess Club in school. Well, we managed to get a teacher-in-charge and quite a number of new members. We even organized our very first Inter-Class tournaments. But due to it's close to year-end and getting near to our final year exam, the school has suggested us to postpone the tournament.

   

Soon, when I was in high school, my younger brother, who introduce me to a Japanese comic series, Hikaru No Go and get me addicted, as I finally can get my eyes on a comic that's talk about Go. Thanks to my father, who bought us a computer, and connected to Internet, we managed to search for Go online. To our surprises, there are a lot of Go resources available in both English and Mandarin.

   

Since then, my interest has made me dedicated my time to Go, and I reach the stage where I almost flung my high school studies, and spending most of my time in studying Go. I gotten pretty excited when I know a friend who gave me a set of Go board with stones from China. I began my journey half on Go board, half on computer Go board, and getting all my learning materials printed off from Internet.

   

When I went to college (Ngee Ann Polytechnic in Singapore), and I began astounded by the power of Internet speed there, and having gotten myself a notebook, which is a must for IT students, I started sourcing for not only PDF books but also SGF format "books" and game records, as well as other ebook formats to learn how to play Go. Until one day, the friend (I regard him as an elder brother of me) rang an alarm and asked me to stop playing and focus on studies if I were to continue be friend with him. So I heeded to his advice and no longer learning Go. Until I finally graduated, I started in touch with Go once again.

   

I ended up knowing a friend from Taiwan, and have him gathered a series of Go learning books used in China and so-called for training kids to be professional players, my brother brought it back from Taiwan for me, during his trip there. So I ended up learning Go again after many years of no-Go days. It has been about 6 years I never learn or play any Go. Then I finally setup Go forums for Chinese and English speaking players, and requested a Club Room on KGS (Kiseido Go Server - http://www.gokgs.com/) and started having a lot of players playing inside the room. I even play in office with my fellow co-workers and teaching them the basics.

   

And then I changed job and play alone, but I enjoyed myself pretty much interacting with various level of players, and we even have joined Hong Kong room invitational friendly tournaments, though we lost, that's a great experiences to everyone.

   

However, due to my part-time degree studies, I once again give up Go for a few years until recently I'm quite confident I wont be distracted by Go and would in fact helps in my studies, and I picked up Go from scratch again, and spread my love in Go to colleagues. And I started watching the anime of Hikaru No Go again, and getting very involved.

   

Due to my busy schedule, I seldom play on KGS now, but I will try to spend some time over every weekend (if I'm free) to play some games of Go. I play on those 1 move per day Go server like Dragon Go Server (http://www.dragongoserver.net) and Northwest Go Server (http://nwgo.braindog.org) most of the time. It's still fun for me, even though I make more mistakes now, and lost quite a number of games.

   

Playing Go not only kill time and train my mind, it also helps in my studies and my work as a programmer, try it and I'm sure you'll love it!

[AJAX Numeric Updown Control] Microsoft JScript runtime error: The number of fractional digits is out of range

One Comment | Jun 22, 2011

If you have been using Ajax control toolkits a lot (which I will skip the parts on where to download and how to configure it in Visual Studio 2010), you might have encountered some bugs or limitations of the controls, or rather, some weird behaviours. I would call them weird behaviours though.

Recently, I've been working on a Ajax numeric updown control, which i remember clearly it was working fine without problems. In fact, I use 2 numeric updown control this time.

So I went on to configure it to be as simple as possible and I will just use the default up and down buttons provided by it (so that I won't need to design my own). I have two textbox controls to display the value controlled by the updown control. One for month, and another for year.

<asp:TextBox ID="txtMonth" runat="server" CssClass="txtNumeric" ReadOnly="True" Width="150px" />

<asp:TextBox ID="txtYear" runat="server" CssClass="txtNumeric" ReadOnly="True" Width="150px" />

So I will now drop 1 numeric updown control for each of the textboxes.

<asp:NumericUpDownExtender ID="txtMonth_NumericUpDownExtender"
    runat="server" TargetControlID="txtMonth" Maximum="12" Minimum="1" Width="152">
</asp:NumericUpDownExtender>
                        
<asp:NumericUpDownExtender ID="txtYear_NumericUpDownExtender"
    runat="server" TargetControlID="txtYear" Width="152">
</asp:NumericUpDownExtender>                        
                        
You noticed that I configure the Maximum and Minimum value for the first numericupdown control, but I never did the same for the second one (for txtYear). That's because it won't work, well, at least for me.

So I remove the Minimum="2000" and Maximum="2099" from there. Then I would configure the initial value to the the current year, and let the year to flow up and down freely. If you want, you want write the codes to restrict it.

Here are the codes I used on PageLoad:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then

            If Trim(txtMonth.Text) = "" Then

                Me.txtMonth.Text = System.DateTime.Today.Month

            End If

            If Trim(txtYear.Text) = "" Then

                Me.txtYear.Text = System.DateTime.Today.Year

            End If

        End If

    End Sub
 


Enjoy!

Having Problem with AJAX ModalPopUpExtender?

Add Comment | Jun 13, 2011

Recently, when I'm working on a ModalPopUp for my own custom alert with ModalPopUpExtender, I encountered an issue which myself can't explain.

   

Here is what I did:

   

First, I design a panel (pnlPopUp) with a title and message body labels, and then an OK button to close the pop up message.

   

<asp:Panel ID="pnlPopUp" runat="server" BackColor="#FFFFCC" BorderStyle="Solid"

BorderWidth="1px" CssClass="panel" Height="150px"

style="position:absolute; top: 407px; left: 478px;" Width="300px">

<table class="style12" style="width: 100%; height: 100%">

<tr>

<td align="center" class="headerTD" colspan="3">

<asp:Label ID="lblTitle" runat="server" CssClass="PageDispText" Text="Title"></asp:Label>

</td>

</tr>

<tr>

<td class="style21">

</td>

<td class="style22">

<asp:Label ID="lblMessage" runat="server" CssClass="label" Height="100%"

Text="No Message Here" Width="100%"></asp:Label>

</td>

<td class="style22">

</td>

</tr>

<tr>

<td class="style17">

&nbsp;</td>

<td align="center" class="style20">

<asp:Button ID="btnOk" runat="server" CssClass="Button" Text="OK"

Width="50px" />

</td>

<td>

&nbsp;</td>

</tr>

</table>

</asp:Panel>

   

   

Second, I drop a button to trigger the Popup for testing. So I just name it btnPopUp.

   

<asp:Button ID="btnPopUp" runat="server" Text="Show Pop-up" />

   

Next, I drop a ModalPopUpExtender, which I configure it to pop up my pnlPopup when I click on btnPopup. And you know what? It doesn't work. So I'm quite puzzled why is it behaving so.

   

I googled this until I come to conclusion, there's no people facing the same problem. Just before I gave up, I found 1 person facing the same issue, people mentioned about ScriptManger. But well, I did have a ScriptManager, and it's placed in my Master Page, thus, I think there shouldn't be any issue since my Default will use the ScriptManager from Master Page.

   

So, with it still not working (which means, nothing was shown when I clicked on the btnPopUp), I try to change the Popup object to btnPopup and the control to pnlPopup, and you know what happens? It works! So I'm quite frustrated how would this happen?

   

And I went on to replace btnPopUp with a hyperlink control, so the target pop up object is now set back to pnlPopUp, but the control that trigger the pop up would now be a hyperlink instead. And to my surprise, it also works!

   

<asp:HyperLink ID="HyperLink1" runat="server" CssClass="label">Show Pop Up</asp:HyperLink>

   

I really don't understand why is it behaving so weird. Since my Master Page is doing nothing with the Script Manager, so I've decided to remove it, then I will manually add a new ScriptManager for Default.aspx. Now, I tried to set back the PopupControlID to pnlPopUp, and the TargetControlID to btnPopUp, and setup the other properties in the ModalPopUpExtender, and finally it's working perfectly! Of course, you might want to set the background alpha to around 50-70% to create an effect to inform users that the pop-up lockout the background until you get rid of this pop-up alert by clicking on the "Ok" button.

   

<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnPopUp"

PopupControlID="pnlPopUp" OkControlID="btnOk"

BackgroundCssClass="modalBackgroundCSS" >

</asp:ModalPopupExtender>

   

   

You can make use of the BackGrondCssClass to achieve this. Properties you might want to set for the modalPopUp would be:

   

background-color:#fff; /** or #ffffff or any other color you like */

filter:alpha(opacity=60);

opacity:0.6px;

   

 Modal Pop-up Sample

   

Good luck experimenting with ModalPopupExtender and have fun!

Finally MacDailyNews iPhone App is up!

One Comment | May 29, 2011
image1196800802.jpgfor those who knows what is MacDailyNews and those who has been following the news from MDN from their iOS devices, great news for you!

Not sure whether this post has came a bit late for me to announce here, but I still want to inform fellow MDN-ers please go get your MDN apps updated.

The screenshot shows what are the changes announced in the update.

Enjoy!
-- JC --

First Blog on GWB and iBlogger Setup Tips

One Comment | May 11, 2011

image230415527.jpgHey guys,

I'm new here and nice to meet my fellow GeeksWithBlogs bloggers here.

This is the first time I really spent my time looking for a blog community for the developers and IT professionals.

I usually blog at my own site but I have not have that much of tine to maintain it. so I have chosen to look around and to lighten my burden a little bit.

I've been looking around for quit a while before I decided to try my luck with GeeksWithBlogs (GWB). I know it doesn't give out account just for any applicant out there. I know it's sort of like a privilege if you are given a "yes" for your application.

The day I found out they had approved my application, I'm extremely excited and I quickly take some time during my break to setup the basic information of my blog and thinking of a suitable title for the blog. Good that I can always change it though I don't find that a good idea.

And so, I proceed to begin my journey in hunting for a nice tool to blog from my mobile phone. I searched for a few days and have decided to check with@StaffOfGeeks for some ideas. so they shared with me they've previously been looking into some MetaBlogAPI supported apps for iPhone. so after I've been searching up and down, high and low. I manage to find this iBlogger apps.

Here are some tips and screenshots to guide you through the setting up processes. It did took up some time of mine to figure out the correct parameters for all the required fields.

After you've downloaded iBlogger to your iPhone, launch the apps and select Other MetaWeblog. Now, they will ask you to put in your blog URL. DO NOT THINK THAT IT'S YOUR BLOG URL. it's instead the GWB MetaBlogAPI's service endpoint URL. So, key in this line in the blog address:

http://geekswithblogs.net/services/metablogapi.aspx

Blog URL - This is GeeksWithBlogs MetaBlogAPI URL

Then, tap on Next to proceed.

iBlogger will validate your MetaBlogAPI URL

In the next screen, you will be presented with login information and your access URL.

Key in your GWB User Name and Password then your Blog's MetaBlogAPI URL

Just fill up the fields with you GWB username and password. As for the access URL is not that straightforward but similar to the previous URL we've just entered.

instead of keying in http://geekswithblogs/yourblog/ , you should key in the URL in this format: http://geekswithblogs/yourblog/services/metablogapi.aspx

Key in http://geekswithblogs.net/yourblog/services/metablogapi.aspx in Access URL field

And tap NEXT to continue. It will verify your account and that's it! Your account is now added and displayed with whatever name you've given to your Blog.

GWB Endpoint will validate your account
 

As you can see from the image, now my blog account is addede into iBlogger

tap on it will take you to the page where you can make your first post from iBlogger. Just tap the "+" sign to create new blog entry and it'll be saved automatically to your iPhone.

Tap on "+" to create a new blog entry

Click Edit to Insert Content to your blog entry
 

For your information, this is also my first post from iBlogger. Enjoy!

[EDIT: Seems like it only allows me to upload one picture per entry. Thus, I've edited my post from my PC]