Wednesday, October 7, 2009

How to improve your Windows XP performance

Although Windows Vista is the new current favourite of the drones and the new Windows 7 is supposed to knock everyone's socks off, the fact remains that windows xp rules the roost for the rest of us. Towards that end find below some tips and trick to squeeze more out of your windows XP machine.
(Note: The author takes no responsibility of you messing up your system, although none of these have affected my system in any way!)

This article covers how to improve your Windows performance.
Contents
     1 General Maintenance
          o 1.1 Check your disk for errors
          o 1.2 Cookies and net stuff
          o 1.3 Delete extra temp files
          o 1.4 Check for spywarez and viruses
     2 Now make comp faster tiem
          o 2.1 Desktop
          o 2.2 Turning stuff off that's useless to gain back POWAH
                + 2.2.1 Last access
                + 2.2.2 Disable short filenames
                + 2.2.3 fonts
                + 2.2.4 programs
                + 2.2.5 Indexing
     3 Starting up faster and staying a little faster
          o 3.1 msconfig
     4 Useless services go away
     5 Defrag
          o 5.1 With default Windows defragmenter
          o 5.2 With specialized software
     6 Further performance tweek
          o 6.1 Desktop graphics performance
          o 6.2 Pagefile
          o 6.3 Caching

 General Maintenance
 Check your disk for errors

   1. Go to Start, Run, type "cmd", OK, type "chkdsk C: /r /x"
   2. Select yes and let it run on the next restart
   3. This can take many hours so don't restart until you goto bed

 Cookies and net stuff

Delete your internet cookies and junk if you haven't done it in awhile, you should do this at least once a week

     In internet explorer, Tools->options->general tab for browsing history change the settings to something good and then do a delte
     In firefox, Tools->options->privacy tab change the settings and then clear the datas

 Delete extra temp files

Noob way:
Make sure can see hidden files

   1. Open windows explorer
   2. Tools-> folder options -> view
   3. Enable "show hidden files and folder" and uncheck "hide protected operating system files"

Now time to delete stuff

   1. Start - Run - %temp% (temporary files in user folder)
   2. You can delete all those files: edit->selectall->then delete
   3. Start - Run - temp (temporary files in %windir%)
   4. You can delete all those files: edit->selectall->then delete
   5. Start - Run - %windir%\prefetch
   6. You can delete all those files: edit->selectall->then delete

Find any extra temp filez

   1. Start menu - search - files and folders
   2. Choose "all files and folders," may take some time
   3. Search: *.tmp,*.temp,*.old,*.gid,*.log,*.gid,*.~
   4. Delete all the ones you can, some may be currently in use by programs running on the comp

Pro way:

   1. Go to http://www.ccleaner.com/download and download CCleaner
   2. Install and run CCleaner
   3. You're done.

 Check for spywarez and viruses

The following programs are free!

   1. Spyware - Adaware and/or Spybot
   2. Anti-virus - AVG or Avira AntiVirAvast AntiViravast has boot level scanning and automatic updates

Make sure scheduled scans and updates are enabled at least once a week
 Now make comp faster time
 Desktop

   1. Right click on desktop->properties->themes tab
   2. Change theme to Windows Classic
   3. Screensaver tab
   4. Make it so no screensaver and apply
   5. User power saving if you want the screen to turn off

 Turning stuff off that's useless
 Last access

   1. start menu->run, type in cmd, press enter
   2. "fsutil behavior set disablelastaccess 1" into the cmd and press enter, no quotes

 Disable short filenames

   1. In the same command prompt enter"fsutil behavior set disable8dot3 1" without quotes

 fonts

   1. Start menu-> control panel -> fonts
   2. Delete fonts that you never use/won't use
   3. If you wanna save them just in case, you can, just make a diff folder somewhere and zip em up so the comp won't

 programs

   1. Start menu->control panel -> add/remove programs
   2. Take off any you don't use and won't be using

 Indexing

   1. my computer->right click on harddrive
   2. click box to make indexing off and apply, let it run, will take awhile

 Starting up faster and staying a little faster
 msconfig

   1. Startmenu->run, type msconfig press entar
   2. Go over to the Startup tab, click diable all, and enable what you only really need at startup, virus and firewall stuffs mainly, on laptops can be moar wireless and button stuffz as well
   3. Go to the services tab now
   4. check the box to hide all Microsoft services, we don't wanna disable microsoft things we need to run comp
   5. Now set things you dont use to manual startup
   6. Apply and done

 remove useless services
