Saturday, 28 April 2012

Creating a Python App on Heroku

Need a requirements file containing all items plus:

distribute
gunicorn==0.13.4

Plus a Procfile:
web: gunicorn app:app -b 0.0.0.0:$PORT -w 3

Then you just go:
heroku login
heroku create --stack cedar
git push heroku master
heroku ps:scale web=1

Saturday, 31 March 2012

Windows Command Line History in CMD.EXE

I just found out about these!



  • F1: Pastes the last executed command (character by character)
  • F2: Pastes the last executed command (up to the entered character)
  • F3: Pastes the last executed command
  • F4: Deletes current prompt text up to the entered character
  • F5: Pastes recently executed commands (does not cycle)
  • F6: Pastes ^Z to the prompt
  • F7: Displays a selectable list of previously executed commands
  • F8: Pastes recently executed commands (cycles)
  • F9: Asks for the number of the command from the F7 list to paste

Installing Python nicely on Windows box

At the time of writing despite x64 Windows use Python 2.7 (not 3.0) and x86 (not x64).
The Windows virtualenv wrapper notes are here: https://github.com/davidmarble/virtualenvwrapper-win

At this point ready to use VirtualEnv, along with requirements files etc. I suppose the process might look something like this:

  • make project folder new_proj
  • cd into new_proj
  • make requirements.txt
  • edit requirements.txt add say "flask"
  • mkvirtualenv new_proj_env
  • pip install -r requirements.txt
Additionally the postgres database driver might be required. This is in combination with a local installation of Postgres.

Friday, 28 October 2011

Network settings from Run box in Windows 7

On XP and Server 2003 it was only a few clicks, Start > Network Connections, to get at the config screens for IP/DNS/DHCP etc.

In Windows 7 its hidden a million layers down behind all kind of user friendly fluff.

Luckily you can simply type this into the search box (the Windows 7 version of the Run box...):

ncpa.cpl

Much better!

Thursday, 22 September 2011

Avoid Sharepoint Authentication Popup

One of the most galling things about Sharepoint in the configuration we have at my place of work is that you end up retyping your credentials all the time.

I've previously posted some ways around this by editing security settings in IE to ensure your AD credentials are always posted through.

However I've found a much better solution! Use Google Chrome. Type in your credentials and the experience is seamless.

Cannot pin Netsupport Manager to taskbar in Windows 7

I access some Windows Server boxes via Netsupport Manager at work. I'd like to pin this app to the taskbar, but as it has the word "Support" in the title Microsoft have explicitly excluded this.

I would have enjoyed attending the product management meeting at Microsoft where the decision to exclude any apps with "Support" in the name was made. I hope they had tea and nice biscuits!

To lift this slightly baffling restriction, you can amend the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileAssociation\AddRemoveNames


It will probably look like this:

SETUP.EXE;INSTALL.EXE;ISUNINST.EXE;UNWISE.EXE;UNWISE32.EXE;ST5UNST.EXE;MSOOBE.EXE;LNKSTUB.EXE;CONTROL.EXE;SUPPORT;WERFAULT.EXE;WLRMDR.EXE;GUESTMODEMSG.EXE;MSIEXEC.EXE;DFSVC.EXE;WUAPP.EXE;


Mine now looks like this:


SETUP.EXE;INSTALL.EXE;ISUNINST.EXE;UNWISE.EXE;UNWISE32.EXE;ST5UNST.EXE;MSOOBE.EXE;LNKSTUB.EXE;CONTROL.EXE;WERFAULT.EXE;WLRMDR.EXE;GUESTMODEMSG.EXE;MSIEXEC.EXE;DFSVC.EXE;WUAPP.EXE


And I can now pin NetSupport.

Thursday, 21 April 2011

SYSDATE in Postgres

The equivalent of Oracle's SYSDATE in Postgres is CURRENT_TIMESTAMP.

At least in the context I needed it in!

I learnt about timestamp arithmetic in Postgres from here: http://wiki.postgresql.org/wiki/Working_with_Dates_and_Times_in_PostgreSQL#WORKING_with_DATETIME.2C_DATE.2C_and_INTERVAL_VALUES

Thursday, 7 April 2011

IntelliJ hang

If you find IntellJ just hangs and you have the kill the process, then you restart and it hangs again, its probably an issue with your JDK. I followed the steps here marked workaround:

http://devnet.jetbrains.net/docs/DOC-1193

Basically this involved editing the JVM startup properties to disable cardmarking or some such. The details are all contained in the link.

IntelliJ worked perfectly afterward. Its quite ironic as I was thinking how much I liked IntelliJ just before it happened. At least it was an easy fix. I am using the version 10 Community edition.

Wednesday, 6 April 2011

Windows 7 RDP Slow

If your RDP connections in Windows 7 are slow, over a VPN or whatever then go:

netsh interface tcp set global autotuninglevel=highlyrestricted

From an administrator command shell on the machine initiating the RDP connection.

Monday, 14 February 2011

WebLogic silent.xml for Centos / RHEL 5.5 Production

Oracle do provide a sample, and there are links on the Web but after much frustration, this one actually works.



Assuming the bin file has been downloaded from Oracle, then:

  • Create the Middleware directory beforehand.
  • Specify -mode=silent -silent_xml=/full/path/to/silent.xml on the command line.
  • This will install everything required,  but not the Server examples domain, which is dangerous on a production server.

Saturday, 15 January 2011

Install EPEL Repository on CENTOS

Just putting this here:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Wednesday, 12 January 2011

Install latest Python on Centos

This script will download, compile and install a newer version of Python on CENTOS / RedHat 5.* in a way which respects the underlying Python 2.4 used by Yum etc.

Based on http://www.venkysblog.com/install-python264-modwsgi-and-django-on-cento and http://binarysushi.com/blog/2009/aug/19/CentOS-5-3-python-2-5-virtualevn-mod-wsgi-and-mod-rpaf/.

ZSH and .zshrc

Apparently ZSH is quite good so I'm going to try it out. On most Linux distros this is going to be installed anyway, but the steps are:

yum install zsh
chsh -s /bin/zsh


Here are some links about customizing it:

Sunday, 2 January 2011

Unicode

Seems like a good article, this has always seemed a little mysterious.
I especially found the part about http-equiv content type useful. It had always bothered me how you could specify the character encoding after the start of the file. As it turns out it is a compromise and I am not the only person who had wondered about it.

Tuesday, 30 November 2010