Wednesday, December 20, 2006

Unlocking mobile phones

I recently got a second mobile phone, and wanted to swap sims between the two.

The phones I wanted to unlock were a Nokia 6021, and a Nokia 6070

My experience was
  • Get your IMEI code off your phone (type *#06# into the phone).
  • Figure out if you are DCT3 or DCT 4 and your phone type from this site http://www.mobyproject.com/link/dct3&4list.txt
  • Goto this site http://unlock.nokiafree.org. Enter the details and get the code
  • Take out your sim and start phone without it.
  • Type in the bottom (7th) code from the list following the instructions from http://unlock.nokiafree.org. (Press * multiple times to get letters *, P, W +)

Voila.

Of course there are risks.
This article gives a good synopsis of what to do and some exceptions that can occur
http://www.oreilly.com/pub/wlg/3935

Good luck

Monday, October 16, 2006

Misc unix commands

chmod only dirs, using find
find /dir/to/chmod/all/dirs -type d -exec chmod a+x {} \;

Move all files after a certain date (Yesterday) , using find
find /dir/ -mtime -1 -exec mv {} ./temp \;

List only directories
ls -l | grep ^d

Find last created entity (file or directory)
ls -t ${CIDIR}| head -n 1

Find last created directory (note must use long ls results, therefore we need to parse 8th elment)
ls -tl | grep ^d | head -n 1 | awk '{print $8}'

grep multiple log files in different locations. (Join multiple lines into one line)


grep EXCEPTION `ls -t /var/log/bea/logs/MWOSBDomain/servers/MWOSB1?/customaudit/LogFile1?.log.* | head -n 3 |  tr '\n' ' '`

e.g. this will grep log files in differnt locations from yesterday (based on naming convention LogFile12.log = current log file. LogFile12.log. is rolled over log file. Assuming log files roll over every night).
Top 3 files are taken from ls command (in this case I know there are 3 log directories, so top 3 files are all yesterdays file in each directory)
List output is then 'translated', converting each line break into a space, so feed into grep command.

Dirname

Discovers the dir where the current running script is running;

Useful if writing bash scripts and you want to know where the current file is (for example if loading other companion scripts)

DIR="$( cd "$( dirname "$0" )" && pwd )"

e.g

#!/bin/bash

export DIRNAME=$(cd `dirname $0` && pwd)

source ${DIRNAME}/common.sh

#echo $JAVA_HOME/bin/java -cp $CLASSPATH ie.bge.middleware.envstatus.app.SetSystemStatus $@

$JAVA_HOME/bin/java -cp $CLASSPATH ie.bge.middleware.envstatus.app.SetSystemStatus $@

N.B. script must be executable. Therefore chmod +x


Parse log file with awk
awk normally splits lines based on whitespace characters. This can be forced however using the -F switch and passing a regex.
e.g. the following splits on semi-colon, and prints the 3rd and 6th fields.
awk -F ";" '{print $3 " " $6 }'
this example splits on commas, within quotes e.g. "value1", "value2", ..
awk -F "\"*,\"*" '{print $3}' file.csv

Identify unix version
uname -r
cat /etc/*-release
cat /etc/issue
rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n"|grep release|sort

Misc Tips
Whitepace gothcas when writing bash scripts.

Bash IF statment requires whitespace.
DIRNAME=mydir
if [ -d $DIRNAME ]; then
echo $DIRNAME exists
else
echo $DIRNAME does not exist
fi

1/ There must be NO whitespace in the set command (DIRNAME=mydir, ..e.g. the following won't work DIRNAME = mydir). Otherwise bash misinterprets the set operation as a command (called DIRNAME here).
2/ The whitespace between the IF statement and the [..] is required. e.g. (if [-d $DIRNAME]; then will cause an error)

Script to copy latest build folder to other location
#!/bin/bash
# Exit on Error
set -e
DIR=/usr/local/apache2/htdocs/Repository
CIDIR=/opt/continuous_integration/build_archive/
echo $#
if [ $# -ne 1 ]; then
echo Usage: PublishBuild.sh VER. Must supply version number.
exit 1
fi
VER=$1
if [ ! -d ${DIR}/$VER ]; then
mkdir ${DIR}/$VER
fi
if [ ! -d ${DIR}/${VER}/osb ]; then
mkdir ${DIR}/$VER/osb
fi
CIB=`ls -t ${CIDIR}| head -n 1`
echo cp -R ${CIDIR}/${CIB}/* ${DIR}/${VER}/osb
cp -R ${CIDIR}/${CIB}/* ${DIR}/${VER}/osb
echo Copied ${CIB} to ${VER}
exit 0

Friday, October 13, 2006

Drupal built in Global

Heres the small prog to produce this list

foreach($GLOBALS as $g=>$v){
if(is_array($v)){
echo("$g = Array {");
foreach($v as $a2=> $b2){
echo("$a2=$b2,");
}
echo("}");
}else
echo("$g = $v");
}

Heres the list
  • HTTP_POST_VARS = Array {}
  • _POST = Array {}
  • HTTP_GET_VARS = Array {q=node/11,}
  • _GET = Array {q=node/11,}
  • HTTP_COOKIE_VARS = Array {MANTIS_PROJECT_COOKIE=5,PHPSESSID=b9fb481c4b12115c83761754702db5ae,MANTIS_STRING_COOKIE=b36c8ddd894abf6d551b90aed8552328be6ab68c73aafdf3d611d932e25c67da,userwdth=null,userfontsz=null,userbg=null,phpMyAdmin=8d176d85421e8ec646ce148c4893cbec,}
  • _COOKIE = Array {MANTIS_PROJECT_COOKIE=5,PHPSESSID=b9fb481c4b12115c83761754702db5ae,MANTIS_STRING_COOKIE=b36c8ddd894abf6d551b90aed8552328be6ab68c73aafdf3d611d932e25c67da,userwdth=null,userfontsz=null,userbg=null,phpMyAdmin=8d176d85421e8ec646ce148c4893cbec,}
  • HTTP_SERVER_VARS = Array {HTTP_HOST=localhost,HTTP_USER_AGENT=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,HTTP_ACCEPT=text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5,HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5,HTTP_ACCEPT_ENCODING=gzip,deflate,HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7,HTTP_KEEP_ALIVE=300,HTTP_CONNECTION=keep-alive,HTTP_REFERER=http://localhost/psoup/lia/?q=node/13,HTTP_COOKIE=MANTIS_PROJECT_COOKIE=5; PHPSESSID=b9fb481c4b12115c83761754702db5ae; MANTIS_STRING_COOKIE=b36c8ddd894abf6d551b90aed8552328be6ab68c73aafdf3d611d932e25c67da; userwdth=null; userfontsz=null; userbg=null; phpMyAdmin=8d176d85421e8ec646ce148c4893cbec,HTTP_CACHE_CONTROL=max-age=0,PATH=c:\\apps\\ruby\\ruby-184-17\\bin;c:\\apps;C:\\oracle\\product\\10.2.0\\db_2\\bin;c:\\beaSP2\\jdk141_05\\bin;c:\\apps\\ruby\\bin;c:\\apps\\sybase\\OCS-12_5\\lib3p;c:\\apps\\sybase\\OCS-12_5\\dll;c:\\apps\\sybase\\OCS-12_5\\bin;c:\\apps\\sybase\\SQLRemote\\dll;c:\\apps\\sybase\\RPL-12_5\\bin;c:\\apps\\sybase\\JS-12_5\\bin;c:\\apps\\sybase\\ASE-12_5\\dll;c:\\apps\\sybase\\ASE-12_5\\bin;C:\\Program Files\\ATI Technologies\\ATI Control Panel;c:\\apps\\imagemagick-6.1.5-q16;c:\\apps\\gpg\\bin;c:\\apps\\sybase\\OLEDB;c:\\apps\\cvs;c:\\apps\\sybase\\ODBC;c:\\apps\\sybase\\ASEP_Win32;c:\\apps\\sybase\\OCS-12_5\\dll;c:\\apps\\sybase\\OCS-12_5\\lib3p;c:\\apps\\sybase\\OCS-12_5\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program Files\\ATI Technologies\\ATI Control Panel;c:\\apps\\apache-ant-1.6.2\\bin;C:\\Program Files\\Subversion\\bin;c:\\apps\\php-4.3.9-Win32;C:\\Program Files\\Common Files\\GTK\\2.0\\bin;c:\\Program Files\\MySQL\\MySQL Server 4.1\\bin;C:\\Program Files\\cvsnt;C:\\apps\\php-4.3.9-Win32;C:\\Program Files\\QuickTime\\QTSystem\\,SystemRoot=C:\\WINDOWS,COMSPEC=C:\\WINDOWS\\system32\\cmd.exe,PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW,WINDIR=C:\\WINDOWS,SERVER_SIGNATURE=
  • Apache/2.0.58 (Win32) PHP/4.3.9 Server at localhost Port 80
  • ,SERVER_SOFTWARE=Apache/2.0.58 (Win32) PHP/4.3.9,SERVER_NAME=localhost,SERVER_ADDR=127.0.0.1,SERVER_PORT=80,REMOTE_ADDR=127.0.0.1,DOCUMENT_ROOT=C:/Program Files/Apache Software Foundation/Apache2/htdocs,SERVER_ADMIN=admin@ad.aol.aoltw.net,SCRIPT_FILENAME=C:/dev/psoup/lia/index.php,REMOTE_PORT=2251,GATEWAY_INTERFACE=CGI/1.1,SERVER_PROTOCOL=HTTP/1.1,REQUEST_METHOD=GET,QUERY_STRING=q=node/11,REQUEST_URI=/psoup/lia/?q=node/11,SCRIPT_NAME=/psoup/lia/index.php,PHP_SELF=/psoup/lia/index.php,PATH_TRANSLATED=C:/dev/psoup/lia/index.php,}
  • _SERVER = Array {HTTP_HOST=localhost,HTTP_USER_AGENT=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,HTTP_ACCEPT=text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5,HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5,HTTP_ACCEPT_ENCODING=gzip,deflate,HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7,HTTP_KEEP_ALIVE=300,HTTP_CONNECTION=keep-alive,HTTP_REFERER=http://localhost/psoup/lia/?q=node/13,HTTP_COOKIE=MANTIS_PROJECT_COOKIE=5; PHPSESSID=b9fb481c4b12115c83761754702db5ae; MANTIS_STRING_COOKIE=b36c8ddd894abf6d551b90aed8552328be6ab68c73aafdf3d611d932e25c67da; userwdth=null; userfontsz=null; userbg=null; phpMyAdmin=8d176d85421e8ec646ce148c4893cbec,HTTP_CACHE_CONTROL=max-age=0,PATH=c:\\apps\\ruby\\ruby-184-17\\bin;c:\\apps;C:\\oracle\\product\\10.2.0\\db_2\\bin;c:\\beaSP2\\jdk141_05\\bin;c:\\apps\\ruby\\bin;c:\\apps\\sybase\\OCS-12_5\\lib3p;c:\\apps\\sybase\\OCS-12_5\\dll;c:\\apps\\sybase\\OCS-12_5\\bin;c:\\apps\\sybase\\SQLRemote\\dll;c:\\apps\\sybase\\RPL-12_5\\bin;c:\\apps\\sybase\\JS-12_5\\bin;c:\\apps\\sybase\\ASE-12_5\\dll;c:\\apps\\sybase\\ASE-12_5\\bin;C:\\Program Files\\ATI Technologies\\ATI Control Panel;c:\\apps\\imagemagick-6.1.5-q16;c:\\apps\\gpg\\bin;c:\\apps\\sybase\\OLEDB;c:\\apps\\cvs;c:\\apps\\sybase\\ODBC;c:\\apps\\sybase\\ASEP_Win32;c:\\apps\\sybase\\OCS-12_5\\dll;c:\\apps\\sybase\\OCS-12_5\\lib3p;c:\\apps\\sybase\\OCS-12_5\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program Files\\ATI Technologies\\ATI Control Panel;c:\\apps\\apache-ant-1.6.2\\bin;C:\\Program Files\\Subversion\\bin;c:\\apps\\php-4.3.9-Win32;C:\\Program Files\\Common Files\\GTK\\2.0\\bin;c:\\Program Files\\MySQL\\MySQL Server 4.1\\bin;C:\\Program Files\\cvsnt;C:\\apps\\php-4.3.9-Win32;C:\\Program Files\\QuickTime\\QTSystem\\,SystemRoot=C:\\WINDOWS,COMSPEC=C:\\WINDOWS\\system32\\cmd.exe,PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW,WINDIR=C:\\WINDOWS,SERVER_SIGNATURE=
  • Apache/2.0.58 (Win32) PHP/4.3.9 Server at localhost Port 80
  • ,SERVER_SOFTWARE=Apache/2.0.58 (Win32) PHP/4.3.9,SERVER_NAME=localhost,SERVER_ADDR=127.0.0.1,SERVER_PORT=80,REMOTE_ADDR=127.0.0.1,DOCUMENT_ROOT=C:/Program Files/Apache Software Foundation/Apache2/htdocs,SERVER_ADMIN=admin@ad.aol.aoltw.net,SCRIPT_FILENAME=C:/dev/psoup/lia/index.php,REMOTE_PORT=2251,GATEWAY_INTERFACE=CGI/1.1,SERVER_PROTOCOL=HTTP/1.1,REQUEST_METHOD=GET,QUERY_STRING=q=node/11,REQUEST_URI=/psoup/lia/?q=node/11,SCRIPT_NAME=/psoup/lia/index.php,PHP_SELF=/psoup/lia/index.php,PATH_TRANSLATED=C:/dev/psoup/lia/index.php,}
  • HTTP_ENV_VARS = Array {}
  • _ENV = Array {}
  • HTTP_POST_FILES = Array {}
  • _FILES = Array {}
  • _REQUEST = Array {q=node/11,MANTIS_PROJECT_COOKIE=5,PHPSESSID=b9fb481c4b12115c83761754702db5ae,MANTIS_STRING_COOKIE=b36c8ddd894abf6d551b90aed8552328be6ab68c73aafdf3d611d932e25c67da,userwdth=null,userfontsz=null,userbg=null,phpMyAdmin=8d176d85421e8ec646ce148c4893cbec,}
  • conf = Array {array_filter=1,comment_image=2,comment_page=0,comment_story=2,file_directory_temp=c:\windows\temp,filter_default_format=3,filter_html_1=1,image_help=,menu_primary_menu=2,menu_secondary_menu=2,minimum_image_size=0,minimum_page_size=0,minimum_story_size=0,nice_menus_menu_1=42,nice_menus_name_1=Nice Menu 1,nice_menus_number=1,nice_menus_type_1=down,node_options_forum=Array,node_options_image=Array,node_options_page=Array,node_options_story=Array,page_help=,story_help=,theme_default=bluemarine2,type=page,upload_image=1,upload_page=1,upload_story=1,}
  • db_url = mysql://root:@localhost/lia
  • db_prefix =
  • base_url = http://localhost/psoup/lia
  • base_path = /psoup/lia/
  • base_root = http://localhost
  • db_type = mysql
  • active_db = Resource id #6
  • HTTP_SESSION_VARS = Array {watchdog_overview_filter=all,node_overview_filter=Array,}
  • _SESSION = Array {watchdog_overview_filter=all,node_overview_filter=Array,}
  • user = Object
  • queries =
  • timers = Array {page=Array,}
  • locale = en
  • multibyte = 0
  • _menu = Array {path index=Array,items=Array,callbacks=Array,visible=Array,}
  • theme = bluemarine2
  • theme_engine = phptemplate
  • custom_theme =
  • theme_key = bluemarine2
  • sidebar_indicator =

Sunday, September 24, 2006

Wednesday, August 30, 2006

Drupal idiosyncracies

  • The always present "Create Content" menu item (even when users aren't logged in)
http://drupal.org/node/47212
In particular, simply "Reset" the menu item should fix it

  • Read More tag in postings
    http://drupal.org/node/64051
Menus
Should write module to allow new terms to be added to menu system. At moment must create terms. Then create content using those terms. As part of this you can select create menu item.

Nice Menus.
By default css only supplies styles for 1 sublevel. Thus higher sublevels autoexpand. Add the following to stop this
(see http://drupal.org/node/65482)

// Add extra layer to stop 2nd level submenus from autoexpanding
//level 2
ul.nice-menu ul,
ul.nice-menu li:hover ul ul, ul.nice-menu li.over ul ul,
ul.nice-menu li:hover li:hover ul ul, ul.nice-menu li.over li.over ul ul {
display:none;
}

ul.nice-menu li:hover ul, ul.nice-menu li.over ul,
ul.nice-menu li:hover li:hover ul, ul.nice-menu li.over li.over ul,
ul.nice-menu li:hover li:hover li:hover ul, ul.nice-menu li.over li.over li.over ul {
display:block;
}

//Level 3
ul.nice-menu ul,
ul.nice-menu li:hover ul ul, ul.nice-menu li.over ul ul,
ul.nice-menu li:hover li:hover ul ul, ul.nice-menu li.over li.over ul ul,
ul.nice-menu li:hover li:hover li:hover ul ul, ul.nice-menu li.over li.over li.over ul ul {
display:none;
}

ul.nice-menu li:hover ul, ul.nice-menu li.over ul,
ul.nice-menu li:hover li:hover ul, ul.nice-menu li.over li.over ul,
ul.nice-menu li:hover li:hover li:hover ul, ul.nice-menu li.over li.over li.over ul,
ul.nice-menu li:hover li:hover li:hover li:hover ul, ul.nice-menu li.over li.over li.over li.over ul {
display:block;

Wednesday, August 16, 2006

Java Spring and Locales

Related to my previous post. We were updating a web app and localizing it for some new countries.

The jsps used some Spring tag libs.

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />


Spring comes with an inbuilt LocaleResolver. By default it uses the AcceptHeaderLocaleResolver which detects the clients Locale from the Http headers (which are sent with the bowsers request).

In our case we didn't want the client locale to get picket up. We wanted to set it based on the servername. (To do these we added some virtual hosts to our tomcat instance).

Then to update the Spring Locale we had to use the SessionLocaleResolver . This has to be instantiated via the Spring xml file (otherwise it will default to AceptHeaderLocaleResolver).



We then simply set the Locale froma filter.

String servername = httpRequest.getServerName();
Locale locale = null;
if(servername.indexOf(".co.uk")>0){
_log.info("Setting UK locale");
locale = Locale.UK;
}else if(servername.indexOf(".fr")>0){
_log.info("Setting FR locale");
locale = Locale.FRANCE;
}else if(servername.indexOf(".de")>0){
_log.info("Setting DE locale");
locale = Locale.GERMANY;
}else{
_log.info("Cannot ascertain originating server. Defaulting to UK locale");
locale = Locale.UK;
}


HttpServletRequest

I keep forgetting these value. So I'm writing it down here to remember

Within a servlet, or Filter (or jsp) you can access the following information about the request.

httpRequest.getContextPath(); // =/webapp
httpRequest.getRequestURI(); // =/webapp/webhome
httpRequest.getServletPath(); // = /webhome
httpRequest.getRequestURL(); // = http://mybox.my:11600/webapp/webhome?q=query&r=prevPage
httpRequest.getRequestURI(); // = http://mybox.my:11600/webapp/webhome

httpRequest.getServerName(); // = mybox.my (1)
httpRequest.getRemoteHost(); // = 10.149.93.49 (2)
httpRequest.getRemoteAddr(); // = 10.149.93.49
httpRequest.getRemoteUser(); // = null ... (3)

N.B.
If you perform a RequestDispatcher.forward() then all the above methods will reflect the new forwarded values. Personally I didn't think the javadocs made this clear.

As of Servlet spec 2.4 however you can still access the original client request data using the following attributes. (see http://www.javaworld.com/javaworld/jw-03-2003/jw-0328-servlet_p.html)

  • javax.servlet.forward.request_uri
  • javax.servlet.forward.context_path
  • javax.servlet.forward.servlet_path
  • javax.servlet.forward.path_info
  • javax.servlet.forward.query_string

Inside a forwarded servlet you'll see getRequestURI() return the path to the target servlet as always, but now if you want the original path, you can call request.getAttribute("javax.servlet.forward.request_uri"). One special caveat: if forward() happens through a getNamedDispatcher() call, these attributes aren't set because, in that case, the original path elements aren't changed.

Note from servlet spec 2.2 there already exists

  • javax.servlet.include.request_uri
  • javax.servlet.include.context_path
  • javax.servlet.include.servlet_path
  • javax.servlet.include.path_info
  • javax.servlet.include.query_string
However, these work just the opposite of the forward() attributes. In an include(), the path elements don't change, so the include attributes act as the backdoor to access the target servlet's path elements. Compare this with a forward() where the path elements change so the forward attributes represent the backdoor to the original path elements.

Should filters invoke for forwarded requests? Included requests? What about for URIs invoked via the mechanism? Before Servlet 2.4, these questions were left as open issues. Now Servlet 2.4 makes it a developer's choice. There's a new element in the deployment descriptor with possible values REQUEST, FORWARD, INCLUDE, and ERROR. You can add any number of entries to a like this:


<filter-mapping>
<filter-name>Logging Filter</filter-name>
<url-pattern>/products/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

This indicates the filter should be applied to requests directly from the client as well as forward requests. Adding the INCLUDE and ERROR values also indicates that the filter should additionally be applied for include requests and requests. Mix and match for what you want. If you don't specify any elements, the default is REQUEST.

The last RequestDispatcher change is to allow, for the first time, relative paths in request.getRequestDispatcher() calls. The path will be interpreted relative to the current request's path. It's a minor change, but comes in handy when dispatching to a sibling servlet.




Notes:
No all these method are available on the basic ServletRequest. Normally I just cast the basic ServletRequest into a HttpServletRequest, since I am normally only writting web apps.

1/ This is the server name from the Request. You can set up your web server to be multi hosted using virtual hosts. (Heres an example for tomcat). Then you can use this variable to differentiate on which host they came in on. We are using this for setting the locale on one project. (In general it is better to choose the locale based on the request,but we have specific reasons for doing it this way).

2/ This is the clients IP address. Can be used for logging.

3/I'm guess this will show a value if the page is protected by HttpAuthentication.

For Php equivilents check out this page

http://www.php.net/reserved.variables

Thursday, July 06, 2006

Updating a Windows Service..

I needed to update mysql to use the old authentication mechanism...
http://dev.mysql.com/doc/refman/5.0/en/old-client.html

This involved adding some command line parameters to mysqld when it starts to use the old authentication mechanism. Unfortunately the Windows Services tool doesn't allow this.

Thanks to http://illiniguy.wordpress.com/2006/03/17/updating-a-windows-service/

regedit to

\\HKEY_LOCAL_MACHINE\SYSTEMCurrentControlSet\Services\___YOUR_SERVICE_NAME___

and edit away...

Saturday, April 08, 2006

Browser interoperability

I've had a lot of headaches with this. In general my approach is to use and libraries/ open source functions etc that are out there since they will almost certainly work better in a cross browser environemnt than what I throw together

This doesn't always work out however and I find myself writting css pages, javascript etc...

Anyway the problem. Looks like a bug in IE. It appears that the document.getElementById() function does not work... However on further examination it turns out that the ID attribute must be the first (or before most atribute) attribute in an html element.

For example

<img class="myimg" name="myimg" src="myimg.jpg" id="12"/>

If you then try to access this in javascript it doesn't work

docuemnt.getElementById("12") returns a null.

However if you re-jig the element so id is the first attribute then it works fine.. Bizarre.

<img id="12" class="myimg" name="myimg" src="myimg.jpg" />

[tested on IE 6.02]