<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-20715940</atom:id><lastBuildDate>Wed, 26 Aug 2026 18:55:16 +0000</lastBuildDate><category>solutions</category><category>how to</category><category>java</category><category>unix</category><category>music</category><category>javascript</category><category>cooking</category><category>sql</category><category>internet explorer</category><category>jquery</category><category>linkage</category><category>teamsite</category><category>RMI</category><category>jsp</category><category>regex</category><category>algorithms</category><category>intellij</category><category>perl</category><category>ant</category><category>eclipse</category><category>lucene</category><category>note to self</category><category>swing</category><category>tomcat</category><category>webdev</category><category>xml</category><category>cron</category><category>firefox</category><category>freebsd</category><category>funny</category><category>grails</category><category>greasemonkey</category><category>groovy</category><category>hibernate</category><category>solaris</category><category>spring</category><category>tellurium</category><category>C</category><category>UI</category><category>catman</category><category>cookbook</category><category>css</category><category>fucking hp</category><category>ibatis</category><category>infusion</category><category>nginx</category><category>note to self books</category><category>oracle</category><category>python</category><category>shameless plug</category><category>subversion</category><category>tcsh</category><category>websphere</category><category>xpath</category><title>Note to self</title><description>Code, cooking, catman</description><link>http://notetodogself.blogspot.com/</link><managingEditor>noreply@blogger.com (Mikhail Koryak)</managingEditor><generator>Blogger</generator><openSearch:totalResults>209</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-3430770521020048068</guid><pubDate>Wed, 23 Sep 2015 21:56:00 +0000</pubDate><atom:updated>2015-09-23T17:56:15.773-04:00</atom:updated><title>on destructuring</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
[5:42 PM] Darien Valentine: [ x, y ] = z || []&lt;br /&gt;
[5:44 PM] Darien Valentine: and when destructuring in parameters, for the same reason sometimes you&#39;ll want to supply an empty default&lt;br /&gt;
[5:44 PM] Darien Valentine: function poop({ color, length, aroma }={}) {}&lt;br /&gt;
[5:46 PM] Darien Valentine: you can also supply defaults in destructured assignments that occur anywhere&lt;br /&gt;
[5:47 PM] Darien Valentine: const { poopCount=0 } = event;&lt;br /&gt;
[5:48 PM] Darien Valentine: the trickiest part of destructuring syntax at first is the distinction between the bindings you&#39;re creating &amp;amp; actual property names. effectively, in the examples above and most that you find (with objects), those bindings are actually a form of shorthand&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;they are doing double duty as both the binding (var, const, let) as well as the property name&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;the long form would look like this:&lt;br /&gt;
[5:49 PM] Darien Valentine: const { poopCount: poopCount=0 } = event;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;meaning the binding identifier there -- the second poopCount -- could actually be another identifier; you&#39;re not stuck with the property name&lt;br /&gt;
[5:51 PM] Darien Valentine: last bit of info I can think of to confer:&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;you can destructure to things that already were declared, but if it&#39;s an object pattern, you need parens or another means to expressionize it (just like with object literals)&lt;br /&gt;
[5:53 PM] Darien Valentine: ({ cats } = obj);&lt;/div&gt;
</description><link>http://notetodogself.blogspot.com/2015/09/on-destructuring.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-5440372925681291541</guid><pubDate>Tue, 18 Nov 2014 16:46:00 +0000</pubDate><atom:updated>2014-11-18T11:53:41.984-05:00</atom:updated><title>tail a *nix command in your browser</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
if you have bash or zsh:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;b&gt;command&lt;/b&gt; | cat -u &amp;lt;( echo $&#39;HTTP/1.0 200 OK\nContent-type:text/plain\n\n&#39; ) - | nc -l 8080&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
otherwise:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;echo $&#39;HTTP/1.0 200 OK\nContent-type:text/plain\n\n&#39; &amp;gt; header.txt&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;b&gt;command&lt;/b&gt; | cat -u header.txt - |&amp;nbsp;&amp;nbsp;nc -l 8088&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
enjoy the output on http://localhost:8080&lt;/div&gt;
</description><link>http://notetodogself.blogspot.com/2014/11/tail-nix-command-in-your-browser.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-5110085880117717368</guid><pubDate>Sun, 17 Aug 2014 02:16:00 +0000</pubDate><atom:updated>2014-08-16T22:16:09.243-04:00</atom:updated><title>rasbian default ssh root password</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This shouldnt be so hard to find. I had a hell of a time trying to find the root password for rasbian on my raspberry pi. There are a lot of places that claim that the username is &quot;pi&quot; but this is not true. use root.&lt;br /&gt;
&lt;br /&gt;
user: &lt;b&gt;root&lt;/b&gt;&lt;br /&gt;
pass:&amp;nbsp;&lt;span style=&quot;background-color: #fcfcfc; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 19.239999771118164px;&quot;&gt;raspberry&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #fcfcfc; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 19.239999771118164px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #fcfcfc; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 19.239999771118164px;&quot;&gt;once you ssh in, change it using the &lt;b&gt;passwd&lt;/b&gt; command. to ssh in, find the thing&#39;s IP and type &lt;b&gt;ssh root@THE_IP&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://notetodogself.blogspot.com/2014/08/rasbian-default-ssh-root-password.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-3908210994862883500</guid><pubDate>Thu, 14 Nov 2013 18:14:00 +0000</pubDate><atom:updated>2013-11-14T13:14:06.279-05:00</atom:updated><title>Building a custom Vagrant box with Parallels Desktop as the Vagrant Provider</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I recently needed to build myself an ubuntu 12.04-lts (amd64) vagrant box that would work in parallels. The problem was that the &lt;a href=&quot;https://github.com/yshahin/vagrant-parallels&quot;&gt;vagrant-parallels&lt;/a&gt; plugin does not provide you that box, and there is &lt;a href=&quot;http://linc01n.github.io/blog/2013/10/05/using-parallels-desktop-as-vagrant-provider/&quot;&gt;very little&lt;/a&gt;&amp;nbsp; information on how to build one yourself. (note - that link is not up to date).&lt;br /&gt;
&lt;br /&gt;
The link above got me part way there, but I found that I did not need to install the parallels SDK or do any voodoo restarts.&lt;br /&gt;
&lt;br /&gt;
The idea is the same though, use veewee to build the vagrant-parallels box. Unfortunately veewee does not have very good docs about how to do this.&lt;br /&gt;
&lt;br /&gt;
The solution was to modify the veewee &#39;ubuntu 12.04-lts&#39; definition and to replace the virtualbox.sh setup with a parallels.sh setup which I found elsewhere.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So here is how you can build a vagrant parallels ubuntu server box:&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;strong&gt;Requirements&lt;/strong&gt;:&lt;/h2&gt;
&lt;ul style=&quot;color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin: 15px 0px; padding: 0px 0px 0px 30px;&quot;&gt;
&lt;li&gt;you should have parallels installed (tested with 8)&lt;/li&gt;
&lt;li&gt;make sure that you have ruby 1.9.2 installed&lt;/li&gt;
&lt;li&gt;go to&amp;nbsp;&lt;a href=&quot;http://downloads.vagrantup.com/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;http://downloads.vagrantup.com/&lt;/a&gt;&amp;nbsp;and install it&lt;/li&gt;
&lt;/ul&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;&quot;&gt;&lt;code style=&quot;background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0px; word-wrap: normal;&quot;&gt;vagrant plugin install vagrant-parallels
sudo gem install veewee
bundle exec veewee parallels define &#39;ubuntu-12.04-lts&#39; &#39;https://github.com/mkoryak/vagrant-parallels-ubuntu-12.04-lts.git/definitions/parallels-ubuntu-12.04-server-amd64&#39;
bundle exec veewee parallels build &#39;ubuntu-12.04-lts&#39;  --workdir=.
bundle exec veewee parallels export &#39;ubuntu-12.04-lts&#39; --workdir=.
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Now you have a vagrant parallels box.&lt;/div&gt;
&lt;div style=&quot;font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To import it into vagrant type:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;&quot;&gt;&lt;code style=&quot;background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0px; word-wrap: normal;&quot;&gt;vagrant box add &#39;ubuntu&#39; &#39;./ubuntu-12.04-lts.box&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 25px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To use it:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-top: 15px; overflow: auto; padding: 6px 10px; word-wrap: normal;&quot;&gt;&lt;code style=&quot;background-color: transparent; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0px; word-wrap: normal;&quot;&gt;vagrant init &#39;ubuntu&#39;
vagrant up --provider=parallels
vagrant ssh&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Updates to this process may be found on my github page for this:&amp;nbsp;&lt;a href=&quot;https://github.com/mkoryak/vagrant-parallels-ubuntu-12.04-lts&quot;&gt;https://github.com/mkoryak/vagrant-parallels-ubuntu-12.04-lts&lt;/a&gt;&lt;/div&gt;
</description><link>http://notetodogself.blogspot.com/2013/11/building-custom-vagrant-box-with.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-7404036622814545881</guid><pubDate>Tue, 25 Sep 2012 20:45:00 +0000</pubDate><atom:updated>2012-09-25T16:46:23.699-04:00</atom:updated><title>vertically center content in bootstrap</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This is how you vertically center stuff in bootstrap:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script class=&quot;brush: html&quot; type=&#39;syntaxhighlighter&#39;&gt;

html, body {
   height:100%;
   width:100%;
}

.container {
   background-color:red;
   height:100%;
   display:table;
   #main-container {
       display:table-cell;
       vertical-align:middle;
   }
}

