Wordpress on Android

I noticed the wordpress app on android market doesn’t support the version on my site. Its been a while since I’ve been wanting to upgrade wordpress. Ever since I saw an android app for wordpress, I’ve been wanting to try it out from my phone. Not that I am a regular poster, but I love my HTC Hero and I am obsessed with having everything on it. 

I thought upgrading wordpress would be a real pain, copying over new files, modding my existing theme for the new version, upgrading the database, fixing broken stuff. But to my surprise it took only 5 mins to untar the new files, goto admin panel and click "Upgrade Database" viola! 

Futhermore, I didn’t have to make any changes to the theme, it just worked out of the box…

Guess i’ll stop being too lazy…………………………………………………………………..naah! :b

Webpshere restart checker

A simple script to check if the websphere process is stopped or was restarted

#!/bin/ksh
##############################################################################
# Description – Check WebSphere Application Server
#
# This script checks the WebSphere process if its stopped/restarted recently
# Sanoop Kuniel (16-12-09)
#############################################################################

## Set Profile and Server instance to monitor ##
set -A profiles “AppSrv01″ “AppSrv02″
set -A servers “server1″ “server2″

notify_list=”sanoop_kuniel@aviva-asia.com”

i=0
while [ $i -lt ${#profiles[@]} ]
do

profile=${profiles[$i]}
server=${servers[$i]}
old_processid=”"

(( i=i+1 ))

result_file=”/tmp/CheckWAS.$profile.$server.result”

echo “##Script Start##” > $result_file
date >> $result_file
count_file=”/tmp/CheckWAS.$profile.$server.count”

## Check if we can find the last recorded process id if not assume first run os script
if [ -f $count_file ]
then
old_processid=`cat $count_file|cut -c 1-8`
echo “Found last recorded process id : $old_processid” >> $result_file
fi

echo “Hostname :: ” `hostname` >> $result_file
ps -ef|grep $profile|grep $server|grep -v grep|awk ‘{print $2}’>$count_file
was_count=`wc -l $count_file |cut -c 1-8`

echo “Profile :: $profile” >> $result_file
echo “Instance :: $server” >> $result_file

if [ $was_count = 0 ]
then
echo “!!!!!!!!! WebSphere Application Server is not running !!!!!!!!!” >> $result_file
mail -s “WEBSPHERE STOPPED on `hostname` – $profile – $server” “$notify_list”< $result_file
else
processid=`cat $count_file|cut -c 1-8`
if [ -z "$old_processid" ]
then
old_processid=$processid
fi
last_processid=`cat /usr/IBM/WebSphere/AppServer/profiles/$profile/logs/$server/$server.pid`

## Compare all process ids
if [ "$old_processid" != "$processid" ] || [ "$processid" != "$last_processid" ] || [ "$old_processid" != "$last_processid" ]
then
echo "Server was restarted!!" >> $result_file
echo “Last recorded process id :: $old_processid” >> $result_file
echo “Process id in pid file :: $last_processid” >> $result_file
echo “Current process id :: $processid” >> $result_file
mail -s “WEBSPHERE RESTART on `hostname` – $profile – $server” “$notify_list”< $result_file
echo "##Script End##" >> $result_file
exit 1
fi
echo “Process id :: `cat $count_file`” >> $result_file
echo “WebSphere is running…exiting” >> $result_file
fi
echo “##Script End##” >> $result_file
done

DB2 restore with rollforward

I recently had a few problem trying to restore a DB2 online compressed backup from one AIX machine to another. 

I thought it would have been a simple process as saying

db2 restore db MYDB from /home/user/backup

which worked fine, Untill i tried to connect to the database. That is when i got the error

db2 => connect to MYDB
SQL1117N A connection to or activation of database “AM2″ cannot be made
because of ROLL-FORWARD PENDING. SQLSTATE=57019

So i tried searching for a solution and tried everything i could.

db2 => rollforward db MYDB to end of logs and stop
SQL4970N Roll-forward recovery on database “MYDB” cannot reach the specifiedstop point (end-of-log or point-in-time) because of missing or corrupted log
file(s) on database partition(s) “0″. Roll-forward recovery processing has
halted on log file “S0001797.LOG”.
db2 => rollforward db MYDB complete
SQL1276N Database “MYDB” cannot be brought out of rollforward pending state
until roll-forward has passed a point in time greater than or equal to
“2009-09-25-06.39.04.000000 UTC”, because node “0″ contains information later
than the specified time.
db2 => rollforward db MYDB to 2009-09-25-06.39.04.000000 and stop
SQL1274N The database “MYDB” requires roll-forward recovery and the
point-in-time must be to the end of logs.
db2 => rollforward db MYDB query status

Rollforward Status

Input database alias = MYDB
Number of nodes have returned status = 1

Node number = 0
Rollforward status = DB working
Next log file to be read = S0001797.LOG
Log files processed = S0001795.LOG – S0001796.LOG
Last committed transaction = 2009-09-25-06.39.04.000000 UTC

To cut it short this is what i did to fix it.

db2 => restore db MYDB from /home/db2inst1/OSOL logtarget /tmp
DB20000I The RESTORE DATABASE command completed successfully.

db2 => rollforward db MYDB to end of logs and stop overflow log path (/tmp) noretrieve

Rollforward Status

Input database alias = MYDB
Number of nodes have returned status = 1

Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = S0001795.LOG – S0001799.LOG
Last committed transaction = 2009-09-25-06.39.04.000000 UTC

DB20000I The ROLLFORWARD command completed successfully.
db2 => connect to MYDB

Database Connection Information

Database server = DB2/AIX64 9.1.4
SQL authorization ID = DB2INST1
Local database alias = MYDB

Promote free software – DUMP VISTA!

The free software foundation has started up a campaign to promote free software and oppose the adoption of Microsoft Windows Vista. Its about time someone thought of this. I would encourage everyone to support the FSF and sign the petition at http://www.badvista.org. So gohead, support a righteous cause.

DUMP VISTA!

db2move import utf-8

Well it starts off as a simple export/import of an UTF-8 database from AIX to Windows. I have an UTF-8 database on an AIX box and I created a UTF-8 database on the windows to replicate the setup on AIX with 

db2 create db MYUTFDB codeset UTF-8 territory US

and did the following to export the schema and the data from the AIX box

db2look -d MYUTFDB -ea -o mydbddl.sql
db2move AMUTF export

 

and on the windows box did this to import it on my newly created UTF-8 DB.

db2 -tvf mydbddl.sql
db2move MYUTFDB IMPORT

 

Now comes the time for a 2 day long struggle to find out why the utf-8 data inside the tables are all messed up, and all I could see are characters looking like "–>–>". When i opened up the ixf file for the imported tables using Notepad++ Instead of seeing actual characters (ex: in Japanese) i could only find "SUB" (Hex: 1A1A). To keep the long story short this is what i used to solve the problem

db2set DB2CODEPAGE=1208
db2 terminate
db2 force applications all
db2stop
db2start

I did this both on the AIX and Windows box. 

 The reason being, for some reason the db2move export on the AIX box, always exported the IXF files in the codepage 819 instead of 1208, eventhough my database was set to codepage 1208. Hence problem solved!

World Peace! 

catch that ESB! – ServiceMix the right concoction for all your ESB needs.

Yes i’ve been lazy! as always!. And this latest post is in response to the question "time to update ur blog?" from someone i know. You know who you are :D , and i know you are the only one reading it :p
So here goes, educate yourself :D . Go back to your Maths and Physics after ur done, ok?

What is ESB?

ESB (Enterprise Service Bus) is not just a fancy name used in the Java world, Its become an iconic term when people talk about "Integration". Imaging 10 different applications wanting to communicate with each other by some means, and lets say each application has some form of communication link between them, the end result? a mesh of communication links running across each of the individual applications resulting in CHAOS! The way ESB solves this problem is providing a single interface to for application to communicate to each other, synonymous to a line and different components connected to the same line at different places. Something like a BUS? :D

Now for some technical jargon….. 

The purpose of an ESB is to facilitate application and process integration by providing distributed processing, intelligent routing, security, and dynamic data transformation. In an ESB these services are infrastructure services so each application does not have to implement these requirements independently and in a proprietary manner. The ESB addresses the disadvantages of existing solutions by creating a standard infrastructure for integration. Point-to-point solutions, where each of n components requires n-1 interfaces for full communication, are replaced by a bus solution where each component requires a single interface to the bus for global communication. An ESB provides distributed messaging, routing, business process orchestration, reliability and security. It also provides pluggable services and, because of the standard bus, these pluggable services can be provided by third parties and still interoperate reliably with the bus.

ServiceMix – Whats it all about?

ServiceMix was an Apache incubator project which finally graduated and is now an Apache top level project. Apache ServiceMix is an Open Source ESB (Enterprise Service Bus) that combines the functionality of a Service Oriented Architecture (SOA) and an Event Driven Architecture (EDA)  to create an agile, enterprise ESB. Its an open source distributed ESB built from the ground up on the  Java Business Integration (JBI) specification JSR 208 and released under the Apache license. The goal of JBI is to allow components and services to be integrated in a vendor independent way, allowing users and vendors to plug and play. 

Why ServiceMix?

There are many vendors that provide ESB solutions (like Oracle ESB and IBM Websphere ESB), but there is no universal agreement as to the best design or architecture for an ESB. ServiceMix has a design that is based on the JBI (JSR 208) specification in order to create a standards based ESB and the ServiceMix ESB combines the functionality of both a Service Oriented Architecture (S0A) and Event Driven Architecture (EDA) to achieve an agile, enterprise ESB.As previously stated, ServiceMix is an open source ESB that is based on the Java Business Integration (JBI) standard. These two factors, open source and open standards-based, allow for low entry cost, maximum flexibility, reuse, and investment protection.

ServiceMix uses yet another Apache project ActiveMQ to provide remoting, clustering, reliability and distributed failover. Iam not going to go into any details on using ServiceMix, there are already plenty of resource for it on the project’s homepage. So goahead and give it a try.

OpenWRT on ASUS WL500gP – Router on Steroids!

I was tired of my old Netgear wireless router, since i had to reset it every…hmm lemme think…1hr!! and i used to go crazy walking to it on the other room and reset it. But finally its all over, i got myself a nice and shiny new ASUS WL500g Premium. Trying to find it at SimLim Square was kinda pain in the arse, considering only one shop had it. The primary reason i wanted to get this particular router was, it had 2 USB ports (called Storage Link in Linksys terminology) making it somewhat of a NAS (Network Attached Storage). The firmware provided was all good, but i needed something better and what better than OpenWRT (http://www.openwrt.org), the open-source linux os for the router initially made for the Linksys WRT series routers but was later ported to routers made by ASUS, Buffalo etc. To make it more clear, this is what the creator of OpenWRT have to say about it.

"OpenWrt is described as a Linux distribution for embedded devices.

Instead of trying to create a single, static firmware, OpenWrt provides a fully writable filesystem with package management. This frees you from the application selection and configuration provided by the vendor and allows you to customize the device through the use of packages to suit any application. For developer, OpenWrt is the framework to build an application without having to build a complete firmware around it; for users this means the ability for full customization, to use the device in ways never envisioned."

What makes OpenWRT so great?

Well it depends on how much you love the word "Freedom". It lets you install everything from an OpenVPN Server,Web Server, FTP Server, Samba Server or a simple NAS server. and the best part its worth around 179 SGD and you get a low end server which always stays on. You could even use it as a bittorrent or an emule client to download stuff of P2P without even having to switch on your PC. It comes with all the goodies provided by the Linux 2.4 kernel.

Another project that complements OpenWRT is X-Wrt (http://www.x-wrt.org ) which is a web interface to configure OpenWRT based systems.

To get started I used the image http://downloads.x-wrt.org/xwrt/firmware_images/whiterussian/ 0.9/latest-daily-build/openwrt-brcm-2.4-squashfs.trx
which comes pre-built with x-wrt packages. And i used the TFTP method mentioned in OpenWRT Wiki to update the firmware

1. Connect your PC to the routers with one of the LAN ports on the routers.

2. Set your PCs IP to a static IP (ex: 192.168.1.10)

3. Unplug the power cord on the router

4. Push the RESTORE (not the red EZsetup!!!!) button on the router using a pen or such, and keep the button pushed down.

5. Plug the power on the router while keeping the (black) RESTORE button pushed for few seconds.

If you see a slowly blinking power light, you’re in diag mode. Now the router should accept an image via tftp.

6. On the PC open up a cmd window.

7. Type "tftp -i 192.168.1.1 PUT openwrt-brcm-2.4-squashfs.trx" and press enter in the command window.

8. After the tftp upload is complete, wait at least 6 minutes. Asus WL-500gP doesn’t seem to reboot automatically after the upgrade is complete. You need to plug off the power, and plug it back on to make the router alive again.

after the router is back up. goto http://192.168.1.1 to get access to the x-wrt management interface.

and don’t forget to use the mighty SSH to login to the router and let your imagination run wild!

 

IPv6 and Reverse DNS (an IRC addicts paradise)

Like always, lazy and sleepy all thanks to KFC’s cheese fries. I’ve been in hibernation for too long. And now that i’ve finally woken up to write something, i would like to write about something that i’ve always liked IRCing, though iam not into it much these days but it still brings back memories. OK then no more talking, lets get back to the point.

hmm, IPv6……

Well IPv6 is the next generation protocol for the Internet. IPv6 is already being tested by a lot of organizations and universities. And for the answer to the first question "Why?", well we are running out of address space. The current internet protocol IPv4 can support a maximum 232 (approx 4.3 billion) distinct addresses and even with things like NAT (Network Address Translation) we are still going to run out of addresses someday. Hence all the smart people around the world have come up with something called IPv6 (aka. IP version 6, as in TCP/IP? :) . IPv6 supports 5×1028 addresses for each of the roughly 6.5 billion people alive today. Unlike IPv4 addresses which look something like 192.168.1.2, IPv6 addresses are normally written as eight groups of four hexadecimal digits ex: 2001:0db8:0000:0000:0000:0000:1428:57ab. Well enought talking getting back to our topic. People on IRC would love to show off l33t host names, something like "southpark.kicks-ass.net" (a.k.a Reverse DNS entries for IPs) instead of an IP when they join a channel and as with the case of IPv4, the people who own the rights to set these Reverse DNS entries are most likely your ISPs or if you own a dedicated server, your server provider. But with the case of IPv6, these rights can be all your, and wats better ITS FREE!! :D

Q: what do you need to have to get you started with IPv6? 

A: An IPv6 Tunnel (Which creates dynamic IPv6 tunnels between someone called the Tunnel Broker  (People who provide IPv6 tunnels) and your machine)

These Tunnels route your traffic over the existing IPv4 network and connect you the world of IPv6. So after you have setup an IPv6 tunnel your traffic would be routed something like this

<Your IPv6 Network/Host–>  IPv4 (Your ISP) <— IPV4 Network — > IPv6 Network.

In short all your IPv6 traffic would be tunneled through ur existing IPv4 infrastructure, hence these tunnels are also called "6to4" tunnels and visa versa.

Q: How do you create an IPv6 Tunnel?
A: There are lots of free IPv6 Tunnel providers, to name a few

    1. Hurricane Electric (http://ipv6tb.he.net)
    2. BT-exact (http://tb.ipv6.btexact.com)

refer to http://en.wikipedia.org/wiki/Tunnel_broker to get a list of tunnel brokers.

the easiest way to get started with IPv6 is to download the Gateway6 Client from http://www.go6.net/4105/download.asp formally known as freenet6. Register for an account at www.go6.com and install the Gateway6 client and run the client and provide your newly created account.

Once you startup the client, it would create a IPv6 Tunnel and install an Virtual IPv6 Tunnel adapter and you would instantly be assigned a IPv6 Address. 

To get started with Reverse DNS you must request an IPv6 Subnet by selecting "Enable Routing Advertisemen".  The next step is to assign a DNS Server that would handle reverse dns for you, again there are lots of free DNS provider out there that support creating IPv6 Zones like http://www.afraid.org and http://www.xname.org. In my case i’ve used ns1.afraid.org as the DNS server to represent afraid.org’s nameservers.

 Gateway 6 Client

 after you have requested a subnet and the gateway 6 client is restarted, your virtual ipv6 adapter would have a new address added to it something like 2001:5c0:95ad::1 and in my case i own the subnet 2001:5c0:95ad::/48 so any address from 2001:5c0:95ad::1 to 2001:5c0:95ad:ffff:ffff:ffff:ffff:ffff is all mine to cherish :)

now that you have the subnet we will start by creating a reverse dns zone at afraid.org (keep in mind they have very low tolerance on DNS abuse)
create an afraid.org account and login to it and create a new IPv6 Reverse Zone

 Under the "IPv6 Reverse" create a IPv6 Subnet with something like "2001:5c0:95ad::/48"

now add a new record for  2001:5c0:95ad::1 inside the subnet, make sure the hostname you specify has already an AAAA record pointing back to 2001:5c0:95ad::1 (Which can be setup from "Subdomain" section at afraid.org). So once the reverse DNS entry is setup you can start using your brand new host name to login to any irc network and when the irc server queries the reverse dns record for your IPv6 IP it will get hold of the hostname you just specified. PWNAGE!!

w00tw00t.at.ISC.SANS.DFind

Well i’ve been having this problem for a long time, with script kiddies trying to run scans on my server with Dfind (http://class101.org ).

These are some of these request from the apache server logs

/var/log/httpd/access_log.2:80.237.172.185 – - [05/Mar/2007:09:20:47 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.2:83.71.188.242 – - [05/Mar/2007:16:25:40 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.2:213.254.226.49 – - [06/Mar/2007:05:11:47 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.2:216.30.246.14 – - [09/Mar/2007:08:56:12 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.3:80.237.211.76 – - [25/Feb/2007:07:46:16 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.3:83.71.188.242 – - [25/Feb/2007:17:51:23 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.3:80.237.172.185 – - [27/Feb/2007:05:42:20 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400

 

All this while i’ve been lazy :D , but today i felt like trying something to fix it. What i’ve come up with is this

grep “w00tw00t” /var/log/httpd/access_log*|awk ‘{print $1}’|sed ’s/\(.*\)://g’|sort|uniq|cat /etc/apf/deny_hosts.rules -|sort|uniq

 

This is one of the things i wrote to get all the list of IPs from the Apache access logs who have been running these scans. Well the purpose of this is to feed these IPs to APF (http://www.rfxnetworks.com/apf.php ) the output of this is pumped to /etc/apf/deny_hosts.rules to block any of these lamers from further accessing my server ^_^

Only problem is for some strange reason, I couldn’t pipe the output of the command directly to /etc/apf/deny_hosts.rules. The file always ended up with output of "grep "w00tw00t" /var/log/httpd/access_log*|awk ‘{print $1}’|sed ’s/\(.*\)://g’|sort|uniq". Well maybe i’ll figure it out sometime later. SLEEPP!! awaits!!

Django for Python

Django is a web-framework similar to Rails for Ruby, i’ve not worked on rails much thought but my friend vivek seems to be the "GURU" of rails =), but when he mentioned Django i just wanted to give it a try. From what i can say Django has been a no pain and all gain framework. Easy to setup and code. In the world of Web 2.0, isn’t that want we want. I had an old friend who ones said "Good Programmers are Lazy Programmers".I still remember your words, Hats-off to you Jacob!. That said, Django is pretty easy to get things started with, I won’t start with providing a tutorials for it, the site already has a great set of tutorials. You can also check out www.djangobook.com  which is a book in making for Django. One other interesting thing to check out is a video on Django at http://video.google.com/videoplay?docid=-70449010942275062&q=Django
 

If you have trouble figuring out Django you can also drop in at the IRC channel #django at irc.freenode.net 

Well thats it from me for a while, I’ve been feeling lazy lately :b 

Next Page »