<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">

 <title>Can Burak Çilingir</title>
 
 <link href="http://www.canb.net/" />
 <updated>2013-04-02T23:31:44-07:00</updated>
 <id>http://www.canb.net/</id>
 <author>
   <name>Can Burak Çilingir</name>
   <email>can@canb.net</email>
 </author>

 
 <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/canburak" /><feedburner:info uri="canburak" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><entry>
   <title>Halal and Organik Logos for Indonesia</title>
   <link href="http://www.canb.net/2013/04/halal-and-organik-logos-for-indonesia.html" />
   <updated>2013-04-03T00:00:00-07:00</updated>
   <id>http://www.canb.net/2013/04/halal-and-organik-logos-for-indonesia</id>
   <content type="html">&lt;p&gt;If you need &amp;#8220;Halal&amp;#8221; and &amp;#8220;Organik&amp;#8221; logos for Indonesia, here they are:&lt;/p&gt;

&lt;h2 id='halal_logo'&gt;Halal Logo&lt;/h2&gt;

&lt;p&gt;&lt;img src='/assets/indonesia-logos/halal-thumb.png' alt='Alt text' /&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href='/assets/indonesia-logos/halal.ai' title='Halal Logo in Adobe Illustrator (AI) format'&gt;Adobe Illustrator (AI)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href='/assets/indonesia-logos/halal.pdf' title='Halal Logo in PDF format'&gt;PDF&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href='/assets/indonesia-logos/halal.png' title='Halal Logo in PNG format'&gt;PNG&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href='/assets/indonesia-logos/halal.jpg' title='Halal Logo in JPG format'&gt;JPG&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id='organik_logo'&gt;Organik Logo&lt;/h2&gt;

&lt;p&gt;&lt;img src='/assets/indonesia-logos/organik-thumb.png' alt='Alt text' /&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href='/assets/indonesia-logos/organik.ai' title='Organik Logo in Adobe Illustrator (AI) format'&gt;Adobe Illustrator (AI)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href='/assets/indonesia-logos/organik.pdf' title='Organik Logo in PDF format'&gt;PDF&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href='/assets/indonesia-logos/organik.png' title='Organik Logo in PNG format'&gt;PNG&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href='/assets/indonesia-logos/organik.jpg' title='Organik Logo in JPG format'&gt;JPG&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>Integrating Mandrill and Postfix</title>
   <link href="http://www.canb.net/2012/05/integrating-mandrill-and-postfix.html" />
   <updated>2012-05-17T00:00:00-07:00</updated>
   <id>http://www.canb.net/2012/05/integrating-mandrill-and-postfix</id>
   <content type="html">&lt;p&gt;I was looking around for transactional email solutions and decided to test &lt;a href='http://mandrill.com/'&gt;Mandrill&lt;/a&gt;. The easiest test case for me was to setup my laptop to relay over it. I am using Ubuntu 12.04. You can find your credentials in the &lt;a href='https://mandrillapp.com/settings/index'&gt;settings page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;An easier method would be using swaks:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;swaks --to YOUR_EMAIL \
      --server smtp.mandrillapp.com \
      --auth-user YOUR_USERNAME \
      --auth-password YOUR_API_KEY&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;First step is to set a fully qualified domain as your hostname. Check if &lt;code&gt;hostname -f&lt;/code&gt; outputs an fqdn. On my laptop it nicely displayed &lt;em&gt;gem.canb.net&lt;/em&gt;, so I was good to go. Please configure your hostname if it is not an FQDN. You can do it with &lt;code&gt;hostname YOUR_FQDN&lt;/code&gt;. If you want this to survive a reboot, you are on your own.&lt;/p&gt;

&lt;p&gt;Add this domain to your Mandrill account as outbound and set-up the DNS records as instructed by the &lt;em&gt;DNS Settings&lt;/em&gt; button.&lt;/p&gt;

