<?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>Florent Clairambault &#187; Linux</title>
	<atom:link href="http://florent.clairambault.fr/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://florent.clairambault.fr</link>
	<description></description>
	<lastBuildDate>Sat, 04 Feb 2012 19:56:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
		<item>
		<title>cron-apt and the perfect update system</title>
		<link>http://florent.clairambault.fr/cron-apt-and-the-perfect-update-system?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cron-apt-and-the-perfect-update-system</link>
		<comments>http://florent.clairambault.fr/cron-apt-and-the-perfect-update-system#comments</comments>
		<pubDate>Wed, 18 Jan 2012 04:00:06 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[cron-apt]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=3688</guid>
		<description><![CDATA[On my spare time, I manage a handful of servers. And even if it&#8217;s not really my job, I try to do it well and efficiently. All of them work on Debian because it&#8217;s simple to manage. I started using cron-apt a few years ago. I started by upgrading everything automatically, this was a big [...]]]></description>
			<content:encoded><![CDATA[<p>
On my spare time, I manage a handful of servers. And even if it&#8217;s not really my job, I try to do it well and efficiently. All of them work on Debian because it&#8217;s simple to manage. I started using cron-apt a few years ago. I started by upgrading everything automatically, this was a big mistake. I switched to only sending mails on available upgrades and doing the upgrade manually. But this is also quite painful because 95% of the time, it consists in typing &#8220;<code>apt-get dist-upgrade -y</code>&#8221; and waiting. And have no free time for doing stupid things.
</p>
<p>So here is my cron-apt configuration, I like it a lot:</p>
<p>
In <code>/etc/apt</code>:<br />
- I removed the <code>sources.list</code> file<br />
- I put the content of my <code>sources.list</code> into sources.list.d/main.list, it should look something like that:</p>

<div class="wp_codebox"><table><tr id="p36887"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p3688code7"><pre class="text" style="font-family:monospace;">deb http://http.us.debian.org/debian stable main contrib non-free
deb-src http://http.us.debian.org/debian stable main contrib non-free</pre></td></tr></table></div>

<p>- I created a directory sources.security.list.d<br />
- I put the following content:</p>

<div class="wp_codebox"><table><tr id="p36888"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p3688code8"><pre class="text" style="font-family:monospace;">deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free</pre></td></tr></table></div>

</p>
<p>
Then I added the repositories with packages I want to manually upgrade to <code>/etc/apt/sources.list.d/</code> and the ones that I want to automatically upgrade (which means that they can&#8217;t require any user interaction) to <code>/etc/apt/sources.security.list.d/</code>.
</p>
<p>
The interesting part is here, in <code>/etc/cron-apt/action.d</code>, this what I have:
</p>
<p><strong>0-update</strong></p>

<div class="wp_codebox"><table><tr id="p36889"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p3688code9"><pre class="bash" style="font-family:monospace;">update <span style="color: #660033;">-o</span> <span style="color: #007800;">quiet</span>=<span style="color: #000000;">2</span>
update <span style="color: #660033;">-o</span> <span style="color: #007800;">quiet</span>=<span style="color: #000000;">2</span> <span style="color: #660033;">-o</span> Dir::Etc::<span style="color: #007800;">sourceparts</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.security.list.d <span style="color: #660033;">-o</span> Dir::State::<span style="color: #007800;">lists</span>=<span style="color: #ff0000;">&quot;security-lists&quot;</span></pre></td></tr></table></div>

<p>
We launch an update of the two kinds of repositories. For the <code>sources.security.list.d</code> one, we use also a different <code>Dir::State::lists</code> parameter (which is the directory the cache file) so that we don&#8217;t to re-download the content of the index files every time.
</p>
<p><strong>2-install-security</strong></p>

<div class="wp_codebox"><table><tr id="p368810"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p3688code10"><pre class="bash" style="font-family:monospace;">dist-upgrade <span style="color: #660033;">-y</span> <span style="color: #660033;">-o</span> <span style="color: #007800;">quiet</span>=<span style="color: #000000;">1</span> <span style="color: #660033;">-o</span> Dir::Etc::<span style="color: #007800;">sourceparts</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.security.list.d <span style="color: #660033;">-o</span> Dir::State::<span style="color: #007800;">lists</span>=<span style="color: #ff0000;">&quot;security-lists&quot;</span></pre></td></tr></table></div>

<p>
We launch the upgrade (dist-upgrade actually) only on the repositories defined in <code>/etc/apt/sources.security.list.d</code>.
</p>
<p><strong>3-download</strong></p>

<div class="wp_codebox"><table><tr id="p368811"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p3688code11"><pre class="bash" style="font-family:monospace;">dist-upgrade <span style="color: #660033;">-d</span> <span style="color: #660033;">-y</span> <span style="color: #660033;">-o</span> APT::Get::Show-Upgraded=<span style="color: #c20cb9; font-weight: bold;">true</span></pre></td></tr></table></div>

<p>
Then we only download files for the upgrade of the non-security packets.
</p>
<p><strong>6-clean</strong></p>

<div class="wp_codebox"><table><tr id="p368812"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p3688code12"><pre class="bash" style="font-family:monospace;">autoclean <span style="color: #660033;">-y</span></pre></td></tr></table></div>

<p>
And we finally delete all the old packets (the ones that will never be used).
</p>
<p>
If you want to play with the <code>apt</code> settings yourself, you should use <code>apt-config</code> to see what can change to fit your needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/cron-apt-and-the-perfect-update-system/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>btrfs for a simple and powerful backup system</title>
		<link>http://florent.clairambault.fr/btrfs-for-a-simple-and-powerful-backup?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=btrfs-for-a-simple-and-powerful-backup</link>
		<comments>http://florent.clairambault.fr/btrfs-for-a-simple-and-powerful-backup#comments</comments>
		<pubDate>Thu, 12 Jan 2012 23:57:47 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[btrfs]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=3671</guid>
		<description><![CDATA[I&#8217;ve been testing btrfs for some months now. One of the most interesting features of this file-system is its snapshoting capabilities. Before that I was using rsnapshot. The issue with rsnapshot is that its lowest atomic level for snapshotting is the files themselves using hard-links. So any database table where one row is changed is [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve been testing btrfs for some months now. One of the most interesting features of this file-system is its snapshoting capabilities. Before that I was using rsnapshot. The issue with rsnapshot is that its lowest atomic level for snapshotting is the files themselves using hard-links. So any database table where one row is changed is copied completely. Btrfs as you might guess will only copy the modified chunks (I don&#8217;t know the atomicity of them [but who cares?]).</p>
<p>Here is a simple I&#8217;ve been using during these last months to backup my laptop and (remotely hosted) servers.
</p>

<div class="wp_codebox"><table><tr id="p367115"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
</pre></td><td class="code" id="p3671code15"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># === ARGUMENTS PARSING ===</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># We don't want to define a default period</span>
<span style="color: #007800;">PERIOD</span>=
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> ^- <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null; <span style="color: #000000; font-weight: bold;">do</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">&quot;--daily&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PERIOD</span>=daily
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">&quot;--monthly&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PERIOD</span>=monthly
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">&quot;--period&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PERIOD</span>=<span style="color: #007800;">$2</span>
        <span style="color: #7a0874; font-weight: bold;">shift</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">shift</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${PERIOD}</span>&quot;</span> = <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;You have to define a period  with the --period arg !&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
        <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># === END OF ARGUMENTS PARSING ===</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># === PARAMETERS ===</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># * Device we will use</span>
<span style="color: #007800;">DISK</span>=<span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>externe3
&nbsp;
<span style="color: #666666; font-style: italic;"># * Subvolume used for the backup</span>
<span style="color: #007800;">SUBVOLUME</span>=<span style="color: #800000;">${DISK}</span><span style="color: #000000; font-weight: bold;">/</span>servers-backup
&nbsp;
<span style="color: #666666; font-style: italic;"># * Current date (you could limit the date to +%Y-%m-%d)</span>
<span style="color: #007800;">DATE</span>=<span style="color: #000000; font-weight: bold;">`/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y-<span style="color: #000000; font-weight: bold;">%</span>m-<span style="color: #000000; font-weight: bold;">%</span>d_<span style="color: #000000; font-weight: bold;">%</span>H-<span style="color: #000000; font-weight: bold;">%</span>M-<span style="color: #000000; font-weight: bold;">%</span>S<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># * snapshot directory that will be used</span>
<span style="color: #007800;">SNAPDIR</span>=<span style="color: #800000;">${DISK}</span><span style="color: #000000; font-weight: bold;">/</span>snap<span style="color: #000000; font-weight: bold;">/</span>servers-backup
&nbsp;
<span style="color: #666666; font-style: italic;"># * snapshot volume that will be used</span>
<span style="color: #007800;">SNAPVOL</span>=<span style="color: #800000;">${SNAPDIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${PERIOD}</span>-<span style="color: #800000;">${DATE}</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># * max days to keep daily backups</span>
<span style="color: #007800;">MAX_DAYLY</span>=<span style="color: #000000;">60</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># * max days to keep monthly backups</span>
<span style="color: #007800;">MAX_MONTHLY</span>=<span style="color: #000000;">365</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># * Alert limit</span>
<span style="color: #007800;">LIMIT_ALERT</span>=<span style="color: #000000;">95</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># * High limit</span>
<span style="color: #007800;">LIMIT_HIGH</span>=<span style="color: #000000;">90</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># * Low limit</span>
<span style="color: #007800;">LIMIT_LOW</span>=<span style="color: #000000;">85</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># === END OF PARAMETERS ===</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># We get the space used over the total allocated space and the total percentage use.</span>
<span style="color: #666666; font-style: italic;"># This is NOT the device total size but it's a lot more reliable than &quot;df -h&quot;</span>
<span style="color: #007800;">DISK_USED</span>=<span style="color: #000000; font-weight: bold;">`/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>btrfs filesystem <span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #800000;">${DISK}</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> Data<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-Po</span> <span style="color: #ff0000;">&quot;used=([0-9]*)&quot;</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span>= -f2<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">DISK_TOTAL</span>=<span style="color: #000000; font-weight: bold;">`/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>btrfs filesystem <span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #800000;">${DISK}</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> Data<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-Po</span> <span style="color: #ff0000;">&quot;total=([0-9]*)&quot;</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span>= -f2<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">DISK_PERC</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #800000;">${DISK_USED}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${DISK_TOTAL}</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">bc</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># We create the snapshot dir if it doesn't exist</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #800000;">${SNAPDIR}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #800000;">${SNAPDIR}</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #800000;">${SNAPDIR}</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># If we are over the low free space limit,</span>
<span style="color: #666666; font-style: italic;"># we delete two days of daily backup.</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$DISK_PERC</span> <span style="color: #660033;">-gt</span> <span style="color: #007800;">$LIMIT_LOW</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;LOW LIMIT reached: <span style="color: #007800;">$DISK_PERC</span> &gt; <span style="color: #007800;">$LIMIT_LOW</span> : Deleting 2 days&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
&nbsp;
        <span style="color: #007800;">OLDEST_FILES</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">--sort</span>=<span style="color: #000000; font-weight: bold;">time</span> -r<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;daily-.*&quot;</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">head</span> -<span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$OLDEST_FILES</span>; <span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>btrfs subvolume delete <span style="color: #007800;">$file</span>;
        <span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># If we are over the high free space limit,</span>
<span style="color: #666666; font-style: italic;"># we delete a month of monthly backup</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$DISK_PERC</span> <span style="color: #660033;">-gt</span> <span style="color: #007800;">$LIMIT_HIGH</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;HIGH LIMIT reached: <span style="color: #007800;">$DISK_PERC</span> &gt; <span style="color: #007800;">$LIMIT_HIGH</span> : Deleting 1 month&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
&nbsp;
        <span style="color: #007800;">OLDEST_FILES</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">--sort</span>=<span style="color: #000000; font-weight: bold;">time</span> -r<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;monthly-.*&quot;</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">head</span> -<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$OLDEST_FILES</span>; <span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>btrfs subvolume delete <span style="color: #007800;">$file</span>;
        <span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># If we are over the alert free space limit,</span>
<span style="color: #666666; font-style: italic;"># we delete the first two oldest files we can find</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$DISK_PERC</span> <span style="color: #660033;">-gt</span> <span style="color: #007800;">$LIMIT_ALERT</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ALERT LIMIT reached: <span style="color: #007800;">$DISK_PERC</span> &gt; <span style="color: #007800;">$LIMIT_ALERT</span> : Deleting the 2 oldest&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
&nbsp;
        <span style="color: #007800;">OLDEST_FILES</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">--sort</span>=<span style="color: #000000; font-weight: bold;">time</span> -r<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">head</span> -<span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$OLDEST_FILES</span>; <span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>btrfs subvolume delete <span style="color: #007800;">$file</span>;
        <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># We touch the subvolume to change the modification date</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #800000;">${SUBVOLUME}</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># We do a snapshot of the subvolume</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${SNAPVOL}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>btrfs subvolume snapshot <span style="color: #800000;">${SUBVOLUME}</span> <span style="color: #800000;">${SNAPVOL}</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># We delete the backups older than MAX_DAYLY</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #800000;">${SNAPDIR}</span> <span style="color: #660033;">-mindepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-mtime</span> +<span style="color: #800000;">${MAX_DAYLY}</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;daily-*&quot;</span> <span style="color: #660033;">-exec</span> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>btrfs subvolume delete <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
<span style="color: #666666; font-style: italic;"># We delete the backups older than MAX_MONTHLY</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #800000;">${SNAPDIR}</span> <span style="color: #660033;">-mindepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-mtime</span> +<span style="color: #800000;">${MAX_MONTHLY}</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;monthly-*&quot;</span> <span style="color: #660033;">-exec</span> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>btrfs subvolume delete <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># This is the actual backup code</span>
<span style="color: #666666; font-style: italic;"># You need to save your data into the ${SUBVOLUME} directory</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># We will only do the actual backup for the daily task</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${PERIOD}</span>&quot;</span> = <span style="color: #ff0000;">&quot;daily&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
&nbsp;
rsync <span style="color: #660033;">-auv</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin <span style="color: #800000;">${SUBVOLUME}</span><span style="color: #000000; font-weight: bold;">/</span>localhost<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div>

<p>Then this is how you can use it by adding these cron-tasks :</p>

<div class="wp_codebox"><table><tr id="p367116"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p3671code16"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000;">12</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span>  user <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>backup-servers <span style="color: #660033;">--period</span> daily   <span style="color: #000000; font-weight: bold;">&gt;/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>backup-servers-daily.log
<span style="color: #000000;">55</span> <span style="color: #000000;">10</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> user <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>backup-servers <span style="color: #660033;">--period</span> monthly <span style="color: #000000; font-weight: bold;">&gt;/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>backup-servers-monthly.log</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/btrfs-for-a-simple-and-powerful-backup/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian 6.0</title>
		<link>http://florent.clairambault.fr/debian-6-0?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=debian-6-0</link>
		<comments>http://florent.clairambault.fr/debian-6-0#comments</comments>
		<pubDate>Mon, 07 Feb 2011 00:24:00 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=3300</guid>
		<description><![CDATA[Debian released a new version of their system. I updated it on the server that powers this blog, it took me something like one hour to do the whole system upgrade. There was only a little glitch with mysql&#8217;s my.cnf file that had an unsupported &#8220;skip-bdb&#8221; line. Everything else went fine&#8230; The very good thing [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://i.mivi.fr/462bf9c7d4a9634c75284cea240db79f268260a1.x.150.png" style="position: relative; float: right; margin-left: 10px" /><a href="http://www.debian.org">Debian</a> <a href="http://www.debian.org/News/2011/20110205a.en.html">released a new version</a> of their system. I updated it on the server that powers this blog, it took me something like one hour to do the whole system upgrade. There was only a little glitch with mysql&#8217;s my.cnf file that had an unsupported &#8220;skip-bdb&#8221; line. Everything else went fine&#8230;</p>
<p>The very good thing in this new release is the new <a href="http://www.debian.org/ports/kfreebsd-gnu/">kfreebsd version</a> (available in i386 and x86_64). It brings the power of the FreeBSD kernel to the great Debian OS. If you don&#8217;t see the point, <a href="http://wiki.debian.org/Debian_GNU/kFreeBSD_why">read this</a>. To put in a nutshell: a more stable kernel with less legal issues, better vendors support and the same softwares.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/debian-6-0/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xrdp</title>
		<link>http://florent.clairambault.fr/xrdp?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=xrdp</link>
		<comments>http://florent.clairambault.fr/xrdp#comments</comments>
		<pubDate>Tue, 21 Dec 2010 00:11:43 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[xrdp]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=3083</guid>
		<description><![CDATA[XRDP is a very interesting project. It allows to create a terminal server on Linux hosts using the RDP protocol. I think the RDP protocol is a great protocol (better than VNC) but that&#8217;s not why I&#8217;m writing this. The important thing about this tool is: It&#8217;s freaking simple to use. On Debian, just type: [...]]]></description>
			<content:encoded><![CDATA[<div style="position: relative; float: right"><img src="http://i.mivi.fr/15121daaa2c6119f3a6c06d60d60a6aea2a657f1.x.128.png" alt="xrdp screenshot" /></div>
<p>XRDP is a very interesting project. It allows to create a terminal server on Linux hosts using the RDP protocol. I think the RDP protocol is a great protocol (better than VNC) but that&#8217;s not why I&#8217;m writing this. The important thing about this tool is: <strong>It&#8217;s freaking simple to use</strong>.</p>
<p>On Debian, just type:
<pre style="border: gray 1px solid; padding: 5px; background-color: #eef; font-weight: bold">apt-get install xrdp -y</pre>
<p>On Red Hat Enterprise Linux, just type:
<pre style="border: gray 1px solid; padding: 5px; background-color: #eef; font-weight: bold">yum install xrdp</pre>
<p>Then, you have to start it:</p>
<pre style="border: gray 1px solid; padding: 5px; background-color: #eef; font-weight: bold">/etc/init.d/xrdp start</pre>
<p>And this is it, you can use it. You can connect dozens of clients without any difficulty. </p>
<p>Most of the projects depend on a single man. The man who gave this project a rebirth is <a href="http://www.linkedin.com/pub/jay-sorg/6/8b0/719" target="_blank">Jay Sorg</a>. He seems to be an expert of RDP and I can clearly understand why he got so interested by the protocol, just look at the <a href="http://en.wikipedia.org/wiki/Remote_Desktop_Protocol#Features" target="_blank">its features</a>.<br />
Under the hood, it uses VNC (Xvnc) to actually get something from it.</p>
<p>&#8220;Ok, but I can do that with VNC.&#8221;. Well no, RDP allows you to :</p>
<ul>
<li>Setup a terminal server very quickly</li>
<li>Choose the size of the terminal (640&#215;480, 800&#215;600, full screen, etc.) </li>
<li>Use an encrypted connection (still without any setup, it&#8217;s even done without your knowledge)</li>
<li>Use only one port (3389) for any number of simultaneous sessions</li>
</ul>
<p>There&#8217;s only one pretty big limitation: It looks really ugly with KDE.</p>
<p>You should maybe change some of the settings, I personally changed the /etc/xrdp/sesman.ini file &#8220;Sessions&#8221; section to :</p>
<pre style="background-color: #eee; font-weight: bold; border: 1px solid gray; padding: 5px">
[Sessions]
MaxSessions=100
KillDisconnected=0
IdleTimeLimit=0
DisconnectedTimeLimit=3600
</pre>
<p>Here is a quick look of what happens in a 640&#215;480 remote desktop connection login:</p>
<div style="text-align: center">
<img src="http://i.mivi.fr/15121daaa2c6119f3a6c06d60d60a6aea2a657f1.png" alt="login screen with ugly logo" /><br />
<img src="http://i.mivi.fr/73113780d01e9b76fc58714296683736cda58476.png" alt="sesman loading the Xvnc session" /><br />
<img src="http://i.mivi.fr/6df0e92086301cb228465f0c4215b6b897f2e2cd.png" alt="Session is loaded" />
</div>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/xrdp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Technology brotherhoods</title>
		<link>http://florent.clairambault.fr/technology-brotherhoods?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=technology-brotherhoods</link>
		<comments>http://florent.clairambault.fr/technology-brotherhoods#comments</comments>
		<pubDate>Tue, 06 Jul 2010 21:00:02 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[C# .Net]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2870</guid>
		<description><![CDATA[I often hear people talking about which technology is better between C / C++ / C# .Net / java. Most of the time, it&#8217;s more a political/brotherhood/community thing (like football, even thought frenchies like me aren&#8217;t so proud of their team now) than a technical talk. I find it absurd. Computer science is about efficiency [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://i.mivi.fr/08d1a596d5f04e8a326679be679c2c76934ed624.x.300.jpg" style="position: relative; float: right; margin-left: 10px"/><br />
I often hear people talking about which technology is better between C / C++ / C# .Net / java. Most of the time, it&#8217;s more a political/brotherhood/community thing (like football, even thought frenchies like me aren&#8217;t so proud of their team now) than a technical talk.<br />
I find it absurd. Computer science is about efficiency and making more money. You can take into account the pleasure you have to work on a technology (as you will be more likely to be more efficient with it), but it should still remain about efficiency.</p>
<p>The following video is about java &#038; C# .Net. I&#8217;ve done quite a lot of C# .Net, Java and C, and some ObjectiveC (while developing iPhone applications) and a little bit of C++. The only thing I <strong>feel</strong> is that Sun with java had the good ideas, Microsoft with .Net took them and finished the work. Still, I often code in java, mostly for the TC65 chip, it&#8217;s quite comfortable. But for instance, it was longer to implement the <a href="http://florent.clairambault.fr/tag/m2mp">M2MP protocol</a> on the <a href="http://florent.clairambault.fr/tag/tc65">TC65</a> chip than the C# .net server. Mostly because of the unsigned types I had to &#8220;emulate&#8221; and the lack of generics (which are not available on the TC65&#8242;s JVM).</p>
<p>By the way, I&#8217;m running .Net apps on Linux everyday using <a href="http://www.mono-project.com/">Mono</a>. </p>
<p>Here is the best example of what I&#8217;m talking about :</p>
<div style="text-align: center">
<video src="http://florent.clairambault.fr/downloads/video/java4ever.mp4" controls="controls" />
</div>
<p>For all these lame people who don&#8217;t have an HTML5 compatible browser, you can go to <a href="http://www.youtube.com/watch?v=9g1y7f1xjJ0">the original video</a>. The reason I downloaded it here in my blog is that you are forced to register to YouTube to watch it. </p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/technology-brotherhoods/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
<enclosure url="http://florent.clairambault.fr/downloads/video/java4ever.mp4" length="12992699" type="video/mp4" />
		</item>
		<item>
		<title>Linux prioritization : do more with less</title>
		<link>http://florent.clairambault.fr/linux-prioritization-do-more-with-less?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=linux-prioritization-do-more-with-less</link>
		<comments>http://florent.clairambault.fr/linux-prioritization-do-more-with-less#comments</comments>
		<pubDate>Sun, 07 Mar 2010 18:34:04 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[cfq]]></category>
		<category><![CDATA[ionice]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[nice]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[prioritization]]></category>
		<category><![CDATA[real-time]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2452</guid>
		<description><![CDATA[I find the concept of prioritization very interesting. It just enables you to do more with less. Doesn&#8217;t that sound great ? Let&#8217;s say you want to be able to respond to user requests as fast as possible but update your data in a low priority manner : You can set the process CPU priority [...]]]></description>
			<content:encoded><![CDATA[<p>I find the concept of prioritization very interesting. It just enables you to do more with less. Doesn&#8217;t that sound great ?</p>
<p>Let&#8217;s say you want to be able to respond to user requests as fast as possible but update your data in a low priority manner :<br />
You can set the process CPU priority from -20 (high priority) to 19 (low priority) by using the command :</p>

<div class="wp_codebox"><table><tr id="p245222"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2452code22"><pre class="sh" style="font-family:monospace;">nice -n &lt;priority&gt; &lt;command&gt;</pre></td></tr></table></div>

<p>You can set the process IO priority in 4 classes (0: none, 1: realtime, 2: best-effort, 3: idle) with some priorities within these classes (0-7, lower being higher prio). But you have to enable the CFQ (Complete Fair Queueing) scheduler first by typing something like that :</p>

<div class="wp_codebox"><table><tr id="p245223"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2452code23"><pre class="sh" style="font-family:monospace;">echo cfq &gt;/sys/block/hda/queue/scheduler</pre></td></tr></table></div>

<p>So the ultimate low priority command will be</p>

<div class="wp_codebox"><table><tr id="p245224"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2452code24"><pre class="sh" style="font-family:monospace;">ionice -c 3 nice -n 20 &lt;command&gt;</pre></td></tr></table></div>

<p>But sometimes changing the CPU and IO priority won&#8217;t change much because the problem you might have might occur within the SQL server for say. So what you do ? Well, you could slow down your low priority program. If you have a low priority php script, you could do it like that :</p>

<div class="wp_codebox"><table><tr id="p245225"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2452code25"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <a href="http://www.php.net/list"><span style="color: #990000;">list</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$load</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/proc/loadavg'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'sleeping '</span><span style="color: #339933;">.</span><span style="color: #000088;">$load</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <a href="http://www.php.net/usleep"><span style="color: #990000;">usleep</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$load</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">1000000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>This program will make a loop that will slow down with the increasing load. It means that this program will always keep space of the system, even if it&#8217;s run hundreads of time.</p>
<p>So yeah, you can now manage efficiently CPU and disk. Are you done ? Not really, there&#8217;s still the memory issue. Memory (RAM) is always fast unless there&#8217;s no memory left, then it&#8217;s paged and everything becomes thousand times slower. You can only disable the virtual memory (swap on Linux), set some memory allocation limits (with ulimit), but that&#8217;s pretty much it.<br />
I would personnally recommend to disable swap and always take more RAM than needed. On servers swap prevent them from having to kill process, but they are so much slowed by it that the whole system is slowed down. And then even ssh server is so slow you have an ssh timeout before reaching the shell.</p>
<p>So, Linux has a great scheduling capacity. But what about NOT scheduling AT ALL ? Well, Linux is also very able to do that. You can put some process in real-time mode, these processes won&#8217;t be interupted by anything unless they are sleeping or waiting for an I/O event.<br />
You can use the Real-Time (RT) mode using the rtprio command :</p>

<div class="wp_codebox"><table><tr id="p245226"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2452code26"><pre class="sh" style="font-family:monospace;">rtprio 99 &lt;command&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/linux-prioritization-do-more-with-less/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stupid C++ vs C# performance comparison</title>
		<link>http://florent.clairambault.fr/stupid-cpp-vs-charp-performance-comparison?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=stupid-cpp-vs-charp-performance-comparison</link>
		<comments>http://florent.clairambault.fr/stupid-cpp-vs-charp-performance-comparison#comments</comments>
		<pubDate>Fri, 26 Feb 2010 20:00:35 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[C# .Net]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[g++]]></category>
		<category><![CDATA[gmcs]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2409</guid>
		<description><![CDATA[I found out that there is real test than the little one i did here. In fact the main interest of the post is this spreadsheet : I recently did a simple and stupid comparison test between C++ (g++) and C# .Net (mono). My point here is that C# can actually be considered as a [...]]]></description>
			<content:encoded><![CDATA[<p>I found out that there is <a href="http://reverseblade.blogspot.com/2009/02/c-versus-c-versus-java-performance.html">real test</a> than the little one i did here. In fact the main interest of the post is this spreadsheet :</p>
<div style="text-align: center">
<a href="http://i.mivi.fr/013092c429a64dd39a55850d8467bad0869e5b35.gif"><img src="http://i.mivi.fr/013092c429a64dd39a55850d8467bad0869e5b35.x.700.gif" /></a>
</div>
<p>I recently did a simple and stupid comparison test between C++ (g++) and C# .Net (mono).</p>
<p>My point here is that C# can actually be considered as a very fast language. It allows automatic hardware-specific optimization. The only real drawback you have in the .Net framework is the garbage collector. It prevents the C# .Net it from being a realtime language/framework. But does it really matter for you ?</p>
<p>The purpose of the following test is to show that C++ isn&#8217;t faster than C# &#8220;as is&#8221;. I KNOW C# can not be faster than C++ because C# can do few hardware specific optimizations when you can do all of them in C++, because all the systems calls have to be done in C/C++ and because there&#8217;s no such thing like Template and forced inlining in C#.</p>
<p>But if you&#8217;re searching for arguments to choose C# .Net over native C++, you should also consider these :</p>
<ul>
<li>C# is much more simple. No headers, the languages specifications are simple and clear</li>
<li>You don&#8217;t have to manage the memory in .Net (no memory leak, optimal memory consumption, etc.)</li>
<li>C# code is as portable as java, it doesn&#8217;t need to be manually ported to a new architecture like C++</li>
<li>.Net don&#8217;t just crash, they always throw an exception and they only crash if nobody catches it</li>
<li>Mono (and presumely the .Net framework) does some really interesting optimizations :

<div class="wp_codebox"><table><tr id="p240936"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2409code36"><pre class="sh" style="font-family:monospace;"># mono --list-opt</pre></td></tr></table></div>

<p>I put some link so that you can learn about these really interesting optimization. This is like design patterns, you should really know these things.</em></p>
<table>
<tr>
<td>peephole</td>
<td><a href="http://en.wikipedia.org/wiki/Peephole_optimization">Peephole postpass</a></td>
</tr>
<tr>
<td>branch</td>
<td><a href="http://www.compileroptimizations.com/category/branch_optimization.htm">Branch optimizations</a></td>
</tr>
<tr>
<td>inline</td>
<td><a href="http://dotnetperls.com/inline-optimization">Inline method calls</a></td>
</tr>
<tr>
<td>cfold</td>
<td><a href="http://www.nullstone.com/htmls/category/consfold.htm">Constant folding</a></td>
</tr>
<tr>
<td>consprop</td>
<td><a href="http://en.wikipedia.org/wiki/Constant_folding#Constant_propagation">Constant propagation</a></td>
</tr>
<tr>
<td>copyprop</td>
<td><a href="http://en.wikipedia.org/wiki/Copy_propagation">Copy propagation</a></td>
</tr>
<tr>
<td>deadce</td>
<td><a href="http://en.wikipedia.org/wiki/Dead_code_elimination">Dead code elimination</a></td>
</tr>
<tr>
<td>linears</td>
<td><a href="http://en.wikipedia.org/wiki/Register_allocation">Linear scan global reg allocation</a></td>
</tr>
<tr>
<td>cmov</td>
<td><a href="http://assemblyrequired.crashworks.org/2009/01/04/fcmp-conditional-moves-for-branchless-math/">Conditional moves</a></td>
</tr>
<tr>
<td>shared</td>
<td>Emit per-domain code</td>
</tr>
<tr>
<td>sched</td>
<td><a href="http://en.wikipedia.org/wiki/Instruction_scheduling">Instruction scheduling</a></td>
</tr>
<tr>
<td>intrins</td>
<td>Intrinsic method implementations</td>
</tr>
<tr>
<td>tailc</td>
<td><a href="http://en.wikipedia.org/wiki/Tail_recursion">Tail recursion and tail calls</a></td>
</tr>
<tr>
<td>loop</td>
<td><a href="http://en.wikipedia.org/wiki/Loop_optimization">Loop related optimizations</a></td>
</tr>
<tr>
<td>fcmov</td>
<td><a href="http://en.wikipedia.org/wiki/FCMOV">Fast x86 FP compares</a></td>
</tr>
<tr>
<td>leaf</td>
<td><a href="http://moby.cs.uchicago.edu/documentation/HTML/ImplNotes/report011.html#htoc82">Leaf procedures optimizations</a></td>
</tr>
<tr>
<td>aot</td>
<td><a href="http://www.mono-project.com/AOT">Usage of Ahead Of Time compiled code</a></td>
</tr>
<tr>
<td>precomp</td>
<td>Precompile all methods before executing Main</td>
</tr>
<tr>
<td>abcrem</td>
<td><a href="http://blogs.msdn.com/clrcodegeneration/archive/2009/08/13/array-bounds-check-elimination-in-the-clr.aspx">Array bound checks removal</a></td>
</tr>
<tr>
<td>ssapre</td>
<td><a href="http://en.wikipedia.org/wiki/Partial_redundancy_elimination">SSA based Partial Redundancy Elimination</a></td>
</tr>
<tr>
<td>exception</td>
<td><a href="http://stackoverflow.com/questions/1108050/does-the-net-jit-optimize-nested-try-catch-statements">Optimize exception catch blocks</a></td>
</tr>
<tr>
<td>ssa</td>
<td><a href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Use plain SSA form</a></td>
</tr>
<tr>
<td>sse2</td>
<td><a href="http://en.wikipedia.org/wiki/SSE2">SSE2 instructions on x86</a></td>
</tr>
<tr>
<td>gshared</td>
<td>Share generics</td>
</tr>
<tr>
<td>simd</td>
<td><a href="http://en.wikipedia.org/wiki/SIMD">Simd intrinsics</a></td>
</tr>
</table>
</li>
<li>Multithreading in .net is much easier than any other language. You even have the parrallel loop operations, like <a href="http://www.lovethedot.net/2009/02/parallelfor-deeper-dive-parallel.html">Parallel.For</a>.</li>
</ul>
<p><strong>SO ! Here is the test&#8230;</strong></p>
<p>I wrote these two sample programs :</p>
<p>One in C++ :</p>

<div class="wp_codebox"><table><tr id="p240937"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code" id="p2409code37"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;iostream&gt;</span>
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">long</span> stupidThing<span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">long</span> nb <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">long</span> out <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">while</span><span style="color: #008000;">&#40;</span> nb <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">0</span> <span style="color: #008000;">&#41;</span>
		out <span style="color: #000040;">*</span><span style="color: #000080;">=</span> nb<span style="color: #000040;">--</span><span style="color: #008080;">;</span>
&nbsp;
&nbsp;
	<span style="color: #0000ff;">return</span> out<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp;
	<span style="color: #0000ff;">long</span> total <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">1000000</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i <span style="color: #008000;">&#41;</span>
		<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">long</span> l <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> l <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">100</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>l <span style="color: #008000;">&#41;</span>
			total <span style="color: #000040;">+</span><span style="color: #000080;">=</span> stupidThing<span style="color: #008000;">&#40;</span> l <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Total : &quot;</span> <span style="color: #000080;">&lt;&lt;</span> total <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>One in C# :</p>

<div class="wp_codebox"><table><tr id="p240938"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code" id="p2409code38"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> test <span style="color: #008000;">&#123;</span>
        <span style="color: #6666cc; font-weight: bold;">class</span> Program <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">long</span> stupidThing<span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">long</span> nb <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                        <span style="color: #6666cc; font-weight: bold;">long</span> ret <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
                        <span style="color: #0600FF; font-weight: bold;">while</span> <span style="color: #008000;">&#40;</span> nb <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">&#41;</span>
                                ret <span style="color: #008000;">*=</span> nb<span style="color: #008000;">--;</span>
                        <span style="color: #0600FF; font-weight: bold;">return</span> ret<span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp;
                        <span style="color: #6666cc; font-weight: bold;">long</span> total <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp;
                        <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">1000000</span><span style="color: #008000;">;</span> <span style="color: #008000;">++</span>i <span style="color: #008000;">&#41;</span>
                                <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">long</span> l <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> l <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">100</span><span style="color: #008000;">;</span> <span style="color: #008000;">++</span>l <span style="color: #008000;">&#41;</span>
                                        total <span style="color: #008000;">+=</span> stupidThing<span style="color: #008000;">&#40;</span> l <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;Total : {0}&quot;</span>, total <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>First of all, I open a shell in real-time priority, because I don&#8217;t want my other processses to mess with my tests :</p>

<div class="wp_codebox"><table><tr id="p240939"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2409code39"><pre class="sh" style="font-family:monospace;"># rtprio 99 bash</pre></td></tr></table></div>

<p>Then I compile the two programs :</p>

<div class="wp_codebox"><table><tr id="p240940"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2409code40"><pre class="sh" style="font-family:monospace;"># gmcs test.cs
# g++ -O4 test.cpp -o test</pre></td></tr></table></div>

<p>And then I launch my test :</p>
<p>On a 64 bits host :</p>

<div class="wp_codebox"><table><tr id="p240941"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2409code41"><pre class="txt" style="font-family:monospace;">Kernel : 2.6.9-023stab051.3-smp #1 SMP Wed Nov 4 18:36:34 MSK 2009 x86_64 x86_64 x86_64 GNU/Linux</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p240942"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code" id="p2409code42"><pre class="sh" style="font-family:monospace;"># time ./test ; time ./test ; time ./test ; time mono test.exe ; time mono test.exe ; time mono test.exe
Total : -6192109806162068864
&nbsp;
real    0m12.433s
user    0m12.394s
sys     0m0.049s
Total : -6192109806162068864
&nbsp;
real    0m12.415s
user    0m12.411s
sys     0m0.014s
Total : -6192109806162068864
&nbsp;
real    0m12.430s
user    0m12.411s
sys     0m0.026s
Total : -6192109806162068864
&nbsp;
real    0m10.311s
user    0m10.287s
sys     0m0.029s
Total : -6192109806162068864
&nbsp;
real    0m10.254s
user    0m10.247s
sys     0m0.011s
Total : -6192109806162068864
&nbsp;
real    0m10.250s
user    0m10.255s
sys     0m0.012s</pre></td></tr></table></div>

<p>C# clearly beats C++ here. Well</p>
<p>On a 32 bits host :</p>

<div class="wp_codebox"><table><tr id="p240943"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2409code43"><pre class="txt" style="font-family:monospace;">Kernel : 2.6.30-2-686 #1 SMP Fri Dec 4 00:53:20 UTC 2009 i686 GNU/Linux</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p240944"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code" id="p2409code44"><pre class="sh" style="font-family:monospace;"># time ./test ; time ./test ; time ./test ; time mono test.exe ; time mono test.exe ; time mono test.exe
Total : 100461056
&nbsp;
real    1m10.927s
user    1m7.376s
sys     0m0.056s
Total : 100461056
&nbsp;
real    1m12.590s
user    1m8.976s
sys     0m0.020s
Total : 100461056
&nbsp;
real    1m13.279s
user    1m9.532s
sys     0m0.056s
Total : -6192109806162068864
&nbsp;
real    2m22.492s
user    2m15.260s
sys     0m0.136s
Total : -6192109806162068864
&nbsp;
real    2m23.002s
user    2m15.760s
sys     0m0.104s
Total : -6192109806162068864
&nbsp;
real    2m25.102s
user    2m17.709s
sys     0m0.144s</pre></td></tr></table></div>

<p>C++ beats C# here, but in 32 bits C++ use other types whereas C# use the same. In C# long is always 64 bits, in C++ it can be 64 bits or 32 bits (depending on the current architecture).</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/stupid-cpp-vs-charp-performance-comparison/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Redirect port on Linux</title>
		<link>http://florent.clairambault.fr/redirect-port-on-linux?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=redirect-port-on-linux</link>
		<comments>http://florent.clairambault.fr/redirect-port-on-linux#comments</comments>
		<pubDate>Mon, 08 Feb 2010 20:00:17 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[port redirect]]></category>
		<category><![CDATA[xinetd]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2325</guid>
		<description><![CDATA[Sometimes, you just need to redirect a port on Linux. The solution I could find is to add an entry into xinetd. Here is a sample /etc/xinetd.d file I have, it just redirects the 587 (tcp) port to the 993 port of gmail&#8217;s servers. I have to do this because Virgin Mobile France blocks the [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, you just need to redirect a port on Linux. The solution I could find is to add an entry into xinetd. Here is a sample /etc/xinetd.d file I have, it just redirects the 587 (tcp) port to the 993 port of gmail&#8217;s servers. I have to do this because Virgin Mobile France blocks the 993 tcp port.<br />
If you&#8217;re in the same situation, you can use my server to access you gmail IMAP access. You just have to set the server name to &#8220;webingenia.com&#8221; and the port to &#8220;587&#8243;.</p>

<div class="wp_codebox"><table><tr id="p232546"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p2325code46"><pre class="txt" style="font-family:monospace;">service submission
{
        disable = no
        flags = REUSE
        port = 587
        socket_type = stream
        protocol = tcp
        user = root
        redirect = 74.125.45.109 993
        #server = /usr/bin/nc
        #serer_args = 74.125.45.109 993
        wait = no
}</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/redirect-port-on-linux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mono Tools for Visual Studio</title>
		<link>http://florent.clairambault.fr/mono-tools-for-visual-studio-2?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mono-tools-for-visual-studio-2</link>
		<comments>http://florent.clairambault.fr/mono-tools-for-visual-studio-2#comments</comments>
		<pubDate>Tue, 29 Dec 2009 06:00:16 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Commercial]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Novell]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2252</guid>
		<description><![CDATA[I talked about this earlier. The mono tools for Visual Studio is a commercial product that easily enables you to test and port your Windows applications to mono. As I told before this is really a great idea. Because I think Visual Studio is the best IDE and Linux is the best server OS (in [...]]]></description>
			<content:encoded><![CDATA[<p>I talked about this <a href="http://florent.clairambault.fr/mono-tools-for-visual-studio-i-have-tested-it">earlier</a>. </p>
<p><a href="http://www.go-mono.com/monotools/">The mono tools for Visual Studio</a> is a commercial product that easily enables you to test and port your Windows applications to mono. </p>
<p>As I told before this is really a great idea. Because I think Visual Studio is the best IDE and Linux is the best server OS (in my opinion, it&#8217;s more efficient and more robust than Windows Server). So, I think it&#8217;s the perfect gateway between this two very different (but very close since Mono appeared) environments to achieve greatness.</p>
<p>And if you don&#8217;t want to buy it, well, you don&#8217;t have to. Mono is free and you can very easily test your Windows programs on it. You just have to install mono, copy your exe (plus its required DLLs) to the Linux host and type something like &#8220;mono SampleProgram.exe&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/mono-tools-for-visual-studio-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JObexFTP from Ricardo Schmidt</title>
		<link>http://florent.clairambault.fr/jobexftp-from-ricardo-schmidt?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jobexftp-from-ricardo-schmidt</link>
		<comments>http://florent.clairambault.fr/jobexftp-from-ricardo-schmidt#comments</comments>
		<pubDate>Sat, 19 Dec 2009 22:20:31 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Cinterion]]></category>
		<category><![CDATA[JObexFTP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MES]]></category>
		<category><![CDATA[TC65]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2216</guid>
		<description><![CDATA[Ricardo Schmidt made a great multi-platform TC65 control and file management tool called JOBextFTP. This can be used for anyone whose Module Exchange Suite (MES) doesn&#8217;t work or doesn&#8217;t work correctly. The biggest effort is put on managing the OBEX file transmission protocol, but it also does offer some simple methods that can be integrated [...]]]></description>
			<content:encoded><![CDATA[<p>Ricardo Schmidt made a great multi-platform TC65 control and file management tool called <a href="https://github.com/3esmit/JObexFTP">JOBextFTP</a>. This can be used for anyone whose <a href="http://florent.clairambault.fr/tag/mes">Module Exchange Suite (MES)</a> doesn&#8217;t work or doesn&#8217;t work correctly.</p>
<p>The biggest effort is put on managing the OBEX file transmission protocol, but it also does offer some simple methods that can be integrated in your development process, like &#8220;turnOn&#8221;, &#8220;turnOff&#8221;, &#8220;getTime&#8221;, &#8220;runApp&#8221;.</p>
<p>I&#8217;m really sorry but I didn&#8217;t take the time to test it as I&#8217;m currently not making some TC65 development. But it looks very operational to me.</p>
<p>Maybe I should start a list of useful TC65 softwares. I can already see this one to help you deploy programs and files locally and my <a href="http://florent.clairambault.fr/sms-otap-program-for-the-tc65-updated">SMSOTAP</a> to help you deploy programs remotely.</p>
<p><a name="2011-02-24"></a><br />
<strong style="color: red">Update: JObexFTP 2.4</strong><br />
<em>Thu, Feb 24, 2011 at 00:51</em></p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello,</p>
<p>You recieved this email due your interest in JObexFTP.</p>
<p>JObexFTP have new cool features!<br />
Now we can:<br />
- move files and folder with mv command<br />
- change mode of files and folder with chmod command<br />
- see the total disk space and the free space.</p>
<p>Checkout the changelog from the past 2 releases:</p>
<p>JObexFTP 2.4<br />
- Added disk information in about command<br />
- Added move (mv) operation<br />
- Added change mode (chmod) operation<br />
JObexFTP 2.3<br />
- Improved ObexClose.<br />
- Improved estability.<br />
- Faster operations.<br />
- Code clean up.<br />
- Fixed getContents of binary OBEXFile</p>
<p>Thank you for the attention!
</p></div>
<p><a name="2011-01-29"></a><br />
<strong style="color: red">Update: New interface</strong><br />
<em>Sat, Jan 29, 2011 at 08:12</em></p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello,</p>
<p>You received this email due your interest in JObexFTP.</p>
<p>New utilities: emulator and cmd_autoexec_off.sh<br />
New TC65SH UI: An improved user interface based on TC65SH 1.2.0<br />
Makefile: just type `make &#038;&#038; sudo make install` and call it by<br />
`jobexftp` from anywhere in your linux. (It also installs the rxtxlib)</p>
<p>Using JObexFTP emulator with your IDE your going to send files to<br />
module, execute and follow their output, all in the IDE. Stack Traces<br />
are automatically parsed by IDE and shown in a programmer friendly way.<br />
Check out attached screen shot.<br />
JObexFTP emulator also turns on your device if is not yet, and attempts<br />
to leave data mode if no response to at commands (just using echo and<br />
cat).</p>
<p>binaries, libraries and sources available to download in github</p>
<p>https://github.com/3esmit/JObexFTP/</p>
<p>Any feature request, issues, experiences or improvements with JObexFTP<br />
please contact me, I will be pleased in have your feedback.</p>
<p>Thank you for the attention,<br />
Ricardo Guilherme Schmidt
</p></div>
<p><strong style="color: red">Update : JObexFTP version 2.0</strong><br />
Ricardo Schmidt sent an other mail about his project on the <a href="https://groups.google.com/forum/#!forum/javacint" target="_blank">javacint group</a>, on Oct 22, 2010 at 14:51 :</p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello community,</p>
<p>I&#8217;ve just released JOBEXFTP 2.0 (beta), which brings tons of<br />
improvements from last version due total refactoring of code. Its<br />
better then never, check out sources!<br />
Now the transfers are stable and 60% much faster. If you are a maniac<br />
object oriented programmer, you going to love it, since it follow many<br />
project patterns as listeners, notify, encapsulation.<br />
The program API is a truly Java library, with easy Obex FTP calls.<br />
Full information available in project README.</p>
<p>The project is released under LGPL and need your feedback.</p>
<p>Access: http://www.github.com/3esmit/jobexftp
</p></div>
<p>Here is the email Ricardo Schmidt sent me on the 17 December 2009 :<br />
<em>I modified and formated some parts of the original mail.</em></p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello Florent,</p>
<p>    With Ondrej ObexTool sources, that I <a href="http://florent.clairambault.fr/tc65-module-exchange-suite-mes-problems#comment-557">met through your blog</a>, I made up a new tool (think OO). So I made a library to help developers make multiplatform easy communication with TC65 and simmilar modules.<br />
I&#8217;m already using it in a desktop configuration program for my M2M application and it just works great.<br />
     It have some TODOs and maybe some bugs, but it have a nice object oriented programming. Also I abused of the exceptions, becouse this project is not just an application, but also a library. You can use it to develop your configurator programs, its very easy to do with it.<br />
     The code is fully in english, but in future I pretend make it multilanguage. For now it just garantees that TC65 is going to work with it, but I belive TC65i and XT75 should work as TC65, since it under the same AT &#8220;platform&#8221;.</p>
<p><strong>Some nice features in the library :</strong></p>
<ul>
<li>Auto turns on/off the module</li>
<li>If for some previous crash it stayed in DATAMODE, it sends the +++<br />
until it get the COMMANDMODE again.</li>
<li>You can choose for seeing verbose messages and for seeing the AT<br />
communication.</li>
<li>You can send a String as a file to the module.</li>
<li>You recieve a file as a String from module (since writing a file is easy).</li>
<li>Working in windows platf (under test)</li>
</ul>
<p><strong>Some nice features in the application :</strong></p>
<ul>
<li>Argument configurable on/off module, verbose and show atcomand.</li>
<li>Download, upload and list files just in one connection (no limit) ex.: jobexftp /dev/ttyACM0 -u arq1.ext arq2.ext arq3.ext arq4.ext -l -d filetodown.ext -V -A</li>
<li>Option to just stdout the file. (sometimes we just need to see the<br />
contents)</li>
</ul>
<p><strong>TODOs:</strong></p>
<ul>
<li>Documentation (kinda important)</li>
<li>Auto run jars (in library is ready, just for app)</li>
<li>Choose folder to send the file (easy task)</li>
<li>MacOSX adaption (maybe its already working, I dont have any macs to test)</li>
<li>Multilanguage</li>
</ul>
<p>The listing comes in the XML from library, I think that this should be treated just in the applications, since the xml is very good for programming analyse.</p>
<p>Hope you like it.</p>
<p>You can get the latest sources from project kenai : <a href="http://www.kenai.com/projects/jobexftp">http://www.kenai.com/projects/jobexftp</a></p>
<p><a href="http://kenai.com/">Kenai</a> is NetBeans integrated, and it uses subversion. This project is opensource under GPL (application) and under LGPL (library).</p>
<p>Thank you for the attention,<br />
Ricardo Schmidt
</p></div>
<p>Here is an other message Ricardo sent on the 18 March 2010 :</p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello developers,</p>
<p>Due to the kenai closing, and to have the best control version system, JObexFTP have moved to github.com.<br />
Now we can manage projects better with git control version. If you dont know Git, you should!<br />
The Kenai&#8217;s JObexFTP will be closed soon, the repository is already deleted.<br />
Note: The old JObexFTP versions are lost due to new commit.<br />
Please consider joining my project. </p>
<p><strong>What is JObexFTP?</strong><br />
Its a fully opensource library (and application) to transfer files from/to obex server.<br />
You can use it in any J2SE application to enable java communication to module without third party app. You can also use it as a MES in unsupported cinterion plataforms like Linux.<br />
For now it just supports cinterion modules due to ATCommand spec.<br />
It needs RxTx library to have the serial communication. </p>
<p><strong>JObexFTP news:</strong><br />
Now we have fully OO obex objects (files/folders).<br />
The downloading files is speeded up. </p>
<p><strong>Under development:</strong><br />
Human readable folder listing<br />
Multilanguage</p>
<p><strong>Known issues:</strong><br />
Deleting multiple files is buggy and needs reconnection. (Its also buggy in windows MES, but here is a way more buggy)<br />
In Windows sometimes it takes more time to have obex ready to read folder listing (I hate you microsoft)
</div>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/jobexftp-from-ricardo-schmidt/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/39 queries in 0.015 seconds using disk: basic
Object Caching 1631/1718 objects using disk: basic

Served from: florent.clairambault.fr @ 2012-02-07 10:33:21 -->
