<?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>Pieces of Life... &#187; Technology</title>
	<atom:link href="http://www.bogdanirimia.ro/category/technology/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bogdanirimia.ro</link>
	<description>Bogdan Irimia&#039;s Web Space</description>
	<lastBuildDate>Fri, 18 Mar 2011 20:11:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Symbolic links on Samba server working from Mac OS X</title>
		<link>http://www.bogdanirimia.ro/symbolic-links-on-samba-server-working-from-mac-os-x/274</link>
		<comments>http://www.bogdanirimia.ro/symbolic-links-on-samba-server-working-from-mac-os-x/274#comments</comments>
		<pubDate>Fri, 18 Mar 2011 18:24:39 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Server administration]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[symbolic]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=274</guid>
		<description><![CDATA[I am reevaluating my decision of becoming an Apple fan or not&#8230; And I tend towards becoming one. Just because of the excellent marketing and the excellent hardware! But the software isn&#8217;t that bad either! Mac OS X, once you get a bit used to it, might become your favorite OS! Of course, it has [...]]]></description>
			<content:encoded><![CDATA[<p>I am reevaluating my decision of becoming an Apple fan or not&#8230; And I tend towards becoming one. Just because of the excellent marketing and the excellent hardware! But the software isn&#8217;t that bad either!</p>
<p>Mac OS X, once you get a bit used to it, might become your favorite OS! Of course, it has its oddities, but&#8230; we all do! <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now&#8230; one of Mac OS X&#8217;s oddities is the fact that the Samba protocol implementation isn&#8217;t so brilliant. I have an Ubuntu box on which I run a Samba server. I have a shared folder, and in it I have created a symbolic link. When connecting from Mac OS X to that folder, the symbolic link can&#8217;t be followed (it appears to be a shortcut file, and when clicked, pops an error with the option to fix the link, but with no success either). From Windows, it worked fine.</p>
<p>The solution to this symbolic link issue was to add in the &#8220;general&#8221; group of the Samba server configuration file the following line:</p>
<p><code>unix extensions = off</code></p>
<p>My Samba configuration file is &#8220;/etc/samba/smb.conf&#8221;. I then restarted the Samba server and reconnected from Mac OS X, and it worked! It also works from Windows too <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/symbolic-links-on-samba-server-working-from-mac-os-x/274/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Strange routing issue, solved</title>
		<link>http://www.bogdanirimia.ro/strange-routing-issue-solved/272</link>
		<comments>http://www.bogdanirimia.ro/strange-routing-issue-solved/272#comments</comments>
		<pubDate>Wed, 29 Sep 2010 10:49:11 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Server administration]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[priority]]></category>
		<category><![CDATA[routes]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=272</guid>
		<description><![CDATA[I just encountered this problem: I have an Ubuntu box, on which ran this downloading service. Because some complaints from the Internet provider, I decided to use another network (from another provider) for this downloading service. Everything else needed to remain the same. So I installed a new network card on the system, and it [...]]]></description>
			<content:encoded><![CDATA[<p>I just encountered this problem: I have an Ubuntu box, on which ran this downloading service. Because some complaints from the Internet provider, I decided to use another network (from another provider) for this downloading service. Everything else needed to remain the same.</p>
<p>So I installed a new network card on the system, and it became <span style="font-family: book antiqua,palatino;">eth1</span>. The first one, <span style="font-family: book antiqua,palatino;">eth0</span>, was connected to network <span style="font-family: book antiqua,palatino;">192.168.2.0</span>. Now, I connected<span style="font-family: book antiqua,palatino;"> eth1</span> to network <span style="font-family: book antiqua,palatino;">192.168.1.0</span>. Both networks provides DHCP.</p>
<p>The first issue was when I configured both NICs with DHCP. No outside access was available on the box because there were two default gateways. So I configured <span style="font-family: book antiqua,palatino;">eth1 </span>as static, and didn&#8217;t specify any default gateway for it. But this rendered the internet connection through <span style="font-family: book antiqua,palatino;">eth1 </span>useless, because all the traffic (for the outside world) was routed through <span style="font-family: book antiqua,palatino;">eth0 </span>now. So when the downloading service was bound to <span style="font-family: book antiqua,palatino;">eth1</span>, it couldn&#8217;t connect anywhere outside the network.</p>
<p>After some searching effort on the Internet, I found this solution:</p>
<p>- <span style="font-family: book antiqua,palatino;">/etc/network/interfaces</span>:</p>
<pre class="brush: bash; title: ; notranslate">

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

# The secondary network interface
auto eth1
iface eth1 inet static
address 192.168.1.2
netmask 255.255.255.0

up /etc/network/prioritize_networks.sh
</pre>
<p>- <span style="font-family: book antiqua,palatino;">/etc/network/prioritize_networks.sh</span>:</p>
<pre class="brush: bash; title: ; notranslate">

#!/bin/sh

#Set up the first subnet's routing table (we'll name it 70)
ip route flush table 70
ip route add table 70 to 192.168.2.0/24 dev eth0
ip route add table 70 to default via 192.168.2.1 dev eth0

#Set up the second subnet's routing table (we'll call it 80)
ip route flush table 80
ip route add table 80 to 192.168.1.0/24 dev eth1
ip route add table 80 to default via 192.168.1.1 dev eth1

#Create the rules to choose what table to use. Choose based on source IP
#We need to give the rules different priorities; for convenience name priority
#after the table
ip rule add from 192.168.2.0/24 table 70 priority 70
ip rule add from 192.168.1.0/24 table 80 priority 80

#Flush the cache to make effective
ip route flush cache
</pre>
<p>So now all the traffic goes by default through <span style="font-family: book antiqua,palatino;">eth0</span>, but all applications bound to <span style="font-family: book antiqua,palatino;">eth1 </span>are routed through the correct gateway of <span style="font-family: book antiqua,palatino;">192.168.1.0</span> network.</p>
<p>I found this hack here: <a href="http://www.physics.umd.edu/pnce/pcs-docs/Glue/linux-route-hack.html" target="_blank">http://www.physics.umd.edu/pnce/pcs-docs/Glue/linux-route-hack.html</a></p>
<p>Hope this help anybody.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/strange-routing-issue-solved/272/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android widget, click event, multiple instances</title>
		<link>http://www.bogdanirimia.ro/android-widget-click-event-multiple-instances/269</link>
		<comments>http://www.bogdanirimia.ro/android-widget-click-event-multiple-instances/269#comments</comments>
		<pubDate>Fri, 09 Jul 2010 13:03:42 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[instances]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=269</guid>
		<description><![CDATA[Ok&#8230; I started to do some Android devel&#8230; And I started to like it, even if it is based on Java, works in Eclipse and has a ton of classes. Now, the first project is a widget (weather widget). For this, there&#8217;s this &#8220;AppWidgetProvider&#8221; class that implements the design and functions for data retrieval (using [...]]]></description>
			<content:encoded><![CDATA[<p>Ok&#8230; I started to do some Android devel&#8230; And I started to like it, even if it is based on Java, works in Eclipse and has a ton of classes.</p>
<p>Now, the first project is a widget (weather widget). For this, there&#8217;s this &#8220;AppWidgetProvider&#8221; class that implements the design and functions for data retrieval (using threads), and also a configuration Activity. When the configuration activity finishes (a &#8220;Save&#8221; button is pressed), a static function of the AppWidgetProvider class is called. This static function updates the settings of the widget and also does something of interest: it sets the event handler for &#8220;onClick&#8221; &#8211; so that when I click (touch) the widget, to be able to modify the layout somehow (to rotate a needle).</p>
<p>This is a part of the static function that updates the widget:</p>
<pre class="brush: java; title: ; notranslate">
...
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
Intent clickIntent = new Intent(context, DigiStation.class);
clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, appWidgetId, clickIntent, 0);
views.setOnClickPendingIntent(R.id.widget_normal_relativelayout, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, views);
...
</pre>
<p>The AppWidgetProvider class is called &#8220;DigiStation&#8221; &#8211; we&#8217;re using it for creating an intent that targets it.</p>
<p>Ok. For handling the events, the DigiStation class (which is of type AppWidgetProvider) implements the function &#8220;onReceive&#8221;. The function is called with two parameters: the context and the intent.</p>
<p>Now, the issue was to be able to distinguish between multiple instances of the same AppWidgetProvider class. To be able to do that, I had to put some extra information in the intent (clickIntent.putExtra). The field contains the appWidgetId &#8211; the widget ID &#8211; of the instance.</p>
<p>The onReceive function looks like this:</p>
<pre class="brush: java; title: ; notranslate">
@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction()==null) {
        Bundle extras = intent.getExtras();
        if(extras!=null) {
            int widgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
            // do something for the widget that has appWidgetId = widgetId
        }
    }
    else {
        super.onReceive(context, intent);
    }
 }
</pre>
<p>All looks simple enough, but there are some little details that I must underline, because I spend a few days with them:</p>
<p style="text-align: left;">1. To be able to distinguish between multiple instances of the same AppWidgetProvider, when registering the &#8220;onClick&#8221; event (intent) you must add an extra value with the widget ID (appWidgetId)</p>
<p style="text-align: left;">2. Update only the views of the current instance! &#8211; appWidgetManager.updateAppWidget(appWidgetId, views);</p>
<p style="text-align: left;">3. <strong>Android reuses intents, so when you create an intent, make sure you put an unique ID, or else the same intent used before will be triggered for all instances! </strong> Only with this detail I spent half a day! ( PendingIntent pendingIntent = PendingIntent.getBroadcast(context, <strong>appWidgetId</strong>, clickIntent, 0); )</p>
<p style="text-align: left;">4. When handling the click event, get the appWidgetId from the &#8220;extras&#8221; payload of the intent.</p>
<p>Hope this helps people not spending so much time for little undocumented details! <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/android-widget-click-event-multiple-instances/269/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>New WordPress 3.0</title>
		<link>http://www.bogdanirimia.ro/new-wordpress-3-0/267</link>
		<comments>http://www.bogdanirimia.ro/new-wordpress-3-0/267#comments</comments>
		<pubDate>Mon, 21 Jun 2010 09:36:52 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=267</guid>
		<description><![CDATA[It seems that the long-awaited WordPress 3.0 is out and it also seems to have some new features that, in my opinion, brings WordPress closer to what a real CMS should be. I worked quite a lot with Drupal and now I consider WordPress to be a good alternative for all those projects. The most [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that the long-awaited WordPress 3.0 is out and it also seems to have some new features that, in my opinion, brings WordPress closer to what a real CMS should be. I worked quite a lot with Drupal and now I consider WordPress to be a good alternative for all those projects.<br />
The most important feature I consider to be the new custom post type functionality, that should open up great ways for customization. Before, I had to use a plugin that extended the properties of a post. Now, a new post type can be created, with all the new features it needs. Just great!<br />
And I have to mention the new menu feature that was&#8230; just needed!<br />
Here&#8217;s a short video that presents the new features. Hmm&#8230; maybe I&#8217;ll update my site soon <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><embed src="http://v.wordpress.com/wp-content/plugins/video/flvplayer.swf?ver=1.21" type="application/x-shockwave-flash" width="640" height="360" wmode="transparent" seamlesstabbing="true" allowfullscreen="true" allowscriptaccess="always" overstretch="true" flashvars="guid=BQtfIEY1&amp;width=640&amp;height=360&amp;locksize=no&amp;dynamicseek=false&amp;qc_publisherId=p-18-mFEk4J448M" title="Introducing WordPress 3.0 &quot;Thelonious&quot;"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/new-wordpress-3-0/267/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transparent text over images</title>
		<link>http://www.bogdanirimia.ro/transparent-text-over-images/265</link>
		<comments>http://www.bogdanirimia.ro/transparent-text-over-images/265#comments</comments>
		<pubDate>Mon, 15 Mar 2010 12:26:14 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[transparent]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=265</guid>
		<description><![CDATA[I needed recently to overlap, on a web page, a text on an image, and the text was to be white, with a black background, with alpha. For this, the solution is to make two DIVs, both positioned in a container div. The container div has to have &#8220;position: relative&#8221;. The second div has to [...]]]></description>
			<content:encoded><![CDATA[<p>I needed recently to overlap, on a web page, a text on an image, and the text was to be white, with a black background, with alpha. For this, the solution is to make two DIVs, both positioned in a container div. The container div has to have &#8220;position: relative&#8221;. The second div has to have &#8220;position: absolute&#8221;, and to set &#8220;top&#8221; and &#8220;left&#8221; properties so that it would be positioned where you want.</p>
<p>So, to wrap things up:</p>
<p>- container div:</p>
<pre class="brush: css; title: ; notranslate">

#container {
position: relative;
}
</pre>
<p>- image div (or just image tag) &#8211; has nothing special, maybe remove its borders&#8230;</p>
<pre class="brush: css; title: ; notranslate">

#container img {
border: 0;
}
</pre>
<p>- text div (or a special tag, like &#8220;h2&#8243;)</p>
<pre class="brush: css; title: ; notranslate">

#container h2 {
display: block;
position: absolute;
top: 10px;
left: 0;
width: 100px;
height: 30px;
color: white;
background: rgb(0, 0, 0); /* fallback color */
background: rgba(0, 0, 0, 0.15);
}

#IEroot #container h2 {
background:transparent;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#40000000,endColorstr=#40000000);
zoom: 1;
}
</pre>
<p>For IE compatibility, you need to use conditional statements. This is done by adding this code before the container div:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!--[if IE]&gt;
&lt;div id=&quot;IEroot&quot;&gt;
&lt;![endif]--&gt;
</pre>
<p>and this code after the container div:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!--[if IE]&gt;
&lt;/div&gt;
&lt;![endif]--&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/transparent-text-over-images/265/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Delete SVN folders&#8221; context menu item</title>
		<link>http://www.bogdanirimia.ro/delete-svn-files-context-menu-item/263</link>
		<comments>http://www.bogdanirimia.ro/delete-svn-files-context-menu-item/263#comments</comments>
		<pubDate>Wed, 24 Feb 2010 12:06:01 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=263</guid>
		<description><![CDATA[If you&#8217;re using Windows and you have some projects synced with SVN, you could have sometimes the need to remove the folder&#8217;s SVN references. This can be done in Windows Explorer by browsing and removing all the .svn subfolders, but if your folder has many subfolders, you&#8217;ll have a lot of work to do. There&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using Windows and you have some projects synced with SVN, you could have sometimes the need to remove the folder&#8217;s SVN references. This can be done in Windows Explorer by browsing and removing all the .svn subfolders, but if your folder has many subfolders, you&#8217;ll have a lot of work to do. There&#8217;s a simpler way: tweaking the registry to add a context menu item that allows to delete the SVN references.</p>
<p>This is the reg file:</p>
<pre class="brush: bash; title: ; notranslate">

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@=&quot;Delete SVN Folders&quot;

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@=&quot;cmd.exe /c \&quot;TITLE Removing SVN Folders in %1 &amp;&amp; COLOR 9A &amp;&amp; FOR /r \&quot;%1\&quot; %%f IN (.svn) DO RD /s /q \&quot;%%f\&quot; \&quot;&quot;
</pre>
<p>Run it, then right-click on a folder and you&#8217;ll see the aforementioned item. Works well on Windows 7.</p>
<p>The idea comes from<a href="http://weblogs.asp.net/jgalloway/archive/2007/02/24/shell-command-remove-svn-folders.aspx" target="_blank"> Jon Galloway</a>&#8216;s blog. Neat!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/delete-svn-files-context-menu-item/263/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C application with MySQL, built with NetBeans, on CygWin</title>
		<link>http://www.bogdanirimia.ro/c-application-with-mysql-built-with-netbeans-on-cygwin/262</link>
		<comments>http://www.bogdanirimia.ro/c-application-with-mysql-built-with-netbeans-on-cygwin/262#comments</comments>
		<pubDate>Mon, 22 Feb 2010 12:38:23 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[CygWin]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[NetBeans]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=262</guid>
		<description><![CDATA[Because MySQL became one of the most used database engine in the world and because of the ease of development in PHP with MySQL, most of the prototype application can be developed at first using this combination (PHP+MySQL). But then, mainly because of performance issues, one might want to implement that project in C &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Because MySQL became one of the most used database engine in the world and because of the ease of development in PHP with MySQL, most of the prototype application can be developed at first using this combination (PHP+MySQL). But then, mainly because of performance issues, one might want to implement that project in C &#8211; so there&#8217;s the need to connect from a C application to the MySQL server. Nothing easier &#8211; you say. MySQL provides us the mysql-connector that has a C implementation and binaries for the most important platforms. But I wanted to develop my application in a full-fledged IDE, and because my workstation runs Windows (7 &#8211; big fan) I needed to make it compile somehow on Windows. But the application will run on a Linux server (or Unix), so it had to be POSIX compatible. This took Visual Studio out of the equation.</p>
<p>So, to build a POSIX C application on Windows I recommend using NetBeans IDE (6.8 at this time) &#8211; it has lots of features, making it a good development environment. It has a C/C++ plugin implementing support for these two languages.</p>
<p>Now, to make it compile, I needed gcc, so I installed CygWin. It works fine on Windows 7 x64. When installing CygWin, you must make sure you install <strong>gcc </strong>(and all that it depends on), <strong>libncurses-devel</strong>, <strong>readline </strong>and <strong>libreadline </strong>(from the Devel category). Of course I didn&#8217;t unselect anything from the default list. I just added these libraries.</p>
<p>To make CygWin more friendly (I have this friendliness obsession  <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) I&#8217;m using <a href="http://code.google.com/p/puttycyg/" target="_blank">PuTTYcyg</a>, a great expansion of PuTTY. I am also editing the <strong>.vimrc</strong> file just like in the post for Solaris. The <strong>.bashrc</strong> file should exist and contain also the line</p>
<pre class="brush: bash; title: ; notranslate">

export PS1='[\u@\h \w]\$ '
</pre>
<p>Now, I&#8217;m having this Linux-like environment running on my Windows. All I have to do is to install the mysql-connector and to configure NetBeans to compile on CygWin.</p>
<p>To install mysql-connector on CygWin I had to download the sources of MySQL (not only mysql-client, I couldn&#8217;t compile it). MySQL includes the client when compiling. These are the steps to follow if you want mysql-client on CygWin</p>
<ul>
<li>make sure you have gcc, libncurses-devel, readline and libreadline</li>
<li>download the mysql sources and extract them in a folder in CygWin</li>
<li>copy the file <strong>ttydefaults.h</strong> (from a working Unix system) in <strong>/usr/include/sys/</strong></li>
<li>go into the sources folder and run<strong> ./configure &#8211;without-readline CFLAGS=-O2 </strong>(you can add &#8211;without-server, but I didn&#8217;t test that)</li>
<li>wait for it to finish (took me about 20 minutes). Hopefully you won&#8217;t have any errors</li>
<li>run <strong>make &amp; make install</strong> and wait for it to finish (should take more than half an hour, but maybe your PC is faster)</li>
</ul>
<p>This should be it. Of course, if you run configure and have a missing library error, install that library and rerun configure. If you have an error during compilation, make sure to run <strong>make clean</strong> before retrying!</p>
<p>Ok. Now to make sure that NetBeans compiles your C application successfully, follow these steps:</p>
<ul>
<li>create a new C project and paste the following code</li>
</ul>
<pre class="brush: cpp; title: ; notranslate">

/*
 * File:   main.c
 * Author: Bogdan
 *
 * Created on February 18, 2010, 1:09 PM
 */

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

#include &lt;my_global.h&gt;
#include &lt;mysql.h&gt;

int main(int argc, char** argv) {

 printf(&quot;Running just fine!\n&quot;);
 printf(&quot;MySQL client version: %s\n&quot;, mysql_get_client_info());

 return (EXIT_SUCCESS);
}
</pre>
<ul>
<li>go to Tools-&gt;Options and select C/C++ tab. Click the &#8220;Add&#8221; button and select the &#8220;bin&#8221; folder of your CygWin installation (mine is C:\cygwin\bin). The other two fields should auto-complete. Click OK, make sure all paths are correct and then click OK again.</li>
<li>right-click your project in Projects pane. Go to Properties</li>
<li>in the Build-&gt;C Compiler section, add the value &#8220;c:/cygwin/usr/local/include/mysql&#8221; in the &#8220;Include directories&#8221; field (supposing that you installed CygWin in C:\cygwin)</li>
<li>in the Build-&gt;Linker section, add the value &#8220;c:/cygwin/usr/local/lib/mysql&#8221;</li>
<li>in the same section (Linker) click on the button near &#8220;Libraries&#8221;, click &#8220;Add Library&#8221;, go to &#8220;/usr/local/lib/mysql&#8221; and add &#8220;libmysqlclient.a&#8221;</li>
<li>after clicking &#8220;Select&#8221;, press again &#8220;Add Library&#8221;, go to &#8220;/lib&#8221; and add &#8220;libz.a&#8221;</li>
<li>click OK and then OK again</li>
</ul>
<p>Now your application should compile and run successfully. So now I&#8217;m ready to develop and test a C application with MySQL connection on my PC and then to deploy it on a UNIX server (of course it will need to be recompiled).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/c-application-with-mysql-built-with-netbeans-on-cygwin/262/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make Solaris more friendly</title>
		<link>http://www.bogdanirimia.ro/make-solaris-more-friendly/261</link>
		<comments>http://www.bogdanirimia.ro/make-solaris-more-friendly/261#comments</comments>
		<pubDate>Fri, 12 Feb 2010 11:57:35 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Server administration]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=261</guid>
		<description><![CDATA[Of course, most Solaris users are at an advanced level and those little nice things in a Linux console don&#8217;t matter that much. But I like to be more productive and enjoy using all the features I can get from a console. So here&#8217;s how I am customizing my Solaris console: 1. I am using [...]]]></description>
			<content:encoded><![CDATA[<p>Of course, most Solaris users are at an advanced level and those little nice things in a Linux console don&#8217;t matter that much. But I like to be more productive and enjoy using all the features I can get from a console. So here&#8217;s how I am customizing my Solaris console:</p>
<p>1. I am using <strong>bash </strong>- this brings most of the features I enjoy: auto-complete at TAB and previous commands list being the most important. To enable <em>bash</em> you have to edit the file &#8220;/etc/passwd&#8221; like this (note the path to the console at the end):</p>
<pre class="brush: bash; title: ; notranslate">username:x:100:100:NameOfUser:/homepath:/bin/bash</pre>
<p>2. I am making <strong>vim</strong> work &#8211; <em>vim </em>is my preferred editor on Unix. For that, I must install <em>vim </em>(using Blastwave) and put the path in the PATH variable. See number 3 for this. After making <em>vim </em>work, I am setting it to work as I like &#8211; like on a Linux console <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . To do that, I am creating a file named .vimrc in my home folder with the following content:</p>
<pre class="brush: bash; title: ; notranslate">
set nocompatible &quot; must be the first line
:syntax enable
filetype on
filetype indent on
filetype plugin on
set laststatus=2
set statusline=%&lt;%f\%h%m%r%=%-20.(line=%l\ \ col=%c%V\ \ totlin=%L%)\ \ \%h%m%r%=%-40(bytval=0x%B,%n%Y%)\%P
set backspace=2
</pre>
<p>3. I am configuring the console to set <em>vim </em>as the default editor, to set the PATH with everything I need, to set the pager with <em>more </em>and to configure the shell prompt. For this, I am creating a file name .profile (or edit if existing) with the following content:</p>
<pre class="brush: bash; title: ; notranslate">
export PATH=/usr/bin:/opt/csw/bin
export TERM=linux
export PAGER=more
export EDITOR=vim
export PS1='[\u@\h \w]\$ '
</pre>
<p>So&#8230; this is it! Now I have a much nicer console!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/make-solaris-more-friendly/261/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cross-domain AJAX</title>
		<link>http://www.bogdanirimia.ro/cross-domain-ajax/257</link>
		<comments>http://www.bogdanirimia.ro/cross-domain-ajax/257#comments</comments>
		<pubDate>Thu, 28 Jan 2010 12:30:35 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[cross-domain]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[JSONP]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=257</guid>
		<description><![CDATA[When using AJAX, there is a cross-domain security restriction that does not allow accessing an URL with a different domain than the one of the page that contains the script (the script&#8217;s domain). For most AJAX applications, this is not an issue, as you can host the data on the same domain. But let&#8217;s consider [...]]]></description>
			<content:encoded><![CDATA[<p>When using AJAX, there is a cross-domain security restriction that does not allow accessing an URL with a different domain than the one of the page that contains the script (the script&#8217;s domain). For most AJAX applications, this is not an issue, as you can host the data on the same domain. But let&#8217;s consider the real case of developing a web page widget. The widget would be a piece of code that any site can put on their pages and the widget should appear there. If that piece of code has to have AJAX functions (like getting search results), you can&#8217;t use AJAX because the domain of the script (of the page that includes the script) is the one of the client, and the domain of the data-provider is our server&#8217;s domain.<br />
So the solution was to use JSONP (JSON with Padding). JSONP uses the following relaxation of the cross-domain restriction: you can include scripts on your page from another domains. So you can have two scripts on the same page, the scripts having two different domains, and one can call a function from the other one. Of course, calling a function allows exchanging data between those two scripts, so cross-domain communication is possible from JavaScript.<br />
jQuery includes and automates this feature. Here is how you can get JSON data from another domain, using jQuery:</p>
<pre class="brush: jscript; title: ; notranslate">
$.getJSON(&quot;http://just.another.domain/myscript.php?param=&quot;+param+&quot;&amp;callback=?&quot;, function(vals) {
	for(var i in vals) {
		// do something with each value
	}
} );
</pre>
<p>The code for myscript.php could be something like this:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
// ... do some processing (based on $_GET['param'])
array_push($results, $val1);
array_push($results, $val2);

echo $_GET['callback'] . '(' . json_encode($results). ');';
?&gt;
</pre>
<p>jQuery automatically generates a function name and puts it in the place of the second &#8216;?&#8217;, so the function to be called from the PHP-generated JavaScript is available in the &#8216;callback&#8217; parameter. All that the PHP script has to do is to output a function call using that function name. As a parameter to that function, we put a string with JSON-encoded data. It has to be JSON-encoded, because the parameter is automatically eval&#8217;d in the jQuery.<br />
So, with these two restrictions (data has to be packed as JSON and the server script has to output a JavaScript function call), you can transmit data between cross-domain scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/cross-domain-ajax/257/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH with PuTTY through a proxy</title>
		<link>http://www.bogdanirimia.ro/ssh-with-putty-through-a-proxy/96</link>
		<comments>http://www.bogdanirimia.ro/ssh-with-putty-through-a-proxy/96#comments</comments>
		<pubDate>Fri, 18 Dec 2009 00:06:32 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Server administration]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[PuTTY]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=96</guid>
		<description><![CDATA[For security reasons, I had to set all my server&#8217;s firewalls to accept connections on the SSH port (22) only from my office IP. I would have added my home IP addres in the access list, if it would have been static. But at home I have a dynamic IP so I can&#8217;t use IP-based [...]]]></description>
			<content:encoded><![CDATA[<p>For security reasons, I had to set all my server&#8217;s firewalls to accept connections on the SSH port (22) only from my office IP. I would have added my home IP addres in the access list, if it would have been static. But at home I have a dynamic IP so I can&#8217;t use IP-based access control in this case. So the only thing I could do to admin my servers from home was to connect first to the office and then to connect, from there, on the server that had to be administered.</p>
<p>Today I set up a new way to connect to my servers from anywhere. I installed a proxy on the office server, and configured PuTTY to use it for the connections to the secured servers. The following are the steps to configure a Linux server (Ubuntu in my case) and PuTTY to make a SSH connection through a proxy:</p>
<p>1. Install mod_proxy and mod_proxy_connect for Apache, and enable them. In Ubuntu (mine is 8.04), these modules are already installed and all you need to do is to enable them:</p>
<pre class="brush: bash; title: ; notranslate">
# a2enmod proxy
# a2enmod proxy_connect
</pre>
<p>2. Configure the proxy by editing the &#8220;proxy.conf&#8221; file:</p>
<pre class="brush: bash; title: ; notranslate">
&lt;IfModule mod_proxy.c&gt;

    ProxyRequests On
    AllowCONNECT 22

    &lt;Proxy *&gt;
        AddDefaultCharset off
        Order deny,allow
        Allow from all
        AuthType Basic
        AuthName &quot;SSH Proxy&quot;
        AuthUserFile /path/to/password/file
        Require user myusername
    &lt;/Proxy&gt;
    ProxyVia Block
&lt;/IfModule&gt;
</pre>
<p>3. Restart Apache<br />
4. Configure PuTTY to use the proxy for the corresponding connections. For this, in the left tree, the &#8220;Proxy&#8221; submenu in the &#8220;Connection&#8221; menu must be used. There, select &#8220;HTTP&#8221; as Proxy type, then enter the hostname of your newly configured proxy, the username and password.</p>
<p style="text-align: left;"><img class="size-full wp-image-100 aligncenter" title="putty_proxy" src="http://www.bogdanirimia.ro/wp-content/uploads/2009/12/putty_proxy.jpg" alt="putty_proxy" width="466" height="448" />Now you should have a functioning proxied SSH connection! Cool!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/ssh-with-putty-through-a-proxy/96/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