&lt;p&gt;From now on, I&amp;#8217;ll be closely following &lt;a href='http://www.postfix.org/SASL_README.html#client_sasl'&gt;Postfix SASL documentation&lt;/a&gt;. Put the following into &lt;em&gt;/etc/postfix/sasl_passwd&lt;/em&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[smtp.mandrillapp.com] YOUR_USERNAME:YOUR_API_KEY&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Secure the file with &lt;code&gt;chown root:root&lt;/code&gt; and &lt;code&gt;chmod go-rwx&lt;/code&gt; and run &lt;code&gt;postmap /etc/postfix/sasl_passwd&lt;/code&gt;. You&amp;#8217;ll need &lt;code&gt;postmap&lt;/code&gt; anytime you change your credentials.&lt;/p&gt;

&lt;p&gt;Modify &lt;em&gt;/etc/postfix/main.cf&lt;/em&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;myhostname = gem.canb.net
mydestination = gem.canb.net, gem, localhost.localdomain, localhost

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous

relayhost = [smtp.mandrillapp.com]:587&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you are going to use this setup for a longer time period, you have to &lt;a href='http://www.postfix.org/TLS_README.html#client_tls_levels'&gt;setup TLS&lt;/a&gt; as we are sending everything in plaintext, thanks to &lt;code&gt;smtp_sasl_security_options = noanonymous&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Restart Postfix and you can &lt;code&gt;ps aux | mail -s test YOUR_EMAIL&lt;/code&gt;. You can &lt;code&gt;tail -f /var/log/syslog&lt;/code&gt; to see what&amp;#8217;s happening.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Jekyll and zenhabits</title>
   <link href="http://www.canb.net/2012/04/jekyll-and-zenhabits.html" />
   <updated>2012-04-03T00:00:00-07:00</updated>
   <id>http://www.canb.net/2012/04/jekyll-and-zenhabits</id>
   <content type="html">&lt;p&gt;Like all geeks I&amp;#8217;ve tried many blogging solutions over the years and I always thought that latest one is the ultimate one.&lt;/p&gt;

&lt;p&gt;This time is no different. I&amp;#8217;ve switched from blogger.com to a &lt;del&gt;self-hosted&lt;/del&gt; github-hosted &lt;a href='http://jekyllbootstrap.com'&gt;jekyll&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After spending some time with &lt;a href='http://www.thenegation.com/'&gt;vst&lt;/a&gt;, we were happy with jekyll. Bolts and nuts are in place. I searched for a decent theme and loved the &lt;a href='http://zenhabits.net/theme/'&gt;Zen Habits theme&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here I am with my ultimate blog solution.&lt;/p&gt;

&lt;p&gt;Now I need another post to demote this one from the front page.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Story of an Analog POS</title>
   <link href="http://www.canb.net/2012/02/story-of-analog-pos.html" />
   <updated>2012-02-18T00:00:00-08:00</updated>
   <id>http://www.canb.net/2012/02/story-of-analog-pos</id>
   <content type="html">&lt;p&gt;I like to read Paul Venezia&amp;#8217;s blog from time to time. He talks about things like &lt;a href='http://www.infoworld.com/d/data-center/why-arent-we-finally-rid-of-patch-cables-186249?page=0,1' title='Why are not we finally rid of patch cables?'&gt;MRJ21 cables&lt;/a&gt; or &lt;a href='http://www.infoworld.com/d/data-center/what-it-should-know-about-ac-power-177345?page=0,1' title='What IT should know about AC power'&gt;C19-to-L6-20 cables&lt;/a&gt;. Recently he wrote &lt;a href='http://www.infoworld.com/d/data-center/it-guy-wanted-must-have-own-tools-185628' title='IT guy wanted; must have own tools'&gt;IT guy wanted; must have own tools&lt;/a&gt; which I remembered today when dealing with the problem I&amp;#8217;ll talk about below.&lt;/p&gt;

