"every right implies a responsibility; every opportunity, an obligation; every possession, a duty"
Sunday, January 23, 2011
Wednesday, November 03, 2010
Got published, again!
Where? .. IEEE Intelligent Systems
Why? .. Because he's a genius.
Link: http://www.computer.org/portal/web/csdl/doi/10.1109/MIS.2010.98
Tuesday, August 24, 2010
Liferay Performance Tuning
Apparently, I'll have to collect stats from both of the tools to summarize the overall difference. Ideally, I'd be able to pinpoint the exact methods that must be rewritten to improve the performance. Instrumenting the CPU using VisualVM by limiting it Liferay specific classes seems like a good idea.
Let's see. I'll try to update this post with results, if and when I get them :)
Thursday, July 29, 2010
Struts2 - Adding Properties to the pageContext
<s:property value="results" />where s is an alias for struts-tags tag library and results is a Collection (can be anything) that we've populated in execute method. Note here that it must be a variable/property in you action handler class with both of its getter and setter methods available. The property tag will call the getResults() getter method.
This is clean. But it should be noted that results is not available in the pageContext of the page being processed currently. So, for example, if you want to use the results collection inside a jsp scriptlet by doing something like
pageContext.getAttribute("results")this will not work. You cannot even say something like
request.getAttribute("results")Anyways, it's possible and pretty clean too :) All you've to do is to set the pageContext attribute by using another struts tag,
<s:set name="pageResults" value="%{results}" />This is equivalent to
pageContext.setAttribute("pageResults",results)but the later won't work. The name is what you want to name the results in the pageContext, like a variable name; and the value is its value. So here, Set tag will call getResults() and assign the returned value to a pageContext variable called pageResults.
Friday, June 11, 2010
Grails and MySQL - Enforcing Foreign Key Constraints
Imagine a scenario where you've two Grails domains called Book and BookAuthor (could by anything) with there respective MySQL tables. You've made sure that every time a Book is created, it must be associated to some BookAuthor by adding something like
BookAuthor author
in your Book domain. Also, you don't have to do anything in BookAuthor domain. Now when someone deletes a BookAuthor, Grails should enforce the foreign key constraint and does not allow it to happen. However, it does and the BookAuthor gets deleted. On top of that, the Book domain is now broken, because all the Books with the deleted BookAuthor as their author are now broken.
Solution
I was hinted that this can be prevented by using InnoDB as the storage engine for those particular tables. For details, read this, or this. For a quick solution, all you've to do is to add the following in your DataSource.groovy in the dataSource enclosure:
dialect = 'org.hibernate.dialect.MySQL5InnoDBDialect'
I dropped the database and let Grails recreate it because the tables have to be created with InnoDB as the storage engine. Note here that the default storage engine that MySQL uses while creating the tables is MyISAM.
This solved things for me. Now, whenever someone tries to delete a BookAuthor, which is associated to some Book, it is prevented by Grails with this message - "The BookAuthor id1 cannot be deleted" .. that's it :)
Happy coding, thanks!
Monday, April 12, 2010
Wednesday, March 31, 2010
About Sentiment Analysis
I wish I had filed a patent or something :(
It's going to be big. I was able to foresee the potential in sentiment analysis, but never got time to finish it ... anyways, kudos to ubervu - I'll be an spectator :)
Wednesday, March 24, 2010
Wednesday, August 05, 2009
Saturday, July 25, 2009
Digging Digg: Comment Mining, Popularity Prediction, and Social Network Analysis
Using comment information available from Digg we define
a co-participation network between users. We focus on
the analysis of this implicit network, and study the behavioral
characteristics of users. Using an entropy measure,
we infer that users at Digg are not highly focused and
participate across a wide range of topics. We also use the
comment data and social network derived features to predict
the popularity of online content linked at Digg using a
classification and regression framework. We show promising
results for predicting the popularity scores even after limiting
our feature extraction to the first few hours of comment
activity that follows a Digg submission.
Thursday, June 04, 2009
The next big thing. [2]
- AMD Phenom 2 x4 940 (3.0 ghz, 4 cores)
- Biostar Ta790gx (amd 790gx chipset, radeon 3300 builtin)
- GSkills 4 GB RAM (ddr2, 1060mhz)
- Western Digital 1 Terabyte HDD (32mb cache, 7200 rpm)
- Antec 300 ATX case and Anter 430w PSU
- Samsung 23' High Definition LCD Monitor (max. res. 1920 x 1080, 5 ms response time)
error 18 selected cylinder exceeds maximum supported by bios
I looked around for workarounds, and found nothing straightforward. A few fellows hinted that the boot partition shouldn't be huge because the location of the kernel must be in the first few gigs of hdd. So, all newbies who'll go with the default ubuntu installations are going to see this error (if they have large hard drives). Here is the simple workaround assuming that it's a new system/build:
- You'll need to re-install ubuntu.
- This time, choose manual partitioning option.
- The problem will be solved if you'll make a separate boot partition (/boot) at the beginning of the disk. It's size can even be 32 mb, but I chose 128mb to be on safe side (this has something to do with ppl who play with kernels)
- /boot (128mb, primary partition)
- / (20gb, primary partition)
- swap (2gb, logical partition)
- /home (900+gb, logical partition)
Benefits:
- I can update my ubuntu installation without messing with my home folder.
- I don't really need a swap, but I've too much of free space :p
- Twenty gigs for Root partition (/) is enough for default installation and many softwares.
- Above all, separating boot partition helped me to get rid of Error 18
My next step - to use some hypervisor and ensure a separation of concern. Primarily, I want to isolate my (future) webserver from everything else I'll be doing on this machine. I know XEN and VMWare ESXI. I am analyzing the comparisons of both; with all I know by now, I might settle down for Xen.
Above all, I am loving it :)
Thursday, May 28, 2009
Tuesday, May 26, 2009
The next big thing.
Processor - Q9400 (6mb cache, 2.66ghz, 4 cores,1333 mhz)
Memory - DDR3 6 GB
Motherboard - Intel DP45SG
HDD - SAMSUNG Spinpoint 1TB F1 HD103UJ 7200 RPM 32MB Cache SATA 3.0Gb/s 3.5" Hard Drive
Power Supply - Coolmax M-500B 500 Watt ATX 12V
Graphics - MSI N95GT-MD512-OC GeForce 9500 GT 512MB 128-bit GDDR2 PCI Express 2.0 x16
Casing - Antec Three Hundred ATX Case
I am building this thing; it's fun. I am getting it all for $615, which is not bad at all! I was almost finalizing the Mac Mini, but within my budget, I was getting nothing better than a refurb core duo, 1 gig box; all crap.. I hope this one lives with me and my needs for atleast an year.
p.s. Why did I buy one? because I hate to shutdown my notebook even once in a month :p
Wednesday, April 08, 2009
Specialization is for Insects
A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.
-Robert A. Heinlein
just a joke, no offense to all my fellows around :)
Sunday, April 05, 2009
The bugs in my life
- Error Code : 2006 - MySQL server has gone away,
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space,
- Error occurred during initialization of VM - Could not reserve enough space for object heap,
- 100 thousand Null Pointer Exceptions,
- java.lang.ArrayIndexOutOfBoundsException: Array index out of range ..
- Error Code : 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ..
- ssh: connect to host [server] port 22: Connection timed out
- and many more :p
And in the meantime, I improved my track record of
- Living with 1 coffee, 1 vitamin water and 1 meal per day..
- Reworking for the 5th time on the same 400 lines of code and fail for the 5th time..
- Thinking effectively for a complete solution .. while taking a bath..
- Staring at random people and realizing the wrong after a bunch of seconds..
Friday, March 27, 2009
Talking about php frameworks
Anyways, a geek friend talked about cakePHP. I looked it up and it seems interesting. The last time I worked with PHP, there was no hype of php frameworks, and perhaps the only one I heard about was by Zend. So, anyways, this world of frameworks is ranked here. By having a couple of sneak peaks at Yii-powered sites, I declare it to be boring to try out.. Next, I've got CodeIgnitor, CakePHP, and Akelos.
On the other hand, I've got RubyOnRails!
Now, I've worked with PHP and it's the easiest language I've worked with by far (considering the compiled languages I know). I wouldn't be comfortable to work with a framework that might make the whole process as easy as a cake (from cakePHP) and at the same time I am thinking to stick to php and do more practical things with it instead of trying out something new like Ruby.
So, I'll think :) One stupid way of comparison is the time it takes to make a blog with these frameworks: RoR takes 15 minutes, and CodeIgnitor and Akelos take 20 minutes :p For more intelligent comparative analysis, I'll look around for resources. I am planning to export all my posts from this blog to my new blog (I don't know how this work though) ..
Wednesday, March 25, 2009
OnLive
Although it’s a neat idea, but I doubt it to be the next big thing in gaming world. It’s only targeting a small niche of gamers: those who have high speed internet connections!
The big question - why do I need it in the first place? If it’s not priced significantly lower than it’s competitor big fishes, then hardcore gamers would surely prefer the ugly big boxes over unexpected interruptions in their gaming performance due to primary dependence on internet connection.
Monday, March 23, 2009
Saturday, February 14, 2009
honda student 1999 civic salman sedan jamali google thesis
following are few of my recent search strings on google:
- how to check fuse of auxiliary power outlet civic 99
- cigarette outlet not working civic 99
- is my coolant leaking? civic 99
- what is oxygen sensor?
- what is primary oxygen sensor 02 civic 99
- how to attach a number plate on front bumper
- lost my driver's license dmv reporting
- zune fm transmitter
- zune car kit
- best fm transmitter reviews
- pioneer car cd player deal
- sony car cd player deal
- magellon gps deals
- garmin gps deals
- garmin vs magellon vs tomtom
- navteq versus teleatlas maps
- samsung bluetooth headset deals
- samsung wep200 vs wep500
- samsung wep200 vs wep410
- antifreez coolant autoparts
- 1999 honda civic mpg
- 1999 honda civic lx kbb
- magellon 4210 review cnet
- progressive insurance
- what is liability insurance
- geico
- mr car wash
- ..
- ..
and seems like this list would go on and on.. errr. Anyways, above all, i wish i could drive here the way we used to do it in Pakistan.. :D I don't like it, it's so peaceful here. I notice people actually waiting for the red to be green and literally stopping when it's about to be red! See that's not way, you're wasting fuel, your time and hmm.. some excitement :D We are not supposed to switch lanes with indications and thank people for letting you cross.. it's all right, just show some aggression in your acceleration and they'll stop.. it works always :D
And what's up with these service stations here?! $90 just to check for the problem in the power outlet? $600-$700 to replace timing belt that cost's $40.. I know it's labor, but still.. it's so systematic that you just don't have any cheaper options, or perhaps i'll get to find few eventually.
One more thing, every third mechanic is a Pakistani just like every third software engineer is an Indian and every third human being around is a Chinese :D
To summarize, after 2.5 months of craigslisting, I think I've got a nice deal! :)
tht's it for now, over n out.
