<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Andrius Miasnikovas</title>
    <link>http://andrius.miasnikovas.lt/</link>
    <description>Recent content on Andrius Miasnikovas</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 14 Jul 2015 00:00:00 +0000</lastBuildDate>
    <atom:link href="http://andrius.miasnikovas.lt/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Quick Glimpse at Go 1.5</title>
      <link>http://andrius.miasnikovas.lt/2015/07/quick-glimpse-at-golang-15/</link>
      <pubDate>Tue, 14 Jul 2015 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2015/07/quick-glimpse-at-golang-15/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been playing around with Golang for a few months now and I have to conclude that it is indeed a practical,
well thought out language that is also fun to use. If you haven&amp;rsquo;t heard about or tried it yet, head over to &lt;a href=&#34;http://tour.golang.org&#34;&gt;tour.golang.org&lt;/a&gt;
right now. There you can try the language right inside your browser, hassle free, no installation required. Though there&amp;rsquo;s something compelling
about compiling things on your own machine. Actually, I have to admit that I was not that &amp;ldquo;into&amp;rdquo; Go when I first saw it and it took me about a year
to come around and try it out again, but this time focusing more on the why, not the how. What really spiked my interest was watching these videos
where developers from the Go team explain their thinking behind the decisions made and present their view of a modern, pragmatic programming language
and tooling as a big part of it all. If you have some free time I encourage you to watch them. I do believe that there&amp;rsquo;s something to be gained
here even if you choose not to learn Go. At least watch the talk by Rob Pike.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=cN_DpYBzKso&#34;&gt;Rob Pike - &amp;lsquo;Concurrency Is Not Parallelism&amp;rsquo;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=sln-gJaURzk&#34;&gt;Google I/O 2012 - Meet the Go Team&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=p9VUCp98ay4&#34;&gt;Google I/O 2013 - Fireside Chat with the Go Team&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=elu0VpLzJL8&#34;&gt;Go for Pythonistas&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some say that Go is a system programming language, though in reality it&amp;rsquo;s more of a general purpose one. But in the end there is no single
programming language that will fit all of the criteria for all the people, that&amp;rsquo;s why there are so many of them. Though the way I see it -
not many languages have a justifiable reason for their existance. When you dig into the history of some languages quite a few of the currently
popular ones started out as some side-project, hack or a pre-processor for another language as a way to avoid using some unwanted other language.
(The language names have been omitted to protect the innocent).&lt;/p&gt;

&lt;p&gt;The thing I personally have been looking forward to this year is the release of the Go 1.5 which should be quite soon, I believe the 1 of August
is the current due date. The cool thing is that beta is already out and can be downloaded today from the &lt;a href=&#34;https://golang.org/dl/#go1.5beta1&#34;&gt;golang page&lt;/a&gt;.
Among various improvements to the compiler and a lot of focus on &lt;a href=&#34;https://twitter.com/francesc/status/618870005141082112&#34;&gt;Garbage Collection&lt;/a&gt;,
my favorite feature is the new crazy simple way of cross
compiling i.e. building statically linked, zero dependency binaries for platforms other than that on which you&amp;rsquo;re writing the code. Once
you have your &lt;code&gt;GOPATH&lt;/code&gt; environment variable setup, the build process is already as simple as doing a &lt;code&gt;go build&lt;/code&gt; inside your project directory.
But now you can specify the target Operating System and Architecture, so on a linux machine you can do the following&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;$ &lt;span style=&#34;color: #f8f8f2&#34;&gt;GOOS&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt;windows &lt;span style=&#34;color: #f8f8f2&#34;&gt;GOARCH&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt;amd64 go build .
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;this will produce a 64-bit Windows executable file. Similarly you can specify any other &lt;a href=&#34;http://golang.org/doc/install/source#environment&#34;&gt;supported platform&lt;/a&gt;.
And you can even create binaries for Mac OS X, now you don&amp;rsquo;t even need an Apple computer for that.&lt;/p&gt;

&lt;p&gt;But wait, there&amp;rsquo;s more. What if I told you you can now develop Android and iOS applications with Go. Well actually I don&amp;rsquo;t think it&amp;rsquo;s meant
as a replacement of the current development environments for mobile apps, but rather as a supplement for performance sensitive parts of
the application (think NDK for Android). The iOS part is not yet ready at the time of writing, but you can go try the Android part right now.
All you need to do is install a couple of packages and initialize the environment.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;$ go get -u golang.org/x/mobile/cmd/gomobile
$ go get -u golang.org/x/mobile/cmd/gobind
$ gomobile init
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now you&amp;rsquo;re ready. There are a few sample apps included in the gomobile package. To try one out just do the following&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;$ &lt;span style=&#34;color: #f8f8f2&#34;&gt;cd&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;$GOPATH&lt;/span&gt;/src/golang.org/x/mobile/example/sprite
$ gomobile build .
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Voila, you should see a &lt;code&gt;sprite.apk&lt;/code&gt; file that is the result of this build. You can now install it onto your Android phone or an emulator.
If you&amp;rsquo;re going to try it on an emulator make sure that the emulator&amp;rsquo;s system image is for ARM architecture since that&amp;rsquo;s the target architecture
for the library. Will need to investigate if there&amp;rsquo;s a way to build it for different architectures, because right now this app wouldn&amp;rsquo;t run
on an Atom-based Android device. The quickest way to install the app (presuming you have Android SDK) is to run&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;$ adb install basic.apk
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And to simplify things further you can run the application based on the package name which can be extracted from the &lt;code&gt;.apk&lt;/code&gt; itself.&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;$ run-apk.sh basic.apk
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s the source for the &lt;code&gt;run-apk.sh&lt;/code&gt; script:&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #75715e&#34;&gt;#!/bin/bash&lt;/span&gt;
&lt;span style=&#34;color: #f8f8f2&#34;&gt;pkg&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;$(&lt;/span&gt;aapt dump badging &lt;span style=&#34;color: #f8f8f2&#34;&gt;$1|&lt;/span&gt;awk -F&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot; &amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;/package/ {print $2}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;|&lt;/span&gt;awk -F&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;#39;&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;/name=/ {print $2}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;)&lt;/span&gt;
adb shell monkey -p &lt;span style=&#34;color: #f8f8f2&#34;&gt;$pkg&lt;/span&gt; -c android.intent.category.LAUNCHER 1
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Admittedly this wasn&amp;rsquo;t a changelog type of overview of the new version of Go, but I just wanted to quickly mention a couple of
cool new things you&amp;rsquo;ll be able to do with Go 1.5, which I&amp;rsquo;m excited about. Hopefully some of this sparked enough interest to motivate
you to go and check out the language for yourself. Happy exploring :)&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Quick Tip: Exporting PuTTY Sessions</title>
      <link>http://andrius.miasnikovas.lt/2015/01/quick-tip-exporting-putty-sessions/</link>
      <pubDate>Tue, 13 Jan 2015 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2015/01/quick-tip-exporting-putty-sessions/</guid>
      <description>&lt;p&gt;Here&amp;rsquo;s a really quick tip. If you&amp;rsquo;re running Windows and are using PuTTY to manage your unix servers, chances are you have a lot of saved sessions i.e. information on how to connect to your server, what font type and size to use, etc. And if you ever tried copying them to another machine you noticed that PuTTY doesn&amp;rsquo;t have a user-friendly export/import sessions button. But there&amp;rsquo;s a way to perform a saved sessions export manually. PuTTY keeps all session related information in system registry, so what you can do is export that part of the registry tree to a file with the following command:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;regedit /ea sessions.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The line above will create a &lt;em&gt;sessions.reg&lt;/em&gt; file which you can copy to a machine where you want to import your saved sessions and simply double click it. Windows will ask you if you&amp;rsquo;re sure you want to run it, since you&amp;rsquo;re actually modifying the system registry, so click Yes and voilà. You can run PuTTY and start using it the way you&amp;rsquo;re used to. One thing to note is that if you were using private/public key authentication (passwordless logins) for some servers then you need to copy over your private keys to the new machine as well. And remember to place them so that they can be found using the same path as on the old machine. If in doubt, just open &lt;em&gt;sessions.reg&lt;/em&gt; with any text editor and browse trough it looking for lines like the following, then you&amp;rsquo;ll know what files you need to copy and where to put them.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&amp;quot;PublicKeyFile&amp;quot;=&amp;quot;C:\\var\\keys\\key1.ppk&amp;quot;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Another use for this session export could be when you want to change something like a font on all your saved sessions, but when you have a lot of them, then it becomes a time consuming process. What you could do is export your sessions as shown before, then open the file in a text editor and simply do a mass replace for the setting that you want changed. For example you could change this line&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&amp;quot;Font&amp;quot;=&amp;quot;Courier New&amp;quot;
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;to this line&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&amp;quot;Font&amp;quot;=&amp;quot;Lucida Console&amp;quot;
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Then just re-import your sessions by double clicking the file. It will overwrite your current session information. That&amp;rsquo;s it.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Quick Tip: Fun with JavaScript Console in Browsers</title>
      <link>http://andrius.miasnikovas.lt/2015/01/quick-tip-fun-with-javascript-console-in-browsers/</link>
      <pubDate>Wed, 07 Jan 2015 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2015/01/quick-tip-fun-with-javascript-console-in-browsers/</guid>
      <description>&lt;p&gt;All modern browsers nowadays have integrated development tools among which there&amp;rsquo;s a JavaScript console where you can type in some JavaScript and test your ideas, debug your code or see output from your script&amp;rsquo;s previous events. But the console is capable of so much more. Well, actually IE&amp;rsquo;s console is somewhat more limited than others, but the rest of them are pretty cool. To get an idea of the possibilities visit the chrome developer &lt;a href=&#34;https://developer.chrome.com/devtools/docs/tips-and-tricks&#34;&gt;tips and tricks&lt;/a&gt; page to learn more. One of the fun and useful things you can do in a console is logging highlighted text. This can be achieve using the C-style formatting notation &lt;strong&gt;%c&lt;/strong&gt; in logging statements e.g.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;console&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;log&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;%clook at me&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;background:yellow&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You can shape the text any way you want using familiar CSS styling. It&amp;rsquo;s possible to change the font family, font size, add some text decorations like underline, strike-trough or apply a shadow effect, just remember to separate them using a semicolon.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;console&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;log&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;%cfunky text&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;background:yellow; font-size: 20px; color: blue; text-shadow: red 0px 0px 6px;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The only thing I was not able to do was using a custom font i.e. one that is not provided by the OS. I tried using &lt;strong&gt;@font-face&lt;/strong&gt; to specify the external URL of the font, tried using &lt;strong&gt;@import&lt;/strong&gt; to import external CSS. I even tried embedding the whole font as base64 encoded string to check whether it&amp;rsquo;s the @font-face that is not being processed or the problem lies with retrieving external resources. Since it didn&amp;rsquo;t work I assume that it&amp;rsquo;s ignoring everything you might put before the curly braces. In fact if you enclose your styling with curly braces &amp;#8211; it won&amp;rsquo;t work. So you can modify the style only of the text that you&amp;rsquo;re outputting, not the whole console. If you know that it&amp;rsquo;s actually possible to use custom fonts I would like to know how that&amp;rsquo;s done, so please leave a comment.&lt;/p&gt;

