<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Johan Känngård &#187; Programming</title>
	<atom:link href="http://johankanngard.net/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://johankanngard.net</link>
	<description>Useful tips for developers</description>
	<lastBuildDate>Fri, 06 Aug 2010 13:49:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Log File Roller For Microsoft Windows</title>
		<link>http://johankanngard.net/2008/12/11/log-file-roller-for-microsoft-windows/</link>
		<comments>http://johankanngard.net/2008/12/11/log-file-roller-for-microsoft-windows/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 13:50:43 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[batch]]></category>

		<guid isPermaLink="false">http://johankanngard.net/?p=330</guid>
		<description><![CDATA[A simple log file roller, that rolls/rotates a file from FILENAME.0, to FILENAME.1, onwards to FILENAME.9. If FILENAME.9 exists, it is deleted. Can be used to keep log files small and managable, and delete old ones. The code is not pretty, I could not get it work with loops. If anyone has a better way [...]]]></description>
			<content:encoded><![CDATA[<p>
A simple log file roller, that rolls/rotates a file from FILENAME.0, to FILENAME.1, onwards to FILENAME.9. If FILENAME.9 exists, it is deleted. Can be used to keep log files small and managable, and delete old ones. The code is not pretty, I could not get it work with loops. If anyone has a better way of doing this, please let me know! :-)
</p>
<p>Usage:<br />
<code><br />
rollLog LOGDIRECTORY LOGFILENAME<br />
</code><br />
For instance, if you have a log at c:\log\at.log, you can run:<br />
<code><br />
rollLog c:\logs at.log<br />
</code></p>
<p>
Afterwards, you have one file named c:\logs\at.log.0. The next time you run it (and there has been something written to at.log) you get two files, at.log.0 and at.log.1.
</p>
<p>
The <a href='http://johankanngard.net/wp-content/uploads/2008/12/rolllog.cmd'>rollLog.cmd file is here</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2008/12/11/log-file-roller-for-microsoft-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Combobox using Autocompleter.Local from Script.aculo.us</title>
		<link>http://johankanngard.net/2008/10/08/simple-combobox-using-autocompleterlocal-from-scriptaculous/</link>
		<comments>http://johankanngard.net/2008/10/08/simple-combobox-using-autocompleterlocal-from-scriptaculous/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 13:19:20 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[Script.aculo.us]]></category>

		<guid isPermaLink="false">http://johankanngard.net/?p=302</guid>
		<description><![CDATA[The Autocompleter.Local in the Script.aculo.us Prototype-addon is quite nice. It can be used to get type-ahead into a field if you have a local JavaScript Array. I wanted to extend the functionality to have it behave as a Combobox, which is like a Select with a text input field. Here is how I did it, [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://github.com/madrobby/scriptaculous/wikis/autocompleter-local">Autocompleter.Local</a> in the <a href="http://script.aculo.us/">Script.aculo.us</a> <a href="http://www.prototypejs.org">Prototype</a>-addon is quite nice. It can be used to get type-ahead into a field if you have a local JavaScript Array. I wanted to extend the functionality to have it behave as a Combobox, which is like a Select with a text input field. Here is how I did it, be advised it has some bugs, let me know if you have a better solution!<br />
<code><br />
var Combobox={};<br />
Combobox.Local=Class.create(Autocompleter.Local,{<br />
	initialize:function($super,element,update,array,options){<br />
		$super(element,update,array,options);<br />
		this.options.minChars=this.options.minChars||0;<br />
		Event.observe(this.element,'click',this.onClick.bindAsEventListener(this));<br />
	},<br />
	onClick:function($super,event){<br />
		if(Event.element(event).id){<br />
			if(this.active){<br />
				this.hasFocus=false;<br />
				this.active=false;<br />
				this.hide();<br />
			}else{<br />
				this.activate();<br />
				this.render();<br />
			}<br />
			return;<br />
		}<br />
		$super(event);<br />
  }<br />
});<br />
</code><br />
The CSS I use is a modified variant of the <a href="http://github.com/madrobby/scriptaculous/wikis/autocompleter-local">Autocompleter.Local wiki page</a>:<br />
<code><br />
.combo {<br />
	background-image:url(combo_select2.gif);<br />
	background-repeat:no-repeat;<br />
	background-position:right top;<br />
	margin-right:10px;<br />
}</p>
<p>.combo:hover {<br />
	background-image:url(combo_select2.gif);<br />
	background-repeat:no-repeat;<br />
	background-position:right -18px;<br />
}</p>
<p>div#autocomplete {<br />
	margin:0px;<br />
	padding:0px;<br />
	width:250px;<br />
	background:#fff;<br />
	border:1px solid #888;<br />
	position:absolute;<br />
}</p>
<p>div#autocomplete ul {<br />
	margin:0px;<br />
	padding:0px;<br />
	list-style-type:none;<br />
}</p>
<p>div#autocomplete ul li.selected {<br />
	background-color:#ffb;<br />
}</p>
<p>div#autocomplete ul li {<br />
	margin:0;<br />
	padding:2px;<br />
	height:12px;<br />
	display:block;<br />
	list-style-type:none;<br />
	cursor:pointer;<br />
}<br />
</code><br />
Usage:<br />
<code><br />
new Combobox.Local('textFieldID','outputDivID',array,options);<br />
</code><br />
Example JavaScript:<br />
<code><br />
var cities=new Array('Stockholm','Göteborg','Kiruna');<br />
new Combobox.Local(<br />
	'cityField',<br />
	'autocomplete',<br />
	cities,<br />
	{<br />
		partialSearch:true,<br />
		fullSearch:true,<br />
		partialChars:0,<br />
		minChars:0<br />
	}<br />
);<br />
</code><br />
Example HTML:<br />
<code></p>
<input type="text" id="cityField">
<div id="autocomplete"></div>
<p></code><br />
The Windows XP style combobox image referenced in the CSS can be found here:<br />
<img src="http://johankanngard.net/wp-content/uploads/2008/10/combo_select2.gif"></p>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2008/10/08/simple-combobox-using-autocompleterlocal-from-scriptaculous/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>lotus.com/ldd no more :-(</title>
		<link>http://johankanngard.net/2008/09/04/lotuscomldd-no-more/</link>
		<comments>http://johankanngard.net/2008/09/04/lotuscomldd-no-more/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 10:50:23 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[Domino/Notes]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[Lotus]]></category>

		<guid isPermaLink="false">http://johankanngard.net/?p=298</guid>
		<description><![CDATA[IBM has removed the old redirect for the Lotus Developer Domain, I only get to Lotus Software using that old URL. Now is time to remember this: http://www.ibm.com/developerworks/lotus]]></description>
			<content:encoded><![CDATA[<p>
IBM has removed the old redirect for the <a href="http://lotus.com/ldd">Lotus Developer Domain</a>, I only get to Lotus Software using that old URL. Now is time to remember this: <a href="http://www.ibm.com/developerworks/lotus">http://www.ibm.com/developerworks/lotus</a></p>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2008/09/04/lotuscomldd-no-more/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>HOWTO Use Lotus Notes, Domino Designer and Domino Administrator 8.01 on Ubuntu 8.04 via Wine 1.0.0</title>
		<link>http://johankanngard.net/2008/09/01/howto-use-lotus-notes-domino-designer-and-domino-administrator-801-on-ubuntu-804-via-wine-100/</link>
		<comments>http://johankanngard.net/2008/09/01/howto-use-lotus-notes-domino-designer-and-domino-administrator-801-on-ubuntu-804-via-wine-100/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 20:09:28 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[Domino/Notes]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Lotus Notes]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Wine]]></category>

		<guid isPermaLink="false">http://johankanngard.net/?p=294</guid>
		<description><![CDATA[I just followed Julian&#8217;s excellent guide and it worked! Even though the guide was for previous versions of both Notes, Ubuntu and Wine, I did not have to make any additional steps to get it working. All programs works, I haven&#8217;t found anything that is broken (yet), and it&#8217;s great having the Designer &#8220;directly&#8221; in [...]]]></description>
			<content:encoded><![CDATA[<p>I just followed <a href="http://www.nsftools.com/tips/UseNotesWithWine.htm">Julian&#8217;s excellent guide</a> and it worked! Even though the guide was for previous versions of both Notes, Ubuntu and Wine, I did not have to make any additional steps to get it working. All programs works, I haven&#8217;t found anything that is broken (yet), and it&#8217;s great having the Designer &#8220;directly&#8221; in Ubuntu instead of firing up  <a href="http://www.virtualbox.org/">VirtualBox</a>.</p>
<p>Thanks Julian, for your excellent guide!</p>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2008/09/01/howto-use-lotus-notes-domino-designer-and-domino-administrator-801-on-ubuntu-804-via-wine-100/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL Commands Cheat Sheet</title>
		<link>http://johankanngard.net/2008/07/31/mysql-commands-cheat-sheet/</link>
		<comments>http://johankanngard.net/2008/07/31/mysql-commands-cheat-sheet/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 12:03:48 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://johankanngard.net/?p=255</guid>
		<description><![CDATA[Another memory-dump. The manual contains more information (that&#8217;s a surprise :-). mysql> delete from TABLE where id=X Removes the specified row mysql> describe TABLE; Shows the structure of the specified table mysql> select * from TABLE; Shows all rows in the specified table :-O mysql> show procedure status; Shows stored procedures mysql> show table status; [...]]]></description>
			<content:encoded><![CDATA[<p>
Another memory-dump. The <a href="http://dev.mysql.com/doc/#manual">manual</a> contains more information (that&#8217;s a surprise :-).
</p>
<dl>
<dt>mysql> delete from TABLE where id=X</dt>
<dd>Removes the specified row</dd>
<dt>mysql> describe TABLE;</dt>
<dd>Shows the structure of the specified table</dd>
<dt>mysql> select * from TABLE;</dt>
<dd>Shows all rows in the specified table :-O</dd>
<dt>mysql> show procedure status;</dt>
<dd>Shows stored procedures</dd>
<dt>mysql> show table status;</dt>
<dd>Shows tables in current database</dd>
<dt>mysql> use MYDATABASE;</dt>
<dd>Changes the database to act on</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2008/07/31/mysql-commands-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO: Install Lotus Domino 7.0.2 on Ubuntu 8.0.4</title>
		<link>http://johankanngard.net/2008/07/16/howto-install-lotus-domino-702-on-ubuntu-804/</link>
		<comments>http://johankanngard.net/2008/07/16/howto-install-lotus-domino-702-on-ubuntu-804/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 09:05:23 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[Domino/Notes]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Domino]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Lotus]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://johankanngard.net/?p=196</guid>
		<description><![CDATA[This minimalistic guide shows how to install Domino 7.0.2 on Ubuntu 8.0.4 server or workstation. I did this on Ubuntu 7, but did not write everything down, which meant learning/searching for the information once more. Please let me know if you have better ways of doing this! Create a domino user and group $ sudo [...]]]></description>
			<content:encoded><![CDATA[<p>
This minimalistic guide shows how to install Domino 7.0.2 on Ubuntu 8.0.4 server or workstation. I did this on Ubuntu 7, but did not write everything down, which meant learning/searching for the information once more. Please let me know if you have better ways of doing this!
</p>
<p><h2>Create a domino user and group</h2>
<p><code><br />
$ sudo useradd -m domino<br />
$ sudo groupadd domino<br />
$ sudo passwd domino<br />
</code></p>
<h2>Add required libraries</h2>
</p>
<p>
Domino uses some libraries that is not installed by the standard Ubuntu installation.
</p>
<p><code><br />
$ sudo apt-get install libstdc++5<br />
$ sudo apt-get install libxmu6<br />
$ sudo apt-get install libxp6<br />
$ sudo apt-get install libxp-java<br />
$ sudo apt-get install libxtst6<br />
</code></p>
<h2>Install</h2>
<p>
Unpack the installation file (my is named S7.0.2.tar) and run the linux/domino/install script as root. Use default settings (except user, enter domino), use &#8220;Manual setup&#8221;.
</p>
<p><code><br />
$ tar -xvf S7.0.2.tar<br />
$ cd S7.0.2/linux/domino<br />
$ sudo install<br />
</code></p>
<h2>Change ownerships on files</h2>
<p>
Since you installed as root, the files is owned by root. I guess if install was run as the domino user, this step would not be required.
</p>
<p><code><br />
$ sudo chown -R domino /local/notesdata<br />
$ sudo chgrp -R domino /local/notesdata<br />
$ sudo chown -R domino /opt/ibm<br />
$ sudo chgrp -R domino /opt/ibm<br />
</code></p>
<h2>Firewall</h2>
<p>
Stop your local firewall or open 1352 in the local firewall. If you are using shorewall, you can do your own Notes macro. Change the port from 80 to 1352 in the macro.Notes file.
</p>
<p><code><br />
$ sudo cp /usr/share/shorewall/macro.HTTP /usr/share/shorewall/macro.Notes<br />
$ sudo gedit /usr/share/shorewall/macro.Notes<br />
</code></p>
<p>
Add the following (depending on setup&#8230;) to /etc/shorewall/rules:
</p>
<p><code><br />
Notes/ACCEPT	net		$FW<br />
</code></p>
<h2>Conflicting services</h2>
<p>Stop any mail, web, ldap services, so that Domino does not conflict on ports. Remember to disable those you don&#8217;t need or disable the Domino services that you don&#8217;t need.<br />
<code><br />
$ sudo /etc/init.d/postfix stop<br />
$ sudo /etc/init.d/courier-imap stop<br />
$ sudo /etc/init.d/courier-imap-ssl stop<br />
</code></p>
<h2>Relink sh</h2>
<p>
The server script uses /bin/sh, relink sh to bash that normally links to /bin/dash.
</p>
<p><code><br />
$ sudo rm /bin/sh<br />
$ sudo ln -s /bin/bash /bin/sh<br />
</code></p>
<h2>nsd.sh</h2>
<p>I got many &#8220;Command not found&#8221; errors when starting the server first time. After some research, I found that the script requires gawk in sd.sh:<br />
<code><br />
$ sudo apt-get install gawk<br />
</code></p>
<h2>Start the server setup listener</h2>
<p><code><br />
$ su notes<br />
$ DISPLAY=:0.0<br />
$ export DISPLAY<br />
$ cd /local/notesdata<br />
$ /opt/ibm/lotus/bin/server -listen<br />
</code></p>
<p>
If you want to add a server with existing IDs, put the certifier ID, the server ID and the admin ID in the notesdata directory on the server. Run the Remote Server Setup utility on a client. Usually in Start\Lotus Applications\Remote Server Setup. Configure as a normal setup.
</p>
<h2>Server startup script</h2>
<p>
To be able to start Domino on startup, restart it and shutdown when system restarts, you can <a href="http://johankanngard.net/wp-content/uploads/2008/07/domino">download domino init.d-script</a> and put in /etc/init.d. Restart the server to see if it works.
</p>
<p><code><br />
$ cd /etc/init.d<br />
$ sudo wget http://johankanngard.net/wp-content/uploads/2008/07/domino<br />
$ sudo chmod +x domino<br />
$ sudo chown domino domino<br />
$ sudo chgrp domino domino<br />
$ sudo update-rc.d domino defaults<br />
$ sudo shutdown -r now<br />
</code></p>
<h2>Test</h2>
<p>
Use a Notes client and test that the server is up and running. To see if the server is running on the server, you use telnet.
</p>
<p><code><br />
$ ps a | grep server<br />
4505 pts/0    Ss+    0:00 su - domino -c /opt/ibm/lotus/bin/server<br />
</code></p>
<p>
You can also try connecting to the server locally with telnet using:
</p>
<p><code><br />
$ telnet localhost 1352<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is \\\\\\\\\\\\\\\'^]\\\\\\\\\\\\\\\'.<br />
</code></p>
<h2>Some links of interest</h2>
<ul>
<li><a href="http://www.nashcom.de/nshweb/pages/startscript.htm">Domino on Unix/Linux Start Script</a></li>
<li><a href="http://www.windelen.be/windelen/wwwindelen.nsf/(All)/AA5357E00F220729C125704A0040CBB8">Migrate Domino to Linux</a></li>
<li><a href="http://www.dominopower.com/issues/issue200010/linux1000001.html">Installing Lotus Domino on Linux</a></li>
</ul>
<p><ins datetime="2008-07-19T12:23:42+00:00"><br />
Updated the startup script since the stop argument wasn&#8217;t working.<br />
</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2008/07/16/howto-install-lotus-domino-702-on-ubuntu-804/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Full and incremental dump of a Subversion repository from a Windows BAT file</title>
		<link>http://johankanngard.net/2008/05/23/full-dump-of-a-subversion-repository-from-a-windows-bat-file/</link>
		<comments>http://johankanngard.net/2008/05/23/full-dump-of-a-subversion-repository-from-a-windows-bat-file/#comments</comments>
		<pubDate>Fri, 23 May 2008 13:47:43 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://johankanngard.net/2008/05/23/full-dump-of-a-subversion-repository-from-a-windows-bat-file/</guid>
		<description><![CDATA[The first is something you should do weekly on your Subversion repository &#8211; a full dump. Put the following in a BAT or CMD file on a Windows box, and run it scheduled. @echo off REM Creates a full dump of the repository, should be run weekly for /f \"tokens=1-4 delims=- \" %%a in (\'date [...]]]></description>
			<content:encoded><![CDATA[<p>The first is something you should do weekly on your <a href="http://subversion.tigris.org">Subversion</a> repository &#8211; a full dump. Put the following in a BAT or CMD file on a Windows box, and run it scheduled.</p>
<p><code><br />
@echo off<br />
REM Creates a full dump of the repository, should be run weekly</p>
<p>for /f \"tokens=1-4 delims=- \" %%a in (\'date /T\') do set year=%%a<br />
for /f \"tokens=1-4 delims=- \" %%a in (\'date /T\') do set month=%%b<br />
for /f \"tokens=1-4 delims=- \" %%a in (\'date /T\') do set day=%%c<br />
for /f \"tokens=1-2 delims=: \" %%a in (\'time /T\') do set hour=%%a<br />
for /f \"tokens=1-2 delims=: \" %%a in (\'time /T\') do set minute=%%b<br />
set TODAY=%year%%month%%day%<br />
set NOW=%hour%%minute%</p>
<p>for /F \"tokens=1 \" %%i IN (\'svnlook youngest c:\\repository\') do call set YOUNGEST=%%i<br />
echo %YOUNGEST% > c:\\backup\\repository\\latestRev.dat<br />
svnadmin dump c:\\repository > c:\\backup\\repository\\svndump_full_rev%YOUNGEST%.%TODAY%%NOW%<br />
</code><br />
The above example makes a dump to c:\backup\repository of your repository at c:\repository named with the most recent revision and todays date and time.<br />
The example below creates incremental dumps using the latestRev.dat file to store the latest revision that was dumped.<br />
<code><br />
	@echo off<br />
	REM Creates a partial dump with all revisions since last full dump, should be run daily</p>
<p>	for /f \"tokens=1-4 delims=- \" %%a in (\'date /T\') do set year=%%a<br />
	for /f \"tokens=1-4 delims=- \" %%a in (\'date /T\') do set month=%%b<br />
	for /f \"tokens=1-4 delims=- \" %%a in (\'date /T\') do set day=%%c<br />
	for /f \"tokens=1-2 delims=: \" %%a in (\'time /T\') do set hour=%%a<br />
	for /f \"tokens=1-2 delims=: \" %%a in (\'time /T\') do set minute=%%b<br />
	set TODAY=%year%%month%%day%<br />
	set NOW=%hour%%minute%</p>
<p>	for /F \"tokens=1 \" %%i in (\'svnlook youngest c:\\repository\') do call set YOUNGEST=%%i<br />
	set PREVIOUS=0<br />
	if not exist c:\\backup\\repository\\latestRev.dat goto nolatestrev</p>
<p>	for /F \"tokens=1 \" %%i in (c:\\backup\\repository\\latestRev.dat) do call set PREVIOUS=%%i</p>
<p>:nolatestrev:<br />
	if %YOUNGEST% == %PREVIOUS% goto noupdate</p>
<p>	echo %YOUNGEST% > c:\\backup\\repository\\latestRev.dat</p>
<p>	svnadmin dump -r %PREVIOUS%:%YOUNGEST% c:\\repository > c:\\backup\\repository\\svndump_incremental_rev%PREVIOUS%to%YOUNGEST%.%TODAY%%NOW%<br />
	goto finally</p>
<p>:noupdate<br />
	echo No dump needed<br />
:finally<br />
</code><br />
I&#8217;m no Windows batch file pro, but I got this working anyway with some help from <a href="http://www.google.com">Google</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2008/05/23/full-dump-of-a-subversion-repository-from-a-windows-bat-file/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Post &#8220;Java versions in Lotus Domino and Notes&#8221; updated</title>
		<link>http://johankanngard.net/2007/12/04/post-java-versions-in-lotus-domino-and-notes-updated/</link>
		<comments>http://johankanngard.net/2007/12/04/post-java-versions-in-lotus-domino-and-notes-updated/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 12:43:55 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[Domino/Notes]]></category>

		<guid isPermaLink="false">http://johankanngard.net/2007/12/04/post-java-versions-in-lotus-domino-and-notes-updated/</guid>
		<description><![CDATA[I&#8217;ve added 8.0 to the list.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added 8.0 to <a href="http://johankanngard.net/2006/02/09/java-versions-in-lotus-domino-and-notes/">the list</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2007/12/04/post-java-versions-in-lotus-domino-and-notes-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add your own indexOf in the JavaScript Array object</title>
		<link>http://johankanngard.net/2007/10/31/add-your-own-indexof-in-the-javascript-array-object/</link>
		<comments>http://johankanngard.net/2007/10/31/add-your-own-indexof-in-the-javascript-array-object/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 13:16:45 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://johankanngard.net/2007/10/31/add-your-own-indexof-in-the-javascript-array-object/</guid>
		<description><![CDATA[Internet Explorer does not have an indexOf method in the Array object. Here is how you can add your own: if(!Array.indexOf){ Array.prototype.indexOf=function(o){ for(var i=0;i]]></description>
			<content:encoded><![CDATA[<p>Internet Explorer does not have an indexOf method in the Array object. Here is how you can add your own:<br />
<code><br />
if(!Array.indexOf){<br />
	Array.prototype.indexOf=function(o){<br />
		for(var i=0;i
<this .length;i++)<br />
			if(this[i]==o) return i;<br />
		return -1;<br />
	}<br />
}<br />
</code><br />
Use it like this:<br />
<code><br />
var a=new Array(\'aaa\',\'bbb\',\'ccc\');<br />
alert(a.indexOf(\'bbb\')); // Shows 1 as it is the index of \'bbb\' in the a Array.<br />
alert(a.indexOf(\'b\')); // Shows -1 since \'b\' is not a member of the a Array.<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2007/10/31/add-your-own-indexof-in-the-javascript-array-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 5 Stored Procedures Cheat Sheet</title>
		<link>http://johankanngard.net/2007/07/05/mysql-5-stored-procedures-cheat-sheet/</link>
		<comments>http://johankanngard.net/2007/07/05/mysql-5-stored-procedures-cheat-sheet/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 10:37:57 +0000</pubDate>
		<dc:creator>Johan Känngård</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://johankanngard.net/2007/07/05/mysql-5-stored-procedures-cheat-sheet/</guid>
		<description><![CDATA[I will add more when I stumble upon commands I can&#8217;t remember the syntax of. To list all stored procedures: mysql> SHOW PROCEDURE STATUS; Example output (with cropped dates and times for readable table): Db Name Type Definer Modified Created Security_type Comment mydb store_user PROCEDURE root 2007-0.. 2007-0.. DEFINER mydb store_cart PROCEDURE root 2007-0.. 2007-0.. [...]]]></description>
			<content:encoded><![CDATA[<p>
I will add more when I stumble upon commands I can&#8217;t remember the syntax of.
</p>
<h2>To list all stored procedures:</h2>
<p><code><br />
mysql> SHOW PROCEDURE STATUS;<br />
</code><br />
Example output (with cropped dates and times for readable table):</p>
<table>
<thead>
<tr>
<th>Db</th>
<th>Name</th>
<th>Type</th>
<th>Definer</th>
<th>Modified</th>
<th>Created</th>
<th>Security_type</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>mydb</td>
<td>store_user</td>
<td>PROCEDURE</td>
<td>root</td>
<td>2007-0..</td>
<td>2007-0..</td>
<td>DEFINER</td>
<td></td>
</tr>
<tr>
<td>mydb</td>
<td>store_cart</td>
<td>PROCEDURE</td>
<td>root</td>
<td>2007-0..</td>
<td>2007-0..</td>
<td>DEFINER</td>
<td></td>
</tr>
<tr>
<td>mydb</td>
<td>store_settings</td>
<td>PROCEDURE</td>
<td>root</td>
<td>2007-0..</td>
<td>2007-0..</td>
<td>DEFINER</td>
<td></td>
</tr>
</tbody>
</table>
<p><script type="text/javascript"><!--
google_ad_client = "pub-8220767383302774";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "CCCCCC";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_url = "666666";
google_color_text = "333333";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<span id="more-134"></span></p>
<h2>To create a new procedure</h2>
<p><code><br />
mysql> DELIMITER $$<br />
mysql> CREATE PROCEDURE adduser(IN username VARCHAR(32), IN emailaddress VARCHAR(32))<br />
BEGIN<br />
	INSERT INTO users VALUES (username, emailaddress);<br />
END<br />
$$<br />
</code></p>
<h2>To show a stored procedure</h2>
<p><code><br />
mysql> SHOW CREATE PROCEDURE `userdb`.`adduser`\\\\G<br />
</code><br />
Example output:<br />
<code><br />
*************************** 1. row ***************************<br />
       Procedure: adduser<br />
        sql_mode:<br />
Create Procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `adduser`(IN username varchar(32), IN emailaddress(32))<br />
BEGIN<br />
	INSERT INTO users VALUES (username, emailaddress);<br />
END<br />
1 row in set (0.00 sec)<br />
</code></p>
<h2>To call a stored procedure from Java</h2>
<p><code><br />
Connection con = DriverManager.getConnection(url, user, password);<br />
CallableStatement statement = con.prepareCall(\\\"{call userdb.adduser(?, ?)}\\\");<br />
int i = 0;<br />
statement.setString(i++, \\\"myuser\\\");<br />
statement.setString(i++, \\\"myuser@spammealot.com\\\");<br />
statement.execute();<br />
</code><br />
For this to work you must give the user SELECT privilege to the proc table in the MySQL database, where the stored procedures are stored. Do it like this:<br />
<code><br />
GRANT SELECT ON `mysql`.`proc` TO \\\'mysqluser\\\'@\\\'myhost\\\';<br />
</code><br />
<ins datetime="2008-07-31T12:04:20+00:00">For a list of more commands, see my <a href="http://johankanngard.net/2008/07/31/mysql-commands-cheat-sheet/">MySQL Commands Cheat Sheet</a>.</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://johankanngard.net/2007/07/05/mysql-5-stored-procedures-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
