<?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...</title>
	<atom:link href="http://www.bogdanirimia.ro/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bogdanirimia.ro</link>
	<description>Bogdan Irimia&#039;s Web Space</description>
	<lastBuildDate>Thu, 26 Aug 2010 15:17:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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 threads), [...]]]></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;">
...
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;">
@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 spend 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>0</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 important [...]]]></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;">

#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;">

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

#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;">
&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;">
&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;">

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>&#8217;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;">

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;">

/*
 * 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 bash [...]]]></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;">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;">
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;">
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>Despre prietenii&#8230;</title>
		<link>http://www.bogdanirimia.ro/despre-prietenii/258</link>
		<comments>http://www.bogdanirimia.ro/despre-prietenii/258#comments</comments>
		<pubDate>Thu, 04 Feb 2010 14:49:42 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[cunoştinţă]]></category>
		<category><![CDATA[prietenie]]></category>
		<category><![CDATA[singurătate]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=258</guid>
		<description><![CDATA[Citeam acum pe blogul unei cunoștințe că &#8220;N-am avut niciodata mulţi prieteni. Doar multe cunoştinţe&#8220;. Și asta mi-a completat revelația pe care am avut-o în urma unor discuții mai sincere cu cei pe care îi încadram în categoria prietenilor (și încă o fac). Mi-am dat seama că de fapt termenii de prieten și cunoștință nu [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-259" title="friendship" src="http://www.bogdanirimia.ro/wp-content/uploads/2010/02/friendship.png" alt="" width="100" height="87" />Citeam acum pe blogul unei <em>cunoștințe </em>că &#8220;N-am avut niciodata mulţi <em>prieteni</em>. Doar multe <em>cunoştinţe</em>&#8220;. Și asta mi-a completat <em>revelația</em> pe care am avut-o în urma unor discuții mai sincere cu cei pe care îi încadram în categoria <em>prietenilor </em>(și încă o fac). Mi-am dat seama că de fapt termenii de <em>prieten</em> și <em>cunoștință</em> nu sunt așa de depărtați, cum aveam senzația. Poate că aveam crezul ăsta pentru confortul meu propriu: &#8220;eu am prietenii mei, nu sunt singur&#8221;. Adică, mai bine zis, din refuzul meu de a-mi accepta singurătatea. Lucru pe care am început să-l fac (sigur, știți că nu-i nici ușor, nici plăcut).</p>
<p>Şi acceptarea este primul pas. Cel mai uşor. Al doilea pas este să începi să funcţionezi eficient (din perspectiva propriei fericiri). Adică să începi să apreciezi şi să iubeşti oamenii dincolo de necesitatea proprie de a avea <em>prieteni</em>. Asta este cel mai greu, şi extrapolând conceptul, efortul principal către care îmi canalizez energia este acela de a găsi căile de a fi fericit necondiţionat de factorii exteriori  <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> A bit too philosophical!</p>
<p>Oricum, dragi <em>prieteni</em>, vă salut cu drag (pe toţi cei pe care-i ştiu sau pe care nu) şi vă ofer spre apreciere simbolul chinezesc al prieteniei (care se citeşte &#8220;you&#8221;  <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/despre-prietenii/258/feed</wfw:commentRss>
		<slash:comments>5</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;">
$.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;">
&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>Crăciun fericit!</title>
		<link>http://www.bogdanirimia.ro/craciun-fericit/107</link>
		<comments>http://www.bogdanirimia.ro/craciun-fericit/107#comments</comments>
		<pubDate>Fri, 25 Dec 2009 15:48:05 +0000</pubDate>
		<dc:creator>Myself</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[bucurie]]></category>
		<category><![CDATA[Crăciun]]></category>
		<category><![CDATA[familie]]></category>
		<category><![CDATA[Moş Crăciun]]></category>
		<category><![CDATA[sărbători]]></category>

		<guid isPermaLink="false">http://www.bogdanirimia.ro/?p=107</guid>
		<description><![CDATA[Probabil că sunt cuvintele cel mai des auzite şi citite zilele astea. Şi, dacă sunt spuse din toată inima, chiar ne bucură, căci exprimă bucuria naşterii, a sărbătorii, a veseliei.
Dar&#8230; ce este Crăciunul? Răspunsul educat ar fi ceva de genul &#8220;Crăciunul este sărbătoarea naşterii lui Iisus Hristos&#8230;&#8221; s.a.m.d. Dar dincolo de asta, ce este Crăciunul? [...]]]></description>
			<content:encoded><![CDATA[<p>Probabil că sunt cuvintele cel mai des auzite şi citite zilele astea. Şi, dacă sunt spuse din toată inima, chiar ne bucură, căci exprimă bucuria naşterii, a sărbătorii, a veseliei.</p>
<p>Dar&#8230; ce este Crăciunul? Răspunsul educat ar fi ceva de genul &#8220;Crăciunul este sărbătoarea naşterii lui Iisus Hristos&#8230;&#8221; s.a.m.d. Dar dincolo de asta, ce este Crăciunul? De data aceasta, răspunsul este puternic legat de aspectele culturale şi educaţionale ale persoanelor pentru care încercăm să răspundem. În speţă, încercăm să dăm un răspuns pentru români &#8211; eu despre români pot scrie, dar provoc pe toţi ceilalţi care cunosc şi Crăciunuri pentru altcineva, să mă completeze. Creştinismul este religia cu cei mai mulţi adepţi din lume, deci probabil serbăm Crăciunul împreună cu alte câteva miliarde de oameni. Aveţi despre ce scrie! <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Deci, iată ce este de fapt Crăciunul pentru români:</p>
<ol>
<li>CUMPĂRĂTURI. Probabil că este o reminiscenţă comunistă, de atunci de când trebuia să stăm la cozi interminabile pentru&#8230; carne sau ulei, când pâinea era cu raţie şi mărfurile erau rare. Şi acum însă cozile sunt interminabile, aglomeraţia este&#8230; mirobolantă <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Şi lumea aproape disperată să CUMPERE. Cu ce bani? Bani din pensie, împrumut, amanet sau&#8230; salariu (pentru cei norocoşi). Dar de la cumpărături nu se poate face rabat! Şi asta produce aglomeraţie, haos în trafic, nebunie în oraşe. Aici la Buzău stau foarte aproape de câteva centre comerciale şi pur şi simplu fenomenul descris este&#8230; de nedescris <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>Mâncare şi băutură. Pentru mine, masa de Crăciun este al doilea motiv ca importanţă pentru care aş prefera oricând să petrec această sărbătoare în România (primul motiv fiind apropierea de familie şi prieteni). Deoarece este tradiţional la noi să tăiem porcul de Crăciun, bucatele de porc abundă pe masa festivă. Cârnaţi, caltaboş, tobă, friptură, şorici şi multe alte bunătăţi fac masa festivă una, să zicem, &#8220;râvnită&#8221;. Probabil de aceea şi febra cumpărăturilor!</li>
<li>Brad împodobit şi colindători, precum şi tradiţionalele cadouri. Probabil că doar aşa se mai păstrează în mediul urban tradiţiile Crăciunului. Cele mai multe case au un brad împodobit &#8211; nu ca în filme, brad bogat şi mare, aranjat uniform, ci brăduţ mititel, cu beteală colorată puternic, cu 2 instalaţii clipicioase şi cu globuri şi ciocolăţele. Cât despre colinde, de cele mai multe ori vin ţigănuşi care mai mult recită colindele. Dar avem parte şi de grupuri mai bine organizate şi cu prezenţă mult mai frumoasă, însă în general românii devin din ce în ce mai sceptici la colindători. Poate singurul mit păstrat aproximativ nealterat este cel al lui Moş Crăciun, care vine în seara de ajun şi aduce cadouri copiilor cuminţi. Pe vremea comunismului, Moş Crăciun era numit Moş Gerilă <img src='http://www.bogdanirimia.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Dar este unul din miturile cele mai importante care încă se păstrează.</li>
<li>Bucuria sărbătorilor alături de cei dragi, de familie şi prieteni. De obicei, majoritatea celor care merg pe drumul lor la distanţe de mai multe mii de kilometri de casă vin de Crăciun acasă. A devenit cumva o tradiţie ca noi, prieteni foşti colegi de liceu, să ne strângem în seara de Crăciun în cel mai popular &#8220;pub&#8221; din Buzău şi să ne simţim bine. De asemeni, masa de Crăciun (sus amintită) alături de familie este&#8230; lucrul pentru care merită să numim sărbătorile de iarnă sărbători ale bucuriei.</li>
</ol>
<p>Oricum, indiferent de aspecte pozitive sau negative, care există de altfel în orice, trebuie să ne bucurăm că avem şansa să petrecem o astfel de sărbătoare, să ne veselim împreună cu cei din jur şi să ne dorim, pentru toţi cei dragi, să trăiască mulţi ani fericiţi. Crăcin fericit!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bogdanirimia.ro/craciun-fericit/107/feed</wfw:commentRss>
		<slash:comments>1</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;">
# a2enmod proxy
# a2enmod proxy_connect
</pre>
<p>2. Configure the proxy by editing the &#8220;proxy.conf&#8221; file:</p>
<pre class="brush: bash;">
&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>