&lt;p&gt;Besides the practical there&amp;rsquo;s also a fun side to this. Even though it seems you can&amp;rsquo;t use external fonts, but you can use fonts with pictures in them that are provided by your OS like &lt;strong&gt;Wingdings&lt;/strong&gt;. And you can leave your own signature in the console on your page or just a message for the curious ones that will peek at the console when visiting your page.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;console&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;log&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;%ck&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;font-family: Wingdings; font-size: 24px&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The snippet above would print a nicely styled ampersand symbol on Windows. But unfortunatelly different OSes include different fonts and users viewing your page from a Linux machine or a Mac would most likely not be able to see your message as you intended it. But there&amp;rsquo;s another thing you can do &amp;#8211; images. Yes, you can use images in the console. Well, actually you can set the background to display an image and then put some blank characters so that it gets rendered correctly.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;console&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;log&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;%c  &amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;background-image: url(&amp;#39;https://cloud.githubusercontent.com/assets/6187567/2544544/434705aa-b602-11e3-9a1c-6868c69bd4b8.png&amp;#39;); background-repeat: no-repeat&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;But typically console lines that are meant for logging are only about 13 pixels in height, so sany larger image would be cut off and if you would try it with a larger image that has a white background it would seem that it just doesn&amp;rsquo;t work. There&amp;rsquo;s actually a very simple way to get around this, you just need to set the font size high enough so that your whole image would be displayed. And if you don&amp;rsquo;t want to use the full size of your image, you can even specify the background size so that it scales correctly.&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;console&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;log&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;%c  &amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;background-image: url(&amp;#39;http://i.imgur.com/r9nq6d2.png&amp;#39;); background-repeat: no-repeat; background-size: 88px 128px; font-size: 128px&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Also note that if you try to add some text after the whitespace you left for the image, it will appear quite large. If you want to add a message on the same line but with smaller text you can do this by adding a third string parameter with your text. The styles you specified will not be applied to it and so you&amp;rsquo;ll still be able to print out a message of decent length if you need to.&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;console&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;log&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;%c  &amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;background-image: url(&amp;#39;http://i.imgur.com/r9nq6d2.png&amp;#39;); background-repeat: no-repeat; background-size: 88px 128px; font-size: 128px;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;ho ho ho&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Oh and by the way, the animated GIFs do work and are pretty cool way to surprise someone :) Have fun and check out &lt;a href=&#34;https://developer.chrome.com/devtools/docs/console&#34;&gt;Chrome developer docs&lt;/a&gt; for more information.&lt;/p&gt;

&lt;script&gt;
console.log(&#34;%c     &#34;, &#34;background-image: url(&#39;http://media0.giphy.com/media/MOWPkhRAUbR7i/giphy.gif&#39;); background-repeat: no-repeat; background-size: 250px 113px; font-size: 113px;&#34;)
&lt;/script&gt;
</description>
    </item>
    
    <item>
      <title>Quick Tip: Easy Time Lapse Videos with FFmpeg</title>
      <link>http://andrius.miasnikovas.lt/2013/01/quick-tip-easy-time-lapse-videos-with-ffmpeg/</link>
      <pubDate>Thu, 31 Jan 2013 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2013/01/quick-tip-easy-time-lapse-videos-with-ffmpeg/</guid>
      <description>

&lt;p&gt;In this  tip I want to share with you a quick and easy way of creating your own time lapse videos using your webcam and a tool called FFmpeg. I just recently discovered this command line tool myself and can think of various cool uses for it e.g. connecting a webcam to a Raspberry Pi and leaving it somewhere to take snapshots on certain events, or stream video of some place you want to monitor.&lt;/p&gt;

&lt;h3 id=&#34;getting-the-tool:5c93bd2ff25b01a73b983760dd1fe775&#34;&gt;Getting the tool&lt;/h3&gt;

&lt;p&gt;First thing is first &amp;#8211; &lt;a title=&#34;Download FFmpeg&#34; href=&#34;https://www.ffmpeg.org/&#34; target=&#34;_blank&#34;&gt;download FFmpeg&lt;/a&gt;. On the download page you&amp;rsquo;ll find various different ways of getting this tool. You can clone a git repository, download source code snapshots or get the pre-built binaries for your platform. I&amp;rsquo;m using a 64-bit version of Windows 7 so I go to the &lt;a title=&#34;FFmpeg Windows Builds&#34; href=&#34;http://ffmpeg.zeranoe.com/builds/&#34; target=&#34;_blank&#34;&gt;FFmpeg Windows builds&lt;/a&gt; page and get the 64-bit build with all the libraries statically linked. If you&amp;rsquo;re not sure what to download just get &lt;a title=&#34;FFmpeg 32-bit static build&#34; href=&#34;http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.7z&#34; target=&#34;_blank&#34;&gt;this file&lt;/a&gt; and it should work on most Windows machines. Also note that you&amp;rsquo;ll need a program called &lt;a title=&#34;7-Zip&#34; href=&#34;http://7-zip.org/&#34; target=&#34;_blank&#34;&gt;7-Zip&lt;/a&gt; to extract the downloaded archive.&lt;/p&gt;

&lt;h3 id=&#34;preparation:5c93bd2ff25b01a73b983760dd1fe775&#34;&gt;Preparation&lt;/h3&gt;

&lt;p&gt;Now that you downloaded and extracted FFmpeg open up a command promt and go to the binary directory of the tool e.g. &lt;code&gt;ffmpeg-win64-static\\bin&lt;/code&gt;. Let&amp;rsquo;s check what devices are supported by executing the following command:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;ffmpeg -list_devices true -f dshow -i dummy
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You should get a response of something like this&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;...
[dshow @ 00000000020977e0] DirectShow video devices
[dshow @ 00000000020977e0] &amp;quot;Microsoft LifeCam Cinema&amp;quot;
[dshow @ 00000000020977e0] DirectShow audio devices
[dshow @ 00000000020977e0] &amp;quot;Jack Mic (IDT High Definition A&amp;quot;
[dshow @ 00000000020977e0] &amp;quot;Desktop Microphone (2- Cinema -&amp;quot;
[dshow @ 00000000020977e0] &amp;quot;Dock Mic (IDT High Definition A&amp;quot;
[dshow @ 00000000020977e0] &amp;quot;Headset Microphone (GN 2000 USB&amp;quot;
[dshow @ 00000000020977e0] &amp;quot;Rec. Playback (IDT High Definit&amp;quot;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;We&amp;rsquo;re interested in the video devices, so take note of the one that comes up for you, in my case it&amp;rsquo;s &amp;#8220;Microsoft LifeCam Cinema&amp;#8221;. Now let&amp;rsquo;s see what resolutions are supported on this camera:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;ffmpeg -f dshow -list_options true -i video=&amp;quot;Microsoft LifeCam Cinema&amp;quot;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Remember to replace the &lt;em&gt;video&lt;/em&gt; parameter value with your own video device name. You should get a list of supported resolutions and framerates for your camera. Choose a resolution that you want and let&amp;rsquo;s test how it will look:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;ffplay -f dshow -video_size 1280x720 -i video=&amp;quot;Microsoft LifeCam Cinema&amp;quot;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Notice that this time I used &lt;em&gt;ffplay&lt;/em&gt; instead of &lt;em&gt;ffmpeg&lt;/em&gt; because I wanted it to open a window with a live video feed of the camera to make sure everything looks good and to be able to set up the camera where you want. Creating time lapse videos involves leaving the camera in the same place for long periods of time so you need to be sure that you&amp;rsquo;re getting the view you expect.&lt;/p&gt;

&lt;h3 id=&#34;creating-the-time-lapse-video:5c93bd2ff25b01a73b983760dd1fe775&#34;&gt;Creating the time lapse video&lt;/h3&gt;

&lt;p&gt;Now that everything is in place you can start capturing images. You can play around with the setting, but my suggestion is to first try recording 1 frame per second and leave camera untouched for an hour or so. Point it at something that has movement, but don&amp;rsquo;t put the camera to close to the subject or the images might be blurry from time to time due to the auto focusing. Start capturing:&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;ffmpeg -t 100000 -f vfwcap -s 1280x720 -i -r 1 -f image2 camera%06d.jpg
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;the &lt;code&gt;-t 100000&lt;/code&gt; part means that it will try to capture that many images before the program exits, but if at any time you change your mind simply click q while the ffmpeg window is in focus. The frame rate is set with the parameter &lt;code&gt;-r 1&lt;/code&gt;. Also you may or may not get some errors about buffer being full, but this does not impact your capturing session. Though if that bothers you just add parameter &lt;code&gt;-v quiet&lt;/code&gt; right after &lt;code&gt;ffmpeg&lt;/code&gt;. The images will be captured with file names of &lt;code&gt;camera000001.jpg&lt;/code&gt; through &lt;code&gt;camera999999.jpg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After your done capturing the frames you need to convert those images to a movie like this:&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;ffmpeg -f image2 -i camera%06d.jpg time-lapse.mp4
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Voila, you have created a time lapse video!&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s a sample of my first attempt:&lt;/p&gt;

&lt;iframe src=&#34;https://player.vimeo.com/video/58617539&#34; width=&#34;720&#34; height=&#34;405&#34; frameborder=&#34;0&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
</description>
    </item>
    
    <item>
      <title>Quick Tip: Velocity Template Debugging</title>
      <link>http://andrius.miasnikovas.lt/2012/04/quick-tip-velocity-template-debugging/</link>
      <pubDate>Wed, 25 Apr 2012 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2012/04/quick-tip-velocity-template-debugging/</guid>
      <description>&lt;p&gt;In this post I&amp;rsquo;ll try to share my recent experience with [Velocity]() template debugging. There are a few ways to debug the templates depending on where you think the problem lies. But at times you have modify templates written by others and that&amp;rsquo;s when you need to do some exploring like finding out what variables are actually passed to the template. This is not always easily found in code, sometimes it&amp;rsquo;s simpler to print this stuff out when you&amp;rsquo;re already in the template. Below is a macro that I used to print out request and session attributes and parameters.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;macro&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;installDebugWindow&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;script&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;language&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;javascript&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&#34;color: #66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;debugWindow&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;{&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;window.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;open&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;width=800,height=600,resizable,scrollbars=yes&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Velocity Debug Console&amp;lt;/title&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;textarea{width:100%;} tr:nth-child(odd){background:#ddd;} tr:nth-child(even){background:#fafafa;} td:nth-child(odd){font-family:monospace;} tr:first-child{background:#ccc;} tr:first-child td{font-family:Arial;vertical-align:middle;} td h3{margin:10px;} table{margin-bottom:30px;border:2px solid #000;}&amp;lt;/style&amp;gt;&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;h2&amp;gt;Velocity Debug Console&amp;lt;/h2&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;

  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;table width=&amp;#39;100%&amp;#39;&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;tr bgcolor=#cccccc&amp;gt;&amp;lt;td colspan=&amp;#39;2&amp;#39;&amp;gt;&amp;lt;h3&amp;gt;Request Attributes:&amp;lt;/h3&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;foreach&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;$name&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;in&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;$request&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getAttributeNames&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;())&lt;/span&gt;
    &lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;printRow&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;$name&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;$request&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getAttribute&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;$name&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;).&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;toString&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;().&lt;/span&gt;
      &lt;span style=&#34;color: #a6e22e&#34;&gt;replaceAll&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;\\n&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;).&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;replaceAll&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;\r&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;))&lt;/span&gt;
  &lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;end&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;

  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;table width=&amp;#39;100%&amp;#39;&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;tr bgcolor=#cccccc&amp;gt;&amp;lt;td colspan=&amp;#39;2&amp;#39;&amp;gt;&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;+&lt;/span&gt;
  	&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;h3&amp;gt;Request Parameters:&amp;lt;/h3&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;foreach&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;$name&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;in&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;$&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;request&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getParameterNames&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;()})&lt;/span&gt;
    &lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;printRow&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;$name&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;$request&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getParameter&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;$name&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;).&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;toString&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;().&lt;/span&gt;
    	&lt;span style=&#34;color: #a6e22e&#34;&gt;replaceAll&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;\\n&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;).&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;replaceAll&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;\r&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;))&lt;/span&gt;
  &lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;end&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;

  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;table width=&amp;#39;100%&amp;#39;&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;tr bgcolor=#cccccc&amp;gt;&amp;lt;td colspan=&amp;#39;2&amp;#39;&amp;gt;&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;+&lt;/span&gt;
  	&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;h3&amp;gt;Session Attributes:&amp;lt;/h3&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;foreach&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;$name&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;in&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;$&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;session&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getAttributeNames&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;()})&lt;/span&gt;
    &lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;printRow&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;$name&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;$session&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getAttribute&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;$name&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;).&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;toString&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;().&lt;/span&gt;
    	&lt;span style=&#34;color: #a6e22e&#34;&gt;replaceAll&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;\\n&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;).&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;replaceAll&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;\r&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;))&lt;/span&gt;
  &lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;end&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;/table&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;

  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;write&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;vc&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.document.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;close&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;();&lt;/span&gt;