&lt;p&gt;Some of my work involves &lt;a href='http://www.brandsfever.com/' title='Brandsfever: cool brands hot sales'&gt;Brandsfever&lt;/a&gt;, which is a private shopping club in Singapore. Tomorrow we&amp;#8217;ll have an offline sales event and I was unable to resist the idea of playing with a new toy, &lt;a href='http://www.verifone.com/countertop/vx510.aspx' title='Vx 510 Details'&gt;VeriFone Vx 510&lt;/a&gt;. When I had the device, I was ready to plug it to my laptop via one of my cisco console cables. Remembering how lucky guy I am, things didn&amp;#8217;t go smooth and we realized that the device needs to operate on a good old analog phone line. I was expecting at least a SIM card or may be some Wi-Fi but I am still thankful that we don&amp;#8217;t have to use a credit card imprint device.&lt;/p&gt;

&lt;p&gt;It didn&amp;#8217;t took long to realize that we are using &lt;a href='http://www.elastix.org/' title='elastix: freedom to communicate'&gt;elastix&lt;/a&gt; and we do not have any analog lines. Thankfully Melvin found a &lt;a href='http://en.wikipedia.org/wiki/Linksys_PAP2' title='Linksys PAP2'&gt;Linksys PAP2&lt;/a&gt; buried in the IT drawer and configured it which provides us an analog line. After spending some time with the device we were able to charge my card 0.01$. We were ready for the event&amp;#8230; A phone call disturbed my dream. We won&amp;#8217;t have a line in the event&amp;#8217;s place. I love problems to stack up. Thankfully I have my &lt;a href='https://plus.google.com/107124435011904335651/posts/DWi23MNk7jd' title='TP Link Portable Wireless N Router coming with GPL leaflet'&gt;GPL&amp;#8217;d portable wireless router&lt;/a&gt; which makes me the type of IT guy Venezia want. After spending some time configuring elastix and the Linksys device to work together over 3g, I&amp;#8217;ve succeded to charge my credit card without a real phone line.&lt;/p&gt;

&lt;p&gt;Hopefully, if you come to visit our &lt;a href='https://www.facebook.com/events/351464508221741/' title='Brandsfever Shopping at Lucky13'&gt;event&lt;/a&gt; at 111 Somerset tomorrow, your card will be charged over a POS device which connects to the bank over a 3g connection with the help of a USB dongle connected to a wireless router, a Linksys PAP2 device and an Elastix server located in our office. It makes me feel like a &lt;a href='http://www.catb.org/~esr/faqs/hacker-howto.html' title='How To Become A Hacker'&gt;hacker&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Please SingTel, don&amp;#8217;t let us down! And thanks to Venezia for the inspiration to write this post.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update: After a couple of charges over this system, luckily we were able to use a real phone line and switched back to the real analog for our charges. Now, I want to connect this to a computer.&lt;/em&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Push data to google analytics with python</title>
   <link href="http://www.canb.net/2012/01/push-data-to-google-analytics-with.html" />
   <updated>2012-01-16T00:00:00-08:00</updated>
   <id>http://www.canb.net/2012/01/push-data-to-google-analytics-with</id>
   <content type="html">&lt;p&gt;I&amp;#8217;ll share with you how to push data to Google Analytics with a simple Python example. You can collect/plot/analyze some interesting data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you have a programmable door lock in the office, you can track employees&amp;#8217; office hours.&lt;/li&gt;

&lt;li&gt;Track the commits of your team. Tag with branch/hash etc.&lt;/li&gt;

&lt;li&gt;Track your own computer usage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Google Analytics is mostly used with a JavaScript snippet on the client side but if you browse the documentation, you&amp;#8217;ll see that they also provide &lt;a href='https://developers.google.com/analytics/devguides/collection/other/mobileWebsites'&gt;mobile tracking&lt;/a&gt; features which help you to collect data without a web browser or even if the client doesn&amp;#8217;t support JavaScript.&lt;/p&gt;