type services.msc in your start - > run window
click on services you do not want or do not recognize and click on the stop button in the left hand panel.

 Defrag
 With default Windows defragmenter

   1. My computer->right click on drive to defrag->properties->tools, defrag
   2. click defrag
   3. have it do it about 2 or 3 times so it'll be all done, each time it'll go faster

 With specialized software

     Microsoft Bootvis, defragments files that can't be defragmented while Windows is running (like boot files)
     O&O Defrag, more defrag options than default defragger
     Raxco PerfectDisk, also moar options and statistics
     UniBlue Regisrty Booster, Does what you thought Windows Optimizer was supposed to do, except IRL. Microsoft Certified so no system32 worries.

 Further performance tweaks
 Desktop graphics performance

   1. Now go over to the advanced tab and then click on performance settings
   2. Adjust for best performance

 Pagefile

   1. Start menu->right click on My Computer->properties->general tab
   2. near bottom says how much RAM you have, remember that
   3. Go to advanced tab under performance options.
   4. Go to virtual memory, click change
   5. If you have more than one harddrive move the paging file to whichever one has the least amount of data access and is the fastest, don't have the pagefile on the OS/Applications drive unless its your only one.
   6. Remember how much RAM you have? Set the paging file to be custom size and your initial size as 2 times the size of your RAM and the max size as 2 times the size of your RAM
   7. click set and okay and apply it all

 Caching

   1. Open regedit
   2. Find hkey_local_machine\system\currentcontrolset\control\session manager\memory management\
   3. Dwords LargeSystemCache and DisablePagingExecutive both set to 1

Tuesday, October 6, 2009

top ten books/comics/movies to read/watch (In no particular order)

Graphic Novels

  1. Watchmen (obviously !)
  2. The forty niners
  3. Pride of Baghdad
  4. Cairo
  5. Scalped (My new favourite)
  6. The Preacher
  7. Fables (its offshoot Jack of fables not so good IMHO)
  8. Sandman (again obviously)
  9. Nova (great job converting an unknown hero to such a great character)
  10. Locke and Key
  11. Demo (anything brian wood is usually pretty good!)
  12. The surrogates
  13. Laika (such a tragedy !)
  14. Alice in sunderland
Books
  1. The time travellers wife - audrey niffenburger
  2. The Game & Emergency - neil strauss
  3. Lolita - Nabokov
  4. The Godfather - mario puzo
  5. travels with my aunt - graham greene
  6. Anything by Malcolm Gladwell (Simplistically put but always take conclusions drawn with a pinch of salt)
  7. the mandala of Sherlock holmes - jamyang norbu
  8. empire - how britain made the modern world - Niall Ferguson
  9. anything by james herriot
  10. anything by agatha christie, arthur conan doyle, paul theroux, william dalrymple, billy bryson, peter mayle,
Movies
  1. Irreversible (need a strong stomach for this one)
  2. Nuevas Reinas
  3. Oldboy (by same director, no sympathy for mr vengeance and no sympathy for miss vengeance)
  4. Gulal
  5. Dev D
  6. Manorama six feet under
  7. twelve angry men
  8. clerks
  9. wall e
  10. city of god
  11. Das experiment
  12. Time crimes (better than primer)

(Note: no there is no star wars or indiana jones, the later versions ruined whatever pleasure there was in the original ones!)


These are all that i can remember will keep on updating the list now and again.

Lessons learnt

1)Do not trust the end user or client; they do not know what they want, explain requirements to them repeatedly and only implement the same only until you get a write of on mail or even better on a hard copy with requisite sign offs.

2)Maintain a "Decisions" excel sheet where in every functional change is clearly mentioned as to "WHY" a particular change has been implemented.

3)Implement a change "freeze" on all requirements. A functionality can be changed only twice, take a sign of from the "Process Holder" in all cases.

4)Have a test machine that no one uses as a Test server with the exact same configuration as the live server. Elementary, but has to be done.

5)Deploy every new change on the above mentioned server, with the latest DB and configuration files get developer and tester to test the same.

6)Update and document your server installation steps e.g. tomcat connector 1.2.25 does not work with tomcat 6.0.16 but works with 6.0.14

7)Remember, Linux is case sensitive and windows is not.

