<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>Return Boolean True</title><generator>Tumblr (3.0; @tachang)</generator><link>http://tachang.tumblr.com/</link><item><title>Backing up and Archiving Google Mail Accounts</title><description>&lt;p&gt;The easiest way to backup Google Mail accounts is to enable IMAP on the account and download the messages using &lt;a href="http://pyropus.ca/software/getmail/"&gt;getmail&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;Once getmail is installed you need to create a file called getmailrc. If you plan to download multiple gmail accounts then you might want to create a directory for each account and point the getmail script to that directory. Here is an example of a getmailrc file for Google Mail:&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;[retriever]&lt;br/&gt;type = SimpleIMAPSSLRetriever&lt;br/&gt;server = imap.gmail.com&lt;br/&gt;username = username@example.com&lt;br/&gt;password = examplepassword&lt;br/&gt;mailboxes = (&amp;#8220;[Gmail]/All Mail&amp;#8221;,)&lt;br/&gt;port = 993&lt;br/&gt;&lt;br/&gt;[destination]&lt;br/&gt;type = Maildir&lt;br/&gt;path = ~/username@example.com/&lt;br/&gt;&lt;br/&gt;[options]&lt;br/&gt;received = false&lt;br/&gt;delivered_to = false&lt;br/&gt;read_all = false&lt;br/&gt;verbose = 1&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;After this file is saved you can procede to run getmail. I needed getmail to run all night and in the background. I outputted all the stdout to a logfile so I used the following command:&lt;br/&gt;&lt;br/&gt;getmail &amp;#8212;getmaildir . &amp;gt; output.txt 2&amp;gt;&amp;amp;1 &amp;amp;&lt;br/&gt;&lt;br/&gt;Don&amp;#8217;t forget to create the directories cur, new, tmp as these are the directories that are needed for IMAP.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;Now that you have your mail in a Maildir format what do you do with it? In my case I wanted to delete the account off Google Apps but still be able to search the mail if I needed it at a later date. &lt;br/&gt;&lt;br/&gt;The strategy I came up with to bring up a copy of courier and serve the Maildir using a webmail script (in this case Roundcube).&lt;br/&gt;&lt;br/&gt;I installed PHP through Nginx first. The easiest way to get a PHP environment up and running on Nginx is to use the Ubuntu packages:&lt;br/&gt;&lt;br/&gt;php5-cgi &lt;br/&gt;php5-common&lt;br/&gt;&lt;br/&gt;For additional functionality such as PostgreSQL support you can install the package:&lt;br/&gt;php5-pgsql&lt;br/&gt;&lt;br/&gt;I then configured nginx with the following script:&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;server {&lt;br/&gt;  listen      80;&lt;br/&gt;  server_name webmail.example.com;&lt;br/&gt;  access_log  /var/log/nginx/access.log;&lt;br/&gt;  log_subrequest off;&lt;br/&gt;&lt;br/&gt;  location / {&lt;br/&gt;    root /www/webmail.example.com;&lt;br/&gt;    index index.php;&lt;br/&gt;&lt;br/&gt;    location ~ &amp;#46;php$ {&lt;br/&gt;      include        fastcgi_params;&lt;br/&gt;      fastcgi_pass   localhost:9000;&lt;br/&gt;      fastcgi_param  SCRIPT_FILENAME  /www/webmail.example.com/$fastcgi_script_name;&lt;br/&gt;    }&lt;br/&gt;  }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;I then created the script: /etc/init.d/php-fcgi&lt;br/&gt;BIND=127.0.0.1:9000&lt;br/&gt;USER=www-data&lt;br/&gt;PHP_FCGI_CHILDREN=15&lt;br/&gt;PHP_FCGI_MAX_REQUESTS=1000&lt;br/&gt;&lt;br/&gt;PHP_CGI=/usr/bin/php-cgi&lt;br/&gt;PHP_CGI_NAME=`basename $PHP_CGI`&lt;br/&gt;PHP_CGI_ARGS=&amp;#8221;- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND&amp;#8221;&lt;br/&gt;RETVAL=0&lt;br/&gt;&lt;br/&gt;start() {&lt;br/&gt;      echo -n &amp;#8220;Starting PHP FastCGI: &amp;#8220;&lt;br/&gt;      start-stop-daemon &amp;#8212;quiet &amp;#8212;start &amp;#8212;background &amp;#8212;chuid &amp;#8220;$USER&amp;#8221; &amp;#8212;exec /usr/bin/env &amp;#8212; $PHP_CGI_ARGS&lt;br/&gt;      RETVAL=$?&lt;br/&gt;      echo &amp;#8220;$PHP_CGI_NAME.&amp;#8221;&lt;br/&gt;}&lt;br/&gt;stop() {&lt;br/&gt;      echo -n &amp;#8220;Stopping PHP FastCGI: &amp;#8220;&lt;br/&gt;      killall -q -w -u $USER $PHP_CGI&lt;br/&gt;      RETVAL=$?&lt;br/&gt;      echo &amp;#8220;$PHP_CGI_NAME.&amp;#8221;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;case &amp;#8220;$1&amp;#8221; in&lt;br/&gt;    start)&lt;br/&gt;      start&lt;br/&gt;  ;;&lt;br/&gt;    stop)&lt;br/&gt;      stop&lt;br/&gt;  ;;&lt;br/&gt;    restart)&lt;br/&gt;      stop&lt;br/&gt;      start&lt;br/&gt;  ;;&lt;br/&gt;    *)&lt;br/&gt;      echo &amp;#8220;Usage: php-fastcgi {start|stop|restart}&amp;#8221;&lt;br/&gt;      exit 1&lt;br/&gt;  ;;&lt;br/&gt;esac&lt;br/&gt;exit $RETVAL&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;After php was up and running I installed courier:&lt;br/&gt;apt-get install courier-imap courier-imap-ssl&lt;br/&gt;&lt;br/&gt;I then downloaded roundcube and configured roundcube as necessary.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-7082756300136292492?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265589582</link><guid>http://tachang.tumblr.com/post/22265589582</guid><pubDate>Thu, 27 Oct 2011 14:52:00 -0400</pubDate><category>getmail</category><category>gmail</category><category>backup</category></item><item><title>Google Apps Split Delivery for Email - Have your cake and eat it too</title><description>&lt;p&gt;Split delivery for e-mail is when you have a single piece of mail but want a copy of it sent to multiple destinations. There are a couple of reasons you would want to do this:&lt;br/&gt;&lt;br/&gt;- You are getting ready to migrate to Google Apps but don&amp;#8217;t want to go all in yet with your current e-mail server. This is understandable since you want to test out Google Apps first to see if it will work.&lt;br/&gt;&lt;br/&gt;- You like Google Apps but don&amp;#8217;t want to pay the yearly fee. You rather just stay under the limit of the free accounts but still want to have e-mail accounts on your domain (i.e. @example.com).&lt;br/&gt;&lt;br/&gt;- You have other special circumstances where you want a copy of all the mail that comes in and have it delivered to some other server.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;This post is actually more toward the 2nd point. 90% of my e-mails are on Google Apps but there is a remaining 10% that I rather not have a Google Apps account. However I still want them to have e-mail via some webmail client.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;To get this working I am using Ubuntu with Postfix running the primary mail server for example.com. I set the MX records for example.com to this:&lt;br/&gt;10 mail.example.com&lt;br/&gt;20 ALT1.ASPMX.L.GOOGLE.COM&lt;br/&gt;&lt;br/&gt;Pretty straight forward so far. The trick is that you need to get Postfix to forward a copy of all Google Apps mail to their mail servers. To do this I use Postfix&amp;#8217;s Before-Queue Content Filter: &lt;a href="http://www.postfix.org/SMTPD_PROXY_README.html"&gt;&lt;a href="http://www.postfix.org/SMTPD_PROXY_README.html"&gt;http://www.postfix.org/SMTPD_PROXY_README.html&lt;/a&gt;&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;This allows me to create a SMTP server that Postfix will delivery a copy of the mail to Google Apps. In the file /etc/postfix/master.cf I put the following at the end:&lt;br/&gt;&lt;br/&gt;# =============================================================&lt;br/&gt;# service type  private unpriv  chroot  wakeup  maxproc command&lt;br/&gt;#               (yes)   (yes)   (yes)   (never) (100)&lt;br/&gt;# =============================================================&lt;br/&gt;#&lt;br/&gt;# Before-filter SMTP server. Receive mail from the network and&lt;br/&gt;# pass it to the content filter on localhost port 10025.&lt;br/&gt;#&lt;br/&gt;smtp      inet  n       -       n       -       20      smtpd&lt;br/&gt;  -o smtpd_proxy_filter=127.0.0.1:10025&lt;br/&gt;  -o smtpd_client_connection_count_limit=10&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;This makes Postfix delivery a copy of the incoming mail to the SMTP server at  127.0.0.1:10025.&lt;br/&gt;&lt;br/&gt;Okay but now you are asking where do I get an SMTP server to do the processing? It so happens Python comes with a smtp server library. I wrote a script that basicallyhttp://www.blogger.com/img/blank.gif inherits the SMTPServer (called CustomSMTPServer). It also implements the one command that is expected by Postfix (EHLO) because Postfix actually speaks ESMTP. I did this by subclassing the smtpd.SMTPChannel class. One caveat is that I had to use the _SMTPChannel__variablename syntax because some variables like fqdn and greeting were made private by the SMTPChannel class. So with Python you use the special syntax of prepending the class name to access it. This is generally bad practice but in this case it was all I had.&lt;br/&gt;&lt;br/&gt;You can download the script here:&lt;br/&gt;&lt;a href="http://dl.dropbox.com/u/2177278/pymailforwarder.py"&gt;&lt;a href="http://dl.dropbox.com/u/2177278/pymailforwarder.py"&gt;http://dl.dropbox.com/u/2177278/pymailforwarder.py&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Simply run the script to start a basic SMTP server listening on port 10025 and localhost. The script simply accepts a piece of mail and forwards it to Google App&amp;#8217;s mail server.&lt;br/&gt;&lt;br/&gt;So what does this let you do? In my case this lets me run Roundcube, Horde, or SquirrelMail for users that don&amp;#8217;t need a Google Apps e-mail account. For those that do I simply create that user on Google Apps.&lt;br/&gt;&lt;br/&gt;Things to watch out for with this type of deployment:&lt;br/&gt;&lt;br/&gt;- You have to edit /etc/postfix/main.cf and add the value&lt;br/&gt;local_recipient_maps =&lt;br/&gt;(Yes that is a blank or equals nothing). This makes Postfix accept the mail even though the recipient is not in the list. This can be bad. Postfix says this in the documentation:&lt;br/&gt;&lt;br/&gt;With this setting, the Postfix SMTP server will not reject mail with &amp;#8220;User unknown in local recipient table&amp;#8221;. Don&amp;#8217;t do this on systems that receive mail directly from the Internet. With today&amp;#8217;s worms and viruses, Postfix will become a backscatter source: it accepts mail for non-existent recipients and then tries to return that mail as &amp;#8220;undeliverable&amp;#8221; to the often forged sender address. &lt;br/&gt;&lt;br/&gt;To get around this you should really have an alias map file. For temporary testing though this setting will work wonders.&lt;br/&gt;&lt;br/&gt;- The Python SMTP relay should not be exposed to the internet. It listens on localhost but ideally it would be nice to modify the script to accept authentication of some sort.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-2771984039591762606?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265588533</link><guid>http://tachang.tumblr.com/post/22265588533</guid><pubDate>Wed, 19 Oct 2011 13:57:00 -0400</pubDate><category>Google Apps</category><category>Postfix</category><category>Split Delivery</category></item><item><title>Locales in Ubuntu</title><description>&lt;p&gt;The list of locales that you have installed on a system are in the directory:&lt;br/&gt;&lt;br/&gt;/usr/lib/locale&lt;br/&gt;&lt;br/&gt;To generate a locale you can run:&lt;br/&gt;&lt;br/&gt;locale-gen en_US.UTF-8&lt;br/&gt;&lt;br/&gt;This is very useful when you need to generate a UTF-8 locale.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-2220337126098547308?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265587488</link><guid>http://tachang.tumblr.com/post/22265587488</guid><pubDate>Mon, 17 Oct 2011 00:09:00 -0400</pubDate></item><item><title>Microsoft Office Communicator - Problem verifying certificate from the server.</title><description>&lt;p&gt;When using Microsoft Office Communicator with a server that has TLS enabled you might get an error message &amp;#8220;Problem verifying certificate from the server.&amp;#8221;.&lt;br/&gt;&lt;br/&gt;This message means that the computer you are on does not trust the certificate that is being presented to it.&lt;br/&gt;&lt;br/&gt;The first way to troubleshoot this is to figure out what certificate it is receiving. The easiest way I&amp;#8217;ve found to do this is to use openssl&amp;#8217;s s_client:&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;openssl s_client -connect lcs.example.com:5061&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;By doing this you will see the entire certificate chain. You now need to go into the windows certificate management tools and make sure that chain is valid.&lt;br/&gt;&lt;br/&gt;Generally this will involve running mmc.exe, then adding the snap in &amp;#8220;Certificate Management&amp;#8221; for the computer itself.&lt;br/&gt;&lt;br/&gt;Another option is to cut and paste the BEGIN and END certificate lines into a text file. Name the text file with a .der extension and install the certificate. Then browse to the certificate in MMC and see if anything is wrong. Things that might go wrong include the validity date or being unable to trust the certificate chain (most likely from missing certificates).&lt;br/&gt;&lt;br/&gt;If you are missing certificates you need to track them down and install them. After this is done you should be able to connect to communicator server.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-2088929103130237255?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265586575</link><guid>http://tachang.tumblr.com/post/22265586575</guid><pubDate>Thu, 13 Oct 2011 17:17:00 -0400</pubDate><category>microsoft office communicator</category></item><item><title>Getting Around the YouTube Duplicate Content Filter</title><description>&lt;p&gt;I was recently trying to upload a video to YouTube but kept getting the Rejected (duplicate upload) message.&lt;br/&gt;&lt;br/&gt;I found the easiest way to get around this is to change the metadata on the video you are trying to upload. In my case it was an mp4 video.&lt;br/&gt;&lt;br/&gt;To change the metadata I used a program called AtomicParley:&lt;br/&gt;&lt;br/&gt;&lt;a href="http://atomicparsley.sourceforge.net/"&gt;&lt;a href="http://atomicparsley.sourceforge.net/"&gt;http://atomicparsley.sourceforge.net/&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;After downloading it simply run&lt;br/&gt;&lt;br/&gt;AtomicParsley.exe &amp;#8220;example.mp4&amp;#8221; &amp;#8212;artist &amp;#8220;Me&amp;#8221;&lt;br/&gt;&lt;br/&gt;Or whatever artist you want. The new file will be written out with new metadata. This should then pass any YouTube duplicate content check.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-982926555000637490?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265585613</link><guid>http://tachang.tumblr.com/post/22265585613</guid><pubDate>Wed, 12 Oct 2011 21:52:00 -0400</pubDate></item><item><title>Wordpress htaccess</title><description>&lt;p&gt;One of my friends recently had a desire to rewrite some URLs with a Wordpress installation. The theme they were using was called Solid-WP and it supported a concept called &amp;#8220;Projects&amp;#8221;. When you create a new project it actually gives it the URL&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.example.com/project/"&gt;http://www.example.com/project/&lt;/a&gt;&lt;name&gt;&lt;br/&gt;&lt;br/&gt;However there was a requirement that the URL should be renamed to &lt;a href="http://www.example.com/apps/"&gt;http://www.example.com/apps/&lt;/a&gt;&lt;name&gt;.&lt;br/&gt;&lt;br/&gt;To do this I broke out mod_rewrite. Wordpress has some default rewrites stored inside .htaccess. Here is what it looks like:&lt;br/&gt;&lt;br/&gt;# BEGIN WordPress&lt;br/&gt;&lt;ifmodule mod_rewrite&gt;&lt;br/&gt;RewriteEngine On&lt;br/&gt;&lt;br/&gt;RewriteBase /&lt;br/&gt;RewriteRule ^index&amp;#46;php$ - [L]&lt;br/&gt;RewriteCond %{REQUEST_FILENAME}&amp;#160;!-f&lt;br/&gt;RewriteCond %{REQUEST_FILENAME}&amp;#160;!-d&lt;br/&gt;RewriteRule . /index.php [L]&lt;br/&gt;&lt;/ifmodule&gt;&lt;br/&gt;&lt;br/&gt;# END WordPress&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;Rewrite can be hard to understand so I wanted to breakdown exactly what Wordpress was doing. First line turns on the Rewrite engine and 2nd line is used to define a base URL for rewrites.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;RewriteRule ^index&amp;#46;php$ - [L]&lt;br/&gt;&lt;br/&gt;If there is a request for /index.php then don&amp;#8217;t do any rewriting and just end processing right here (the L flag).&lt;br/&gt;&lt;br/&gt;RewriteCond %{REQUEST_FILENAME}&amp;#160;!-f&lt;br/&gt;RewriteCond %{REQUEST_FILENAME}&amp;#160;!-d&lt;br/&gt;&lt;br/&gt;These rewrite conditions are to test for real files and directories. Basically we don&amp;#8217;t want to rewrite a URL if the URL points to a directory or file. We just want to serve the file up.&amp;#160;!-f tests whether or not the file exists and&amp;#160;!-d tests whether or not the directory exists.&lt;br/&gt;&lt;br/&gt;RewriteRule . /index.php [L]&lt;br/&gt;&lt;br/&gt;This last line as I understand it rewrites all requests to index.php.&lt;br/&gt;&lt;br/&gt;What I ended up adding was this:&lt;br/&gt;&lt;br/&gt;&lt;ifmodule mod_rewrite&gt;&lt;br/&gt;RewriteEngine On&lt;br/&gt;&lt;br/&gt;RewriteRule project/(.+) /apps/$1 [L,R]&lt;br/&gt;RewriteRule apps/(.+) /example-wp/index.php/project/$1/ [L]&lt;br/&gt;&lt;br/&gt;RewriteBase /&lt;br/&gt;RewriteRule ^index&amp;#46;php$ - [L]&lt;br/&gt;RewriteCond %{REQUEST_FILENAME}&amp;#160;!-f&lt;br/&gt;RewriteCond %{REQUEST_FILENAME}&amp;#160;!-d&lt;br/&gt;RewriteRule . /index.php [L]&lt;br/&gt;&lt;/ifmodule&gt;&lt;br/&gt;&lt;br/&gt;The first time a user might hit /project/example. They would hit the first rule and get redirected. Processing would stop.&lt;br/&gt;&lt;br/&gt;The second time a user hit the URL it would say /apps/example which would trigger the 2nd rule. It would get rewritten to the long form of WordPress&amp;#8217;s controller action.&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-5570985819784202144?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;&lt;/name&gt;&lt;/name&gt;&lt;/p&gt;</description><link>http://tachang.tumblr.com/post/22265584329</link><guid>http://tachang.tumblr.com/post/22265584329</guid><pubDate>Wed, 05 Oct 2011 12:40:00 -0400</pubDate><category>rewrite</category><category>mod_rewrite</category><category>wordpress</category></item><item><title>Designing Good Web APIs</title><description>&lt;p&gt;I am not going to claim eons of experience in designing good APIs. I am going to approach it from the background of a developer who has to use and integrate with them.&lt;br/&gt;&lt;br/&gt;What makes a good API? Here are some of my tenets:&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;1. Make your API calls as RESTful-like as possible&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Because this term has evolved quite a bit I am going to stick with the primarily principles. Make API calls nouns describing &amp;#8220;what&amp;#8221; and not &amp;#8220;do something&amp;#8221;.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;2. API calls should have defaults.&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Don&amp;#8217;t give me 100 required parameters just to see some action. Try as hard as you can to give me a basic call so I know I am doing something right. Along with this is to keep a minimum of API calls. The more calls you have documented the more I have to figure out which one it is I am suppose to be calling to get the right information. This is an area where I actually do want to be spoon-fed.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;3. Use HTTP basic over SSL for authentication.&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;If you have the time and energy also support OAuth. The reason I hesitate with going straight to OAuth is because if you are just building an API your resources are probably limited. You are going to make mistakes. Getting it up and running with the lowest (and secure) common denominator is key.&lt;br/&gt;&lt;br/&gt;Also use dedicated API keys that consist of an ID and a shared secret. Make sure these can be rolled.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;4. Make your return format JSON.&lt;/span&gt;&lt;br/&gt;For the love of god please don&amp;#8217;t use XML. &lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;5. Version your API call in the end point:&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;/api/1.0/user/3&lt;br/&gt;/api/2.0/user/3&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;6. Make the calls easily testable.&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;To me this means I can plug it into a web browser, type in some credentials, and get a response back. As a developer this makes me feel good early on.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight:bold;"&gt;7. Document your API calls with examples.&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Especially the ones where I can click on a link and it does an API call for me. This is also great for testing your call.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;A number of these guidelines are geared heavily to web development. If you are designing an API for a message passing system with latency and size requirements a good deal of this would change.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-6186641860134266807?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265583377</link><guid>http://tachang.tumblr.com/post/22265583377</guid><pubDate>Thu, 20 Jan 2011 20:42:00 -0500</pubDate></item><item><title>How to get a 2yr single root SSL certificate for $10</title><description>&lt;p&gt;I recently had to do some shopping for a SSL certificate for my startup &lt;a href="https://www.stratismo.com/"&gt;Stratismo&lt;/a&gt; (I linked to it incase anyone wants to see the actual certificate). Obviously I wanted one that was widely supported and didn&amp;#8217;t really want to pay a ridiculous amount for it.&lt;br/&gt;&lt;br/&gt;So shopping around I landed on RapidSSL&amp;#8217;s site.  RapidSSL has a program where you can switch to them if you have a competitor&amp;#8217;s certificate. On top of that they also give you a free year. All of this for free. The program details are here:&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.rapidssl.com/switch-ssl/index.html"&gt;&lt;a href="http://www.rapidssl.com/switch-ssl/index.html"&gt;http://www.rapidssl.com/switch-ssl/index.html&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;I just happened to have a Comodo certificate so I gave this a test run. The Comodo certificate had some issues because of the number of intermediate certificates I had to include. While this shouldn&amp;#8217;t cause problems in theory in reality it is just one more thing to deal with.&lt;br/&gt;&lt;br/&gt;So what I did was apply for RapidSSL. They ended up giving me one of their SSL certificates for free after verifying I had a Comodo SSL certificate. They also extended the validation by a year so basically I got two years for $10. RapidSSL certificates are also signed by Equifax which is installed on almost every browser.&lt;br/&gt;&lt;br/&gt;Overall a great deal.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-1206809098165836786?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265582434</link><guid>http://tachang.tumblr.com/post/22265582434</guid><pubDate>Mon, 15 Nov 2010 00:22:00 -0500</pubDate></item><item><title>PySAML - A SAML 2.0 Toolkit for Python</title><description>&lt;p&gt;Security Assertion Markup Language (SAML) can be a bit confusing to understand. At its core SAML is just a protocol with defined messages written in XML. The main purpose of SAML is to enable you to log in at one place such as a website and then jump over to another website without having to log in again. This setup is commonly called &amp;#8220;federation&amp;#8221;.&lt;br/&gt;&lt;br/&gt;It is similiar to OAuth. I see SAML continuing to make headroom in the enterprise space while OAuth stays strong in the consumer space. However in the future I hope these two technologies will end up playing well together.&lt;br/&gt;&lt;br/&gt;In either case I am releasing a small Python library for generating SAML assertions. The main purpose of this is to learn SAML by doing (actually having to create an assertion gives me a good idea of the complexity of the protocol).&lt;br/&gt;&lt;br/&gt;The library depends on M2Crypto so download and install it:&lt;br/&gt;&lt;a href="http://chandlerproject.org/bin/view/Projects/MeTooCrypto"&gt;http://chandlerproject.org/bin/view/Projects/MeTooCrypto&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;M2Crypto depends on SWIG so you might need that as well.&lt;br/&gt;&lt;br/&gt;Once that is installed you can download my distribution of PySAML here:&lt;br/&gt;&lt;br/&gt;Python 2.6 - Win32:&lt;br/&gt;&lt;a href="http://darkeneddesire.com/PySAML/PySAML-1.0.win32.exe"&gt;&lt;a href="http://darkeneddesire.com/PySAML/PySAML-1.0.win32.exe"&gt;http://darkeneddesire.com/PySAML/PySAML-1.0.win32.exe&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;Unix (source):&lt;br/&gt;&lt;a href="http://darkeneddesire.com/PySAML/PySAML.tar.gz"&gt;&lt;a href="http://darkeneddesire.com/PySAML/"&gt;http://darkeneddesire.com/PySAML/&lt;/a&gt;&lt;/a&gt;&lt;a href="http://darkeneddesire.com/PySAML/PySAML.tar.gz"&gt;PySAML.tar.gz&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;For windows you just run the executable. For unix you should run the following commands:&lt;br/&gt;&lt;br/&gt;# cd PySAML&lt;br/&gt;# python setup.py build&lt;br/&gt;# python setup.by install&lt;br/&gt;&lt;br/&gt;There are examples in the &amp;#8220;examples&amp;#8221; folder if you download the full source.&lt;br/&gt;&lt;br/&gt;The whole project is available on github as well:&lt;br/&gt;&lt;a href="http://http//github.com/tachang/PySAML/tree/master"&gt;&lt;a href="http://github.com/tachang/PySAML/tree/master"&gt;http://github.com/tachang/PySAML/tree/master&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-8476133849519411923?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265581469</link><guid>http://tachang.tumblr.com/post/22265581469</guid><pubDate>Mon, 13 Jul 2009 18:27:00 -0400</pubDate></item><item><title>Trying to get Dual-SIM to work in T-Mobile G1</title><description>&lt;p&gt;There is a product being sold called &amp;#8220;Magic SIM&amp;#8221;.&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.magicsim.com/en/dual_sim_show.asp?id=49&amp;amp;cp_id=&amp;amp;sort2name=14"&gt;http://www.magicsim.com/en/dual_sim_show.asp?id=49&amp;amp;cp_id=&amp;amp;sort2name=14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Basically it is a SIM card that has two slots and a small memory chip. After physically cutting up your two SIM cards and putting them into the slots you insert the whole thing into your phone.&lt;br/&gt;&lt;br/&gt;If your phone supports the GSM STK (SIM Tool Kit) standard then you can switch back and forth between the two SIM cards.&lt;br/&gt;&lt;br/&gt;However for your phone to actually support the standard the manufacturer had to have built it into the operating system as well as provide a tool to &amp;#8220;talk&amp;#8221; using the STK.&lt;br/&gt;&lt;br/&gt;I currently see that the Android development  tree has some Stk development going on. I downloaded a precompiled Stk.apk and installed it on my phone with the card. However it does not seem to work.&lt;br/&gt;&lt;br/&gt;While I do see the SIM Toolkit menu icon and it does seem to read from the custom card I am unable to obtain a carrier signal from either of my SIM cards. When I scroll to any of the menu options such as &amp;#8220;SIM 1&amp;#8221; or &amp;#8220;SIM 2&amp;#8221; and press the trackball the phone simply gives me a rotating circle on the upper right saying it is busy. And at that point it hangs.&lt;br/&gt;&lt;br/&gt;Here is a quick and dirty image of my phone as well as what the SIM menu looks like:&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_D1ngxQVNLdM/Sla6JNg2d1I/AAAAAAAABgc/FO4iW5FK27I/s1600-h/CIMG1878.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_D1ngxQVNLdM/Sla6JNg2d1I/AAAAAAAABgc/FO4iW5FK27I/s320/CIMG1878.JPG" alt="" id="BLOGGER_PHOTO_ID_5356673474212820818" border="0"/&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_D1ngxQVNLdM/Sla6YR7v5hI/AAAAAAAABgk/3lG9UZkp81U/s1600-h/CIMG1879.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_D1ngxQVNLdM/Sla6YR7v5hI/AAAAAAAABgk/3lG9UZkp81U/s320/CIMG1879.JPG" alt="" id="BLOGGER_PHOTO_ID_5356673733097416210" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-7783286046602603292?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265580544</link><guid>http://tachang.tumblr.com/post/22265580544</guid><pubDate>Thu, 09 Jul 2009 21:18:00 -0400</pubDate></item><item><title>Using Github Through Draconian Proxies (Windows And Unix)</title><description>&lt;p&gt;Here is a pretty standard scenario at most corporations:&lt;br/&gt;&lt;br/&gt;- All access to the internet is restricted to a proxy&lt;br/&gt;- The proxy only allows connections out on port 80 and 443&lt;br/&gt;- CONNECT method is only enabled for 443&lt;br/&gt;- Proxy Authentication is required (NTLM or Basic)&lt;br/&gt;&lt;br/&gt;I like to use both Windows and Unix environments. On Unix tunneling to Github is a bit easier because lots of tools are included.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Unix&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;1. Download Git. At the time I was writing this I was using Ubuntu so I simply did apt-get install git-core&lt;br/&gt;&lt;br/&gt;2. Download and install corkscrew (&lt;a href="http://www.agroman.net/corkscrew/"&gt;http://www.agroman.net/corkscrew/&lt;/a&gt;). This is a tool for tunneling SSH through HTTP proxies.&lt;br/&gt;&lt;br/&gt;3. Edit or create the file ~/.ssh/config and put the following:&lt;br/&gt;&lt;br/&gt;ProxyCommand /usr/bin/corkscrew proxy.example.com 443 %h %p ~/.ssh/myauth&lt;br/&gt;&lt;br/&gt;Host github.com&lt;br/&gt;User git&lt;br/&gt;Port 22&lt;br/&gt;Hostname github.com&lt;br/&gt;IdentityFile &amp;#8220;/media/truecrypt1/Keys/GitHubKey.private&amp;#8221;&lt;br/&gt;TCPKeepAlive yes&lt;br/&gt;IdentitiesOnly yes&lt;br/&gt;&lt;br/&gt;Host ssh.github.com&lt;br/&gt;User git&lt;br/&gt;Port 443&lt;br/&gt;Hostname ssh.github.com&lt;br/&gt;IdentityFile &amp;#8220;/media/truecrypt1/Keys/GitHubKey.private&amp;#8221;&lt;br/&gt;TCPKeepAlive yes&lt;br/&gt;IdentitiesOnly yes&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The ProxyCommand is invoked when ssh needs to make a connection. We are telling ssh to use &lt;span style="font-weight: bold;"&gt; /usr/bin/corkscrew&lt;/span&gt;. This is a 3rd party program that sets up a socket through the HTTP proxy.&lt;/li&gt;&lt;li&gt;The program  &lt;span style="font-weight: bold;"&gt; /usr/bin/corkscrew &lt;/span&gt;takes as its 5th argument a file containing credentials for your HTTP proxy. Not all proxies need authentication but if you do just put in the file a single line formatted username:password.&lt;/li&gt;&lt;li&gt;The &lt;span style="font-weight: bold;"&gt;Host github.com&lt;/span&gt; indicates to ssh that if we are connecting to github.com to use these specific settings. There is nothing special here except we specify the location of the private key that corresponds to the public key we had over in &lt;a href="http://www.github.com/"&gt;http://www.github.com/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Notice we have another entry titled &amp;#8220;&lt;span style="font-weight: bold;"&gt;Host ssh.github.com&amp;#8221;&lt;/span&gt; . This is to get around proxies that only allow the CONNECT command over 443 (the truly locked down ones). To get around this github setup a whole separate host that listens on port 443. We add both entries here since they are both valid.&lt;br/&gt;&lt;/li&gt;&lt;/ul&gt;4. If everything is setup correctly you should be able to run:&lt;br/&gt;# ssh github.com&lt;br/&gt;&lt;br/&gt;Hi tachang! You&amp;#8217;ve successfully authenticated, but GitHub does not provide shell access.&lt;br/&gt;Connection to github.com closed.&lt;br/&gt;&lt;br/&gt;If this doesn&amp;#8217;t work you can run&lt;br/&gt;# ssh ssh.github.com&lt;br/&gt;&lt;br/&gt;And get the exact same thing. If the first command didn&amp;#8217;t work it means you are using a proxy that blocks CONNECT on port 22. Almost no proxies block CONNECT on port 443 because you need that for SSL.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;We get a no shell access message from github because we are trying to obtain a shell and github has it disabled. However this indicates everything is working. This concludes the setup for Unix.&lt;br/&gt;&lt;br/&gt;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&amp;#8212;&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Windows&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;1. Download msysgit&lt;/span&gt; &lt;a href="http://code.google.com/p/msysgit/"&gt;&lt;a href="http://code.google.com/p/msysgit/"&gt;http://code.google.com/p/msysgit/&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;Some settings:&lt;br/&gt;&lt;br/&gt;- &amp;#8220;Run Git from the Windows Command Prompt&amp;#8221;&lt;br/&gt;- &amp;#8220;Use OpenSSH&amp;#8221; (this one is very important)&lt;br/&gt;- Pick your line endings&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;2. Download connect.c&lt;/span&gt;&lt;br/&gt;&lt;a href="http://bent.latency.net/bent/darcs/goto-san-connect-1.85/src/connect.html"&gt;&lt;a href="http://bent.latency.net/bent/darcs/goto-san-connect-1.85/src/connect.html"&gt;http://bent.latency.net/bent/darcs/goto-san-connect-1.85/src/connect.html&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;This tool deserves its own post mostly because of its utter simplicity. It mirrors the open source tool corkscrew and is used for tunneling through proxies. Yes the tool&amp;#8217;s name is really called &amp;#8220;connect.c&amp;#8221;.&lt;br/&gt;&lt;br/&gt;For Window&amp;#8217;s users, a pre-compiled binary is available:&lt;br/&gt;&lt;a href="http://dl.dropbox.com/u/2177278/connect.exe"&gt;connect.exe&lt;/a&gt;&lt;br/&gt;I put my connect.exe in C:\Windows\connect.exe&lt;br/&gt;&lt;br/&gt;3. Decide whether you like to use the Windows cmd.exe to do stuff or the Cygwin style shell. Or both.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Cygwin Git Bash Shell&lt;/span&gt;&lt;br/&gt;For the Cygwin style shell start up the Git icon and edit the file ~/.ssh/config&lt;br/&gt;*Make sure the file has no extension.&lt;br/&gt;&lt;br/&gt;Put the following in that file:&lt;br/&gt;&lt;br/&gt;ProxyCommand /c/windows/connect.exe -H username@proxy.example.com:443 %h %p&lt;br/&gt;&lt;br/&gt;Host github.com&lt;br/&gt;User git&lt;br/&gt;Port 22&lt;br/&gt;Hostname github.com&lt;br/&gt;IdentityFile &amp;#8220;/c/Keys/GitHubKey.private&amp;#8221;&lt;br/&gt;TCPKeepAlive yes&lt;br/&gt;IdentitiesOnly yes&lt;br/&gt;&lt;br/&gt;Host ssh.github.com&lt;br/&gt;User git&lt;br/&gt;Port 443&lt;br/&gt;Hostname ssh.github.com&lt;br/&gt;IdentityFile &amp;#8220;/c/Keys/GitHubKey.private&amp;#8221;&lt;br/&gt;TCPKeepAlive yes&lt;br/&gt;IdentitiesOnly yes&lt;br/&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;Notice the slash style in order to access the file system.&lt;br/&gt;&lt;/li&gt;&lt;li&gt;The proxy username is specified as part of the proxy setting. The password for the proxy is prompted for. Read more about connect.c to figure out how to get rid of this prompt.&lt;/li&gt;&lt;/ul&gt;At this point, using the Git Bash shell should yield:&lt;br/&gt;&lt;br/&gt;$ ssh github.com&lt;br/&gt;&lt;br/&gt;Hi tachang! You&amp;#8217;ve successfully authenticated, but GitHub does not provide shell access.&lt;br/&gt;Connection to github.com closed&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Windows cmd.exe shell&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Suppose you don&amp;#8217;t like the Git Bash shell. You prefer the cmd.exe interpreter.&lt;br/&gt;&lt;br/&gt;- Go to your config file at C:\Documents and Settings\&lt;username&gt;&amp;#46;ssh\config&lt;br/&gt;- Make a copy of it or make a new one. I called mine config-windows&lt;br/&gt;&lt;br/&gt;Put the following in the file:&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br/&gt;ProxyCommand C:/Windows/connect.exe -H username@proxy.example.com:443 %h %p&lt;br/&gt;&lt;br/&gt;Host github.com&lt;br/&gt;User git&lt;br/&gt;Port 22&lt;br/&gt;Hostname github.com&lt;br/&gt;IdentityFile &amp;#8220;C:\Keys\GitHubKey.private&amp;#8221;&lt;br/&gt;TCPKeepAlive yes&lt;br/&gt;IdentitiesOnly yes&lt;br/&gt;&lt;br/&gt;Host ssh.github.com&lt;br/&gt;User git&lt;br/&gt;Port 443&lt;br/&gt;Hostname ssh.github.com&lt;br/&gt;IdentityFile &amp;#8220;C:\Keys\GitHubKey.private&amp;#8221;&lt;br/&gt;TCPKeepAlive yes&lt;br/&gt;IdentitiesOnly yes&lt;br/&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;Notice the mixture of slash styles. I find this rather odd but it is what works. We have a forward slash style for the ProxyCommand but for the IdentityFile a forward slash or backward slash both work.&lt;/li&gt;&lt;/ul&gt;Running the command (making sure we run Git\bin&amp;#8217;s ssh.exe and not some other one in the PATH):&lt;br/&gt;&lt;br/&gt;C:\Program Files\Git\bin&amp;gt;ssh.exe -F &amp;#8220;C:\Documents and Settings\&lt;username&gt;&amp;#46;ssh\config-windows&amp;#8221; github.com&lt;br/&gt;&lt;br/&gt;Hi tachang! You&amp;#8217;ve successfully authenticated, but GitHub does not provide shell access.&lt;br/&gt;Connection to github.com closed&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;General Git Cloning&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;- Make sure you are using the right Git URL:&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Suppose your Public Clone URL is:&lt;a href="git://github.com/zemmekkis/EyeFiServer.git" class="git_url_facebox" rel="#git-clone"&gt; git://github.com/tachang&lt;/a&gt;&lt;a href="git://github.com/zemmekkis/EyeFiServer.git" class="git_url_facebox" rel="#git-clone"&gt;/EyeFiServer.git&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;You should use the following URL that utilizes the SSH transport:&lt;br/&gt;&lt;br/&gt;git clone ssh://git@github.com:22/tachang/EyeFiServer.git&lt;br/&gt;git clone ssh://git@ssh.github.com:443/tachang/EyeFiServer.git&lt;/username&gt;&lt;/username&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-6849433345859706827?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265579539</link><guid>http://tachang.tumblr.com/post/22265579539</guid><pubDate>Thu, 18 Jun 2009 20:38:00 -0400</pubDate><category>proxy</category><category>windows</category><category>SSH</category><category>Github</category><category>linux</category></item><item><title>Django TypeError Exception</title><description>&lt;p&gt;One of the central pieces of Django is urls.py:&lt;br/&gt;&lt;br/&gt;&lt;a href="http://docs.djangoproject.com/en/dev/topics/http/urls/"&gt;http://docs.djangoproject.com/en/dev/topics/http/urls/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;This file is well documented and serves as a central place to match what pages get served by what URLs. Seems simple enough since they accept regular expressions.&lt;br/&gt;&lt;br/&gt;One thing I did run into though was getting a TypeError exception. It looked something like this:&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;TypeError at /applicationname/&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;index() takes exactly 1 argument (2 given)&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;To me I was puzzled why this was happening. The reason is that when Django parses the regular expression it not only does a match but saves each of the tuples in the regular expression. In the documentation it is this line:&lt;br/&gt;&lt;br/&gt;&lt;span style="font-style: italic;"&gt;&amp;#8220;The view gets passed an HttpRequest as its first argument and any values captured in the regex as remaining arguments.&amp;#8221;&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;So what happens is that when you start to get fancy with your regular expressions the function signature in your views.py needs to change as well to accommodate the extra parameters.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-324950665629831247?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265578561</link><guid>http://tachang.tumblr.com/post/22265578561</guid><pubDate>Mon, 15 Jun 2009 20:26:00 -0400</pubDate><category>urls.py</category><category>views.py</category><category>python</category><category>Django</category></item><item><title>SiteMinder R12 Admin GUI</title><description>&lt;p&gt;If you are upgrading or installing SiteMinder R12 you may have noticed that the traditional admin GUI has changed. The Java applet now asks you for 4 fields.&#13;&lt;br/&gt;&lt;br/&gt;Username: This is the username found in the &amp;#8220;Administrators&amp;#8221; list on the old version 6 GUI. The applet is not case sensitive.&#13;&lt;br/&gt;Password: The password in the  &amp;#8220;Administrators&amp;#8221; list.&#13;&lt;br/&gt;Host Name: A 4.x compatible Agent&amp;#8217;s name&#13;&lt;br/&gt;Passphrase: The Shared Secret of the 4.x compatible agent&#13;&lt;br/&gt;&lt;br/&gt;The Host Name and Passphrase fields are where things get interesting. SiteMinder R12 is trying heavily to move the functions of this applet to a web based system. The web based system communicates with the SiteMinder policy server using the API. However, the API still uses 4.x agents as the method of authentication to the policy server. 4.x agents have an associated shared secret.&#13;&lt;br/&gt;&lt;br/&gt;Thus to get into the traditional 6.0 GUI you need to have a 4.x compatible agent. But what happens when you upgrade to SiteMinder R12 and don&amp;#8217;t have one? You have two options:&#13;&lt;br/&gt;&lt;br/&gt;1. Install the SiteMinder Web Access Manager GUI - Unfortunately the installer for Windows is over 2GB&#13;&lt;br/&gt;2. Manually create a 4.x Web Agent&#13;&lt;br/&gt;&lt;br/&gt;Option 2 is easiest. We are going to create a file with the proper parameters and then use smobjimport to import it directly to the policy store. To do this create a file called &amp;#8220;Generic4xAgent&amp;#8221; and put the following in the file:&#13;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;&lt;blockquote&gt;objectclass: Agent&#13;&lt;br/&gt;Oid: 01-39c83ef9-5c51-4fb4-ba13-193543b8a9d4&#13;&lt;br/&gt;Name: siteminder&#13;&lt;br/&gt;Desc:&#13;&lt;br/&gt;AgentType: 10-8d78bb96-ae15-11d1-9cdd-006008aac24b&#13;&lt;br/&gt;RealmHintAttrId: 0&#13;&lt;br/&gt;&lt;br/&gt;objectclass: TrustedHost&#13;&lt;br/&gt;Oid: 24-5ea55269-d8a9-47a0-864c-c97026c00b99&#13;&lt;br/&gt;Name: siteminder&#13;&lt;br/&gt;Desc:&#13;&lt;br/&gt;IpAddr: 127.0.0.1&#13;&lt;br/&gt;Secret: password&#13;&lt;br/&gt;Is4xHost: true&#13;&lt;br/&gt;RolloverEnabled: false&#13;&lt;br/&gt;SecretGenTime: 00000000-00000000-000000000000000000000000000000000000000000000000&#13;&lt;br/&gt;SecretUsedTime: 00000000-00000000-000000000000000000000000000000000000000000000000&#13;&lt;br/&gt;PrevSecret:&#13;&lt;br/&gt;&lt;/blockquote&gt;&#13;&lt;br/&gt;Save the file as &amp;#8220;Generic4xAgent&amp;#8221;. Now run the command:&#13;&lt;br/&gt;smobjimport -iGeneric4xAgent -dsiteminder -wpassword -c&#13;&lt;br/&gt;&lt;br/&gt;-i is the filename&#13;&lt;br/&gt;-d is the SiteMinder admin username&#13;&lt;br/&gt;-w is the SiteMinder admin password&#13;&lt;br/&gt;-c indicates that the file has cleartext passwords&#13;&lt;br/&gt;&lt;br/&gt;This creates a 4.x agent named &amp;#8220;siteminder&amp;#8221; with a shared secret of &amp;#8220;password&amp;#8221;.&#13;&lt;br/&gt;&lt;br/&gt;At this point you should be able to login to the traditional admin UI.&#13;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-6641446271501407020?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265577381</link><guid>http://tachang.tumblr.com/post/22265577381</guid><pubDate>Thu, 11 Jun 2009 13:47:00 -0400</pubDate><category>SiteMinder</category></item><item><title>Fixing pkg_add -r on FreeBSD (things no one tells you)</title><description>&lt;p&gt;On FreeBSD when you want to install a program you have to make a choice. Your two choices are to install a package or compile from ports.&lt;br/&gt;&lt;br/&gt;Installing a package means you download a binary package and copy all the files to the right places. Everything is already compiled. This is how Windows works. When you install a piece of software it has already been compiled.&lt;br/&gt;&lt;br/&gt;Your second option is to compile from ports. What this means is that the source files are downloaded and then compiled on your system. You need to have all the prerequisites for the compile to be successful.&lt;br/&gt;&lt;br/&gt;Why choose one over the other? Well with packages sometimes the binary doesn&amp;#8217;t work. Either you happen to have a newer or older file than what the creator compiled it with or you changed something with your system and it doesn&amp;#8217;t match anymore with the author&amp;#8217;s compiled environment. However packages are fast to install. No need to break out gcc and compile source code.&lt;br/&gt;&lt;br/&gt;Ports on the other hand will almost always work. They are targetted for your system because you are compiling them. It takes a bit longer but you also get to customize any of the build options.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;To install a program from package you use this command:&lt;br/&gt;&lt;br/&gt;pkg_add -r &lt;program-name&gt;&lt;br/&gt;&lt;br/&gt;Examples:&lt;br/&gt;&lt;br/&gt;pkg_add -r xorg&lt;br/&gt;pkg_add -r nano&lt;br/&gt;pkg_add -r curl&lt;br/&gt;&lt;br/&gt;I like pkg_add -r because it fetches the package for me and installs it. It does that by looking at your system&amp;#8217;s uname (I think) and forms a URL to FreeBSD&amp;#8217;s software repository. The problem is that after a while repositories are taken offline. So if you are using some older version of FreeBSD and trying to do a pkg_add -r it will return that it can&amp;#8217;t find the package.&lt;br/&gt;&lt;br/&gt;The thing is, the package is probably still around but in a newer form. The newer package is compatible with your version if you can find it. FreeBSD makes a statement that says packages in the same stable branch will always be compatible.&lt;br/&gt;&lt;br/&gt;To force pkg_add -r to bend to your will you edit the &lt;tt class="ENVAR"&gt;PACKAGESITE&lt;span style="font-family:Georgia,serif;"&gt; &lt;/span&gt;&lt;/tt&gt;environment variable. If you want to force pkg_add -to download FreeBSD 7-STABLE packages, set &lt;tt class="ENVAR"&gt;PACKAGESITE&lt;/tt&gt; to &lt;tt class="LITERAL"&gt;&lt;a href="ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/"&gt;ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/&lt;/a&gt;&lt;/tt&gt;.&lt;br/&gt;&lt;br/&gt;Be very careful though that you point to the right URL. I actually pointed to the wrong URL and downloaded 32-bit packages instead of the amd64 packages which I needed:&lt;br/&gt;&lt;br/&gt;&lt;a href="http://ftp2.at.freebsd.org/pub/FreeBSD/ports/amd64/packages-7-stable/Latest/"&gt;http://ftp2.at.freebsd.org/pub/FreeBSD/ports/amd64/packages-7-stable/Latest/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;tt class="ENVAR"&gt;&lt;/tt&gt;&lt;/program-name&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-5878756243478781852?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;&lt;/p&gt;</description><link>http://tachang.tumblr.com/post/22265576382</link><guid>http://tachang.tumblr.com/post/22265576382</guid><pubDate>Fri, 29 May 2009 15:18:00 -0400</pubDate><category>pkg_add</category><category>FreeBSD</category></item><item><title>Ubuntu: Getting files off your phone using bluetooth</title><description>&lt;p&gt;Sometimes you just want to get a file off your phone. One of the easiest ways to do this is bluetooth. The problem is that some carriers (such as Verizon) lock their phones down so you can&amp;#8217;t transfer files from your phone to your PC over bluetooth.&lt;br/&gt;&lt;br/&gt;The real technicality is that while the phone can&amp;#8217;t initiate the sending of the file, you can still browse the phone for files and pull them.&lt;br/&gt;&lt;br/&gt;So far the most useful tool I found to get files off my phone (which is an LG Chocolate) is obexftp.&lt;br/&gt;&lt;br/&gt;To get started install the package using Synaptic then open up a console and type:&lt;br/&gt;&lt;br/&gt;$ obexftp -b&lt;br/&gt;&lt;br/&gt;When you find a device you want you connect to it like so:&lt;br/&gt;&lt;br/&gt;$ obexftp -b 00:1E:75:ED:62:2C -l&lt;br/&gt;Browsing 00:1E:75:ED:62:2C &amp;#8230;&lt;br/&gt;Channel: 7&lt;br/&gt;Connecting&amp;#8230;done&lt;br/&gt;Receiving &amp;#8220;(null)&amp;#8221;&amp;#8230;&lt;br/&gt;&lt;folder-listing version="1.0"&gt;&lt;folder name="MySounds"&gt;&lt;folder name="MyPictures"&gt;&lt;folder name="MyVideos"&gt;&lt;folder name="SdPictures"&gt;&lt;folder name="SdSounds"&gt;done&lt;br/&gt;Disconnecting&amp;#8230;done&lt;br/&gt;&lt;br/&gt;The way obexftp works is that you basically have to run the command over and over with different options to get what you want. So after running it with this &amp;#8220;list&amp;#8221; option I say I want to browse the folder &amp;#8220;MyPictures&amp;#8221;.&lt;br/&gt;&lt;br/&gt;$ obexftp -b 00:1E:75:ED:62:2C -c MyPictures -l&lt;br/&gt;Browsing 00:1E:75:ED:62:2C &amp;#8230;&lt;br/&gt;Channel: 7&lt;br/&gt;Connecting&amp;#8230;done&lt;br/&gt;Sending &amp;#8220;MyPictures&amp;#8221;&amp;#8230; done&lt;br/&gt;Receiving &amp;#8220;(null)&amp;#8221;&amp;#8230;&lt;br/&gt;&lt;folder-listing version="1.0"&gt;&lt;parent-folder&gt;&lt;file name="0309091806.jpg" size="210900"&gt;done&lt;br/&gt;Disconnecting&amp;#8230;done&lt;br/&gt;&lt;br/&gt;Now that I know the location of the file I can procede to actually get the file.&lt;br/&gt;&lt;br/&gt;$ obexftp -b 00:1E:75:ED:62:2C -c MyPictures -g 0512091207.jpg&lt;br/&gt;Browsing 00:1E:75:ED:62:2C &amp;#8230;&lt;br/&gt;Channel: 7&lt;br/&gt;Connecting&amp;#8230;done&lt;br/&gt;Sending &amp;#8220;MyPictures&amp;#8221;&amp;#8230; done&lt;br/&gt;Receiving &amp;#8220;0512091207.jpg&amp;#8221;&amp;#8230;|done&lt;br/&gt;Disconnecting&amp;#8230;done&lt;br/&gt;&lt;br/&gt;Easy enough. Probably not the most intuitive way to do things but it gets the job done.&lt;/file&gt;&lt;/parent-folder&gt;&lt;/folder-listing&gt;&lt;/folder&gt;&lt;/folder&gt;&lt;/folder&gt;&lt;/folder&gt;&lt;/folder&gt;&lt;/folder-listing&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-2329337696017668293?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;&lt;/p&gt;</description><link>http://tachang.tumblr.com/post/22265575430</link><guid>http://tachang.tumblr.com/post/22265575430</guid><pubDate>Tue, 12 May 2009 15:14:00 -0400</pubDate><category>ubuntu</category><category>file transfer</category><category>obex</category><category>bluetooth</category></item><item><title>Obtaining a Free Fully Trusted SSL Certificate</title><description>&lt;p&gt;Ever get that popup when you visited a supposedly &amp;#8220;secure&amp;#8221; website that says the certificate is not trusted? Reason you get that popup is because the person who signed/issued the certificate is not trusted by default on your computer.&lt;br/&gt;&lt;br/&gt;The business of selling certificates is a lucrative one. Large certificate authorities such as Thawte and VeriSign make a killing issuing digital certifcates. They can arbitrarily adjust the parameters on the certificate and charge for it on a case by case basis. The reason they are able to do so is because almost every computer by default trusts these companies. You can check this in Windows by going to start, run, mmc.exe and adding the Certificate snap in. Look under Trusted Root Certification Authorities.&lt;br/&gt;&lt;br/&gt;In general you have to pay quite a bit of money to get a certificate signed by one of these authorities. However there is one way to get a virtually &amp;#8220;free&amp;#8221; one.&lt;br/&gt;&lt;br/&gt;Thawte offers a program called their Web of Trust:&lt;br/&gt;&lt;br/&gt;&lt;a href="https://www.thawte.com/cgi/personal/wot/contents.exe"&gt;&lt;a href="https://www.thawte.com/cgi/personal/wot/contents.exe"&gt;https://www.thawte.com/cgi/personal/wot/contents.exe&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;Basically after going through the steps Thawte will give you a free certificate signed by an authority called &amp;#8220;Thawte Personal Freemail CA&amp;#8221;. Because this CA is installed by default on all Windows installations it is trusted everywhere.&lt;br/&gt;&lt;br/&gt;Getting this certificate involves a combination of sending in documents to Thawte or finding people who have already gone through the process to vouch for you. Once you have it though you keep it forever (as far as I can see) and can generate certificates with your e-mail address in it.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-6436888483369683537?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265574316</link><guid>http://tachang.tumblr.com/post/22265574316</guid><pubDate>Mon, 27 Apr 2009 18:57:00 -0400</pubDate></item><item><title>PyXMLSec Windows Binary</title><description>&lt;p&gt;&lt;h1 style="font-weight: bold;font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Xmlsec Python Bindings for Windows&lt;/span&gt;&lt;/h1&gt; Getting the python xmlsec library to work on windows is a bit of work though it really shouldn&amp;#8217;t be. Provided here are windows installers for xmlsec. The installer itself is produced by python distutils.&lt;br/&gt;&lt;br/&gt;In order to get it to work you will also need libxml2. I am providing a copy of it here as well.&lt;br/&gt;&lt;br/&gt;&lt;a href="http://dl.dropbox.com/u/2177278/pyxmlsec-0.3.0.win32-py2.6.exe"&gt;pyxmlsec-0.3.0.win32-py2.6.exe&lt;/a&gt;&lt;br/&gt;&lt;a href="http://dl.dropbox.com/u/2177278/libxml2-python-2.7.3.win32-py2.6.exe%22"&gt;libxml2-python-2.7.3.win32-py2.6.exe&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;I used MinGW for compilation. The entire environment I used to compile pyxmlsec is available here. Look inside the pyxmlsec directory for build.bat.&lt;br/&gt;&lt;a href="http://PythonWindowsCompileEnvironment.zip"&gt;PythonWindowsCompileEnvironment.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-4810300617290155729?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;&lt;/p&gt;</description><link>http://tachang.tumblr.com/post/22265573435</link><guid>http://tachang.tumblr.com/post/22265573435</guid><pubDate>Wed, 15 Apr 2009 17:35:00 -0400</pubDate><category>pyxmlsec</category><category>python</category><category>xmlsec</category></item><item><title>Eye Fi Standalone Server Version 2.0</title><description>&lt;p&gt;I&amp;#8217;d like to release an updated version of the Eye Fi standalone server in python that I have been working on. This version should work on Linux, Mac OS X, Windows, Solaris, or wherever else you can load a Python interpreter. As always I love comments so if you are using this feel free to e-mail me or drop me a note!&lt;br/&gt;&lt;br/&gt;Source on GitHub: &lt;a href="http://github.com/tachang/EyeFiServer"&gt;&lt;a href="http://github.com/tachang/EyeFiServer"&gt;http://github.com/tachang/EyeFiServer&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Download (zip)&lt;/span&gt;: &lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;a href="http://www.darkeneddesire.com/EyeFiServer/2.0/EyeFiServer-v2.0.zip"&gt;&lt;a href="http://www.darkeneddesire.com/EyeFiServer/2.0/EyeFiServer-v2.0.zip"&gt;http://www.darkeneddesire.com/EyeFiServer/2.0/EyeFiServer-v2.0.zip&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;I know some people just like to browse around the source without having to download stuff (I&amp;#8217;m one of those people):&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.darkeneddesire.com/EyeFiServer/2.0/Release/"&gt;&lt;a href="http://www.darkeneddesire.com/EyeFiServer/2.0/Release/"&gt;http://www.darkeneddesire.com/EyeFiServer/2.0/Release/&lt;/a&gt;&lt;br/&gt;&lt;/a&gt;&lt;br/&gt;This new version has the following features:&lt;br/&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The server can now execute an arbitrary command on each uploaded photo. This is a very dangerous feature and should be used with caution. On the other hand it is also very cool. You can have the server FTP files, display them using an image viewer, or even run sorting programs on the images.&lt;br/&gt;&lt;/li&gt;&lt;li&gt;Improved security: the server now generates its own nonces instead of using one that was hard coded. The nonce is based on the random library provided by python. The INTEGRITYDIGEST field is also checked.&lt;/li&gt;&lt;li&gt;Ability to read settings from a configuration file (there is a included DefaultSettings.ini for reference). The file allows you to configure the listen port, console output, logging, download location, and execute on upload, and upload key.&lt;/li&gt;&lt;/ul&gt;Some other notable improvements but not really features are the addition of regression tests and support for Python 2.5.  The regression tests are interesting since I run them against the official Eye-Fi Manager to make sure my behavior is a close match.&lt;br/&gt;&lt;br/&gt;Getting usage information as to how to specify a configuration file:&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;C:\EyeFiServer\Release&amp;gt;EyeFiServer.py -h&lt;/span&gt;&lt;br/&gt;Usage: EyeFiServer.py [options]&lt;br/&gt;&lt;br/&gt;Options:&lt;br/&gt; -h, &amp;#8212;help            show this help message and exit&lt;br/&gt; -c CONFIGFILE, &amp;#8212;config=CONFIGFILE&lt;br/&gt;                       Path to configuration file (example in&lt;br/&gt;                       DefaultSettings.ini)&lt;br/&gt;&lt;br/&gt;Actually specifying a configuration file:&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;C:\EyeFiServer\Release&amp;gt;EyeFiServer.py -c DebugSettings.ini&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-6478252334706825910?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265572453</link><guid>http://tachang.tumblr.com/post/22265572453</guid><pubDate>Thu, 02 Apr 2009 22:56:00 -0400</pubDate><category>python</category><category>Eye-Fi</category><category>standalone</category><category>EyeFi</category><category>linux</category><category>server</category></item><item><title>Converting LDIF/LDAP data into a CSV file</title><description>&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;LDIF to CSV&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;I work with LDAP on a regularly basis. I frequently have to pull data using ldapsearch. While the data that ldapsearch spits out is a decent representation sometimes I want something a bit easier to work with.&lt;br/&gt;&lt;br/&gt;The format I use most tends to be CSV. While the acronym stands for comma separated value the format may be used to describe data that is printed out line by line and separated by anything you can imagine.&lt;br/&gt;&lt;br/&gt;The problem for me is finding a decent LDIF to CSV converter. The ones that I have tried tend to choke on any number of issues. Some of these include binary data or failing to normalize the multivalued attributes.&lt;br/&gt;&lt;br/&gt;I finally got sick enough of these issues that I decided to write my own. You can download it here:&lt;br/&gt;&lt;br/&gt;&lt;a href="http://dl.dropbox.com/u/2177278/LDIFtoCSV-src-v1.0.zip"&gt;Python/Linux/Source&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://dl.dropbox.com/u/2177278/LDIFtoCSV-win32-v1.0.zip"&gt;Windows&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Hopefully the Windows binary works for you. If it doesn&amp;#8217;t then just download Python 2.6 and run the source manually. I am providing the binary just for convenience.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:130%;"&gt;Using LDIFtoCSV&lt;/span&gt;&lt;br/&gt;&lt;/span&gt;&lt;br/&gt;Running &amp;#8220;python LDIFtoCSV.py&amp;#8221; should give you the usage text.&lt;br/&gt;&lt;br/&gt;usage: LDIFtoCSV.py [options] &lt;ldif_file&gt;&lt;br/&gt;&lt;br/&gt;-o &amp;lt;filename&amp;gt;  &amp;#160;: File to write output. By default this is set to sys.stdout&lt;br/&gt;-l &amp;lt;filename&amp;gt;  &amp;#160;: File to write logging output. By default there is no logging.&lt;br/&gt;-F &amp;lt;char&amp;gt;      &amp;#160;: Character to separate the fields by. By default this is a comma. i.e. -F&amp;#8221;,&amp;#8221;&lt;br/&gt;-D &amp;lt;char&amp;gt;      &amp;#160;: Character to delimit the text value by. By default this is a double quote. i.e. -D&amp;#8221;&amp;#8220;&amp;#8221;&lt;br/&gt;-M &amp;lt;num&amp;gt;       &amp;#160;: The maximum number of columns a multivalued attribute should take up (default: 5). This is common with the objectClass attribute where it can have over 20 values. Do you want to have 20 columns each with the same heading objectClass or do you want to limit it.&lt;br/&gt;&lt;br/&gt;Here are some common command lines that I use (assuming you have a test.ldif):&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Outputs the CSV straight to standard output:&lt;/span&gt;&lt;br/&gt;python LDIFtoCSV.py test.ldif&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Outputs CSV to standard output with semicolons as the delimiter:&lt;/span&gt;&lt;br/&gt;&lt;/ldif_file&gt;python LDIFtoCSV.py -F&amp;#8221;;&amp;#8221; test.ldif&lt;ldif_file&gt;&lt;br/&gt;&lt;br/&gt;&lt;/ldif_file&gt;&lt;span style="font-weight: bold;"&gt;Outputs CSV to standard output with pipes as the delimiter and text surrounded by carrots:&lt;/span&gt;&lt;br/&gt;python LDIFtoCSV.py -F&amp;#8221;|&amp;#8221; -D&amp;#8221;^&amp;#8221; test.ldif&lt;br/&gt;&lt;ldif_file&gt;&lt;br/&gt;&lt;br/&gt;&lt;/ldif_file&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-1937325780893140153?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265571437</link><guid>http://tachang.tumblr.com/post/22265571437</guid><pubDate>Tue, 27 Jan 2009 18:33:00 -0500</pubDate><category>LDIF</category><category>LDIF to CSV</category><category>Converting LDIF to CSV</category><category>python</category><category>CSV</category><category>LDAP</category></item><item><title>Downloading the Global Address List from Outlook/Exchange</title><description>&lt;p&gt;&lt;span style="font-weight: bold;font-size:130%;"&gt;Getting the Data&lt;br/&gt;&lt;/span&gt;&lt;br/&gt;Recently I had a need to dump the entire Global Address List from within Outlook. Usually the address list will contain the contact information for your entire organization.&lt;br/&gt;&lt;br/&gt;The most effective way I have found to do this is a straight LDAP search on the Active Directory and pull everything into an LDIF file. Conceptually it is straightforward but I have found the most difficult part is usually trying to get all the pieces together. So subscribing to the French idea of &amp;#8220;mise en place&amp;#8221; here is what you&amp;#8217;ll need:&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Username&lt;/span&gt;&lt;br/&gt;Your username is your fully qualified distinguished name. It is not your Windows login name. It commonly looks something like &amp;#8220;CN=Tchang&amp;#44; Jeff,OU=Users,OU=USA,DC=example,DC=com&amp;#8221;.&lt;br/&gt;&lt;br/&gt;The easiest way I have found to obtain your username is to login to a Windows machine and then put the following two lines in a text file with the extension .vbs:&lt;br/&gt;&lt;br/&gt;Set objADSysInfo = WScript.CreateObject(&amp;#8220;ADSystemInfo&amp;#8221;)&lt;br/&gt;result = InputBox(&amp;#8220;Active Directory Username (copy and paste as necessary)&amp;#8221;, &amp;#8220;Active Directory Username&amp;#8221;, objADSysInfo.UserName, 100, 100)&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Password&lt;/span&gt;&lt;br/&gt;The password will be your domain password.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Domain controller hostname&lt;/span&gt;&lt;br/&gt;Couple of ways to get this. This will be the Active Directory/LDAP server that you will extract the entries. An echo %logonserver% at the command prompt usually works.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;font-size:100%;"&gt;Ldapsearch tool&lt;/span&gt;&lt;br/&gt;Easiest way to get the tools is from Sun&amp;#8217;s iPlanet Directory SDK. Go to &lt;a href="http://www.sun.com/download/products.xml?id=3ec28dbd"&gt;&lt;a href="http://www.sun.com/download/products.xml?id=3ec28dbd"&gt;http://www.sun.com/download/products.xml?id=3ec28dbd&lt;/a&gt;&lt;/a&gt; and select the iPlanet Directory SDK downloads. After download the zipfile find the executable named ldapsearch.exe.&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Performing the search&lt;/span&gt;&lt;br/&gt;Here is an example syntax to extract out all the users:&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Windows:&lt;/span&gt;&lt;br/&gt;ldapsearch.exe -b OU=Users,OU=USA,DC=example,DC=com -h host.example.com -p 389 -D &amp;#8220;CN=Tchang&amp;#44; Jeff,OU=Users,OU=USA,DC=example,DC=com&amp;#8221; -w - (objectClass=*)&lt;br/&gt;&lt;br/&gt;&lt;span style="font-weight: bold;"&gt;Unix:&lt;/span&gt;&lt;br/&gt;ldapsearch -b OU=Users,OU=USA,DC=example,DC=com -h host.example.com -p 389 -D &amp;#8220;CN=Tchang&amp;#44; Jeff,OU=Users,OU=USA,DC=example,DC=com&amp;#8221; -W -x &amp;#8220;(objectClass=*)&amp;#8221;&lt;br/&gt;&lt;br/&gt;The -b is for the base. In this example I knew the users were all stored in that branch. -D is for username. -w - (that is a dash w followed by a dash) means to read the password from the console. On Unix the big -W is to prompt and the -x indicates you want simple authentication (cleartext username/password).&lt;br/&gt;&lt;br/&gt;You might want to add a &amp;#8221; &amp;gt; output.txt&amp;#8221; to send the output to a file. If you do that you will have to supply the password on the command line.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/2044427065375438750-5987368060820209870?l=returnbooleantrue.blogspot.com" alt=""/&gt;&lt;/div&gt;</description><link>http://tachang.tumblr.com/post/22265570234</link><guid>http://tachang.tumblr.com/post/22265570234</guid><pubDate>Wed, 21 Jan 2009 16:24:00 -0500</pubDate><category>Active Directory</category><category>LDIF</category><category>python</category><category>GAL</category><category>Outlook</category><category>LDAP</category></item></channel></rss>
