It may not seem that hot, but steam tables are essential for modeling Rankine cycles like steam turbines and the boilers that provide steam like solar thermal. But properties are not enough, you need thermodynamic derivatives as well. The IAPWS provides correlations for water and steam properties and derivatives which I have coded in MATLAB for your use. You can find them on Github.
Friday, March 23, 2012
Tuesday, March 20, 2012
Virtually vapid
[UPDATED 2016-02-23] Now I'm swinging back to VirtualBox on both systems as the overall King of VM. Unfortunately VMWare Player 7 on my Windows machine was freezing up randomly and at one point just refused to work. It turns out that there have been a lot of changes with VirtualBox in the last 4 years, and now not only does VirutalBox include hardware virtualization but it also has valid certs for Windows. Previously there were some scary messages along the lines of, "use at your own risk," which obviously goes without saying so ... why were they saying it? Anyway, the newest VirtualBox 5 is super fast and so far stable. In addition to these obvious performance perks, the fact that VirtualBox is really free, as in FOSS, means that there are tons of great features like cloning and snapshots, and the license allows commercial use with no restrictions. The VMWare player restricts VMWare Player to non-commercial use only, and it was a free lite version of the more powerful VMWare Workstation, so lite on features. So, for now, I'm really happy!
I did it. I installed a Windows VM on Ubuntu using VirtualBox and Ubuntu VM on Windows using VMware 3.1.5 (the PC was too old for 4.0.2). VirtualBox was a breeze and fast, but VMware and Ubuntu took forever (*). You have to install VMware Tools (**) which takes like a million years. It's probably my ancient laptop and the out-of-date VM, but that was the best I could do for now. What's the point? There is no point, it's just cool.P.S. 99% of problems are solved by cycling vm, shut it down; not sleep.
P.P.S. "user$ sudo ./vmware-install.pl" (**) since you need root access and your extracted vmware-tools folder is not on your path. "user$ sudo ./bin/vmware-uninstall.pl" to remove.
Update (2012-03-21): (**) Preferred method is to use open-vm-tools from package manager since it updates with your Linux distro. Use apt-get, Synaptic or Ubuntu Software Center. In other words do not use VMware Tools.
Update (2012-03-22): After installing your guest on VirtualBox VM, install guest-additions, to get video, mouse and other drivers. If you're on Ubuntu, use the iso image in the Software Center.
Update (2012-03-23): (*) OK, I've changed my opinion a little bit, after spending an embarrassing number of hours updating from XP to SP3 for the guest VM on the Linux host. What I'm getting at is that installing the guest Linux VM was a lot faster, even though the initial XP install was pretty fast, getting the updates is painfully slow. This is a good time to make a bullet list of lessons learned:
- VMware >3 only works on machines with Hardware Assisted Virtualization like Intel VT-x.
- VirtualBox works on anything.
- If installing a guest Linux VM using VMware, do not download VMware Tools from the internet. Instead use package manager (apt-get, Synaptic or Ubuntu Software Center) to install open-vm-tools package.
- If installing VirtualBox on Linux host, use package manager and install virtualbox-qt and virtualbox-guest-additions-iso (which is the VirtualBox equivalent of VMware Tools).
- For best performance, install on a system with at least 2GB of RAM and >2 core processor. Although it will work on a single core with 1GB, you noticeably see performance suffer, and you make experience system hangs or BSOD.
- If installing a guest Windows XP VM, turn off automatic updates and instead use Windows XP Service Pack 2 Network Installation Package for IT Professionals and Developers followed by Windows XP Service Pack 3 Network Installation Package for IT Professionals and Developers. Otherwise you will spend a very long time waiting for downloads and installing them.
- Do not overtax your host machine during critical guest installations, e.g. installing OS. Think of rooting your phone - although the stakes are not as high, you want everything to go alright so you don't have to repeat the entire process on a new VM. It's also a good idea to kill your screensaver/lock/sleep feature on your host during crucial installs, otherwise your hard-drive might turn off.
- After installing guest OS, don't forget to run either open-vm-tools for VMware from the package manager or virtual-box-guest-additions-iso for VirtualBox from the devices menus option on your VirtualBox VM after you've downloaded it package manager.
xz for windows
xz is a compression tool like gz, bzip2, tar, rar, 7z & zip, to name a few. Download the windows binaries from the link above and add it to your windows path (*). Done. If you have a newish version of tar you can extract a tar.xz file with the command "tar -Jxvf filename.tar.xz". Works in dos and bash. Note: xz comes included in default Cygwin or Ubuntu installations. I don't know about minGW - msysGit did not.
(*) Adding a folder your windows path is easiest by right-clicking on your My Computer desktop icon, selecting properties and the advanced tab, then pressing the environment variables button. Select path and edit. Put the full path to your xz bin folder (c:\xz-5.0.3 for me since I copied the extracted folder there) followed by a semicolon at the beginning of the current path. Click ok, ok, ok and you're done. You can see your other in dos by typing "> echo %PATH%" and in bash it's "$ echo $PATH".
Cygwin Ports
But, although Cygwin Ports has amassed a large number of ports (awesome!), mostly GNOME, GTK+ & KDE, I personally couldn't deal with the terribly slow download speed from their ftp (maybe another mirror is faster?). More than once it timed out. Although they've added a blog and their code is in git on sourceforge, the mailing list for issues is not searchable, there is no issue tracker and IMHO support was generally lacking (sorry!).
So I went back to stock Cygwin, and lo and behold, magically I was able to build meld all on my own. See Building Meld for Cygwin.
Building Meld for Cygwin
- Download and run the setup.exe from Cygwin. If you already have Cygwin you can skip this step.
- In addition to the Cygwin defaults, select X11 and Gnome. This should install "make" and some other packages you'll need to build Meld, that are not installed by default. I think Cygwin installs Python 2.6.7 by default (they are not up to 2.7.2 yet) but if you want to be extra careful expand the Python packages and make sure it is installed (should say 2.6.7 and/or keep).
- Download the Meld source, copy to your ~/downloads folder and run ...
- user$ tar -Jxvf filename
- (see man tar). I personally like to keep all my Cygwin downloads in my Cygwin folders for easier navigation, otherwise you have to prefix cygdrive to all of your windows paths.
- Navigate to the extracted folder and run ...
- user$ make install
- Hopefully you won't have any errors.
- Start Cygwin/X - the easiest way is from the windows start menu in all programs. You should find Cygwin/X and Xserver. You'll know it's running when a window opens and you see the X in your system tray. To start Xserver from the Cygwin bash run ...
- user$ startxwin
- user$ startx
- In the X window type meld, and if you're lucky it should run!
- Another useful online resource is CyGNOME.
Tuesday, March 13, 2012
Bad Github api v2
http://github.com/api/v2/json/user/show?login=defunkt&token=XXX
Thank you very much Dustin for doing such a great job on py-github, in which deeply buried I found this gem.
I wonder if this would have been harder or easier in Java?
update (2012-03-13): Adding a header with the key "Authentication" and the value "Basic username:password" encoded with base64 also works, but why?
>>> import urllib2
>>> url = "http://your.url.com"
>>> user = "your-username"
>>> token = "your-password"
>>> req = urllib2.Request(url)
>>> req.add_header('Authorization'
... 'Basic ' + base64.b64encode("%s:%s" %(user + '/token',
... token)).strip()
>>> data = urllib2.urlopen(req).read()
This makes me think that HTTPBasicAuthHandler should work, at least according to this site on basic authentication and this Python page on fetching internet resources.
I also found PyCurl (*) which probably would have helped a lot! I've never had any problems with libcurl. Another resource is ask/python-github2 which uses httplib2 (**). I have also read on Stack Overflow about Requests which actually has a Github api example on their PyPi page. New is always better, so that's probably the way to go. In fact the Requests site goes so far as to say that the urllib2 API is "thoroughly broken" which in my limited experience is the truth.
(*) Update (2012-03-14): PycURL is not actively maintained; this package (7.19) was last updated in 2008. You must install libcurl to use PycURL. If you try to use the tarball from the PycURL website, it requires the install option --curl-dir=c:\your\src\dir, which is the folder of your libcurl files. The setup.py file looks for libcurl.lib, but in the current release of libcurl (7.24), this file is renamed, so the setup fails. Same for ssl setup. An alternative installation for Windows (32/64-bit Python 2.6/7) is available as an executable from Christoph Gohlke's Python extensions. On Ubuntu Linux, python-pycurl is maintained on launchpad.
OK, one more totally obvious way to send basic authentication is to include it in the url and open it with urllib not urllib2.
>>> urllib.urlopen("http://username:password@your.url.com")
Python, I'm not as psyched as I once was. Something this simple shouldn't be so totally non-obvious to so many people. I've starred no less than ten SO posts all related to the same thing, and not once has anyone gotten urllib2 to work the way it's supposedly meant.
Answered! I finally figured it out! Here is the Github v2 api response:
Server: nginx/1.0.13
Date: Wed, 14 Mar 2012 07:37:16 GMT
Content-Type: application/json; charset=utf-8
Connection: close
Status: 401 Unauthorized
X-RateLimit-Limit: 60
X-Frame-Options: deny
X-RateLimit-Remaining: 59
X-Runtime: 7
Content-Length: 26
Cache-Control: no-cache
Python urllib2 is expecting to see "www-authenticate" but since it's not there, it does not send the login info. Problem solved. I saw this SO post but it was also in the missing urllib2 manual all along.
(**) Update (2012-03-15): BTW: httplib2 has the exact same problem as urllib2 according the SO post I mentioned above; the site must return "WWW-Authenticate" in the header or no credentials are sent.
Monday, March 5, 2012
Apache is not apache2
Looking for Apache on Ubuntu? Search for apache2 (note the 2). I have made a habit of looking for packages at http://packages.ubuntu.com.
Also downloading synaptic was probably one of the smartest things I've done. But Google how to add the orphans filter or see my post on KDiff3 Katastrophe.
