Thursday, December 24, 2009
Steam promotion for the holidays - up to 80% off!
Steam is having a sale for the holidays, some of the games are up to 80% off! And there are the daily specials: for today, Mirror's Edge is going for $4.99 USD, S.T.A.L.K.E.R. is going for $1.99 USD! I doubt there's a better deal anywhere else!
Saturday, November 14, 2009
Reinstalling PostgreSQL - deleting the "postgres" service account
I was playing around with PostgreSQL 8.4 for my personal project. After my initial installation, I uninstalled it and tried to reinstall it. During the installation, I was prompted to enter the password for the "postgres" service account, which I don't remember. To continue with the installation, I needed to enter the following command and create a new password
net user /delete postgres
net user /delete postgres
Friday, November 6, 2009
Removing external Javascript from Spring 3 documentation with jEdit
The Spring 3 reference in HTML format loads Javascript files from external sites. It's a bit annoying to wait for the loading of the scripts, particularly when I need to navigate between the pages frequently.
I used jEdit to search for the following regular expressions in the HTML files and replace them with a space
I used jEdit to search for the following regular expressions in the HTML files and replace them with a space
(?s)Begin Google Analytics code.*End Google Analytics code
(?s)Begin LoopFuse code.*End LoopFuse code
Thursday, November 5, 2009
Problems creating a JDBC resource with Glassfish 3 and PostgreSQL 8.4 drivers
What I initially thought was a straight-forward task turns out to be more complex than I imagined. After dumping the jars for PostgreSQL 8.4 driver (postgresql-8.3-701.jdbc3.jar
, postgresql-8.4-701.jdbc4.jar) into <GLASSFISH>/domains/domain1/lib/databases, I started the GF 3 server and tried to create a connection pool. I tried to create a javax.sql.ConnectionPoolDataSource resource using org.postgresql.ds.PGConnectionPoolDataSource. However I kept getting this error:
I get this error even when I do not specifiy "guranteed" for the isolation level.
Googling around, I finally found someone with a similar problem. Seems that there is a bug in some of the earlier builds, so I downloaded the latest build (build 70)and reinstalled GF3.
All's well? Not quite. When I tried to start the server, I get some problem with using port 7676 for the default JMS host. I dont think I've gotten this error before in the older builds. Well, I did change the http-listener-2 port in domain1's domain.xml, not sure if I introduced some typo error there, so I ran
and checked that the domain.xml is ok. The error is something along the line of
It turns out that for some reason the new GF3 build has problem using Vista's default hosts file (at C:\Windows\System32\drivers\etc).
To get it to work, change
to
Restart the server again.
Now proceed to create the connection pool. However, according to the PostgreSQL driver download website,
So, you'll need to specify an additional property JDBC30DataSource and set it to true when configuring the connection pool. That should be about it, now you can get some real work done.
, postgresql-8.4-701.jdbc4.jar) into <GLASSFISH>/domains/domain1/lib/databases, I started the GF 3 server and tried to create a connection pool. I tried to create a javax.sql.ConnectionPoolDataSource resource using org.postgresql.ds.PGConnectionPoolDataSource. However I kept getting this error:
Can't find ConfigModel.Property for attr -isolation-level-guaranteed on interface com.sun.enterprise.config.serverbeans.JdbcConnectionPool
I get this error even when I do not specifiy "guranteed" for the isolation level.
Googling around, I finally found someone with a similar problem. Seems that there is a bug in some of the earlier builds, so I downloaded the latest build (build 70)and reinstalled GF3.
All's well? Not quite. When I tried to start the server, I get some problem with using port 7676 for the default JMS host. I dont think I've gotten this error before in the older builds. Well, I did change the http-listener-2 port in domain1's domain.xml, not sure if I introduced some typo error there, so I ran
asadamin verify-domain-xml
and checked that the domain.xml is ok. The error is something along the line of
java.net.SocketException: Address family not supported by protocol family: bind
It turns out that for some reason the new GF3 build has problem using Vista's default hosts file (at C:\Windows\System32\drivers\etc).
To get it to work, change
::1 localhost
to
127.0.0.1 localhost
#::1 localhost
Restart the server again.
Now proceed to create the connection pool. However, according to the PostgreSQL driver download website,
It comes in two flavors, JDBC3 and JDBC4. If you are using the 1.6 JVM, then you should use the JDBC4 version.
.....
JDK 1.6 - JDBC4. Support for JDBC4 methods is limited. The driver builds, but the majority of new methods are stubbed out.
So, you'll need to specify an additional property JDBC30DataSource and set it to true when configuring the connection pool. That should be about it, now you can get some real work done.
Thursday, September 24, 2009
Overheard conversations
I was at Cash Converters the other day, rummaging through some stacks of CDs when I heard this conversation between a female customer and a male sales assistant.
For those who don't read Chinese, here's a translation.
女:请问你们有PS2吗?
男:有。
女:怎么卖?
男:69快。
女:是不是买回家就可以玩?
男:我们保证原装的disc可以玩。
女:这样说就是不可以玩啦?
男:如果是原装的disc一定可以玩。如果不可以玩,可以拿回来换。
女:那么pirated的可以玩吗?
男:我们只保证原装的disc可以玩。
女:那么就是pirated的不可以玩啦?
男:小姐,你还是听不懂我的意思。
For those who don't read Chinese, here's a translation.
F: Do you sell PS2 here?
M: Yes.
F: How much?
M: 69 bucks.
F: So I just bring it home then I can play?
M: We guarantee that you can play original discs.
F: That means it cannot play?
M: If it's original discs, it can play, if it doesn't work you can bring it back for exchange.
F: What about pirated ones?
M: We only guarantee that original discs can be played.
F: That means I cannot play pirated games?
M: Ma'am, you still don't understand what I mean.
Labels:
Family #38; Friends,
funny,
Life,
overheard conversations
Saturday, July 25, 2009
Young programmers win big
Young programmers win big
Two things interest me about this story. First, it is the age of the girls. I think it's quite hard to even understand what computer programming is about at the age of eight, let alone four. I didn't know what programming was when I was eight. Hmm..I don't think I've even played with a computer when I was eight. Anyway, even though tools are greatly simplifying programming, basic programming stuff like looping, conditionals, function calling, differences between classes and objects,etc can still easily overwhelm a young kid's mind. Then you also need to consider things like how the users interact with the program and the animation. You need a certain degree of logic and training to do programming. So I'm truly impressed that they can not only complete the project, but also beat the older competitors.
Second, it's interesting that they used Squeak to implement their project. Squeak is an implementation of the Smalltalk programming language. Most programmers I've talked to have never heard of Smalltalk, but I did manage to use the VisualWorks implementation for about 3 years for work. Generally, you hear about the SAP, J2EE, .Net stuff powering the enterprise systems, so it is mildly surprising that Smalltalk used to be powering one of the biggest pay systems here. All those policies, payment stuff, bonuses, income tax, CPF computation in beautiful Smalltalk code. Funny how things appear though rose-tinted glasses. Anyway, we have difficulty recruiting people because most people consider Smalltalk to be an antiquated language. There really isn't a market for Smalltalk so no one wants to learn it, at least in Singapore. I'm a bit language agnostic (Ok, actually I prefer Java) so I didn't really think it mattered that much.
Straints Times, July 20, 2009
TALK about starting young: Celine Chan, four, took on competitors far older in a national computer programming contest held here recently.
Celine and her sister, Charlene, eight, proved more than a match for the older competitors, trumping most of them handily in the contest, organised by the Information Technology Standards Committee which is supported by the Infocomm Development Authority (IDA).
Called XtremeApps, the competition required those taking part to program computer applications from scratch.
Armed with just the basics in the Squeak programming language, as well as encouragement - but no help - from mum and dad, the Chan sisters came up with an application called Health Fairies.
Two things interest me about this story. First, it is the age of the girls. I think it's quite hard to even understand what computer programming is about at the age of eight, let alone four. I didn't know what programming was when I was eight. Hmm..I don't think I've even played with a computer when I was eight. Anyway, even though tools are greatly simplifying programming, basic programming stuff like looping, conditionals, function calling, differences between classes and objects,etc can still easily overwhelm a young kid's mind. Then you also need to consider things like how the users interact with the program and the animation. You need a certain degree of logic and training to do programming. So I'm truly impressed that they can not only complete the project, but also beat the older competitors.
Second, it's interesting that they used Squeak to implement their project. Squeak is an implementation of the Smalltalk programming language. Most programmers I've talked to have never heard of Smalltalk, but I did manage to use the VisualWorks implementation for about 3 years for work. Generally, you hear about the SAP, J2EE, .Net stuff powering the enterprise systems, so it is mildly surprising that Smalltalk used to be powering one of the biggest pay systems here. All those policies, payment stuff, bonuses, income tax, CPF computation in beautiful Smalltalk code. Funny how things appear though rose-tinted glasses. Anyway, we have difficulty recruiting people because most people consider Smalltalk to be an antiquated language. There really isn't a market for Smalltalk so no one wants to learn it, at least in Singapore. I'm a bit language agnostic (Ok, actually I prefer Java) so I didn't really think it mattered that much.
Labels:
News,
Other IT Stuff Worth Knowing,
Smalltalk,
Squeak
Sunday, July 5, 2009
Manhã de Carnaval
The best interpretation of the classic on Youtube by Ulli Boegershausen
Labels:
acoustic,
bossa nova,
Entertainment,
fingerstyle,
guitar
Saturday, June 20, 2009
Javascript performance tuning
Recently, I was working on a customer complaint that our application was slow when churning out reports. The worst case occurs when the user selects to generate a report for the time-span of 18 months, and the application will take about 3 minutes plus to generate the reports. Not being very familiar with Javascript and DOM, I googled and found the following resources which were extremely helpful.
Nicholas C. Zakas
Speed up your JavaScript, Part 1
Speed up your JavaScript, Part 2
Speed up your JavaScript, Part 3
Speed up your JavaScript, Part 4
Yahoo! Developer Network
Exceptional Performance
Dev Opera
Efficient JavaScript
IE Blog
IE + JavaScript Performance Recommendations - Part 1
IE+JavaScript Performance Recommendations Part 2: JavaScript Code Inefficiencies
IE+JScript Performance Recommendations Part 3: JavaScript Code Inefficiencies
In our app, I found that main bottleneck was that that there was simply too much DOM interaction when creating the report's table. Creating the report involved creating TD and TR DOM elements and adding them to a table, and deciding when to break the page. After the report is created, some of the TD cells will be merged based on some criteria.
To tune the app, I cloned the TBODY node of the table, added all the child nodes into this cloned node, and replaced the original node. Then, I has to clone the node again for doing the breaking the pages and merging the cells. Basically, it involved multiple calls to cloning the nodes, creating new doc fragments, and replacing the original nodes. Basically, it seems like the code is doing a lot more work than the original. However, it is more than 60% percent faster after tuning!
As a side-note, it really is hell trying to work on a JSP that mixes scriptlets and badly-written Javascript. First, visually it's so messy it's disorientating. Second, sometimes you can't do profiling until you've refactored the Javascript, which is sometimes hopelessly entangled with the JSP scriptlets. And some people always wonder why I'm rewriting so much code :/
Nicholas C. Zakas
Speed up your JavaScript, Part 1
Speed up your JavaScript, Part 2
Speed up your JavaScript, Part 3
Speed up your JavaScript, Part 4
Yahoo! Developer Network
Exceptional Performance
Dev Opera
Efficient JavaScript
IE Blog
IE + JavaScript Performance Recommendations - Part 1
IE+JavaScript Performance Recommendations Part 2: JavaScript Code Inefficiencies
IE+JScript Performance Recommendations Part 3: JavaScript Code Inefficiencies
In our app, I found that main bottleneck was that that there was simply too much DOM interaction when creating the report's table. Creating the report involved creating TD and TR DOM elements and adding them to a table, and deciding when to break the page. After the report is created, some of the TD cells will be merged based on some criteria.
To tune the app, I cloned the TBODY node of the table, added all the child nodes into this cloned node, and replaced the original node. Then, I has to clone the node again for doing the breaking the pages and merging the cells. Basically, it involved multiple calls to cloning the nodes, creating new doc fragments, and replacing the original nodes. Basically, it seems like the code is doing a lot more work than the original. However, it is more than 60% percent faster after tuning!
As a side-note, it really is hell trying to work on a JSP that mixes scriptlets and badly-written Javascript. First, visually it's so messy it's disorientating. Second, sometimes you can't do profiling until you've refactored the Javascript, which is sometimes hopelessly entangled with the JSP scriptlets. And some people always wonder why I'm rewriting so much code :/
Friday, March 13, 2009
Quick trip to IT Show 2009
It's the first day of IT Show 2009, and there was a huge turnout of eager shoppers looking for good deals. Being a Thursday afternoon, you'll expect the crowd to be a bit thinner. I expected to be in and out within an hour as I'm a focussed shopper, but the snaking queues almost began the moment I stepped out of City Hall MRT. After about an hour and a half I finally completed my re-contract and purchase of Nokia's XpressMusic 5800. There was a minor hiccup when a staff did not give me free earphones worth 139 bucks, but thankfully it was resolved promptly. Finally, I'm back to owning a camera-phone after more than 3 years!
There's many interesting IT products in the show, like ACRyan's Playon! DVR. I own an older version of ACRyan HD recorder, but the new version is on steroids! Expanded connectivity options (wired and wireless), video-stream playback capability and the ability to record analog and digital TV certainly makes it very attractive.
UOB credit card owners looking for a new camera can check out Harvey Norman for the Fujifilm Finepix F60FD. It's 349 (originally 499) after trade-in with ANY camera (including those using film) and you get a whole lot of freebies (mini-tripod, 8GB SD card, etc) just by swiping your card.
Overall it's a pretty nice shopping experience. With lots of stuff at discounted prices and with cute show girls manning some of the booths, even the congestion can be forgiven :)
There's many interesting IT products in the show, like ACRyan's Playon! DVR. I own an older version of ACRyan HD recorder, but the new version is on steroids! Expanded connectivity options (wired and wireless), video-stream playback capability and the ability to record analog and digital TV certainly makes it very attractive.
UOB credit card owners looking for a new camera can check out Harvey Norman for the Fujifilm Finepix F60FD. It's 349 (originally 499) after trade-in with ANY camera (including those using film) and you get a whole lot of freebies (mini-tripod, 8GB SD card, etc) just by swiping your card.
Overall it's a pretty nice shopping experience. With lots of stuff at discounted prices and with cute show girls manning some of the booths, even the congestion can be forgiven :)
Tuesday, February 17, 2009
拭目以待 - "未来不是梦"主题曲 ("The Dream-Catchers")
最近在追“未来不是梦”,觉得题材相当有趣,更有趣的是拍摄的动机。主题曲相当特别,是我近期来最喜欢的歌曲。
歌词 by 小寒
http://blog.omy.sg/xiaohan/2009/02/02/我用悲觀去樂觀著。/
歌词 by 小寒
http://blog.omy.sg/xiaohan/2009/02/02/我用悲觀去樂觀著。/
Labels:
Entertainment,
The Dream-Catchers,
小寒,
拭目以待,
未来不是梦,
林倛玉
Tuesday, February 10, 2009
Singapore IT sector resilient against current recession?
With all the news about retrenchments locally and abroad and how hard it is for people to land jobs, I'm seeing quite a lot of new faces in and around my workplace, quite a number of them fresh grads. And among my friends and colleagues, quite a few have switched jobs. My mailbox is full of alerts from job portals about new opportunities. So amidst all the doom and gloom, I'm just wondering, is the local IT sector more resilient against the current recession compared to the other industries?
Saturday, February 7, 2009
陈绮贞 - 太阳 ( Cheer Chen - Immortal )
陈绮贞的新专辑发行了!那天听朋友说了之后我马上到唱片行去买。933强力推选,但我是他的粉丝,没人推荐也会照买无误。真的觉得这张专辑非常好听,“太阳”和“烟火”属于摇滚,令我情绪高昂也想跟着呐喊。“距离”和“下个星期去英国”则属于清新民谣,听了让我轻松许多。
原来新加坡有绮贞的后援会,太棒了!而且值得注意的是,她将在四月四号在室内体育馆举办演唱会!太棒了吧?
原来新加坡有绮贞的后援会,太棒了!而且值得注意的是,她将在四月四号在室内体育馆举办演唱会!太棒了吧?
Saturday, January 24, 2009
Rynten Okzaki's "Mai"
A beautiful, melodic piece by Rynten Okzaki
Labels:
Entertainment,
guitar,
Mai,
Rynten Okzaki,
岡崎倫典,
麻衣
Sunday, January 18, 2009
Thoughts on starting the school day later
I was reading the Straits Times the other day about the positive benefits about starting the school day later. Basically, students would perform better academically. However, as bus operators who ferry students to schools also ferry worker to offices/factories, they pick up the students on the same schedule as before, Schools that have pushed back their start times find some students still arriving at the same time and these students have to endure a longer wait. The articles suggests pushing back the starting time even further back (to say 9am) so that bus operators have enough time to ferry workers and students. Parents would also have some time for breakfast with their kids. Anyway, I saw this letter to the ST forums:
Some thoughts.
First, can we fault the bus operators for wanting to make more money by operating two services instead of one? Of course not, these are private business entities and they provide a solution to the problem of getting kids to schools. How much of a rise in transportation fees are parents willing to bear so that bus operators can maintain their current profits by running one service instead of two? And since labour is indeed needed to sustain the economy, it is important as well to ferry workers to their workplaces as well and it should not be denigrated.
Second, what are the ramifications for other motorists, public commuters and transport operators? And not all students take school buses, quite a lot of them make use of public transport as well and starting school later would definitely add a significant amount of traffic during the morning rush hours. Feeder and intra-town bus services would be most severely affected as many primary and secondary schools are located near to student's homes. They would be jam-packed with students at a time when hordes of people are rushing to work. Train passengers would be affected as well but would not be as much since student traffic is usually localised (at least for primary and secondary students).
To add on, if parents drive and need to drop their kids off, traffic around the school might slow down as well. If they don't, they'll need to take the public transport to send their kids to school. Either way we're looking at a situation where almost everyone spends more time in their daily commute and a certain proportion of them needs to wake up earlier. And the reason for this is so that students can spend more time sleeping. How ironic is that?
If school is to start later.....make it a lot later
Starting school later is a good idea, but clashing with the peak hour traffic is not. 9.30 or 10am would be a better time to start school as the crowd would have thinned out by then
Teachers and other staff will also benefit from later start to school day
MANY parents like me are in full agreement with the article, 'Start school later and let children sleep longer' (Jan 9).
Finally, after so many years, we have an article that puts this matter in perspective. How is it that our children's well-being is determined by bus operators keen to make more money by operating two services instead of one? Since Singapore has no natural resources and depends on labour to sustain the economy, do the authorities not want to evaluate the ramifications of sleep deprivation on our children in their growing years?
Apart from that, will teachers and other school staff not also benefit from this positive change? I am certain that teachers and staff will welcome the change as this means aligning their working hours to those of their spouses and other family members. With positive changes like this, the Ministry of Education will see less attrition of good teachers too.
Furthermore, if school starts later at 8.30am or 9am, schoolchildren will also depend less on school buses as working parents can take them to school on the way to work. It is ridiculous to allow children's and school staff's well-being to be decided by bus operators. It is time the authorities looked into this and not continue this mindless trend.
With sufficient rest, children will not find school as tiring and tedious and will enjoy it more. Teachers will also be less sleep-deprived and able to deal with work stress better too.
Ginny Leow (Mdm)
Some thoughts.
First, can we fault the bus operators for wanting to make more money by operating two services instead of one? Of course not, these are private business entities and they provide a solution to the problem of getting kids to schools. How much of a rise in transportation fees are parents willing to bear so that bus operators can maintain their current profits by running one service instead of two? And since labour is indeed needed to sustain the economy, it is important as well to ferry workers to their workplaces as well and it should not be denigrated.
Second, what are the ramifications for other motorists, public commuters and transport operators? And not all students take school buses, quite a lot of them make use of public transport as well and starting school later would definitely add a significant amount of traffic during the morning rush hours. Feeder and intra-town bus services would be most severely affected as many primary and secondary schools are located near to student's homes. They would be jam-packed with students at a time when hordes of people are rushing to work. Train passengers would be affected as well but would not be as much since student traffic is usually localised (at least for primary and secondary students).
To add on, if parents drive and need to drop their kids off, traffic around the school might slow down as well. If they don't, they'll need to take the public transport to send their kids to school. Either way we're looking at a situation where almost everyone spends more time in their daily commute and a certain proportion of them needs to wake up earlier. And the reason for this is so that students can spend more time sleeping. How ironic is that?
If school is to start later.....make it a lot later
Starting school later is a good idea, but clashing with the peak hour traffic is not. 9.30 or 10am would be a better time to start school as the crowd would have thinned out by then
Subscribe to:
Posts (Atom)