&lt;span style=&#34;color: #f8f8f2&#34;&gt;}&lt;/span&gt;

&lt;span style=&#34;color: #66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;parseKeys&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;e&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;{&lt;/span&gt;
  &lt;span style=&#34;color: #a6e22e&#34;&gt;e&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;e&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;||&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;window.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;event&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;;&lt;/span&gt;
  &lt;span style=&#34;color: #66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;e&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;ctrlKey&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;e&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;keyCode&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;===&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;48&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;debugWindow&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;();&lt;/span&gt;
&lt;span style=&#34;color: #f8f8f2&#34;&gt;}&lt;/span&gt;

&lt;span style=&#34;color: #66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;(window.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;addEventListener&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;{&lt;/span&gt;
  &lt;span style=&#34;color: #f8f8f2&#34;&gt;window.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;addEventListener&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;keydown&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;parseKeys&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;false&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
&lt;span style=&#34;color: #f8f8f2&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;(window.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;attachEvent&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;{&lt;/span&gt;
  &lt;span style=&#34;color: #f8f8f2&#34;&gt;window.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;attachEvent&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;onkeydown&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;parseKeys&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;);&lt;/span&gt;
&lt;span style=&#34;color: #f8f8f2&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;{&lt;/span&gt;
  &lt;span style=&#34;color: #f8f8f2&#34;&gt;window[&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;onkeydown&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;parseKeys&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;;&lt;/span&gt;
&lt;span style=&#34;color: #f8f8f2&#34;&gt;}&lt;/span&gt;
&lt;span style=&#34;color: #960050; background-color: #1e0010&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;It creates a new window and prints this data separate from your actual page layout, just make sure that your browser doesn&amp;rsquo;t kill this pop-up window. I placed the macro in my &lt;strong&gt;VM_global_library.vm&lt;/strong&gt; file to be able to access it from any Velocity template. Then you can put the call to this macro &lt;strong&gt;#installDebugWindow()&lt;/strong&gt; at the end of the page.  This macro is based on the one I found on the &lt;a href=&#34;http://wiki.apache.org/velocity/VelocityDebuggingTemplate&#34; target=&#34;_blank&#34;&gt;Apache Wiki&lt;/a&gt;. I adjusted some things to better suit my taste. In the original version whenever you open a template that contains a call to #installDebugWindow a new window will instantly pop up. This is not always the desired behaviour. In my suggested version to get this window with all the template variable information you have to hit the key combination &lt;strong&gt;Ctrl+0&lt;/strong&gt;. This doesn&amp;rsquo;t clutter your view with debug information when you don&amp;rsquo;t need and you have access to it whenever you do. Hope someone finds this useful.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Experimenting with WebGL</title>
      <link>http://andrius.miasnikovas.lt/2012/03/experimenting-with-webgl/</link>
      <pubDate>Wed, 28 Mar 2012 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2012/03/experimenting-with-webgl/</guid>
      <description>&lt;p&gt;I was experimenting with &lt;a href=&#34;http://en.wikipedia.org/wiki/WebGL&#34; target=&#34;_blank&#34;&gt;WebGL&lt;/a&gt; the other day and it&amp;rsquo;s pretty damn cool. Here&amp;rsquo;s a &lt;a href=&#34;http://andriusm.github.com/3d-tieto/&#34; target=&#34;_blank&#34;&gt;spinning 3d logo&lt;/a&gt; of the company I currently work for as an attempt at animating something in 3D. If you&amp;rsquo;re not in the loop, WebGL is a JavasSript API supported by modern browsers that allows interactive 3D graphics rendering in a browser&amp;rsquo;s window, specifically the &lt;strong&gt;canvas&lt;/strong&gt; tag. The graphics rendering is GPU accelerated which means excellent performance (as long as you&amp;rsquo;re using it wisely). The API is designed by the Khronos Group and is based on OpenGL ES 2.0. If you ever used OpenGL then it will be easier for you to start, but similar to OpenGL ES the WebGL API doesn&amp;rsquo;t have the &lt;a href=&#34;http://en.wikipedia.org/wiki/Immediate_mode&#34; target=&#34;_blank&#34;&gt;immediate mode&lt;/a&gt; which is widely used in OpenGL tutorials. If you want learn WebGL you&amp;rsquo;ll need to get better acquainted with the concept of shaders which are lower level programs executed on the GPU. Depending on the type of shader, they&amp;rsquo;re executed for each vertex of the object or each pixel to be drawn. Those things are fast as hell. If you want a good place to start learning this stuff see &lt;a href=&#34;http://learningwebgl.com/blog/?page_id=1217&#34; target=&#34;_blank&#34;&gt;Learning WebGL&lt;/a&gt; blog. But note that they may not explain all the nitty-gritty details, so you&amp;rsquo;ll probably end up searching for more information elsewhere. Another good resource is the official &lt;a href=&#34;http://www.khronos.org/files/webgl/webgl-reference-card-1_0.pdf&#34; target=&#34;_blank&#34;&gt;WebGL cheat sheet&lt;/a&gt; or reference card, whatever you wanna call it. But before you go and start programming something for your page, note that WebGL is not supported by all the current browsers and some visitors might not see the graphics at all. If you can&amp;rsquo;t see the spinning logo demo yourself then you could try switching browsers. Like using the latest version of Chrome or Firefox (these work for me). But chances are that your particular hardware might not be supported even by those browsers. I&amp;rsquo;ll finish up by leaving you with a link to some really cool looking &lt;a href=&#34;http://www.chromeexperiments.com/webgl&#34; target=&#34;_blank&#34;&gt;WebGL demos&lt;/a&gt;. Enjoy!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>SSH tunneling simplified (I think)</title>
      <link>http://andrius.miasnikovas.lt/2012/03/ssh-tunneling-simplified-i-think/</link>
      <pubDate>Mon, 26 Mar 2012 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2012/03/ssh-tunneling-simplified-i-think/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s been quite a while since my last post so I&amp;rsquo;ll try to ease back into blogging. For now I&amp;rsquo;ll just share a little something I created for myself to &lt;a href=&#34;http://andriusm.github.com/ssh-tunnel-gen/&#34;&gt;help with the SSH tunnels&lt;/a&gt; that I need to create on a seemingly regular basis. Sometimes I forget or mix up the parameters that need to be passed to SSH client, especially when interconnecting these tunnels. In this simple tool you can enter the missing info to form a logical sentence in English language and when you click the generate button you get a command line for the SSH client. Pretty user friendly ;) And if you&amp;rsquo;re not sure what SSH tunnels are and why you need them, take a look at this post on &lt;a href=&#34;http://matt.might.net/articles/ssh-hacks/&#34;&gt;SSH hacks&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>A Story of Switching from Java to Developing for Mac OS X</title>
      <link>http://andrius.miasnikovas.lt/2011/07/a-story-of-switching-from-java-to-developing-for-mac-os-x/</link>
      <pubDate>Thu, 28 Jul 2011 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2011/07/a-story-of-switching-from-java-to-developing-for-mac-os-x/</guid>
      <description>&lt;p&gt;A couple of months ago I&amp;rsquo;ve switched from Java development to developing for Mac OS X. Let me tell you, it&amp;rsquo;s a completely different world, but that was to be expected. The first thing is to get acquainted with the OS and it&amp;rsquo;s features. That actually didn&amp;rsquo;t take too long. I&amp;rsquo;m really pleased with the availability of a full-fledged UNIX console in the OS, so I&amp;rsquo;m able to leverage all of my linux knowledge. The eye candy and the elegant design of most of the applications really give you quite a difference experience of using the computer than it would be on another OS. And at the end of the day, I guess, that is the most important factor for most users. Feature-wise Mac OS X has all the benefits of *BSD systems, being a derivative of FreeBSD and all. Over the years I&amp;rsquo;ve been using different OSes and for a long time now, I&amp;rsquo;ve not seen many major issues in any of them. I would suggest that such things like stability are not really a factor for choosing an OS nowadays. All of the OSes struggle to be as stable as they can be and the result is reasonable. I&amp;rsquo;d say that neither Mac OS X nor linux nor any other OS is the silver bullet, but some are better than others. I had experienced a application crashes in every OS I worked with. No matter how good the OS is you still need your day-to-day software to be well written and stable.  Sometimes it&amp;rsquo;s a matter of configuration and sometimes you&amp;rsquo;re just at the mercy of the application you&amp;rsquo;re using. When switching to a Mac you cannot overlook the sleek design of Mac OS X which I believe does lure a lot of users. I guess, I would agree, that this sort of design looks more profesional and makes a different impression on someone if say, you would be presenting something to your client vs. showing them something on Windows Vista.&lt;/p&gt;

