We can use following script to clean Drupal database; I do this every time before taking a db-backup.
TRUNCATE `cache_block`;
TRUNCATE `cache_filter`;
TRUNCATE `cache_form`;
TRUNCATE `cache_menu`;
TRUNCATE `cache_page`;
TRUNCATE `sessions`;
TRUNCATE `watchdog`;
Fresh install of wordpress has little junk in it (a test post, a test comment and 7 links)
TRUNCATE TABLE `wp_links`;
TRUNCATE TABLE `wp_comments`;
TRUNCATE TABLE `wp_posts`;
TRUNCATE TABLE `wp_term_relationships`;
UPDATE `wp_term_taxonomy` SET `count` = '0' WHERE `term_taxonomy_id` = 1;
UPDATE `wp_term_taxonomy` SET `count` = '0' WHERE `term_taxonomy_id` = 2;
The Top 10 List
#10 There’s only one Struts - Struts is an open-source product, whereas JSF is a specification.
#9 JSF is the standard - JEE 5.0 containers must provide an implementation of JSF, which means that JSF will soon be ubiquitous.
#8 POJO Action Methods - Struts actions are tied to the Struts API, but JSF action methods can be implemented in Plain Old Java Objects.
#7 Managed Beans - Like Spring, JSF uses dependency injection (or inversion of control, if you will), for instantiating and initializing beans. It’s true that Struts creates action beans and form beans for you, but JSF generalizes that concept and adds the ability to initialize managed beans-of any type-created by the framework.
#6 Extensibility - This is huge. JSF has 6 objects that implement much of the framework’s capabilities and you can easily replace those objects by decorating the default implementations. That makes it ridiculously easy, for example, to add your own custom variables to the JSF expression language. It also makes it easy, for example, to plug in your own view handlers, perhaps a view handler that implements Tapestry-like views so you can truly separate components and HTML. In fact, Shale, does both of those things. As if that weren’t enough, JSF gives you numerous hooks into the JSF lifecycle to inject your own voodoo. Shale gives you even more.
#5 Event Model - JSF has an event model that lets you react to value changes, actions, and phase changes in the JSF lifecycle.
#4 Value Bindings - With Struts, you are responsible for ferrying data from your forms to your model objects. You implement an action with an execute method that takes a form bean as an argument. Then you manually pull data out of that form bean and push it to your model. For every form in your application. Ugh.With JSF, you do this:
#{model.property}. That’s all. JSF takes care of the rest.
#3 Renderers - Have you ever looked at the source code for Struts tags? They generate HTML directly. JSF component tags, OTOH, don’t generate anything; instead, they refer to a component-renderer pair on the server. The component maintains state whereas the renderer is in charge of rendering a view. The point here is that renderers are pluggable: you can replace the default renderers with your own implementations; for example, in my Felix talk at NFJS, I illustrate how to implement a custom label renderer that adds asteriks to labels that represent required fields. You plug in that renderer, and JSF will automatically use it throughout your application.Sweet.
#2 Render Kits - I had a Struts consulting job a few years ago where we had to support both a browser-based interface and radio frequency devices, and it was painful.That task would’ve been greatly simplified with JSF because you can create your own render kit-a collection of renderers for a particular display technology-and plug it into JSF.
#1 Components - Components are the number one differentiator between Struts and JSF. Like Swing, JSF provides a rich infrastructure for developing components in addition to a standard set of components. That infrastructure makes it relatively easy to create your own components and share them with others. Already, we’re seeing custom components popping up all over the place, for example with Oracle’s ADF and MyFaces, both of which provide a rich set of components such as JavaScript-powered calendars, trees, etc. Of course, components are only half the story; typically, components delegate rendering to a separate renderer, which provides substantial benefits (see item #3 above). But, as with most things in JSF, you are not forced to adhere to the party line. If you want, you can implement components that render themselves, although if you do so, you will loose the ability to plug a different renderer into your component.
Note: This wonderful article is taken from Freedom OSS newsletter, thanks to OSS for that.
Stress tool: http://openwebload.sourceforge.net/
Server: PIII 900MHz, 512MB, CentOS 5.2, lighttpd/1.4.19, PHP 5.2.6
Desktop: Athlon XP 2600+, 2GB, WinXP
[index.php]
Php says 2 + 2 = <?php echo (2 + 2); ?>
Since PHP code is a very simple one, response time (or cpu usage) should have better representation of magnet/rewrite over-head.
Statistics without any technique
C:\>openload.exe http://example.com/index.php 4
MaTps 237.86, Tps 237.86, Resp Time 0.016, Err 0%, Count 240 MaTps 237.77, Tps 237.00, Resp Time 0.017, Err 0%, Count 477 MaTps 238.06, Tps 240.59, Resp Time 0.017, Err 0%, Count 720 MaTps 238.55, Tps 243.03, Resp Time 0.016, Err 0%, Count 964 MaTps 238.58, Tps 238.85, Resp Time 0.017, Err 0%, Count 1205 MaTps 238.28, Tps 235.59, Resp Time 0.017, Err 0%, Count 1442 MaTps 238.12, Tps 236.61, Resp Time 0.017, Err 0%, Count 1685 MaTps 238.20, Tps 239.00, Resp Time 0.017, Err 0%, Count 1924 MaTps 238.51, Tps 241.28, Resp Time 0.017, Err 0%, Count 2166 MaTps 238.29, Tps 236.29, Resp Time 0.017, Err 0%, Count 2403 MaTps 239.21, Tps 247.52, Resp Time 0.016, Err 0%, Count 2653 MaTps 239.37, Tps 240.80, Resp Time 0.017, Err 0%, Count 2895 MaTps 238.50, Tps 230.69, Resp Time 0.017, Err 0%, Count 3128 MaTps 239.05, Tps 244.00, Resp Time 0.016, Err 0%, Count 3372 MaTps 239.52, Tps 243.76, Resp Time 0.016, Err 0%, Count 3616 MaTps 238.90, Tps 233.30, Resp Time 0.017, Err 0%, Count 3850 MaTps 240.06, Tps 250.50, Resp Time 0.016, Err 0%, Count 4103 MaTps 240.23, Tps 241.79, Resp Time 0.017, Err 0%, Count 4346 MaTps 240.49, Tps 242.81, Resp Time 0.016, Err 0%, Count 4591 MaTps 239.78, Tps 233.37, Resp Time 0.017, Err 0%, Count 4826 MaTps 240.11, Tps 243.06, Resp Time 0.016, Err 0%, Count 5071 MaTps 240.20, Tps 241.07, Resp Time 0.017, Err 0%, Count 5314 MaTps 240.23, Tps 240.52, Resp Time 0.017, Err 0%, Count 5555 MaTps 240.57, Tps 243.54, Resp Time 0.016, Err 0%, Count 5800 MaTps 240.79, Tps 242.81, Resp Time 0.016, Err 0%, Count 6045 MaTps 240.82, Tps 241.07, Resp Time 0.017, Err 0%, Count 6288 MaTps 240.32, Tps 235.82, Resp Time 0.017, Err 0%, Count 6525 MaTps 241.19, Tps 249.00, Resp Time 0.016, Err 0%, Count 6774 MaTps 241.20, Tps 241.28, Resp Time 0.016, Err 0%, Count 7016
CPU usage by lighttpd process was swinging between 20% & 22%
I recently bought a “TaylorMade Burner Draw 460 Drivers” from a leading sporting goods chain for $199 (currently selling for $149 +taxes). The salesman (a golf-pro working there) also wanted me to get the “Store Warranty” for extra $18. Store warranty would cover any damage to the club for next two years which was tempting but somehow I declined it. Read the rest of this entry »
Suppose that every day, ten men go out for beer and the bill for all ten comes to $100. If they paid their bill the way we pay our taxes, it would go something like this:
The first four men (the poorest) would pay nothing.
The fifth would pay $1.
The sixth would pay $3.
The seventh would pay $7.
The eighth would pay $12.
The ninth would pay $18.
The tenth man (the richest) would pay $59.
Read the rest of this entry »
You can download CSV for list of companies listed at AMEX (American Stock Exchange), NASDAQ (National Association of Securities Dealers Automated Quotations) and NYSE (New York Stock Exchange) from here.
FYI: Data is not clean and requires some deal of scripting before you can extract list of symbols from it. I’ll post more on this to make things better and handy.
Cheers,
Here is a small program that can create list of companies listed at NYSE (New York Stock Exchange). I created the script to help a friend of mine who has a itch for “stock analysis”.
<?php $files = range('A', 'Z'); $files[] = 'Other'; $curl = curl_init(); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); foreach ($files as $f) { $url = "http://www.nyse.com/about/listed/lc_ny_name_${f}.js"; curl_setopt($curl, CURLOPT_URL, $url); $content = curl_exec($curl); // get symbol from JS preg_match_all('%\[\"(\w*)\",%', $content, $matches); foreach($matches[1] as $symbol) { echo "$symbol\n"; } } ?>
I’ll upload the complete list somewhere to make it more handy.
Cheers,
Commuter — one who spends his life in riding to and from his wife; And man who shaves and takes a train, and then rides back to shave again. - Elwyn Brooks White
Funny, isn’t it?
Cheers,
Here are few reasons for switching your email service (for your small business/personal domains) to Google apps.
1. Google is very reputed and trusted company
- check their company profile
2. Email component in Google Apps platform is Gmail
- the best available in the market, Web 2.0 platform
- IMAP and Pop3 access are free
- mobile version is also included
3. Google apps is built using massive distributed infrastructure
- great reliability
- huge mailbox, never have to delete any email
4. Better SPAM handling
- best spam flagging (lesser false spam)
- better delivery chances for legitimate email sender
5. Standard edition is free, enterprise is cheap
- free is great for non-profit, small business and webmasters
- enterprise edition is cheaper than owning your own infrastructure
Tutorial objectives
* To install CentOS using their first CD only.
* To install true minimal CentOS for custom deployment need (say firewall, vps infrastructure, etc).
Read the rest of this entry »
This utility class can generate md5 of any string and is also compatible with PHP.
Read the rest of this entry »
Suppose we want to extract and see the RPM content without installing it. This is how we can do it
It should work on any RPM based system like redhat, fedora, centos etc.
Read the rest of this entry »
I was always wondering that why local phone companies are not offering DSL without phone service. Technically they are two different service sharing same media (copper wire) and it should be possible to unbundle them. But phone companies were not doing it until recently when they started losing this business because of VOIP.
Read the rest of this entry »
CECB or Coupon-Eligible Converter Box is a specification for converter boxes eligible to receive subsidy coupons through the U.S. federally-sponsored DTV Converter Box Coupon Program. (Ref - http://en.wikipedia.org/wiki/CECB)
I still have my old Panasonic TAU (27 inch flat screen tube SDTV) and occasionally turn it on. Thus buying a converter box for less than $10 was pretty exciting and I started browsing https://www.dtv2009.gov/ and other related sites to gather more information ![]()
Read the rest of this entry »
I found few url-rewrite based solution for enabling Permalinks in Wordpress+Lighttpd but none of them worked flawlessly. Guys, all we need here is something similar to following Apache rewrite code (without any side effect, like 404 header etc).
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
I found few url-rewrite based solution for enabling CleanURL in Drupal + Lighttpd but none of them worked flawlessly. Guys, all we need here is something similar to following Apache rewrite code (without any side effect, like 404 header etc).
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
This article explains an isolated and much secured MySQL setup in OpenVZ environment. The container VPS for “database node” can be a centos-5-minimal (centos-5-i386-minimal.tar.gz) and without any IP address for extra security.
Read the rest of this entry »
“The only secure computer is one that’s unplugged, locked in a safe and buried 20 feet under the ground in a secret location… and I’m not even too sure about that one.” — Dennis Huges, FBI.
Quote mentioned above is not to scare you from connecting your machine to network, but to give you a message that there is nothing like a “perfectly secured and networked computer”. The best we can do is to harden the security and actively monitor it. Especially when it is a server running 24×7 and serving your critical data to the Internet.
Read the rest of this entry »
If you are working on multiple projects using RAD 6.X, you may notice slowness after some time. This happens because test server is shared across workspaces and applications are deployed into same server-instance; hence making the experience sluggish. Read the rest of this entry »