8)Apply updates from http://rhn.redhat.com on test server or another linux machine to see if it works.

9)Keep checking your logs of tomcat, mysql and http log files on a weekly basis,rotate the same

10)Maintain two applications on your server, one where the client can evaluate his changes and the second where the client uses on a daily basis. A test application and the regular version, the live version to be exact.

11)Get a database server on a priority basis !!!

12)To reduce the number of steps in a web application.
  • Put all the css on top of the web page(i.e. in the head tag).
  • Put all the javascripts at the bottom of the web page.
  • Minify the javascripts and the css files.
  • Do not include unwanteded javascripts and Css  files in an html page.
  • Add Future Expires Headers in the httpd.conf. file:
<FilesMatch"\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Apr 2010 20:00:00
GMT"

</FilesMatch>
  • Add
    Cache-Control Headers in the httpd.conf. file:
<FilesMatch
"\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">

Header set Cache-Control "max-age=290304000,
public"

</FilesMatch>
13)Set all objects to null (especially hashtables and vectors) once the work is done by them in the code or are not needed anymore.Never create an object INSIDE a Loop.Use log4j extremely sparingly.

14)Follow naming convention of struts2 as directed in,
http://struts.apache.org/2.1.6/docs/action-configuration.html#ActionConfiguration-WildcardMethod

15)Use loops sparingly, clear demarcation of logic in struts action and in javascript

16)Keep library files EITHER in tomcat/Lib or in webapps/projectname/lib not in both

17)Use the following to add index to BLOB object types in MySql
ALTER TABLE tablename ADD INDEX fieldname(name(1048576))

18)Implement production values of all config files for tomcat's server.xml, web.xml and context.xml.
http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html#Production%20Configuration
server.xmlchanges : 
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="2000" redirectPort="8443"
compression="on"
compressableMimeType="text/html,text/xml,text/plain,application/x-javascript,image/gif,text/css,image/gif" enableLookups="false"/>



web.xml changes:
<init-param>
<param-name>development</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>genStringAsCharArray</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>
context.xml changes:  <Context reloadable="false" delegate="false"privilieged="false">
 
logging.properties changes: 
set warning status to SEVERE will reduce log file size.


struts.properties changes:
struts.custom.i18n.resources=ApplicationResource
struts.devMode=false
struts.i18n.reload=false
struts.xslt.nocache=false
struts.configuration.xml.reload=false
persistence.xml changes:
<property name="toplink.jdbc.user" value="dbusername"/>
<property name="toplink.jdbc.password"value="dbpassword"/>
<property name="toplink.jdbc.url"
value="jdbc:mysql://localhost:3306/dbname?autoReconnect=true"/ gt;

<property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="toplink.cache.type.default" value="SoftWeak"/>
<property name="toplink.cache.size.default" value="3000"/>
<property name="toplink.target-database"value="MySQL4"/>
<property name="toplink.jdbc.bind-parameters" value="true"/>

19)Implement production values for all and any frameworks used,struts 1, struts 2 and toplink
http://struts.apache.org/2.0.11.1/docs/performance-tuning.html
http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/toc.htm

20)Specifically, keep dev mode false in tomcat and struts 2, use soft weak references in persistence.xml, keep number of objects to 3000, keep AutoReconnect=true in the connector string

21)Remove all leading and trailing spaces around the "=" sign from ApplicationResources.Properties files

22)Use latest libraries whenever possible, especailly for commons- jars and mysql connector jars, avoid using 5.0 and earlier versions of these.

23)Implemented thread cache, increased wait_timeout, increased interacitve_timeout, max_connections, max_user_connections by logging into mysql through the command prompt and then typin following command, set global variable_name=value; Which variable to set can be seen by using the the show variables; command. DB status can be seen, by using show status;

24)Perm gen error solved for a 4 GB server with RAID 5 haveing RHEL 5 ES. With one jsp/servlets, two struts 1.2.9 and one struts 2.0.9 application all on a tomcat 6.0.20 server, mysql 5.1.38 on it. With 150 users on it making nearly 7000 entries every month.
After doing all of the above.Added following in catalina.sh and then restarted tomcat
JAVA_OPTS="-server -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled -XX:CMSInitiatingOccupancyFraction=70 -XX:TargetSurvivorRatio=90 -XX:+CMSParallelRemarkEnabled -Djava.awt.headless=true"