&lt;p&gt;Basically, mobile client displays an image which is served by a server-side script hosted by you and the script pushes the visit data to Google via GET request. The parameters of this method is listed on &lt;a href='http://code.google.com/apis/analytics/docs/tracking/gaTrackingTroubleshooting.html#gifParameters'&gt;Troubleshooting the Tracking Code&lt;/a&gt; section of the documentation.&lt;/p&gt;

&lt;p&gt;After looking at this list and &lt;a href='http://code.google.com/apis/analytics/docs/mobile/download.html#Download_the_Google_Analytics_server_side_package'&gt;PHP/Perl codes provided by Google&lt;/a&gt;, with some trial and error I&amp;#8217;ve found the minimum parameters to push data.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;utmwv&lt;/code&gt;: tracking code version. The latest version at the time of this writing is 5.2.2d.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;utmn&lt;/code&gt;: unique ID generated for each GIF request to prevent caching of the GIF image. Example value in the documentation is 10 digits so stick to maximum of 10 digits.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;utmp&lt;/code&gt;: requested path of the current page.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;utmac&lt;/code&gt;: account string (property id).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;utmcc&lt;/code&gt;: cookie values. &lt;em&gt;&lt;code&gt;__utma&lt;/code&gt;&lt;/em&gt; is required. These 2 posts &lt;a href='http://www.analytics-ninja.com/blog.html'&gt;discusses&lt;/a&gt; &lt;a href='http://www.randycullom.com/chatterbox/archives/2008/10/google_analytic.html'&gt;this cookie&lt;/a&gt; in detail. &lt;code&gt;1&lt;/code&gt; can be used for each part except unique visitor id. For the visitor id, you can generate something unique for each visitor which doesn&amp;#8217;t change between visits. The safe assumption for the length of the id 10 because google Analytics itself uses around 10 digits.&lt;/p&gt;

&lt;p&gt;After this data is generated, simply request &lt;a href='http://www.google-analytics.com/__utm.gif'&gt;http://www.google-analytics.com/__utm.gif&lt;/a&gt; with these parameters in the query string.&lt;/p&gt;

&lt;p&gt;Here is the proof of concept Python code:&lt;/p&gt;
&lt;script src='https://gist.github.com/1593381.js?file=ga.py'&gt;
&lt;/script&gt;
&lt;p&gt;I&amp;#8217;ve provided you the bare minimum. Now you can add more variables and track whatever you need. Don&amp;#8217;t forget to share your hack in the comments.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>How to serve static files with Pyramid</title>
   <link href="http://www.canb.net/2012/01/how-to-serve-static-files-with-pyramid.html" />
   <updated>2012-01-11T00:00:00-08:00</updated>
   <id>http://www.canb.net/2012/01/how-to-serve-static-files-with-pyramid</id>
   <content type="html">&lt;p&gt;If you want to host your &lt;a href='http://www.pylonsproject.org/'&gt;Pyramid&lt;/a&gt; static files in s3 or compile everything to a local folder, just like &lt;a href='https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#collectstatic'&gt;Django&amp;#8217;s collectstatic&lt;/a&gt;, &lt;a href='https://github.com/jinty/van.static'&gt;van.static&lt;/a&gt; is to the rescue.&lt;/p&gt;