&lt;/script&gt;

&lt;br /&gt;
This doesnt work in IE8 or less.&lt;/div&gt;
</description><link>http://notetodogself.blogspot.com/2012/09/vertically-center-content-in-bootstrap.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-455827129954312593</guid><pubDate>Mon, 24 Sep 2012 15:18:00 +0000</pubDate><atom:updated>2012-09-24T11:22:48.208-04:00</atom:updated><title>install syntax highlighter 3.x on blogger</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
To install syntax highligher on blogger here what you need to do:&lt;br /&gt;
&lt;br /&gt;
Edit raw template html and put this after the HEAD tag:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script class=&quot;brush: html&quot; type=&quot;syntaxhighlighter&quot;&gt;&lt;![CDATA[

&lt;link href=&#39;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&#39; rel=&#39;stylesheet&#39; type=&#39;text/css&#39;/&gt;
&lt;script src=&#39;https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;style type=&#39;text/css&#39;&gt;

pre {
    background-color: #F5F5F5;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px 4px 4px 4px;
    display: block;
    font-size: 13px;
    line-height: 20px;
    margin: 0 0 10px;
    padding: 9.5px;
    white-space: pre-wrap;
    word-break: break-all;
    word-wrap: break-word;
}
code, pre {
    border-radius: 3px 3px 3px 3px;
    color: #333333;
    font-family: Monaco,Menlo,Consolas,&amp;quot;Courier New&amp;quot;,monospace;
    font-size: 12px;
    padding: 0 3px 2px;
}

&lt;/style&gt;
]
&lt;/script&gt;&lt;/div&gt;
and put this at the bottom of the template before the closing HTML tag:


&lt;script class=&quot;brush: html&quot; type=&quot;syntaxhighlighter&quot;&gt;&lt;![CDATA[

&lt;script type=&#39;text/javascript&#39;&gt;
$(function () {


SyntaxHighlighter.config.bloggerMode = true;


function syntaxFile()
{
  var args = arguments,
      result = [];
       
  for(var i = 0; i &lt; args.length; i++)
      result.push(args[i].replace(&amp;quot;@&amp;quot;, &amp;quot;http://alexgorbatchev.com/pub/sh/current/scripts/&amp;quot;));
       
  return result
};
 
SyntaxHighlighter.autoloader.apply(null, syntaxFile(
  &amp;quot;applescript            @shBrushAppleScript.js&amp;quot;,
  &amp;quot;actionscript3 as3      @shBrushAS3.js&amp;quot;,
  &amp;quot;bash shell             @shBrushBash.js&amp;quot;,
  &amp;quot;coldfusion cf          @shBrushColdFusion.js&amp;quot;,
  &amp;quot;cpp c                  @shBrushCpp.js&amp;quot;,
  &amp;quot;c# c-sharp csharp      @shBrushCSharp.js&amp;quot;,
  &amp;quot;css                    @shBrushCss.js&amp;quot;,
  &amp;quot;delphi pascal          @shBrushDelphi.js&amp;quot;,
  &amp;quot;diff patch pas         @shBrushDiff.js&amp;quot;,
  &amp;quot;erl erlang             @shBrushErlang.js&amp;quot;,
  &amp;quot;groovy                 @shBrushGroovy.js&amp;quot;,
  &amp;quot;java                   @shBrushJava.js&amp;quot;,
  &amp;quot;jfx javafx             @shBrushJavaFX.js&amp;quot;,
  &amp;quot;js jscript javascript  @shBrushJScript.js&amp;quot;,
  &amp;quot;perl pl                @shBrushPerl.js&amp;quot;,
  &amp;quot;php                    @shBrushPhp.js&amp;quot;,
  &amp;quot;text plain             @shBrushPlain.js&amp;quot;,
  &amp;quot;py python              @shBrushPython.js&amp;quot;,
  &amp;quot;ruby rails ror rb      @shBrushRuby.js&amp;quot;,
  &amp;quot;sass scss              @shBrushSass.js&amp;quot;,
  &amp;quot;scala                  @shBrushScala.js&amp;quot;,
  &amp;quot;sql                    @shBrushSql.js&amp;quot;,
  &amp;quot;vb vbnet               @shBrushVb.js&amp;quot;,
  &amp;quot;xml xhtml xslt html    @shBrushXml.js&amp;quot;
));

SyntaxHighlighter.all();


});
&lt;/script&gt;]
&lt;/script&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE:&lt;br /&gt;
If the javascript snippet above you must escape all html entities. They are shown as non-escaped becase of limitations of blogger. You will have to replace all of &#39; with&amp;nbsp;@quot; and &amp;lt; with &amp;lt;&lt;/div&gt;
</description><link>http://notetodogself.blogspot.com/2012/09/install-syntax-highlighter-3x-on-blogger.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-668731591883465539</guid><pubDate>Mon, 17 Sep 2012 21:56:00 +0000</pubDate><atom:updated>2012-09-21T13:43:24.165-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">nginx</category><title>A/B Testing with nginx via rewrite </title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Here is how you can setup 50% of your users to see a different homepage via nginx.&lt;br /&gt;
&lt;br /&gt;
We split them based on the last digit of their IP address:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
location / {
    if ($remote_addr ~ &quot;[02468]$&quot;) {
        rewrite ^(.+)$ /a$1 last;
    }
    rewrite ^(.+)$ /b$1 last;
}
location /a {
    alias   /Users/dogself/site;
    index  index.html index.htm;
    ssi    on;
}
location /b {
    alias   /Users/dogself/site;
    index  index2.html index2.htm;
    ssi    on;
}
&lt;/pre&gt;
&lt;br /&gt;
The trick here is that instead of using the root directive you should use the alias directive. Using alias means that you dont need to create an &#39;a&#39; and &#39;b&#39; directories on your server for this to work.&lt;br /&gt;
&lt;br /&gt;
The downside is that now you have /a/ and /b/ in your path. If you know a way around that, let me know!&lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2012/09/ab-testing-with-nginx-via-rewrite.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-8170555912183736445</guid><pubDate>Mon, 17 Sep 2012 16:42:00 +0000</pubDate><atom:updated>2012-09-17T12:42:48.563-04:00</atom:updated><title>How To Install Node.js on RasberryPi </title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This will let you install the latest version of &lt;a href=&quot;http://nodejs.org/&quot;&gt;node.js&lt;/a&gt; on a Raspberry Pi running &lt;a href=&quot;http://learn.adafruit.com/adafruit-raspberry-pi-educational-linux-distro/occidentalis-v0-dot-2&quot;&gt;occidentalis 0.2&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/joyent/node.git&lt;br /&gt;
cd node&lt;br /&gt;
export GYP_DEFINES=&quot;armv7=0&quot;&lt;br /&gt;
export CXXFLAGS=&#39;-march=armv6 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT&#39;&lt;br /&gt;
export CCFLAGS=&#39;-march=armv6 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT&#39;&lt;br /&gt;
./configure --shared-openssl --without-snapshot&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Compiling node will take about 4-5 hours.&lt;br /&gt;
&lt;br /&gt;
but at the end you will be rewarded with:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;pi@raspberrypi ~ $ node --version&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;v0.9.2-pre&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</description><link>http://notetodogself.blogspot.com/2012/09/how-to-install-nodejs-on-rasberrypi.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-5910882767383200981</guid><pubDate>Wed, 15 Aug 2012 15:02:00 +0000</pubDate><atom:updated>2012-09-21T13:24:37.334-04:00</atom:updated><title>Instrument javascript functions with before and after hooks</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;Use-Case:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I have a javascript class that i want to intrument in an aspect oriented programming (AOP) style by adding before and after hooks to every method in the class. I want to do this generically.&lt;br /&gt;
&lt;br /&gt;
The before function should take the same arguments as the instrumented function and return a set of modified (or not) arguments for the instrumented function.&lt;br /&gt;
&lt;br /&gt;
The after function should take the same arguments as the arguments passed to the instrumented function.&lt;br /&gt;
&lt;br /&gt;
You can also do other things, for example the before function could abort the call to the instrumented function and the after function could munge the returned value.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I decided to add the before and after functions as properties of the instrumented function. Remember, in javascript functions are also objects and can have properties added just like any javascript object. &lt;br /&gt;
&lt;br /&gt;
Once my class&#39;s functions are instrumented the code that uses the class remains the same, but new code can now define the new before and after functions:&lt;br /&gt;
MyClass.someMethod.before = function(...) { ... }&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Code:&lt;/b&gt;&lt;br /&gt;
Note: This code makes use of &lt;a href=&quot;http://underscorejs.org/&quot;&gt;underscore.js&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script class=&quot;brush: js&quot; type=&quot;syntaxhighlighter&quot;&gt;

var instrumentFunctions = function(obj){ //add &#39;before&#39; and &#39;after&#39; functions to each public function in the behavior. &#39;before&#39; function can optionally return an array of the modified arguments
    _.each(obj, function(func, funcName){
        if(_.isFunction(func)){
            obj[funcName] = _.wrap(func, function(fn){
                var wrappedArgs = _.toArray(arguments).slice(1);
                wrappedArgs = obj[funcName].before &amp;&amp; obj[funcName].before.apply(this, wrappedArgs) || wrappedArgs;
                var ret = fn.apply(this, wrappedArgs);
                obj[funcName].after &amp;&amp; obj[funcName].after.apply(this, wrappedArgs);
                return ret;
            }); 
        }
    });
    return obj;
};

var obj = instrumentFunctions({test: function(x){ return x * 2; }, &#39;name&#39;: &#39;double&#39; });
var result = obj.test(2);
console.log(&#39;result&#39;, result); 
//after this call the following is printed to console:
//result 4

obj.test.before = function(x) { return x + 3; };
obj.test.after  = function(x) { console.log(&#39;finished test&#39;); };
 
var result = obj.test(2);
console.log(&#39;result&#39;, result); 
//after this call the following is printed to console:
//result 10
//finished test
&lt;/script&gt;

&lt;b&gt;Final Thoughts:&lt;/b&gt;&lt;br /&gt;
The code as it stands now does not allow the programmer to define multiple before and after functions, only a single one can exist at one time. In the future I may consider supporting binding multiple functions.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://notetodogself.blogspot.com/2012/08/instrument-javascript-functions-with.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-4690716539488085617</guid><pubDate>Wed, 25 Jul 2012 20:07:00 +0000</pubDate><atom:updated>2012-09-21T13:45:12.673-04:00</atom:updated><title>get table sizes of MySQL database</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;mysql&amp;gt; SELECT count(*) tables,
    -&amp;gt;   concat(round(sum(table_rows)/1000000,2),&#39;M&#39;) rows,
    -&amp;gt;   concat(round(sum(data_length)/(1024*1024*1024),2),&#39;G&#39;) data,
    -&amp;gt;   concat(round(sum(index_length)/(1024*1024*1024),2),&#39;G&#39;) idx,
    -&amp;gt;   concat(round(sum(data_length+index_length)/(1024*1024*1024),2),&#39;G&#39;) total_size,
    -&amp;gt;   round(sum(index_length)/sum(data_length),2) idxfrac
    -&amp;gt; FROM information_schema.TABLES;
+--------+---------+--------+--------+------------+---------+
| tables | rows    | data   | idx    | total_size | idxfrac |
+--------+---------+--------+--------+------------+---------+
|    389 | 325.92M | 74.15G | 26.63G | 100.78G    |    0.36 |
+--------+---------+--------+--------+------------+---------+
1 row in set, 14 warnings (15.45 sec)
&lt;/pre&gt;
&lt;br /&gt;
To get the details for one table, using something like:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
mysql&amp;gt; SELECT count(*) tables,
    -&amp;gt;        concat(round(sum(table_rows)/1000000,2),&#39;M&#39;) rows,
    -&amp;gt;        concat(round(sum(data_length)/(1024*1024*1024),2),&#39;G&#39;) data,
    -&amp;gt;        concat(round(sum(index_length)/(1024*1024*1024),2),&#39;G&#39;) idx,
    -&amp;gt;        concat(round(sum(data_length+index_length)/(1024*1024*1024),2),&#39;G&#39;) total_size,
    -&amp;gt;        round(sum(index_length)/sum(data_length),2) idxfrac
    -&amp;gt;        FROM information_schema.TABLES
    -&amp;gt;        WHERE  table_name like &quot;users&quot;;
+--------+-------+-------+-------+------------+---------+
| tables | rows  | data  | idx   | total_size | idxfrac |
+--------+-------+-------+-------+------------+---------+
|      1 | 3.47M | 0.58G | 0.21G | 0.78G      |    0.36 |
+--------+-------+-------+-------+------------+---------+
1 row in set (0.27 sec)
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2012/07/get-table-sizes-of-mysql-database.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-6236607228660529827</guid><pubDate>Sat, 03 Dec 2011 22:20:00 +0000</pubDate><atom:updated>2011-12-03T17:20:21.326-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">how to</category><category domain="http://www.blogger.com/atom/ns#">solutions</category><title>configure boxee to work as a second monitor with sound over hdmi</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;My HTPC setup is simple:&lt;br /&gt;
I ran a 40 foot HDMI cable from my computer room into my bedroom through the basement. I hooked up my TV in the bedroom to be the 2nd monitor on my PC and set boxee to run on that monitor. &lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
I wanted to have Boxee use sound over hdmi, but also be able to listen to to music and play games on my computer as usual without the sound coming from the bedroom TV.&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
In your windows sound prefs set:&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&quot;Speakers&quot; as your default audio device&lt;/li&gt;
&lt;li&gt;&quot;HDMI digital output&quot; as your default communication device&lt;/li&gt;
&lt;/ul&gt;In boxee sound config set:&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt; primary soundcard: HDMI digial sound&lt;/li&gt;
&lt;/ul&gt;restart boxee. Now you should be able to hear HDMI sound only on the TV, and all other sound will come from your speakers.&amp;nbsp; &lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2011/12/configure-boxee-to-work-as-second.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-1483245347085981877</guid><pubDate>Wed, 19 Oct 2011 03:03:00 +0000</pubDate><atom:updated>2011-10-18T23:03:19.315-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">fucking hp</category><title>Photosmart CN216 no LCD or power lights</title><description>I have a brand new (POS) HP Photosmart CN216 all in one print/scan/copy/web printer.&lt;br /&gt;
The only trouble is that sometimes it will power on, but no lights come on. The power light is not not blue, and the LCD is off. At the same time, the printer is on because its making the normal noises.&lt;br /&gt;
&lt;br /&gt;
I was about to return it to HP since once this happens no amount of pressing the power button will &quot;turn it back on&quot;. I found a solution:&lt;br /&gt;
&lt;br /&gt;
The fix is to open the printer as if you were about to replace the ink cartridges, then SLAM it shut. It helps if you are are angry, but you will be when your brand new 100$ wireless printer doesnt work. This will cause it to turn on properly. &lt;br /&gt;
&lt;br /&gt;
The downside to this solution is that it cannot be done at night when people are sleeping</description><link>http://notetodogself.blogspot.com/2011/10/photosmart-cn216-no-lcd-or-power-lights.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-4810085324801929530</guid><pubDate>Thu, 29 Sep 2011 15:18:00 +0000</pubDate><atom:updated>2011-09-29T11:18:00.236-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">sql</category><title>mysql function example</title><description>delimiter //&lt;br /&gt;
create function mytest ()  returns char(50) deterministic&lt;br /&gt;
begin&lt;br /&gt;
declare c int;&lt;br /&gt;
select count(*) into c from table;&lt;br /&gt;
return c;&lt;br /&gt;
end&lt;br /&gt;
//&lt;br /&gt;
delimiter ;</description><link>http://notetodogself.blogspot.com/2011/09/mysql-function-example.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-2174018467114007588</guid><pubDate>Fri, 08 Jul 2011 18:24:00 +0000</pubDate><atom:updated>2011-07-08T14:31:30.373-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">how to</category><category domain="http://www.blogger.com/atom/ns#">python</category><title>Python: remove some entries from a dict</title><description>&lt;b&gt;Problem&lt;/b&gt;: &lt;br /&gt;
Remove a bunch of entries from a dict in an elegant way&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution 1&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;map(lambda name: dict.pop(name, None), [&#39;some_key&#39;, &#39;some_other_key&#39;, &#39;bleee&#39;])&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution 2&lt;/b&gt;:&lt;br /&gt;
My coworker &lt;a href=&quot;http://ohthehugemanatee.net/&quot;&gt;Dave&lt;/a&gt; came up with an even better way to do this thing:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;map(dict.pop, [&#39;some_key&#39;, &#39;some_other_key&#39;, &#39;bleee&#39;], [])&lt;/b&gt;</description><link>http://notetodogself.blogspot.com/2011/07/python-remove-some-entries-from-dict.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-4737666585483595386</guid><pubDate>Thu, 07 Apr 2011 03:36:00 +0000</pubDate><atom:updated>2011-05-17T09:03:25.300-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">grails</category><category domain="http://www.blogger.com/atom/ns#">how to</category><title>Grails: Securing CKEditor URLs</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;Problem:&lt;/b&gt;&lt;br /&gt;
I am using the grails &lt;a href=&quot;http://grails.org/plugin/ckeditor&quot;&gt;CKEditor plugin&lt;/a&gt;&lt;b&gt; &lt;/b&gt;and i wanted to secure the file manager urls to be accessed only by a site admin. I am using the &lt;a href=&quot;http://www.grails.org/plugin/spring-security-core&quot;&gt;Spring Security Core&lt;/a&gt; plugin for site security, but i was already using annotations elsewhere on my site, so using a &lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; font-size: 12px;&quot;&gt;InterceptUrlMap &lt;/span&gt;&lt;/span&gt;was not an option.&lt;br /&gt;
&lt;br /&gt;
So, how to keep using annotations and secure a plugin&#39;s urls?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
The trick is properly using the controllerAnnotations.staticRules (which really isnt that hard if you pay attention to the docs).&lt;br /&gt;
Here is the mapping that works for ANY url mapping you define to CKEditor:&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: courier,&#39;courier new&#39;,monospace; font-size: 12px; line-height: 12px; white-space: pre;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;script class=&quot;brush: java&quot; type=&quot;syntaxhighlighter&quot;&gt;
grails.plugins.springsecurity.controllerAnnotations.staticRules = [
   &#39;/openFileManagerConnector/show&#39;: [&#39;IS_AUTHENTICATED_ANONYMOUSLY&#39;],
   &#39;/standardFileManagerConnector/show&#39;: [&#39;IS_AUTHENTICATED_ANONYMOUSLY&#39;],
   &#39;/openFileManagerConnector/**&#39;: [&#39;ROLE_ADMIN&#39;],
   &#39;/standardFileManagerConnector/**&#39;: [&#39;ROLE_ADMIN&#39;],
]
&lt;/script&gt;&lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2011/04/grails-securing-ckeditor-urls.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-1933003684659774376</guid><pubDate>Fri, 25 Mar 2011 02:51:00 +0000</pubDate><atom:updated>2011-03-24T22:51:20.283-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">grails</category><category domain="http://www.blogger.com/atom/ns#">groovy</category><category domain="http://www.blogger.com/atom/ns#">solutions</category><title>manually set id of grails domain object</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;Problem:&lt;/b&gt;&lt;br /&gt;
if you create a new domain object and set its id in the constructor like this:&lt;br /&gt;
&lt;i&gt;Cat catman = new Cat(id:1000, name: &quot;catman&quot;, kind: &quot;domestic short haired&quot;)&lt;/i&gt;&lt;br /&gt;
later, if you look at the object the id will be null. what gives?!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
Its madness, but it works to assign the id after the object is made. Just add&lt;br /&gt;
&lt;i&gt;catman.setId(1000);&lt;/i&gt;&lt;br /&gt;
and you are in business.&lt;br /&gt;
&lt;br /&gt;
Note: if you want to save the object into db after doing this, you must set the id generator to &#39;assigned&#39;&lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2011/03/manually-set-id-of-grails-domain-object.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-8201952337843734091</guid><pubDate>Mon, 14 Mar 2011 01:58:00 +0000</pubDate><atom:updated>2011-03-13T21:58:26.360-04:00</atom:updated><title>lg cdma usb modem driver</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;The lg mobile phone driver is hard to find. i am using it to make bitpim work with my phone.&lt;br /&gt;
&lt;br /&gt;
It will work with all LG VX-something phones and also is sometimes called this:&lt;br /&gt;
&lt;br /&gt;
Prolific USB-to-Serial Comm Port Driver&lt;br /&gt;
LGE CDMA Composite USB Device Driver&lt;br /&gt;
LGE CDMA USB Modem Driver&lt;br /&gt;
LGE CDMA USB Modem Diagnostic Serial Port Driver&lt;br /&gt;
LGE CDMA USB Modem (VCOMM) Driver&lt;br /&gt;
LGE CDMA USB Modem Diagnostic Serial Port (VCOMM) Driver&lt;br /&gt;
LGE CDMA USB Serial Port Driver&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
get it here:&lt;br /&gt;
&lt;a href=&quot;http://programmingdrunk.com/random-stuff/LGUSBModemDriver_4.6_WHQL.zip&quot;&gt;http://programmingdrunk.com/random-stuff/LGUSBModemDriver_4.6_WHQL.zip&lt;/a&gt;&lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2011/03/lg-cdma-usb-modem-driver.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>11</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-8507826242680524980</guid><pubDate>Mon, 21 Feb 2011 17:11:00 +0000</pubDate><atom:updated>2011-02-21T12:11:17.852-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ant</category><category domain="http://www.blogger.com/atom/ns#">solutions</category><title>Class needed by SvnTask cannot be found</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;problem:&lt;/b&gt;&lt;br /&gt;
getting this error when trying to build:&lt;br /&gt;
&lt;br /&gt;
taskdef A class needed by class org.tigris.subversion.svnant.SvnTask cannot be found: org/tigris/subversion/svnclientadapter/SVNClientException&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;solution:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I didnt unzip all libs that came with svnant into my lib folder. Only unzipped svnant.jar. need to put them all in there.&lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2011/02/class-needed-by-svntask-cannot-be-found.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-6823252007773280377</guid><pubDate>Mon, 07 Feb 2011 04:05:00 +0000</pubDate><atom:updated>2011-02-21T11:54:06.693-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">how to</category><category domain="http://www.blogger.com/atom/ns#">tomcat</category><title>Multiple domains with tomcat behind apache</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;This is how you would host multiple domains/webapps on a single tomcat behind apache via mod-jk.&lt;br /&gt;
&lt;br /&gt;
first &lt;a href=&quot;http://notetodogself.blogspot.com/2011/02/linode-how-to-install-modjk-tomcat.html&quot;&gt;setup tomcat behind apache&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I am setting up a new domain called dogself.com:&lt;br /&gt;
&lt;br /&gt;
in &lt;i&gt;server.xml&lt;/i&gt; add this under last host:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&amp;lt;Host name=&quot;dogself.com&quot;  appBase=&quot;webapps-dogself&quot;
  unpackWARs=&quot;true&quot; autoDeploy=&quot;true&quot;
  xmlValidation=&quot;false&quot; xmlNamespaceAware=&quot;false&quot;&amp;gt;
&amp;lt;alias&amp;gt;www.dogself.com&amp;lt;alias&amp;gt;
&amp;lt;/Host&amp;gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;and also add another connector port:&lt;/pre&gt;&lt;pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&amp;lt;Connector port=&quot;8010&quot; protocol=&quot;AJP/1.3&quot; redirectPort=&quot;8443&quot; /&amp;gt; &lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;
create a &lt;i&gt;webapps-dogself&lt;/i&gt; directory next to &lt;i&gt;webapps &lt;/i&gt;and give it the same permissions&lt;br /&gt;
&lt;br /&gt;
in your virtualhost apache config:&lt;br /&gt;
&lt;pre&gt;ServerName dogself.com 
JkMount  /* dogself&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;in workers.properties add dogself worker to list:&lt;br /&gt;
&lt;pre&gt;worker.list=another,dogself

# Define dogself
worker.dogself.port=8010&lt;/pre&gt;&lt;pre&gt;worker.dogself.host=dogself.com
worker.dogself.type=ajp13&amp;nbsp;&lt;/pre&gt;&lt;br /&gt;
If you want the manager app to work on the domain you need to: &lt;br /&gt;
&lt;pre&gt;mkdir /etc/tomcat6/Catalina/dogself.com &lt;/pre&gt;&lt;br /&gt;
and copy the manager.xml into it from &lt;i&gt;/etc/tomcat6/Catalina/localhost&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
in &lt;i&gt;/var/lib/tomcat6&lt;/i&gt; create a &lt;i&gt;webapps-dogself&lt;/i&gt; dir and give it 0775 perms and chown it to tomcat:tomcat&lt;br /&gt;
&lt;br /&gt;
restart tomcat and apache&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Troubleshooting:&lt;/b&gt;&lt;br /&gt;
if you get error:&lt;br /&gt;
&lt;i&gt;worker dogself can&#39;t resolve tomcat address dogself.com&lt;/i&gt;&lt;br /&gt;
Check that your dns a/aaaa records point to your ip. Comment out the worker in workers.properties and see if you can get to the apache vhost. &lt;br /&gt;
&lt;br /&gt;
if any of the domains seems to point to another domain, ie the war that is running on one domain is incorrect. check if you are in the www.domain and if you have aliased the www both in tomcat and in apache. if you dont alias the www correctly tomcat will send you the the defaultDomain as defined in server.xml&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2011/02/multiple-domains-with-tomcat-behind.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-6477436830164866767</guid><pubDate>Fri, 04 Feb 2011 03:35:00 +0000</pubDate><atom:updated>2011-02-03T22:35:01.659-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">how to</category><category domain="http://www.blogger.com/atom/ns#">tomcat</category><title>Linode: how to install mod_jk, tomcat behind apache</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div&gt;This &quot;tutorial&quot; is for Ubuntu 10.04 LTS (Lucid).&lt;br /&gt;
This is how you would set up Tomcat6 behind Apache2 via mod_jk&lt;br /&gt;
&lt;br /&gt;
I am assuming that you have &lt;a href=&quot;http://library.linode.com/lamp-guides/ubuntu-10.04-lucid/&quot;&gt;apache2 installed&lt;/a&gt; and tomcat6 installed. I also assume you have deployed and can find your tomcat app possibly on port 8080 of your linode.&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Install mod_jk: &lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: separate; color: black; font-family: &#39;Times New Roman&#39;; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: helvetica,verdana,tahoma,arial,sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;pre class=&quot;literal-block&quot; style=&quot;background-color: #122312; border: 1px solid rgb(160, 160, 160); color: white; font-family: Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier New&#39;,monospace,serif; font-size: 12.5px; line-height: 15px; overflow: auto; padding: 10px;&quot;&gt;apt-get install libapache2-mod-jk&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Create workers.properties in &lt;i&gt;/etc/apache2/&lt;/i&gt; and add the following into it:&lt;pre&gt;# this lives in /etc/apache2/workers.properties
# workers.properties - ajp13
#
# List workers
worker.list=worker1

# Define worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;Edit your apache2 config in &lt;i&gt;/etc/apache2/apache2.conf&lt;/i&gt; and add this to the end:&lt;br /&gt;
&lt;pre&gt;# tomcat connector stuff:
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
JkShmFile     /var/log/apache2/mod_jk.shm
# Where to put jk logs
JkLogFile     /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel    info
# Select the timestamp log format
JkLogStampFormat &quot;[%a %b %d %H:%M:%S %Y] 
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;In your &lt;i&gt;/etc/apache2/sites-enabled/&lt;/i&gt; dir find the vhost you want to use tomcat and edit it, at the end of the vhost declaration put:&lt;br /&gt;
&lt;pre&gt;#Everything under root goes to tomcat
JkMount  /* worker1
#html files should be served by apache2
JkUnMount /*.html worker1
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Edit &lt;i&gt;/etc/tomcat6/server.xml&lt;/i&gt; and make sure that the ajp connector is uncommented:&lt;br /&gt;
&lt;pre&gt;&amp;lt;connector port=&quot;8009&quot; protocol=&quot;AJP/1.3&quot; redirectport=&quot;8443&quot; /&amp;gt;
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;restart tomcat: &lt;i&gt;/etc/init.d/tomcat6 restart&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;restart apache: &lt;i&gt;/etc/init.d/apache2 restart&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;navigate to yourdomain.com/ and you should be all tomcatted&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2011/02/linode-how-to-install-modjk-tomcat.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>10</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-2331870143146180346</guid><pubDate>Wed, 26 Jan 2011 16:14:00 +0000</pubDate><atom:updated>2011-01-26T11:14:13.459-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">how to</category><title>How to make your bed for engineers</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Being an engineer I am always looking for more efficient ways to do all manner of household tasks. &lt;br /&gt;
Making the bed has never been my strong point. My wife makes the bed faster than me, and it always looks better. I have long given up trying to figure out her technique, she probably just has many more years of experience than me. She is a principal bed maker while i am just a bed maker intern.&lt;br /&gt;
&lt;br /&gt;
Yesterday a friend of mine shared a bed making technique with me that has improved the tidiness and speed of bed making. I would like to share this technique with you!&lt;br /&gt;
&lt;br /&gt;
The secret to making large beds efficiently is to make the bed while you are in it! Being in the middle of the bed gives you maximum reach to both sides, where you can straighten out the covers. You no longer need to make several passes from one side of the bed to the other. After you get the bed looking nice, carefully roll out. Chances are that you will need just one more pass to fix the wrinkles in the covers.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><link>http://notetodogself.blogspot.com/2011/01/how-to-make-your-bed-for-engineers.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-4726917336245093059</guid><pubDate>Thu, 23 Dec 2010 22:18:00 +0000</pubDate><atom:updated>2010-12-23T17:18:18.438-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><title>after a request, page reloads 2 times and contains very little html</title><description>I just fixed a very strange issue in our application.&lt;br /&gt;
&lt;br /&gt;
It went something like this:&lt;br /&gt;
User would click on a link that opened another page. This page would flash for a second, then another page would open containing just the string &quot;2010&quot;.&lt;br /&gt;
&lt;br /&gt;
The bug came from QA as being a regression related to recent development, so i started debugging in the code. There was &lt;b&gt;nothing&lt;/b&gt; in the logs. &lt;br /&gt;
&lt;br /&gt;
Then i opened firebug, went into &quot;net&quot; mode and persisted it. I saw my original request made, along with headers, and then another request made, this one had no headers at all.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
document.write is evil. There was recently a change to the code which attempted to make the copyright year dynamic by replacing it with&lt;br /&gt;
&lt;i&gt;document.write(new Date().getFullYear());&lt;/i&gt;&lt;br /&gt;
inside of a script tag. This alone wouldn&#39;t cause the issue, but document.write only works correctly if its called when the page is being rendered. If the page is rendered, it will overwrite the entire page with whatever its writing out. The issue was the the page the user was going to next, was gotten via ajax, and thus the script was called &lt;b&gt;after &lt;/b&gt;the page was loaded, overwriting the entire page. &lt;br /&gt;
&lt;br /&gt;
Oh the glory of being a programmer.</description><link>http://notetodogself.blogspot.com/2010/12/after-request-page-reloads-2-times-and.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-3801247530116608246</guid><pubDate>Mon, 13 Dec 2010 18:20:00 +0000</pubDate><atom:updated>2010-12-13T13:20:46.430-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">linkage</category><title>batch script to delete cvs files</title><description>for /f &quot;tokens=*&quot; %%i in (&#39;dir /b/a/s CVS*&#39;) do @rmdir /q /s &quot;%%i&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
source: &lt;a href=&quot;http://www.danieltome.com/blog/2007/01/13/delete-cvs-files/&quot;&gt;http://www.danieltome.com/blog/2007/01/13/delete-cvs-files/&lt;/a&gt;</description><link>http://notetodogself.blogspot.com/2010/12/batch-script-to-delete-cvs-files.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-8350185307940606626</guid><pubDate>Sun, 05 Dec 2010 03:38:00 +0000</pubDate><atom:updated>2010-12-05T00:08:56.151-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">groovy</category><title>Convert map to object in groovy</title><description>You need to convert a map into an object in groovy. There must be a better way then iterating through the map and setting all the properties in the object via reflection or otherwise. There is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script class=&quot;brush: java&quot; type=&quot;syntaxhighlighter&quot;&gt;

def MyObject mapToObject(def map){
   new MyObject( map.findAll { k, v -&gt; k in MyObject.metaClass.properties*.name})
}

&lt;/script&gt;</description><link>http://notetodogself.blogspot.com/2010/12/convert-map-to-object-in-groovy.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20715940.post-5030544915883898306</guid><pubDate>Sun, 05 Dec 2010 03:34:00 +0000</pubDate><atom:updated>2010-12-04T22:35:13.015-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">how to</category><title>posting with syntaxhighlighter</title><description>I always forget the markup for posting syntax highlighted code. here it is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script class=&quot;brush: java&quot; type=&quot;syntaxhighlighter&quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
thank me later</description><link>http://notetodogself.blogspot.com/2010/12/posting-with-syntaxhighlighter.html</link><author>noreply@blogger.com (Mikhail Koryak)</author><thr:total>0</thr:total></item></channel></rss>