&lt;p&gt;Let&amp;rsquo;s talk about the development for Mac OS X. First of all you get familiar with the de facto IDE to be used &amp;#8211; Xcode and the Objective C language. Not so long ago Apple released Xcode version 4 and it&amp;rsquo;s a complete redesign of the previous version. The new version is not exactly loved by all of the developers who got used to the previous version. Being new to this, I didn&amp;rsquo;t take up getting to know version 3 of Xcode, since everyone will have to switch to the newer version anyway. The development experience is quite different from that which I&amp;rsquo;m used to when I was developing using Java. And it&amp;rsquo;s not just the language itself. I kind of got used to all the features and the little things of the &lt;a href=&#34;http://www.jetbrains.com/idea/index.html&#34; target=&#34;_blank&#34;&gt;IntelliJ IDEA&lt;/a&gt; which I used before. Even in the Java world it&amp;rsquo;s an IDE that&amp;rsquo;s tough (if possible) to beat. I&amp;rsquo;m not affiliated with JetBrains in any way, but I feel really strongly about this and I recommend with complete confidence this IDE to anyone doing Java development. On the Xcode side of things you get an uncluttered window for writing code and a couple of side panes if you choose to show them. Nothing more, nothing less. The good thing is that this lets you concentrate more on the code at hand without any distractions. The not so good things are the refactoring options of which there are few and some of them like renaming the variables has bugs. Also I don&amp;rsquo;t particularly like the debugger which is of little help when you&amp;rsquo;re trying to inspect some of the variables and expression evaluation isn&amp;rsquo;t so great. It&amp;rsquo;s when you switch from one language to another and especially when switching environments, you begin to see how the things that you&amp;rsquo;re used to can be implemented completely differently. It&amp;rsquo;s always good to learn something new, but there are times, when you&amp;rsquo;re longing to have the features that you&amp;rsquo;re used to. And JetBrains come to the rescue once again with their new product &amp;#8211; &lt;a href=&#34;http://www.jetbrains.com/objc/&#34; target=&#34;_blank&#34;&gt;AppCode&lt;/a&gt;. It&amp;rsquo;s still in a pre-release stage, but I&amp;rsquo;m hoping it will evolve into a great product. I have faith in it because I&amp;rsquo;ve seen what they can do for Java development with IntelliJ IDEA. You can also take a look at this  &lt;a href=&#34;http://blog.jteam.nl/2011/07/06/appcode-intellij-for-objective-c/&#34; target=&#34;_blank&#34;&gt;post about AppCode&lt;/a&gt; which also supports the idea that Xcode shouldn&amp;rsquo;t be the only choice for developing for Mac OS X and highlights the features of AppCode. These are my sentiments so far regarding the Mac OS X IDEs, I encourage you to try out AppCode and report any bugs to JetBrains to help them improve their product.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Introductory PhoneGap Tutorial for Android</title>
      <link>http://andrius.miasnikovas.lt/2011/07/introductory-phonegap-tutorial-for-android/</link>
      <pubDate>Wed, 27 Jul 2011 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2011/07/introductory-phonegap-tutorial-for-android/</guid>
      <description>&lt;p&gt;I haven&amp;rsquo;t posted in quite a while. Been busy with all the job switching, getting used to Mac things and such. On another topic while cleaning up my hard drive I&amp;rsquo;m finding various neat stuff, that I forgot about. Will try and share some of it with the rest of you. These are mostly things that you either need or don&amp;rsquo;t care about at all. One of those things is a screencast that I&amp;rsquo;ve forgotten I made. It was created for a competition hosted by &lt;a href=&#34;http://net.tutsplus.com/&#34; target=&#34;_blank&#34;&gt;NetTuts+&lt;/a&gt; and touches on some of the basics of &lt;a href=&#34;http://www.phonegap.com/&#34; target=&#34;_blank&#34;&gt;PhoneGap&lt;/a&gt; platform. I didn&amp;rsquo;t actually win and now it&amp;rsquo;s a shame I remembered it only a few months later, but perhaps it could still be useful to someone.&lt;/p&gt;

&lt;iframe src=&#34;https://player.vimeo.com/video/24912060&#34; width=&#34;720&#34; height=&#34;405&#34; frameborder=&#34;0&#34; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
</description>
    </item>
    
    <item>
      <title>Automatic Web Server Monitoring</title>
      <link>http://andrius.miasnikovas.lt/2011/02/automatic-web-server-monitoring/</link>
      <pubDate>Tue, 15 Feb 2011 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2011/02/automatic-web-server-monitoring/</guid>
      <description>&lt;p&gt;Hi there! Here&amp;rsquo;s another quick suggestion for all of you out there who have to deal with a lot of web server environments and need to make sure that they&amp;rsquo;re all alive and responsive. Sure there are all sorts of tools for server monitoring and performance tracking, but I found that most of the time you just need to know if the server is up &amp;amp; running. And of course you should be notified if it&amp;rsquo;s not. Here&amp;rsquo;s my short Python script that does just that. You &lt;em&gt;will&lt;/em&gt; need to tweak it a little to use in your environment. First of all I&amp;rsquo;ve set the content &lt;code&gt;threshold&lt;/code&gt; to 2000 Bytes which means that the expected length of the page content returned is no less than 2000 Bytes. If it&amp;rsquo;s below this value, one could assume that something&amp;rsquo;s fishy going on. You might want to change this value to something else depending on what your web server returns. Another thing that you&amp;rsquo;ll want to change is the &lt;code&gt;servers&lt;/code&gt; dictionary in the &lt;em&gt;main()&lt;/em&gt; method. The logic behind this is that each of the web servers is assigned a responsible person that you would need to inform if something is wrong with the server. You should list all your servers that need to be monitored and the responsible person&amp;rsquo;s e-mails. The final change is on the line where you instantiate the &lt;em&gt;HeartbeatMonitor&lt;/em&gt; class. The first parameter &lt;code&gt;admins&lt;/code&gt; is a list of e-mails of the people who will receive the notification if &lt;em&gt;any&lt;/em&gt; of the servers are down. You can leave this list empty if you want, but I usually put my e-mail in there since I like to be in the loop. The second parameter &lt;code&gt;mailServer&lt;/code&gt; is the SMTP server which will be used to send notifications so make sure this one is set correctly. This parameter is actually optional and &lt;em&gt;localhost&lt;/em&gt; will be used as the default mail server if you decide to skip it.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #75715e&#34;&gt;#!/usr/bin/env python&lt;/span&gt;

&lt;span style=&#34;color: #f92672&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;smtplib&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;urllib2&lt;/span&gt;

&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span style=&#34;color: #e6db74&#34;&gt;This script helps monitoring multiple servers and notifies&lt;/span&gt;
&lt;span style=&#34;color: #e6db74&#34;&gt;via email when something is wrong.&lt;/span&gt;
&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;