&lt;p&gt;Before going further, ensure that all of your statics are resolved from the request object and any references from CSSs use relative paths. A Mako example would be: &lt;code&gt;${request.static_url(&amp;quot;app:static/image.png&amp;quot;)}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Install van.static to your virtual environment with &lt;code&gt;pip install van.static&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Setup van.static in your app&amp;#8217;s entry point:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='python'&gt;&lt;span class='kn'&gt;from&lt;/span&gt; &lt;span class='nn'&gt;van.static&lt;/span&gt; &lt;span class='kn'&gt;import&lt;/span&gt; &lt;span class='n'&gt;cdn&lt;/span&gt;
&lt;span class='n'&gt;static_resources&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='p'&gt;((&lt;/span&gt;&lt;span class='s'&gt;&amp;#39;static&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s'&gt;&amp;#39;app:static&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;),)&lt;/span&gt;
&lt;span class='n'&gt;cdn&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;config_static&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='n'&gt;config&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt;
                  &lt;span class='n'&gt;static_resources&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt;
                  &lt;span class='n'&gt;static_cdn&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;&lt;span class='n'&gt;settings&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;get&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s'&gt;&amp;quot;static_cdn&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you want to collect all static files together:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;python -m van.static.cdn --target&lt;span class='o'&gt;=&lt;/span&gt;file:///srv/static/myapp/ --resource&lt;span class='o'&gt;=&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;app:static&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;van.static has 2 modes. If you do not provide it a &lt;code&gt;static_cdn
parameter&lt;/code&gt;, it works in &lt;em&gt;development mode&lt;/em&gt; and it serves everything via Pyramid&amp;#8217;s static view. If you provide the parameter, it goes into &lt;em&gt;oroduction mode&lt;/em&gt; and simply generates unique urls for each version of your application, prefixing the given URL.&lt;/p&gt;

&lt;p&gt;The software is not even a month old but already can compress files with YUI compressor and seems to be pretty usable.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Automatically decorating all views of a django project</title>
   <link href="http://www.canb.net/2010/01/automatically-decorating-all-views-of.html" />
   <updated>2010-01-06T00:00:00-08:00</updated>
   <id>http://www.canb.net/2010/01/automatically-decorating-all-views-of</id>
   <content type="html">&lt;p&gt;Now the real thing, a middleware for &lt;a href='http://www.djangoproject.com/'&gt;Django&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This middleware auto-decorates each view function in a view module (views.py, or views/) with the decorators defined in settings.py.&lt;/p&gt;

&lt;p&gt;An example setting is:&lt;/p&gt;
&lt;script src='https://gist.github.com/1578349.js?file=settings.py'&gt;
&lt;/script&gt;
&lt;p&gt;Think this middleware as a firewall. Whether you decorated your view functions or not, this ensures that your content is protected by using the decorators.&lt;/p&gt;

&lt;p&gt;Note that this middleware needs to be at the end of the middlewares list because it always return an HttpResponse by calling the view function; which means no other middleware after this is executed.&lt;/p&gt;

&lt;p&gt;Here is the function:&lt;/p&gt;
&lt;script src='https://gist.github.com/1578349.js?file=middleware.py'&gt;
&lt;/script&gt;</content>
 </entry>
 
 <entry>
   <title>Emacs buffer coding system</title>
   <link href="http://www.canb.net/2009/02/emektar-iconv-yerine-emacs.html" />
   <updated>2009-02-15T00:00:00-08:00</updated>
   <id>http://www.canb.net/2009/02/emektar-iconv-yerine-emacs</id>
   <content type="html">&lt;p&gt;If emacs doesn&amp;#8217;t recognize the encoding of your file, you can give it some tips to recognize it. For example, I have a file encoded as &amp;#8220;iso-8859-9&amp;#8221; but emacs is unable to display it properly.&lt;/p&gt;

&lt;p&gt;The solution is not hard. You do a &lt;code&gt;C-x RET c iso-8859-9&lt;/code&gt;, followed by &lt;code&gt;C-x C-f&lt;/code&gt;, and you now have a properly encoded buffer.&lt;/p&gt;

&lt;p&gt;To save this file in utf-8, you do a &lt;code&gt;C-x RET c utf-8 C-x C-w&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you have a problem with line coding, append a &lt;code&gt;-dos&lt;/code&gt;, &lt;code&gt;-unix&lt;/code&gt; or &lt;code&gt;-mac&lt;/code&gt; while reading or writing the file.&lt;/p&gt;</content>
 </entry>
 

</feed>
