2010/11/16

XMLHttpRequest not refreshing

I have been playing for some days now with writing some interacting javascript (dynamic forms and so on). Although I already did that in the past I had never played around with the XMLHttpRequest object. To overcome that I tried the XMLHttpRequest so that I could split up data from the javascript code.

One thing I noticed was that the xml request was cached by IE. I tried refreshing the page but this didn't help. The only thing I could do was surf manually to the xml and refresh it so that the cache was updated. This ofcourse was not acceptable. I found two solutions that worked for me.

The first solution was creating a hidden iframe that showed the xml. When you refresh the page, it also refreshes the iframe and thus the cache is updated. Not elegant but it works for not so dynamic pages. Here is an example

<div style="visibility:hidden;display:none"><iframe src="http://tendertechie.tries.technology.com/myxml.xml" id="resframe"></iframe></div>

*** btw if you want to post html code like this but don't want it to be interpreted on blogger.com, you can change the lesser then sign < by the html equivalent &lt; and ofcourse the > by &gt; . To show this code again I used &ampgt; :D


The second one I came up with was while I was driving my car. I was thinking about an old webbased game I used to play (http://cq2.speedxs.nl/indexnl.php). I remembered that while traveling, the webmaster added a ?move=c first in the url and then a ?move=q for the following request. The pattern was constantly alternating. This allowed the page to be refreshed without having caching problems. When I came home I tried to add ?upd=randomdata to my xml url and see if it would display the data correctly (this was the case). This led me to believe that I could refresh the data by adding random new data every time I requested an xml. And was is more "random" then time (read is always different). I came up with the following code

function getXMLDocViaMethod(url,method,reload)
{
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if(reload)
{
var d = new Date();
url = url+"?updch="+d.getTime();
}
xmlhttp.open(method,url,false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
return xmlDoc;
}

If you want to read more about xmlhttprequest, I suggest using the w3schools site. They have good examples that you can interactively try out. Here is a quick link!

2010/10/24

MOB

I have always been a big scripting fan. Scripts make the IT-admin-life so much easier. That is why I always am shocked when IT guys say they hate scripting.

When ESX 4.1 was released I was very happy to hear that VMware is now supporting kickstart scripting in ESXi. Trying it out, I found liam his article about kickstart scripting ESXi (http://www.virtuallyghetto.com/2010/09/automating-esxi-41-kickstart-tips.html). If you don't know liam, you have been living under a rock. This guy is one of the best vmware scripters out there and is quite famous for his perl linkedclone script.

One of the cool things he mentions is tip 7 on how to execute vi api commands via the mob web interface. Playing around with it I made some -hopefully useful- scripts for everybody to play with.
  • date.py : set the date and time
  • dns.py : to set your hostname,dns servers, domain and searchdomains
  • domain.py : join your ESXi hosts to a domain
  • maintmode.py : to enter/exit maintenaince mode
  • gateway.py : to alter your gateway
  • service.py : to start/stop/auto on or off a service like for example ntpd
  • ntp.py : configure ntp servers and on or off of the service
The scripts use the simplymob.py to do the webhandling (so that i didn't have the copy it all over again). The script has to be in the same location of the script you are using.

You can find all the files here

2010/08/19

vWorkspace locks VM

Recently a colleague of mine was playing with the vWorkspace broker from Quest Software. It was all fun and games until vWorkspace decided to lock one of the VMs. Result:
-Unable to delete snapshots (creating them was no problem)
-Unable to migrate the virtual machine
-Unable to delete the virtual machine
-Unable to remove the virtual machine from the inventory.
Notice, they did not throw an error. The options were just grayed out.

Of course I like a challenge so I started my quest ;)

First of all I noticed that I was able to create snapshots, remove the virtual machine from the inventory and so on directly from the ESX host. This was my first clue. Removing the machine from the ESX locally created an orphaned machine. Luckily since the VM was down I could power it on and it was reregistered and no longer orphaned. This lead me to believe that the problem was in the vCenter database.

I started searching the KB and I found the following article

So I started by shutting down vCenter. I then opened up the database and executed
  • select ID from VPX_ENTITY where name ='';
This returned an ID. I then executed
  • delete from VPX_VM where ID=;
  • delete from VPX_ENTITY where ID=;
In my case this deleted 2 rows (one row for each VM)

Lastly I restarted the virtual center. Because the virtual machine was still available on the ESX it was "rediscovered" by vCenter after booting. Result : VM unlocked.

This let me believes that the vWorkspace changes something in the database that locks the virtual machine. Probably the result of some linked-clone locking...

Notice : I have no idea if this broke vWorkspace things though ;)

2010/08/18

IBM Quick Links

ESX and HS22 : some pointers

I recently had some problems with ESX(i) and HS22 blades. Thought I just blog them for future reference.

First of all 2 driver problems. You'll need to install the vsphere cli to solve them (http://www.vmware.com/support/developer/vcli/)

The procedure for both drivers is similar:
  • Extract the ISO
  • Find the offline bundle f.e BCM-bnx2-2.0.7c-1.0.4.00000-offline_bundle-229199.zip in the offline-bundle directory
  • Install the driver by executing : vihostupdate.pl --server --password --username root --install --bundle c:\path\to\zip\BCM-bnx2-2.0.7c-1.0.4.00000-offline_bundle-229199.zip

Another problem. If you have an ESXi recovery cd for you HS22 with Part number (P/N) 60Y0073 you might find that the cd is not booting. If you put the cd in a laptop you will see why. The manufacturer has burned the iso literally on the cd. This means you will need to copy the iso file to you hard disk and then properly burn it to a cd with for example cdburnerxp , brasero or disk utility in Mac. Alternatively, you can open a call at IBM and wait for a replacement part

Lastly while updating the HS22 I have been encountering a lot of problems with doing firmware upgrades. One neat trick I learned is that the uEFI will load it defaults settings after 3 unsuccessful boots! Another thing I learned is that it is better to update the IMM first and then the rest of the components. What I do is now

2010/06/16

Electronic calls @ IBM

Problems with IBM hardware?! Open a call directly without calling to first line :)

http://bit.ly/bjvWA8

2010/03/29

Firefox direct link if you are living in EU or Belgium

Don't you hate it when you want to install firefox on a windows 2003 server just to download some binairies? Here is a fast link for you guys so you don't have to accept 30 mirrors before the auto-redirect page finally hits the same page
Belnet Firefox