&lt;span style=&#34;color: #f8f8f2&#34;&gt;__version__&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;0.1&amp;quot;&lt;/span&gt;
&lt;span style=&#34;color: #f8f8f2&#34;&gt;__author__&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;Andrius Miasnikovas&amp;quot;&lt;/span&gt;
&lt;span style=&#34;color: #f8f8f2&#34;&gt;__license__&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;psf&amp;quot;&lt;/span&gt;

&lt;span style=&#34;color: #66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;HeartbeatMonitor&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(object):&lt;/span&gt;
    &lt;span style=&#34;color: #f8f8f2&#34;&gt;admins&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;[]&lt;/span&gt;
    &lt;span style=&#34;color: #f8f8f2&#34;&gt;mailServer&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;None&lt;/span&gt;
    &lt;span style=&#34;color: #f8f8f2&#34;&gt;threshold&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;2000&lt;/span&gt;

    &lt;span style=&#34;color: #66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;__init__&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(self,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;admins,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;mailServer&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;localhost&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;):&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;super(HeartbeatMonitor,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;self)&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;__init__()&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;mailServer&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;smtplib&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;SMTP(mailServer)&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;mailServer&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;set_debuglevel()&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;admins&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;admins&lt;/span&gt;

    &lt;span style=&#34;color: #66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;sendEmail&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(self,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;recipient,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;content):&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;sender&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;noreply@hmonitor.net&amp;#39;&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;print&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;-- Sending email message: &amp;#39;&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;content&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;recipient&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;recipient&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;strip()&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;len(recipient)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;and&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;not&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;admins&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;__contains__(recipient):&lt;/span&gt;
            &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;admins&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;append(recipient)&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;message&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;From: %s&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;\\&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;r&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;\\&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;nTo: %s&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;\\&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;r&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;\\&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;nSubject: Warning: there&amp;#39;s a problem with the server&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;\\&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;r&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;\\&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;n&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;\\&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;r&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;\\&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;n%s&amp;quot;&lt;/span&gt; \\
                  &lt;span style=&#34;color: #f92672&#34;&gt;%&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;(sender,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;, &amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;join(self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;admins),&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;content)&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;mailServer&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;sendmail(sender,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;admins,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;message)&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;mailServer&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;quit()&lt;/span&gt;

    &lt;span style=&#34;color: #66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;check&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;(self,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;servers):&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;for&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;(server,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;admin)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;in&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;servers&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;items():&lt;/span&gt;
            &lt;span style=&#34;color: #66d9ef&#34;&gt;try&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;:&lt;/span&gt;
                &lt;span style=&#34;color: #f8f8f2&#34;&gt;h&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;urllib2&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;HTTPHandler(debuglevel&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;
                &lt;span style=&#34;color: #f8f8f2&#34;&gt;opener&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;urllib2&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;build_opener(h)&lt;/span&gt;
                &lt;span style=&#34;color: #66d9ef&#34;&gt;print&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;server,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;-&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt;
                &lt;span style=&#34;color: #f8f8f2&#34;&gt;page&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;opener&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;open(server)&lt;/span&gt;
                &lt;span style=&#34;color: #f8f8f2&#34;&gt;data&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;page&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;read()&lt;/span&gt;
                &lt;span style=&#34;color: #66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;page&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;code&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;200&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;len(data)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;threshold:&lt;/span&gt;
                    &lt;span style=&#34;color: #66d9ef&#34;&gt;print&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;UNKNOWN&amp;quot;&lt;/span&gt;
                    &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;sendEmail(admin,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;Server &amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;server&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39; is responding, but state undetermined.&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;
                &lt;span style=&#34;color: #66d9ef&#34;&gt;else&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;:&lt;/span&gt;
                    &lt;span style=&#34;color: #66d9ef&#34;&gt;print&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;UP&amp;quot;&lt;/span&gt;
            &lt;span style=&#34;color: #66d9ef&#34;&gt;except&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;:&lt;/span&gt;
                &lt;span style=&#34;color: #66d9ef&#34;&gt;print&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;DOWN&amp;quot;&lt;/span&gt;
                &lt;span style=&#34;color: #f8f8f2&#34;&gt;self&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;sendEmail(admin,&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;Server &amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;server&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39; is not responding&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;

&lt;span style=&#34;color: #66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;():&lt;/span&gt;
    &lt;span style=&#34;color: #f8f8f2&#34;&gt;servers&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;{&lt;/span&gt;
            &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;https://server1.company.com&amp;#39;&lt;/span&gt;         &lt;span style=&#34;color: #f8f8f2&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;person.one@company.com&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt;
            &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;http://server2.company.com/web/app&amp;#39;&lt;/span&gt;  &lt;span style=&#34;color: #f8f8f2&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;person.two@company.com&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;,&lt;/span&gt;
    &lt;span style=&#34;color: #f8f8f2&#34;&gt;}&lt;/span&gt;

    &lt;span style=&#34;color: #f8f8f2&#34;&gt;hMonitor&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;HeartbeatMonitor([&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;admin@company.com&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;],&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;smtp.company.com&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;)&lt;/span&gt;
    &lt;span style=&#34;color: #f8f8f2&#34;&gt;hMonitor&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;check(servers)&lt;/span&gt;

&lt;span style=&#34;color: #66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;__name__&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;__main__&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;:&lt;/span&gt;
    &lt;span style=&#34;color: #f8f8f2&#34;&gt;main()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;After you make your alterations go ahead and run the script a couple of times to make sure it&amp;rsquo;s working. Then if you&amp;rsquo;re running it on a Linux box you could automate the process by adding it to the cron scheduler list. Simply run the following command&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;~$ crontab -e
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;and add a line similar to this&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;*/30 * * * * /usr/local/bin/hmonitor.py
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Where &lt;em&gt;/usr/local/bin/hmonitor.py&lt;/em&gt; is the absolute path to this monitoring script and the part in front of it is the time when this script should be run. In this specific case the script will be run every 30 minutes, but you can change it to your liking. If you need more information on the crontab format which is used by the cron scheduler see the &lt;a title=&#34;Crontab format&#34; href=&#34;http://en.wikipedia.org/wiki/Cron&#34; target=&#34;_blank&#34;&gt;wiki page&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Search for Files on Remote FTP Server</title>
      <link>http://andrius.miasnikovas.lt/2011/02/search-for-files-on-remote-ftp-server/</link>
      <pubDate>Mon, 14 Feb 2011 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2011/02/search-for-files-on-remote-ftp-server/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ll keep this one short. Don&amp;rsquo;t know about you, but I&amp;rsquo;ve always been frustrated about how most FTP clients won&amp;rsquo;t let you search for files on a remote FTP server. I remember I used some client that had this functionality, but this was quite a while ago so I can&amp;rsquo;t even remember the name of it. If someone else knows any lightweight tools that let you do that, please leave a comment. Recently I needed to do some quick searches on the servers that I have only FTP access to. And you know what they say&amp;#8230; &amp;#8220;when you can&amp;rsquo;t find the right tool for the job &amp;#8211; write it yourself&amp;#8221; Actually I don&amp;rsquo;t know if anyone says that :) but I decided to do it and put together a Python script just for this task. I&amp;rsquo;m not sure if many others have run into a similar problem, but I put it on GitHub anyway. I called it &lt;a title=&#34;FTP search&#34; href=&#34;https://github.com/andriusm/FTP-search&#34; target=&#34;_blank&#34;&gt;FTP search&lt;/a&gt; for obvious reasons. You can find the script and a short documentation there. The only prerequisite is that you have Python 2.7.x installed. I can&amp;rsquo;t promise you that it will work with Python 3.x but you&amp;rsquo;re welcome to try.  If you have any ideas on how to improve this little tool and wish to contribute then leave a comment bellow or contact me via e-mail that&amp;rsquo;s specified on GitHub&amp;rsquo;s project page.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Modifying Treepie To Display File Count</title>
      <link>http://andrius.miasnikovas.lt/2011/01/modifying-treepie-to-display-file-count/</link>
      <pubDate>Tue, 25 Jan 2011 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2011/01/modifying-treepie-to-display-file-count/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve already talked a bit about managing large amounts of files in my post &lt;a href=&#34;http://andrius.miasnikovas.lt/2010/03/disk-efficiency-when-dealing-with-tons-of-small-files/&#34; target=&#34;_self&#34;&gt;Disk efficiency when dealing with tons of small files&lt;/a&gt; so you can kind of tell that I&amp;rsquo;m a proponent of having as little files on disk as possible (but not less). In my everyday tasks I&amp;rsquo;m using this program called Everything by &lt;a href=&#34;http://www.voidtools.com/&#34; target=&#34;_blank&#34;&gt;David Carpenter&lt;/a&gt; and I suggest you check it out if you don&amp;rsquo;t know it yet. The concept is simple, but the consequences are immense &amp;#8211; the program indexes all the files and folders on all volumes connected to your computer i.e. your hard disk drives, flash drives, cd/dvd-roms, etc. And it tracks the changes so this index is always up-to-date allowing you very fast access to ANY FILE on your computer. The thing is that it indexes all the files on startup so the more files you have the longer it takes. To illustrate another reason why too many files aren&amp;rsquo;t great see the picture below.&lt;/p&gt;

&lt;p&gt;&lt;img class=&#34;aligncenter size-full wp-image-481&#34; title=&#34;lots_files&#34; src=&#34;http://andrius.miasnikovas.lt/wp-content/uploads/2011/01/lots_files.png&#34; alt=&#34;&#34; width=&#34;601&#34; height=&#34;643&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Notice how the actual size of the files is about 806KB while because there are so many files (4422 to be exact) and the cluster size for my disk is 4KB the actual space occupied on the drive totals up to almost 18MB. We can do the math to better understand what happened:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cluster size: 4KB = 4096 Bytes&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;number of files: 4422&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;so even if each file contained only a single character i.e. file size of 1 Byte it would occupy the whole cluster and take up 4KB of disk space. Which means that the absolute minimum of disk space consumed by these files is 4422 x 4096 = 18112512 Bytes ~= 17.27 MB&lt;/p&gt;

&lt;p&gt;And of course if the files are larger they will take up even more space. Hopefully I convinced you that you should remove any and all unnecessary files that you&amp;rsquo;re not using and don&amp;rsquo;t just let them hinder your drive&amp;rsquo;s performance. This is the part where we have to find a way to locate directories containing the most files so that we could decide whether we actually need them or not. In the past I&amp;rsquo;ve been using a program called &lt;a href=&#34;http://sourceforge.net/projects/treepie/&#34; target=&#34;_blank&#34;&gt;TreePie&lt;/a&gt; to find which directories occupy the most space on disk. It looks something like this:&lt;/p&gt;

&lt;p&gt;&lt;img class=&#34;aligncenter size-full wp-image-484&#34; title=&#34;treepie&#34; src=&#34;http://andrius.miasnikovas.lt/wp-content/uploads/2011/01/treepie.png&#34; alt=&#34;&#34; width=&#34;617&#34; height=&#34;648&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately it displays the folders proportional only to the space occupied on disk. On the other hand the project is open source so I can modify it&amp;rsquo;s behavior and so I did. Here&amp;rsquo;s the patch file with my changes.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;Index: AllDir.cpp
===================================================================
&lt;span style=&#34;color: #f92672&#34;&gt;--- AllDir.cpp  (revision 16)&lt;/span&gt;
&lt;span style=&#34;color: #a6e22e&#34;&gt;+++ AllDir.cpp  (working copy)&lt;/span&gt;
&lt;span style=&#34;color: #75715e&#34;&gt;@@ -64,7 +64,7 @@&lt;/span&gt;
 {
    HANDLE hFirst;
    WIN32_FIND_DATA hFind;
&lt;span style=&#34;color: #f92672&#34;&gt;-   INT64 nSize =;&lt;/span&gt;
&lt;span style=&#34;color: #a6e22e&#34;&gt;+   INT64 nSize = -2;&lt;/span&gt;

    char sCompleteFile[MAX_PATH];
    char sListFile[MAX_PATH];
&lt;span style=&#34;color: #75715e&#34;&gt;@@ -131,7 +131,7 @@&lt;/span&gt;
            if (hFind.nFileSizeHigh!=-858993460 ) //// ARRRGH!(system information folder)
            {
                //grandezza del file (aritmetica a 64 bit)
&lt;span style=&#34;color: #f92672&#34;&gt;-               nSize += (INT64)hFind.nFileSizeHigh * ((INT64)MAXDWORD+1) + hFind.nFileSizeLow ;&lt;/span&gt;
&lt;span style=&#34;color: #a6e22e&#34;&gt;+               nSize ++;&lt;/span&gt;
                //if (nSize &amp;gt; MAXDWORD){
                //  mb_log(&amp;quot;ListAllDir: nSize sorpassa MAXDWORD&amp;quot;);
                //}
Index: displayer.cpp
===================================================================
&lt;span style=&#34;color: #f92672&#34;&gt;--- displayer.cpp   (revision 16)&lt;/span&gt;
&lt;span style=&#34;color: #a6e22e&#34;&gt;+++ displayer.cpp   (working copy)&lt;/span&gt;
&lt;span style=&#34;color: #75715e&#34;&gt;@@ -62,11 +62,7 @@&lt;/span&gt;
                glLoadIdentity();

                glRasterPos2f(5.0f , rect.bottom - 20.0f );
&lt;span style=&#34;color: #f92672&#34;&gt;-               if (iv_nSize &amp;gt; 1073741824 )&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;-                   glPrint(&amp;quot;%d GB  &amp;quot;,iv_nSize/1073741824);&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;-               else&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;-                   glPrint(&amp;quot;%d MB  &amp;quot;,iv_nSize/1048576);&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;-               glPrint(&amp;quot;(%d KB  )&amp;quot;,iv_nSize/1024);&lt;/span&gt;
&lt;span style=&#34;color: #a6e22e&#34;&gt;+               glPrint(&amp;quot;%d files&amp;quot;,iv_nSize);&lt;/span&gt;

                glRasterPos2f(rect.right/2.0f , rect.bottom - 20.0f );
                glPrint(sBuffer);
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Pretty simple, huh? These changes are enough to get TreePie to start displaying the file count instead of the file size. Though I have to admit that I was unable to open and compile it with Microsoft&amp;rsquo;s Visual Studio Express. I&amp;rsquo;m still not sure if it was something with included project files or was it something with my machine&amp;rsquo;s configuration. I solved it by using an IDE that I have more experience with &amp;#8211; &lt;a href=&#34;http://www.codeblocks.org/&#34; target=&#34;_blank&#34;&gt;CodeBlocks&lt;/a&gt;. I created a new project, copied over the files and soon I had my own modified version of TreePie. Which I&amp;rsquo;m happy to share with you all. Here&amp;rsquo;s an archive containing the &lt;a href=&#34;http://andrius.miasnikovas.lt/files/treepie_mod.zip&#34; target=&#34;_blank&#34;&gt;&lt;strong&gt;modified Treepie&lt;/strong&gt; &lt;/a&gt;version as a CodeBlocks project and includes a compiled version if you don&amp;rsquo;t have this IDE or don&amp;rsquo;t want to install it. I&amp;rsquo;m considering forking this project, cleaning up the code a little bit and maybe throwing in a few new features.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Online Tools That Make My Life Easier</title>
      <link>http://andrius.miasnikovas.lt/2010/11/online-tools-that-make-my-life-easier/</link>
      <pubDate>Thu, 25 Nov 2010 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2010/11/online-tools-that-make-my-life-easier/</guid>
      <description>

&lt;p&gt;Imagine a situation where you&amp;rsquo;re sitting in front of a colleague&amp;rsquo;s computer or one that is publicly used. By definition you&amp;rsquo;re missing all your favorite tools that you&amp;rsquo;re used to and you can&amp;rsquo;t install them even if you wanted to. Here&amp;rsquo;s a short list of online tools that help me a lot when I&amp;rsquo;m using a computer other than my own. These do not fully replace the desktop equivalents, but they&amp;rsquo;re good enough. Though it&amp;rsquo;s not a list of tools that replace desktop applications, but rather a list of online tools that complement them and some provide functionality that does not exist in desktop based applications.&lt;/p&gt;

&lt;h2 id=&#34;html-javascript:94a0196e59a6289b976c5a78360665da&#34;&gt;HTML / Javascript&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://jsbin.com&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://jsbin.com&#34;&gt;http://jsbin.com&lt;/a&gt;&lt;/a&gt; &amp;#8211; this one allows you to write HTML and Javascript code directly in the browser and preview it instantly. Features a nice syntax highlighting.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://zen-coding.ru/demo/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://zen-coding.ru/demo/&#34;&gt;http://zen-coding.ru/demo/&lt;/a&gt;&lt;/a&gt; &amp;#8211; this one is really nice. If you don&amp;rsquo;t have VIM handy or other editor that supports zen-coding, you can simply open up this page and start zen coding right inside the browser. And if you need some help with your zen here&amp;rsquo;s a &lt;a href=&#34;http://code.google.com/p/zen-coding/downloads/detail?name=ZenCodingCheatSheet.pdf&amp;can=2&amp;q=pdf&#34; target=&#34;_blank&#34;&gt;cheat-sheet PDF&lt;/a&gt; and a &lt;a href=&#34;http://www.smashingmagazine.com/2009/11/21/zen-coding-a-new-way-to-write-html-code/&#34; target=&#34;_blank&#34;&gt;nice post&lt;/a&gt; explaining what it is and how to take advantage of it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;beautifiers:94a0196e59a6289b976c5a78360665da&#34;&gt;Beautifiers&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://jsbeautifier.org&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://jsbeautifier.org&#34;&gt;http://jsbeautifier.org&lt;/a&gt;&lt;/a&gt; &amp;#8211; Javascript unpacker &amp;amp; beautifier. Does exactly what it says.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://xmlbeautifier.com/default.aspx&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://xmlbeautifier.com/default.aspx&#34;&gt;http://xmlbeautifier.com/default.aspx&lt;/a&gt;&lt;/a&gt; &amp;#8211; simple XML beautifier, nothing fancy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;regural-expressions:94a0196e59a6289b976c5a78360665da&#34;&gt;Regural Expressions&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://gskinner.com/RegExr/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://gskinner.com/RegExr/&#34;&gt;http://gskinner.com/RegExr/&lt;/a&gt;&lt;/a&gt; &amp;#8211; regular expression test page with possibility to save your expressions and a hint column if you forget something.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;data-processing:94a0196e59a6289b976c5a78360665da&#34;&gt;Data Processing&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://www.miraclesalad.com/webtools/md5.php&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://www.miraclesalad.com/webtools/md5.php&#34;&gt;http://www.miraclesalad.com/webtools/md5.php&lt;/a&gt;&lt;/a&gt; &amp;#8211; MD5 hash generator.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://meyerweb.com/eric/tools/dencoder/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://meyerweb.com/eric/tools/dencoder/&#34;&gt;http://meyerweb.com/eric/tools/dencoder/&lt;/a&gt;&lt;/a&gt; &amp;#8211; URLencode and URLdecode any string using this page.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://www.opinionatedgeek.com/dotnet/tools/base64encode/&#34; target=&#34;_blank&#34;&gt;Base64 encoder&lt;/a&gt; and &lt;a href=&#34;http://www.opinionatedgeek.com/dotnet/tools/base64decode/&#34; target=&#34;_blank&#34;&gt;Base64 decoder&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://www.stringfunction.com/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://www.stringfunction.com/&#34;&gt;http://www.stringfunction.com/&lt;/a&gt;&lt;/a&gt; &amp;#8211; various functions that can be applied to strings.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;network:94a0196e59a6289b976c5a78360665da&#34;&gt;Network&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://networking.ringofsaturn.com/Tools/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://networking.ringofsaturn.com/Tools/&#34;&gt;http://networking.ringofsaturn.com/Tools/&lt;/a&gt;&lt;/a&gt; &amp;#8211; a set of different network related tools, that help you with your subnet calculations, tracerouting, domain resolution, probing and such.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;others:94a0196e59a6289b976c5a78360665da&#34;&gt;Others&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://developer.yahoo.com/yql/console/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://developer.yahoo.com/yql/console/&#34;&gt;http://developer.yahoo.com/yql/console/&lt;/a&gt;&lt;/a&gt; &amp;#8211; that&amp;rsquo;s Yahoo&amp;rsquo;s YQL console which is way awesome. Being the page scraping enthusiast that I am, I really like how you can gather information from different sources in such a simple way, also note the REST API and the ability to save your queries.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://hurl.it/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://hurl.it/&#34;&gt;http://hurl.it/&lt;/a&gt;&lt;/a&gt; &amp;#8211; not quite short how to explain it, but replaces tools like cURL and Wget for me. Basically does a request to specified ULR and returns the result.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://hpricot.com/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://hpricot.com/&#34;&gt;http://hpricot.com/&lt;/a&gt;&lt;/a&gt; &amp;#8211; this one can be used for specific information extraction from any page a.k.a. &lt;a href=&#34;http://en.wikipedia.org/wiki/Web_scraping&#34; target=&#34;_blank&#34;&gt;Web scrapping&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;communication:94a0196e59a6289b976c5a78360665da&#34;&gt;Communication&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://webchat.freenode.net/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://webchat.freenode.net/&#34;&gt;http://webchat.freenode.net/&lt;/a&gt;&lt;/a&gt; &amp;#8211; a web interface for freenode IRC server. Really helpful in situations where you find yourself behind some firewall that restricts outbound access.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://02.chat.mibbit.com/&#34; target=&#34;_blank&#34;&gt;&lt;a href=&#34;http://02.chat.mibbit.com/&#34;&gt;http://02.chat.mibbit.com/&lt;/a&gt;&lt;/a&gt; &amp;#8211; similarly to the above this is a web-based IRC client. The main difference it is not just for the freenode server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This list is not meant to be exhaustive, but if you know some nice online tools and are willing to share them, leave a comment.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Private Key PFX to/from JKS Conversion Using OpenSSL and Jetty</title>
      <link>http://andrius.miasnikovas.lt/2010/10/private-key-pfx-jks-conversion-using-openssl-and-jetty/</link>
      <pubDate>Thu, 21 Oct 2010 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2010/10/private-key-pfx-jks-conversion-using-openssl-and-jetty/</guid>
      <description>

&lt;p&gt;Recently I&amp;rsquo;ve been watching quite a few screencasts which seem to be a really fun way to learn something. This made me want to create something of my own. So for this blog post I&amp;rsquo;m putting up my first attempts at creating screencasts while trying to explain something useful.&lt;/p&gt;

&lt;p&gt;When dealing with PKI based application security, one usually encounters different systems on different platforms and making sure they can interact with each other can be quite a hassle. Testing these systems usually means you create you own self-signed private/public key pairs. And of course there are times when for testing purposes you need to convert your private key to another format because you generated it on a different platform or received it from someone else who didn&amp;rsquo;t ask you about your preferred private key storage format. There are quite a few storage formats devised by the &lt;a href=&#34;http://en.wikipedia.org/wiki/PKCS&#34;&gt;public-key cryptography standards&lt;/a&gt; group. Most of the time I have to deal with keys in Java&amp;rsquo;s JKS format and PFX format used on Microsoft platforms so from time to time I have a need of converting one format into another. See the screencasts bellow of how I&amp;rsquo;m converting them both ways.&lt;/p&gt;

&lt;h2 id=&#34;convert-private-key-in-pfx-format-to-jks-keystore:c301cfc1ba31388ade04043e54b6807d&#34;&gt;Convert private key in PFX format to JKS keystore&lt;/h2&gt;

&lt;iframe width=&#34;720&#34; height=&#34;405&#34; src=&#34;https://www.youtube.com/embed/abakJu2o7zk&#34; frameborder=&#34;0&#34; allowfullscreen&gt;&lt;/iframe&gt;

&lt;p&gt;Note: after this conversion the alias in the Java keystore for the converted key is &amp;#8216;1&amp;rsquo;. Since I&amp;rsquo;m using such conversions only for test purposes I haven&amp;rsquo;t looked into changing the alias to something more meaningful. But if you know a quick way of doing this without reimporting the key, please, post your method in the comments ;)&lt;/p&gt;

&lt;h2 id=&#34;convert-private-key-in-jks-keystore-to-pfx-format:c301cfc1ba31388ade04043e54b6807d&#34;&gt;Convert private key in JKS keystore to PFX format&lt;/h2&gt;

&lt;iframe width=&#34;720&#34; height=&#34;405&#34; src=&#34;https://www.youtube.com/embed/t2GMXNpUJow&#34; frameborder=&#34;0&#34; allowfullscreen&gt;&lt;/iframe&gt;

&lt;p&gt;Here&amp;rsquo;s the source of the Java file I used in the screencast for private key an certificate extraction from JKS keystore. Note that I&amp;rsquo;m assuming here the usage of JDK 6 because &lt;code&gt;System.console().readPassword()&lt;/code&gt; is used to read the password without echoing.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;java.io.*&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;java.security.*&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;java.security.cert.Certificate&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;

&lt;span style=&#34;color: #66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;ExportKeyAndCert&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;

  &lt;span style=&#34;color: #66d9ef&#34;&gt;private&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;Base64&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color: #66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;final&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;encodeData&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
    &lt;span style=&#34;color: #66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;final&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;String&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;charSet&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;

    &lt;span style=&#34;color: #66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;encodeData&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;64&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;];&lt;/span&gt;
      &lt;span style=&#34;color: #66d9ef&#34;&gt;for&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;64&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;c&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;charSet&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;charAt&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;encodeData&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;c&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
      &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
    &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;

    &lt;span style=&#34;color: #66d9ef&#34;&gt;private&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;Base64&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{}&lt;/span&gt;

    &lt;span style=&#34;color: #66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;String&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;encode&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;src&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color: #66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;length&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;src&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;length&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
      &lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;length&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;3&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;4&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;length&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;57&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;];&lt;/span&gt;
      &lt;span style=&#34;color: #66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;x&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;len&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;old&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;state&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;

      &lt;span style=&#34;color: #66d9ef&#34;&gt;for&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;srcIndex&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;srcIndex&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;length&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;srcIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;x&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;src&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;srcIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;];&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;switch&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(++&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;state&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
          &lt;span style=&#34;color: #66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;:&lt;/span&gt;
          &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;encodeData&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;x&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;0x3f&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;];&lt;/span&gt;
          &lt;span style=&#34;color: #66d9ef&#34;&gt;break&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
          &lt;span style=&#34;color: #66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;:&lt;/span&gt;
          &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;encodeData&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[((&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;old&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;4&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;0x30&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;|&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;((&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;x&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;4&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;0xf&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)];&lt;/span&gt;
          &lt;span style=&#34;color: #66d9ef&#34;&gt;break&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
          &lt;span style=&#34;color: #66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;3&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;:&lt;/span&gt;
          &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;encodeData&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[((&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;old&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;0x3C&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;|&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;((&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;x&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;6&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;0x3&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)];&lt;/span&gt;
          &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;encodeData&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;x&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;0x3F&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;];&lt;/span&gt;
          &lt;span style=&#34;color: #f8f8f2&#34;&gt;state&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
          &lt;span style=&#34;color: #66d9ef&#34;&gt;break&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
        &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;old&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;x&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(++&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;len&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;57&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
          &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;\n&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
          &lt;span style=&#34;color: #f8f8f2&#34;&gt;len&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
        &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
      &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
      &lt;span style=&#34;color: #66d9ef&#34;&gt;switch&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;state&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;:&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;encodeData&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;old&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;4&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;0x30&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;];&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;=&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;=&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;break&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;:&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;encodeData&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;old&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;0x3c&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;];&lt;/span&gt;
        &lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dstIndex&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;++]&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;byte&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #e6db74&#34;&gt;&amp;#39;=&amp;#39;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
        &lt;span style=&#34;color: #66d9ef&#34;&gt;break&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;;&lt;/span&gt;
      &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
      &lt;span style=&#34;color: #66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;String&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;dst&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
    &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;

  &lt;span style=&#34;color: #66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color: #a6e22e&#34;&gt;main&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;String&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
    &lt;span style=&#34;color: #66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;length&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color: #ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;System&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;out&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;println&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;Usage: java ExportKeyAndCert keyStore keyAlias&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;System&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;exit&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;();&lt;/span&gt;
    &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
    &lt;span style=&#34;color: #66d9ef&#34;&gt;try&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;String&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;keyStore&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;];&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;String&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;keyAlias&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;args&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color: #ae81ff&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;];&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;Console&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;console&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;System&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;console&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;();&lt;/span&gt;
      &lt;span style=&#34;color: #66d9ef&#34;&gt;char&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;storePass&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;console&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;readPassword&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;Enter keystore password: &amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #66d9ef&#34;&gt;char&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;keyPass&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;console&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;readPassword&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;Enter key password: &amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;

      &lt;span style=&#34;color: #f8f8f2&#34;&gt;KeyStore&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;ks&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;KeyStore&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getInstance&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;jks&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;ks&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;load&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;FileInputStream&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;keyStore&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;),&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;storePass&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;

      &lt;span style=&#34;color: #f8f8f2&#34;&gt;Certificate&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;cert&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;ks&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getCertificate&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;keyAlias&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;String&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;b64&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;Base64&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;encode&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;cert&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getEncoded&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;());&lt;/span&gt;

      &lt;span style=&#34;color: #f8f8f2&#34;&gt;PrintWriter&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;PrintWriter&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;public.cer&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;println&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;-----BEGIN CERTIFICATE-----&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;println&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;b64&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;println&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;-----END CERTIFICATE-----&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;close&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;();&lt;/span&gt;

      &lt;span style=&#34;color: #f8f8f2&#34;&gt;Key&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;key&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;ks&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getKey&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;keyAlias&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;keyPass&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;b64&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;Base64&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;encode&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;key&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;getEncoded&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;());&lt;/span&gt;

      &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;PrintWriter&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;private.key&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;println&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;-----BEGIN PRIVATE KEY-----&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;println&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;b64&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;println&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #e6db74&#34;&gt;&amp;quot;-----END PRIVATE KEY-----&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;);&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;fout&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;close&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;();&lt;/span&gt;

    &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color: #66d9ef&#34;&gt;catch&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #f8f8f2&#34;&gt;Exception&lt;/span&gt; &lt;span style=&#34;color: #f8f8f2&#34;&gt;e&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #f92672&#34;&gt;{&lt;/span&gt;
      &lt;span style=&#34;color: #f8f8f2&#34;&gt;e&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #a6e22e&#34;&gt;printStackTrace&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;();&lt;/span&gt;
    &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
  &lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

</description>
    </item>
    
    <item>
      <title>What’s New in Tomcat 7</title>
      <link>http://andrius.miasnikovas.lt/2010/07/whats-new-in-tomcat-7/</link>
      <pubDate>Wed, 21 Jul 2010 00:00:00 +0000</pubDate>
      
      <guid>http://andrius.miasnikovas.lt/2010/07/whats-new-in-tomcat-7/</guid>
      <description>

&lt;p&gt;Recently I watched this webinar about &lt;a href=&#34;http://tomcat.apache.org/download-70.cgi&#34; target=&#34;_blank&#34;&gt;Tomcat 7&lt;/a&gt; presented by &lt;a href=&#34;http://www.springsource.com/people/mthomas&#34; target=&#34;_blank&#34;&gt;Mark Thomas&lt;/a&gt; and would like to share my thoughts on the subject and what I&amp;rsquo;ve learned.&lt;/p&gt;

&lt;h3 id=&#34;servlet-3-0:5690ecb5708c75d5ec1796a8fe6ac023&#34;&gt;Servlet 3.0&lt;/h3&gt;

&lt;p&gt;The most prominent change is the support of Servlet 3.0 specification which supports such great features as&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;asynchronous servlets &amp;#8211; not used by default&lt;/li&gt;
&lt;li&gt;web-fragment.xml &amp;#8211;  you can specify parts of the configuration in your libraries which you plan to reuse&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The effective deployment descriptor (web.xml) now is the sum total of all the fragment configurations contained in the application&amp;rsquo;s libraries. This means that you need to be more careful when using 3rd party libraries because they can contain some configuration portion that will prevent your application from working like you expected. But to my understanding you can fixate the effective web.xml used and prevent tomcat from scanning all the libraries for configuration fragments. Now deployment descriptors support programmatic configuration i.e. you can decide how to configure an application at startup by considering the environment the server is in and other variables.&lt;/p&gt;

&lt;p&gt;Another interesting thing to note is that before the Servlet 3.0 specification implementation tomcat used two methods of session tracking: cookies and rewriting the URL with the JSESSIONID parameter. The latter in tomcat was mandatory meaning you could not easily switch it off. I actually tried some workarounds, but they produced some side-effects. If anyone knows a proper method to avoid ever seeing the JSESSIONID parameter in Tomcat 6 please let me know. In Tomcat 7 the URL rewriting method is no longer mandatory and a new session tracking method was added based on SSL session. It is more secure, but I believe it needs two-way SSL configured. Don&amp;rsquo;t quote me on this, because I might be wrong about the two-way SSL, will have to check it. While we&amp;rsquo;re at it I can mention that now there&amp;rsquo;s the ability to change the session cookie&amp;rsquo;s default name, domain and path.&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;session-config&amp;gt;&lt;/span&gt;
   &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;tracking-mode&amp;gt;&lt;/span&gt;COOKIE&lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;/tracking-mode&amp;gt;&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;/session-config&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h3 id=&#34;jsp-2-2:5690ecb5708c75d5ec1796a8fe6ac023&#34;&gt;JSP 2.2&lt;/h3&gt;

&lt;p&gt;Not much to talk about other than saying that Tomcat 7 supports it. And maybe worth mentioning that you can now specify the defaults for the content type you&amp;rsquo;re returning and the buffer size. Also there&amp;rsquo;s a nice configuration option  added called &lt;em&gt;error-on-undeclared-namespace&lt;/em&gt; which quoting the documentation does the following:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The default behavior when a tag with unknown namespace is used in a JSP page (regular syntax) is to silently ignore it.  If set to true, then an error must be raised during the translation time when an undeclared tag is used in a JSP page.  Disabled (false) by default.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And here&amp;rsquo;s an example of how you would use this option&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #272822&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;jsp-config&amp;gt;&lt;/span&gt;
    &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;jsp-property-group&amp;gt;&lt;/span&gt;
        &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;url-pattern&amp;gt;&lt;/span&gt;*.jsp&lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;/url-pattern&amp;gt;&lt;/span&gt;
        &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;error-on-undeclared-namespace&amp;gt;&lt;/span&gt;true&lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;/error-on-undeclared-namespace&amp;gt;&lt;/span&gt;
    &lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;/jsp-property-group&amp;gt;&lt;/span&gt;
&lt;span style=&#34;color: #f92672&#34;&gt;&amp;lt;/jsp-config&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Also note that Tomcat 7 implements EL 2.2 and now is much stricter about the EL specifications, but according to Mark it&amp;rsquo;s unlikely to affect many users unless of course you&amp;rsquo;re doing some kind of hack with it.&lt;/p&gt;

&lt;h3 id=&#34;memory-leak-protection:5690ecb5708c75d5ec1796a8fe6ac023&#34;&gt;Memory leak protection&lt;/h3&gt;

&lt;p&gt;This is a nice new feature in Tomcat 7 which has been backported to Tomcat 6 and if you&amp;rsquo;re using version 6.0.24 or later, you can enjoy the benefits. It&amp;rsquo;s implemented as a listener which tries to detect and fix the possible memory leaks whenever it can. These are the leak cases that it tries to prevent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;JDBC drivers&lt;/strong&gt; &amp;#8211; they should be de-registered upon application stop&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ThreadLocals&lt;/strong&gt; &amp;#8211; if you create it when processing the request, you must set it to null before completing the response&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Threads&lt;/strong&gt; &amp;#8211; if a webapp starts a thread (e.g. scheduler) it must stop it, Tomcat doesn&amp;rsquo;t do that for you because it might crash the JVM, but it does report the problem in the log files&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ResouceBundle&lt;/strong&gt; &amp;#8211; Tomcat automatically fixes this one, but if you want some details turn on debug logging&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;alias-support:5690ecb5708c75d5ec1796a8fe6ac023&#34;&gt;Alias support&lt;/h3&gt;

&lt;p&gt;This is said to be a much requested feature which allows you to map a &lt;em&gt;.war&lt;/em&gt; file or a directory with static content that you could for example share among other applications deployed on that server. The main advantage over using symlinks is that when using a symlink Tomcat follows it and undeploys the content along with the application. This is done by specifying the attribute alias in the &lt;em&gt;&lt;context&gt;&lt;/em&gt; tag that looks something like this &lt;code&gt;alias=&amp;quot;/aliasPath=docBase&amp;quot;&lt;/code&gt; and remember to use the absolute path when specifying the content location.&lt;/p&gt;

&lt;h3 id=&#34;even-more-changes:5690ecb5708c75d5ec1796a8fe6ac023&#34;&gt;Even more changes&lt;/h3&gt;

&lt;p&gt;There are more changes like the ones in the &lt;em&gt;manager application&lt;/em&gt; or the &lt;em&gt;jdbc-pool&lt;/em&gt; library, but I won&amp;rsquo;t try to review them here. Other ones include embedding improvements which allow you to easily embed Tomcat using the class &lt;em&gt;org.apache.catalina.startup.Tomcat&lt;/em&gt; and then do programmatic configuration of the server. This seems extremely useful for things like integration tests and in fact most of Tomcat 7 unit tests use embeded Tomcat. Tomcat 7 prevents session fixation attacks by default by changing session ID on authentication. Internal changes include switching from &lt;em&gt;Valves&lt;/em&gt; to &lt;em&gt;Filters&lt;/em&gt;. This change is ongoing and should eventually replace all &lt;em&gt;Valves&lt;/em&gt;. And one thing you might notice when running the new Tomcat is that access log valve is enabled by default. This means that you&amp;rsquo;ll get another file in your logs directory which will log all access to Tomcat server. It&amp;rsquo;s formatted just like the Apache HTTP server&amp;rsquo;s access log and is useful in a number of situations.&lt;/p&gt;

&lt;p&gt;I am using Tomcat 6 and 7 side by side for my current needs and can say that Tomcat 7 with all it&amp;rsquo;s nice features does contain a few bugs so don&amp;rsquo;t rush into using it for any environments that need stability. I&amp;rsquo;m still playing with the new Tomcat&amp;rsquo;s features and maybe will write another post regarding that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UPDATE (2011-07-30)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Since this post is still relevant and gets a reasonable amount of traffic I decided to update it by putting a link to Mark Thomas&amp;rsquo;s recent presentation on &lt;a href=&#34;http://bit.ly/qkGV9s&#34; target=&#34;_blank&#34;&gt;What&amp;rsquo;s New in Tomcat 7&lt;/a&gt;, so that you would get the information straight from the source. The sound quality isn&amp;rsquo;t that great, but it&amp;rsquo;s worth watching/listening if you&amp;rsquo;re interested and have a half an hour to spare.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>