<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Persistent Inappeasable Mind - Software hints</title>
    <link>http://pim.famnit.upr.si/blog/</link>
    <description>thoughts about personal information management, human-computer interaction, interfaces, software ...</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.6 - http://www.s9y.org/</generator>
    <pubDate>Mon, 29 Apr 2013 22:53:58 GMT</pubDate>

    <image>
        <url>http://pim.famnit.upr.si/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Persistent Inappeasable Mind - Software hints - thoughts about personal information management, human-computer interaction, interfaces, software ...</title>
        <link>http://pim.famnit.upr.si/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>AngularJS: show progress of a form by counting the number of disabled fields</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/299-AngularJS-show-progress-of-a-form-by-counting-the-number-of-disabled-fields.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/299-AngularJS-show-progress-of-a-form-by-counting-the-number-of-disabled-fields.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=299</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=299</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;Let say &lt;strong&gt;we have a survey with&lt;/strong&gt; many questions. Some &lt;strong&gt;questions&lt;/strong&gt; are &lt;strong&gt;enabled and some disabled at first and this keeps changing&lt;/strong&gt; based on what is selected or entered. &lt;strong&gt;At any given time we want to know the count of all fields&lt;/strong&gt; in a form, how many of them are &lt;strong&gt;disabled and&lt;/strong&gt; how many still &lt;strong&gt;required&lt;/strong&gt;. The number of all and required fields is easy as AngularJS keeps an array of all form elements. Disabled elements are something else.&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;Counting disabled fields can be a challenge&lt;/strong&gt; if many radio buttons are used, as every radio button is counted as one element. &lt;/p&gt; 
&lt;p&gt;Lets take this code for example: &lt;/p&gt; 
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt; &amp;lt;!doctype html&amp;gt;
 &amp;lt;html&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;head&amp;gt;&amp;#160;&amp;#160;&amp;#160; 
        &amp;lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;/head&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;body&amp;gt;
    
    &amp;lt;form&amp;gt;
     &amp;lt;input type=&quot;radio&quot; name=&quot;typeComputer2&quot; disabled&amp;gt; 1&amp;lt;br&amp;gt;
     &amp;lt;input type=&quot;radio&quot; name=&quot;typeComputer2&quot; disabled&amp;gt; 2&amp;lt;br&amp;gt;
     &amp;lt;input type=&quot;radio&quot; name=&quot;typeComputer2&quot; disabled&amp;gt; 3&amp;lt;br&amp;gt;
    &amp;lt;/form&amp;gt;           
    &amp;lt;div id=&quot;res&quot;&amp;gt;&amp;lt;/div&amp;gt;

    &amp;lt;script&amp;gt;
      var bla = $(&#039;:disabled&#039;).length;
      $(&#039;#res&#039;).text(&quot;Number of disabled elements: &quot; + bla);
    &amp;lt;/script&amp;gt;
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/body&amp;gt;
 &amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;/pre&gt; 
&lt;p&gt;Will produce this:&lt;br /&gt;&lt;/p&gt; 
&lt;blockquote&gt;&lt;img src=&quot;uploads/disabled_elements.png&quot; class=&quot;no_float&quot; /&gt; &lt;/blockquote&gt; 
&lt;p&gt;The number of &lt;strong&gt;disabled elements is 3&lt;/strong&gt;. &lt;strong&gt;But in fact&lt;/strong&gt; this is the same group of radio buttons and &lt;strong&gt;could be counted as one element&lt;/strong&gt; (only one radio button can be selected at once). &lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;Lets look at the solution using AngularJS.&lt;/strong&gt;&lt;/p&gt; 
&lt;p&gt;We have this HTML document with 3 form elements. &lt;/p&gt; 
&lt;ul&gt; 
&lt;li&gt;First one is 3 radio buttons that are disabled and not required until the checkbox is selected&lt;/li&gt; 
&lt;li&gt;Second is a required radio button&lt;/li&gt; 
&lt;li&gt;Third is a required input field&lt;br /&gt;&lt;/li&gt; 
&lt;/ul&gt; 
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt;&amp;lt;html ng-app&amp;gt;
&amp;#160; &amp;lt;head&amp;gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;script src=&quot;http://code.angularjs.org/1.1.0/angular.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
     &amp;lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;lt;script src=&quot;controller.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;#160; &amp;lt;/head&amp;gt;
&amp;#160; &amp;lt;body&amp;gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 
&amp;#160;&amp;#160;&amp;#160; &amp;lt;div ng-controller=&quot;ctrlRead&quot;&amp;gt;

&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;form name=&quot;survey&quot;&amp;gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input type=&quot;radio&quot; name=&quot;n1&quot; value=&quot;1&quot; ng-model=&quot;s.el1&quot; 
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ng-required=&quot;s.el2&quot; ng-disabled=&quot;!s.el2&quot;&amp;gt; 1&amp;lt;br&amp;gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input type=&quot;radio&quot; name=&quot;n1&quot; value=&quot;2&quot; ng-model=&quot;s.el1&quot; 
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ng-required=&quot;s.el2&quot; ng-disabled=&quot;!s.el2&quot;&amp;gt; 2&amp;lt;br&amp;gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input type=&quot;radio&quot; name=&quot;n1&quot; value=&quot;3&quot; ng-model=&quot;s.el1&quot; 
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ng-required=&quot;s.el2&quot; ng-disabled=&quot;!s.el2&quot;&amp;gt; 3&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;

&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input type=&quot;checkbox&quot; name=&quot;n2&quot; ng-model=&quot;s.el2&quot; ng-required=&quot;true&quot;&amp;gt; a&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;

&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input type=&quot;text&quot; name=&quot;n3&quot; ng-model=&quot;s.el3&quot; ng-required=&quot;true&quot;&amp;gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/form&amp;gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 

&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;div id=&quot;res&quot;&amp;gt; 
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Disabled: {{eDisabled}} &amp;lt;br&amp;gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; All: {{eAll}}&amp;#160; &amp;lt;br&amp;gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Required: {{eRequired}} &amp;lt;br&amp;gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Done in %: {{eDonePercent}} &amp;lt;br&amp;gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Valid: {{survey.$valid}}
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/div&amp;gt;

&amp;#160;&amp;#160;&amp;#160; &amp;lt;/div&amp;gt;
&amp;#160; &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt; 
&lt;p&gt;Now we need to write our controller.js&lt;/p&gt; 
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt;function ctrlRead($scope, $timeout) {

&amp;#160; //a variable to store our survey data
&amp;#160; var s = {}; 
&amp;#160; $scope.s = s;

&amp;#160; //watch for the sur variable to change
&amp;#160; $scope.$watch(&quot;s&quot;, function () {
&amp;#160;&amp;#160;&amp;#160;&amp;#160; //timeout to fire events 100ms later 
     //for DOM to register the changes
&amp;#160;&amp;#160;&amp;#160;&amp;#160; $timeout($scope.countPercentageDone, 100);
&amp;#160; }, true);

&amp;#160; $scope.countPercentageDone = function() {&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 
&amp;#160;&amp;#160;&amp;#160; var requiredTrue=0;
&amp;#160;&amp;#160;&amp;#160; var requiredFalse=0;
&amp;#160;&amp;#160;&amp;#160; var disabledElementNames = new Array();&amp;#160;&amp;#160;&amp;#160; 
&amp;#160;
&amp;#160;&amp;#160;&amp;#160; if ($scope.survey) { 
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //this traverses the form elements stored in form name
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $.each($scope.survey, function(index, value) {
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //survey holds other elements ... 
        //only form elements have $error object
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if ($scope.survey[index].$error) { 
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if ($scope.survey[index].$error.required == true) {
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; requiredTrue++;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } else {
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; requiredFalse++;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //check if the form element is disabled
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if ($(&quot;[name=&quot;+$scope.survey[index].$name+&quot;]:disabled&quot;)) {
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //if it is and it is not just element filled in 
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //element also become disabled once filled in!!
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if ($(&quot;[name=&quot;+$scope.survey[index].$name+&quot;]:disabled&quot;).length != 0) { 
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; disabledElementNames.push($scope.survey[index].$name);
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; });
&amp;#160;&amp;#160;&amp;#160; }

&amp;#160;&amp;#160;&amp;#160; $scope.eDisabled = disabledElementNames.length;
&amp;#160;&amp;#160;&amp;#160; $scope.eAll = requiredTrue+requiredFalse;
&amp;#160;&amp;#160;&amp;#160; $scope.eRequired = requiredTrue;
&amp;#160;&amp;#160;&amp;#160; $scope.eDonePercent = 100-((requiredTrue*100)/(requiredTrue+requiredFalse-disabledElementNames.length));
&amp;#160; }

};
&lt;/pre&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;p&gt;To summarise the code: &lt;/p&gt; 
&lt;ul&gt; 
&lt;li&gt;We traverse all form elements in the $scope.survey array. &lt;br /&gt;&lt;/li&gt; 
&lt;li&gt;Because this array contains other elements as well as form elements, we have to look only at those that have an $error object defined. &lt;br /&gt;&lt;/li&gt; 
&lt;li&gt;In all elements that are not required we look for those that have lenght &amp;gt; 0. &lt;br /&gt;We do this because elements that we fill in also become disabled by AngularJS. &lt;/li&gt; 
&lt;/ul&gt; 
&lt;p&gt;This example is also available in &lt;a href=&quot;http://jsfiddle.net/yY3tN/&quot;&gt;jsfiddle&lt;/a&gt;.&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;For the progress bar we could use bootstrap&lt;/strong&gt;:&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt;&lt;p&gt;  
  &amp;lt;div class=&quot;progress&quot;&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;lt;div class=&quot;bar&quot; style=&quot;width: {{eDonePercent}}%&quot;&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

&lt;/p&gt;&lt;/pre&gt; 
&lt;p&gt;or any of the &lt;a href=&quot;index.php?/archives/297-Bootstrap-progress-bar-in-100-images-for-older-browsers.html&quot;&gt;solutions I wrote about here&lt;/a&gt; to support older browsers.&lt;/p&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;p&gt;A big thanks to Tine for all the suggestions and help.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 04 Mar 2013 09:54:00 +0100</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/299-guid.html</guid>
    
</item>
<item>
    <title>Bootstrap progress bar in 100 images for older browsers</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/297-Bootstrap-progress-bar-in-100-images-for-older-browsers.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/297-Bootstrap-progress-bar-in-100-images-for-older-browsers.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=297</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=297</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;These are assumptions taken here:&lt;/p&gt; 
&lt;ul&gt; 
&lt;li&gt;&lt;a href=&quot;http://twitter.github.com/bootstrap/components.html#progress&quot;&gt;Bootstrap&lt;/a&gt; progress bars are nice&lt;/li&gt; 
&lt;li&gt;They do not work in IE 6-9 (I really wonder why 24% of web users don&#039;t upgrade their browsers):&lt;br /&gt;&lt;em&gt;&amp;quot;Progress bars use CSS3 gradients, transitions, and animations to achieve
 all their effects. These features are not supported in IE7-9 or older 
versions of Firefox.&amp;quot;&lt;/em&gt;&lt;/li&gt; 
&lt;li&gt;I needed a progress bar for a web form that would work in all browsers &lt;br /&gt;&lt;/li&gt; 
&lt;li&gt;I&#039;m calculating how much of a web form is completed with &lt;a href=&quot;http://angularjs.org/&quot;&gt;AngularJS&lt;/a&gt; and change the progress bar on he fly.&lt;/li&gt; 
&lt;/ul&gt; 
&lt;p&gt;Let&#039;s start.&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;1. Create 100 progress bars using a php loop and a &lt;a href=&quot;http://twitter.github.com/bootstrap/components.html#progress&quot;&gt;Bootstrap progress bar code&lt;/a&gt;:&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt; &amp;lt;!doctype html&amp;gt;
 &amp;lt;html&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;head&amp;gt;&amp;#160;&amp;#160;&amp;#160; 
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;lib/bootstrap/css/bootstrap.min.css&quot;&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;lt;script src=&quot;lib/bootstrap/js/bootstrap.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;/head&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;body&amp;gt;

&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;lt;div id=&quot;progress_bar&quot; style=&quot;width: 500px; margin: 10px auto 0 auto&quot;&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;lt;?php
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; for ($i=0; $i&amp;lt;101; $i++) { 
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; echo &#039;&amp;#160; &amp;lt;div class=&quot;progress&quot; &lt;span&gt;&lt;span class=&quot;attribute-name&quot;&gt;style&lt;/span&gt;=&quot;&lt;a class=&quot;attribute-value&quot;&gt;margin: 2px&lt;/a&gt;&quot;&lt;/span&gt;&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;lt;div class=&quot;bar&quot; style=&quot;width: &#039;.$i.&#039;%&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;lt;/div&amp;gt;&#039;;
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; }&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; 
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; ?&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;lt;/div&amp;gt;
&amp;#160;&amp;#160;&amp;#160; &amp;lt;/body&amp;gt;
 &amp;lt;/html&amp;gt;&lt;/pre&gt; 
&lt;p&gt;It is possible to use other colours and stripes, etc ... but I&#039;ll use simplest progress bar. Keep in mind that my outer div is 500px wide as this is the size of a progress bar I wanted.&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;2. Crop the progress bars from a web page produces by the above code &lt;/strong&gt;&lt;/p&gt; 
&lt;p&gt;The simplest way is to use &lt;a href=&quot;http://awesomescreenshot.com/&quot;&gt;Awesome screenshot&lt;/a&gt; extension for Chrome, Safari or Firefox. It is also good to cut down the image size with e.g. re-saving it for the web so it would be smaller in size (not resolution).&lt;/p&gt; 
&lt;p&gt;I ended up with this image (&lt;a href=&quot;uploads/progressbar_small.png&quot;&gt;original size can be downloaded here&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;uploads/progressbar_small.png&quot;&gt;&lt;img class=&quot;no_float&quot; src=&quot;uploads/progressbar_small_tn.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;This can be already the end of the story. The only thing wee need is to use this image as a background of a div and slide up or down based on the percentage we want to show.&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;3. Show the progress bar &lt;/strong&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;3.1 Using CSS&lt;/strong&gt; background-position &lt;strong&gt;and AngularJS binding&lt;/strong&gt; &lt;/p&gt; 
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt; &amp;lt;div style=&quot;float: left;&quot;&amp;gt;Progress: &amp;lt;/div&amp;gt;
 &amp;lt;div style=&quot;width: 500px; height: 22px; float: left;
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160; background-image:url(&#039;progressbar_small.png&#039;); 
&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160; &amp;#160; background-position:0px -{{Math.round(22*(percentage))}}px;&quot;&amp;gt;
 &amp;lt;/div&amp;gt;&lt;/pre&gt; 
&lt;p&gt;Each progress bar is 22px high and I multiply it with the percentage I calculate based on how much of the form is filled in. I also use the Math JS in binding for multiplication (maybe there&#039;s a better way but I&#039;m not aware of any). To do this I had to define the Math object in my $scope this way $scope.Math = window.Math;&amp;#160; &lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;For some reason the above did not work in IE 8 (which I really care about). Although it apparently works on some web sites. So i decided to slice up the above image in 100 images.&lt;/p&gt; 
&lt;p&gt; &lt;strong&gt;3.2 Using individual images&lt;/strong&gt;&lt;/p&gt; 
&lt;p&gt;This is not the optimum solution as for every change there is an Ajax get call to retrieve a desired image. We did this only once in the above example.&lt;/p&gt; 
&lt;p&gt;This procedure was also &lt;a href=&quot;http://pim.famnit.upr.si/blog/index.php?/archives/298-Slice-up-an-image-in-100-slices-with-ImageMagick-or-a-progress-bar-in-100-images.html&quot;&gt;explained in a previous post&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;First I sliced up the image with &lt;a href=&quot;http://www.imagemagick.org/Usage/crop/#crop&quot;&gt;ImageMagick using a crop flag&lt;/a&gt; (the second command should be in one line) using a bash one line script:&lt;br /&gt;&lt;/p&gt; 
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt; mk@here/$ ls
 progressbar_small.png

 mk@here/$ for((i=0; i&amp;lt;101; i++)) ; do n=$[i*22]; \ 
          convert progressbar_small.png -crop 500x22+0+$n +repage progressbar${i}.png; \
          done

 mk@here/$ ls
 progressbar0.png&amp;#160;&amp;#160;&amp;#160; progressbar32.png&amp;#160; progressbar56.png&amp;#160; progressbar7.png
 ...
 progressbar2.png&amp;#160;&amp;#160;&amp;#160; progressbar53.png&amp;#160; progressbar77.png&amp;#160; progressbar_small.png
&lt;/pre&gt; 
&lt;p&gt;The -crop flag slices up images 500px wide and 22px high and starts at 0px on the X axis and goes down 22*i where i runs from 0 to 100. The end results are 100 images.&lt;/p&gt; 
&lt;p&gt;And finally the HTML bit: &lt;br /&gt;&lt;/p&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt; &amp;lt;div style=&quot;float: left;&quot;&amp;gt;Progress: &amp;lt;/div&amp;gt;
 &amp;lt;div style=&quot;width: 500px; height: 22px; float: left;&quot;&amp;gt;
     &amp;lt;img src=progressbar{{Math.round(22*(percentage))}}.png&quot;&amp;gt;
 &amp;lt;/div&amp;gt;&lt;/pre&gt; 
&lt;p&gt;All&amp;#160; images are available &lt;a href=&quot;uploads/progress_bar.zip&quot;&gt;in this zip file&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;I hope this can help someone.&lt;/p&gt; 
&lt;p&gt;Any other suggestions greatly appreciated.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;A big thank you to Tine for all the suggestions and help.&lt;br /&gt;&lt;/p&gt; 
&lt;ul&gt; &lt;/ul&gt; 
    </content:encoded>

    <pubDate>Mon, 11 Feb 2013 06:33:00 +0100</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/297-guid.html</guid>
    
</item>
<item>
    <title>Slice up an image in equal slices with ImageMagick or a progress bar in 100 images</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/298-Slice-up-an-image-in-equal-slices-with-ImageMagick-or-a-progress-bar-in-100-images.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/298-Slice-up-an-image-in-equal-slices-with-ImageMagick-or-a-progress-bar-in-100-images.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=298</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=298</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;Let&#039;s assume we need a progress bar in 101 images where each shows a particular percentage form 0 to 100. How to create such image will be explained in &lt;a href=&quot;http://pim.famnit.upr.si/blog/index.php?/archives/297-Bootstrap-progress-bar-in-100-images-for-older-browsers.html&quot;&gt;the next post&lt;/a&gt; (not ready yet at the time of writing). &lt;a href=&quot;uploads/progressbar_small.png&quot;&gt;I already prepared the image here&lt;/a&gt;. &lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;The easiest way to slice up an image is &lt;strong&gt;in a command lin&lt;/strong&gt;e using &lt;a href=&quot;http://www.imagemagick.org/Usage/crop/#crop&quot;&gt;&lt;strong&gt;ImageMagick&lt;/strong&gt;&#039;s a crop flag&lt;/a&gt;. The first command shows the image file we are going to slice. The second command (which should be in one line) is &lt;strong&gt;a simple a bash for loop&lt;/strong&gt; and&lt;strong&gt; in each iteration we create a new slice&lt;/strong&gt;. The third command just lists files that we created.&lt;br /&gt;&lt;/p&gt; 
&lt;pre style=&quot;background-color: #ffffd2;&quot;&gt; &lt;strong&gt;mk@here/$&lt;/strong&gt; ls
 progressbar_small.png

&lt;strong&gt; mk@here/$&lt;/strong&gt; for((i=0; i&amp;lt;101; i++)) ; do n=$[i*22]; \ 
           convert progressbar_small.png -crop 500x22+0+$n +repage progressbar${i}.png; \
           done

 &lt;strong&gt;mk@here/$&lt;/strong&gt; ls
 progressbar0.png&amp;#160;&amp;#160;&amp;#160; progressbar32.png&amp;#160; progressbar56.png&amp;#160; progressbar7.png
 ...
 progressbar2.png&amp;#160;&amp;#160;&amp;#160; progressbar53.png&amp;#160; progressbar77.png&amp;#160; progressbar_small.png
&lt;/pre&gt; 
&lt;p&gt;The -crop flag slices up images 500px wide and 22px high and starts 
at 0px on the X axis and goes down 22*i where i runs from 0 to 100. The 
end results are 100 images.&lt;/p&gt; 
&lt;p&gt;All images are available &lt;a href=&quot;http://pim.famnit.upr.si/blog/uploads/progress_bar.zip&quot;&gt;in this zip file&lt;/a&gt;.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 04 Feb 2013 07:38:00 +0100</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/298-guid.html</guid>
    
</item>
<item>
    <title>LaTeX - insert a PDF table as an image in a table environment</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/282-LaTeX-insert-a-PDF-table-as-an-image-in-a-table-environment.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/282-LaTeX-insert-a-PDF-table-as-an-image-in-a-table-environment.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=282</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=282</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;On of the most painful (at least IMHO) things to create in LaTeX are complex or big tables. It is easier to make them in a spreadsheet software (Libreoffice Calc, MS Excel or even Word) and export them as PDFs (either File-&amp;gt;Export as PDF, File-&amp;gt;Save as or using &lt;a href=&quot;http://sourceforge.net/projects/pdfcreator/&quot;&gt;PDFCreator&lt;/a&gt;). It is possible to &lt;strong&gt;insert PDFs as images in figure environment&lt;/strong&gt; like this:
&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wra&lt;/style&gt; &lt;/p&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;&lt;span style=&quot; color:#0000cc;&quot;&gt;\begin&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{figure}[!&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;ht&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;]&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt; &lt;span style=&quot; color:#0000cc;&quot;&gt;\begin&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{center}                                      &lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;   &lt;span style=&quot; font-weight:600; color:#0000cc;&quot;&gt;\includegraphics&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;[width=0.85&lt;/span&gt;&lt;span style=&quot; color:#800000;&quot;&gt;\textwidth&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;]{images/table-frameworks-overlap.pdf}                                                                  &lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;&lt;span style=&quot; color:#000000;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; color:#0000cc;&quot;&gt;\end&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{center}&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;&lt;span style=&quot; color:#000000;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; color:#800000;&quot;&gt;\caption&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{Similarities and overlap between the two &lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;PIM&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt; frameworks}&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;&lt;span style=&quot; color:#000000;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; font-weight:600; color:#0000cc;&quot;&gt;\label&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{fig:table-frameworks-overlap}&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;&lt;span style=&quot; color:#0000cc;&quot;&gt;\end&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{figure}&lt;/span&gt;&lt;/pre&gt; 
&lt;p&gt;However, &lt;strong&gt;this caption starts with the word &amp;quot;Image X: ...&amp;quot;&lt;/strong&gt; while I want to have a caption stating with &amp;quot;Table X: ...&amp;quot;. &lt;/p&gt; 
&lt;p&gt;It is possible to &lt;strong&gt;insert a PDF in a table environment&lt;/strong&gt; as well like this:
&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }&lt;/style&gt; &lt;/p&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;&lt;span style=&quot; color:#0000cc;&quot;&gt;\begin&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{table}[&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;ht&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;]&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;  &lt;span style=&quot; color:#800000;&quot;&gt;\caption&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{A table}&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;  &lt;span style=&quot; color:#800000;&quot;&gt;\centering&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;  &lt;span style=&quot; color:#0000cc;&quot;&gt;\begin&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{tabular}{c}&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;    &lt;span style=&quot; color:#0000cc;&quot;&gt;\begin&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{center}                                                                         &lt;/span&gt;&lt;span style=&quot; color:#606060;&quot;&gt;&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;      &lt;span style=&quot; font-weight:600; color:#0000cc;&quot;&gt;\includegraphics&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;[width=0.85&lt;/span&gt;&lt;span style=&quot; color:#800000;&quot;&gt;\textwidth&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;]{images/table-studies.pdf} &lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;    &lt;span style=&quot; color:#0000cc;&quot;&gt;\end&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{center}     &lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;  &lt;span style=&quot; color:#0000cc;&quot;&gt;\end&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{tabular}&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;  &lt;span style=&quot; font-weight:600; color:#0000cc;&quot;&gt;\label&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{tab:}&lt;/span&gt;&lt;/pre&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;&lt;span style=&quot; color:#0000cc;&quot;&gt;\end&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{table}&lt;/span&gt;&lt;/pre&gt; 
&lt;p&gt;If a PDF needs to be cropped you can do it like this:&lt;/p&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;&lt;span style=&quot; font-weight:600; color:#0000cc;&quot;&gt;&lt;span style=&quot; color:#606060;&quot;&gt;                                                       %left, bottom, right, top
&lt;/span&gt;\includegraphics&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;[width=0.85&lt;/span&gt;&lt;span style=&quot; color:#800000;&quot;&gt;\textwidth,&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt; clip=true, trim=&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;0cm&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;0cm&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;0cm&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;0cm&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;]&lt;/span&gt;&lt;/pre&gt; 
&lt;p&gt;You might also need the following package:
&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wra&lt;/style&gt; &lt;/p&gt; 
&lt;pre style=&quot;margin: 0px; text-indent: 0px;&quot;&gt;&lt;span style=&quot; color:#800000;&quot;&gt;\usepackage&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;{graphicx}&lt;/span&gt;&lt;/pre&gt; 
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;p&gt; &lt;/p&gt; 
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 17 Dec 2012 06:31:00 +0100</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/282-guid.html</guid>
    
</item>
<item>
    <title>Add a blur to a part of a video with Avidemux</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/264-Add-a-blur-to-a-part-of-a-video-with-Avidemux.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/264-Add-a-blur-to-a-part-of-a-video-with-Avidemux.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=264</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=264</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;I made a video of &lt;a href=&quot;http://pim.famnit.upr.si/blog/index.php?/archives/263-Add-circle,-logo,-image-or-blur-to-video-with-Avidemux.html&quot;&gt;how to emphasize (add a circle over a face) things in a video with Avidemux&lt;/a&gt;. The same can be done for adding a blur with a different filter - Mplayer delogo.&lt;br /&gt;&lt;br /&gt;However, blurring just one part of the video with the Mplayer delogo filter once failed on me. I wanted to add a blur just for five seconds over a face in a longer video. If I didn&#039;t specify the frames (Partial button in step 5 of the previous tutorial) I got the blur over the whole length of the video. With Partial selected I ended up with a destroyed video.&lt;br /&gt;&lt;br /&gt;Let say I want to &lt;strong&gt;add a blur from the frame 500 to the frame 600 on a video of 1000 frames&lt;/strong&gt;. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. Split the video in 3 parts&lt;/strong&gt; &lt;br /&gt;Use the reddish buttons A &amp;amp; B at the bottom of the video to select UNDESIRED parts of it and use Edit-&amp;gt;Delete to cut bits of the video out. Save each part as it&#039;s own file (no encoding needed so both video and audio remain on Copy) so we end up with 3 files:&amp;#160; first from frame 0-499, second from frame 500-600 and third from frame 601-100. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Add a blur to the second video file&lt;/strong&gt;&lt;br /&gt;Use the &lt;a href=&quot;http://pim.famnit.upr.si/blog/index.php?/archives/263-Add-circle,-logo,-image-or-blur-to-video-with-Avidemux.html&quot;&gt;procedure of the previous tutorial&lt;/a&gt; but select Mplayer delogo as a filter (and don&#039;t forget to encode the video).&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;3. Concatenate the three videos. &lt;/strong&gt;&lt;br /&gt;Open the first one and select File-&amp;gt;Append to add the other two in the right order&lt;br /&gt;&lt;br /&gt;Here&#039;s the video (sorry I forgot to turn the mic on but it&#039;s short and self explanatory).&lt;/p&gt; 
&lt;p&gt; 
&lt;iframe width=&quot;600&quot; height=&quot;480&quot; frameborder=&quot;0&quot; src=&quot;http://www.youtube.com/embed/fuyV0wrxcZo&quot;&gt;&amp;amp;lt;span id=&amp;amp;quot;XinhaEditingPostion&amp;amp;quot;&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;/iframe&gt;&lt;br /&gt; 
&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 14 Jul 2012 10:16:44 +0200</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/264-guid.html</guid>
    
</item>
<item>
    <title>Add circle, logo, image or blur to video with Avidemux</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/263-Add-circle,-logo,-image-or-blur-to-video-with-Avidemux.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/263-Add-circle,-logo,-image-or-blur-to-video-with-Avidemux.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=263</wfw:comment>

    <slash:comments>5</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=263</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;I needed to &lt;strong&gt;add a red circle on a video to emphasize the content&lt;/strong&gt; over a period of a few seconds. It turns out that this is fairly simple with &lt;strong&gt;Avidemux&lt;/strong&gt;. &lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;Steps: &lt;br /&gt;&lt;strong&gt;1. Create a PNG image&lt;/strong&gt; of a circle with a transparent background (I did it in Gimp and its beyond this tutorial)&lt;br /&gt;&lt;strong&gt;2. Open a video&lt;/strong&gt; file in avidemux.&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; From the menu select &lt;strong&gt;Video -&amp;gt; Filter&lt;/strong&gt; to open Video Filter Manager, then &lt;strong&gt;select Miscellaneous on the left and doubleclick on Logo&lt;/strong&gt; (add a png as logo) on the right. &lt;br /&gt;&lt;strong&gt;4.&lt;/strong&gt; In new window &lt;strong&gt;select a logo file, enter X and Y positions&lt;/strong&gt; in pixels from the top left corner, &lt;strong&gt;choose transparency&lt;/strong&gt; (0 means fully transparent and 255 not) &lt;strong&gt;and click OK&lt;/strong&gt; button.&lt;br /&gt;&lt;strong&gt;5.&lt;/strong&gt; Back on Video Filter Manager &lt;strong&gt;click on Partial button&lt;/strong&gt; on the bottom of the window, in a new window &lt;strong&gt;enter the frames&lt;/strong&gt; (which can be found out on the main video window) &lt;strong&gt;and click OK button&lt;/strong&gt;.&lt;br /&gt;&lt;strong&gt;6. Click on the Close button&lt;/strong&gt; on the Video Filter Manager to return to the main video window and &lt;strong&gt;left to the video select the encoding type &lt;/strong&gt;instead of default Copy.&lt;br /&gt;&lt;strong&gt;7.&lt;/strong&gt; Just &lt;strong&gt;re-save&lt;/strong&gt; the video.&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;A logo can be added the same way&lt;/strong&gt;, just &lt;strong&gt;don&#039;t use a partial filter&lt;/strong&gt; (step 5) &lt;strong&gt;and 
alpha&lt;/strong&gt; should be 255 (no transparency in step 4). &lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;To blur&lt;/strong&gt; a certain part of a video
 (square shaped), just &lt;strong&gt;use another filter&lt;/strong&gt; instead (step 3): &lt;strong&gt;Mplayer delogo&lt;/strong&gt;, enter
 the position and size of the blurred square/rectangle area.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;To move an image&lt;/strong&gt; (circle) &lt;strong&gt;together with the video&lt;/strong&gt; (for example to follow the face of a person) &lt;strong&gt;use several Logo filters&lt;/strong&gt; and adjust X and Y accordingly to each of them.&lt;/p&gt; 
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;iframe width=&quot;640&quot; height=&quot;480&quot; frameborder=&quot;0&quot; src=&quot;http://www.youtube.com/embed/hblV__KKWjQ&quot;&gt;&lt;/iframe&gt; 
&lt;p&gt; &lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 25 Jun 2012 02:37:30 +0200</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/263-guid.html</guid>
    
</item>
<item>
    <title>Taps 13: confusing pulling and turning</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/256-Taps-13-confusing-pulling-and-turning.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/256-Taps-13-confusing-pulling-and-turning.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=256</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=256</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;This one was tricky even for me, not to mention my son who tried to rotate the left knob (the right one is for soap) for at least a minute before he started to complain. The tap has usual two features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Controlling the flow: by pulling out the little stick on the knob out&lt;/li&gt;
&lt;li&gt;Controlling the temperature: by turning the knob left and right&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Also not clear is on which side the temperature is cold and on which hot.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;uploads/20120409_007.jpg&quot; class=&quot;no_float&quot;/&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;uploads/20120409_008.jpg&quot;  class=&quot;no_float&quot;/&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;uploads/20120409_009.jpg&quot;  class=&quot;no_float&quot;/&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 23 May 2012 12:00:46 +0200</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/256-guid.html</guid>
    
</item>
<item>
    <title>Multiprotocol IM clients on OS X - a list I have tried so far</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/223-Multiprotocol-IM-clients-on-OS-X-a-list-I-have-tried-so-far.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/223-Multiprotocol-IM-clients-on-OS-X-a-list-I-have-tried-so-far.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=223</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=223</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;IM is one of the PIM applications I often rely to. I still use ICQ for that matter (and AIM, Yahoo! MSN, Skype). For anyone who needs&lt;strong&gt; a multiprotocol IM client on Mac OS X&lt;/strong&gt;. I won&#039;t go into details and what I like/dislike about these clients as it is a personal thing. Some are more developed than others. Some are more native than others. Some ore more opensource than others. And some are easier to set up than others.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.adiumx.com/&quot;&gt;Adium&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://fire.sourceforge.net/&quot;&gt;Fire&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.instantbird.com/&quot;&gt;Instantbird&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.proteusx.org/&quot;&gt;Proteus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://psi-im.org/download/&quot;&gt;PSI IM&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://itunes.apple.com/us/app/trillian/id412056820?mt=12&quot;&gt;Trillian&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 30 Mar 2012 06:14:00 +0200</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/223-guid.html</guid>
    
</item>
<item>
    <title>Make Skype (5.3 OS X) show your contacts instead of recent history on the left sidebar</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/193-Make-Skype-5.3-OS-X-show-your-contacts-instead-of-recent-history-on-the-left-sidebar.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/193-Make-Skype-5.3-OS-X-show-your-contacts-instead-of-recent-history-on-the-left-sidebar.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=193</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=193</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;The new version of Skype for OS X (5+) received a lot of &lt;a href=&quot;http://forum.skype.com/index.php?showtopic=793299&quot;&gt;negative comments from users&lt;/a&gt;.&amp;#160;It is getting better but I was still missing to see &lt;strong&gt;all my contacts at once&lt;/strong&gt;. &lt;/p&gt; 
&lt;p&gt;I know it is &lt;strong&gt;possible to open the Contacts monitor,&lt;/strong&gt; but that is a separate always-on-the-top window. Instead I wanted to see all my contacts on the left sidebar. On default, the &lt;strong&gt;left sidebar or sidepanel includes the most useless information possible&lt;/strong&gt;: a log of my last conversations - my history of Skype usage. I couldn&#039;t care less who I called. I call people when I need them and not based on looking at my history ;).&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;However, it is possible to have all contacts on the left if they are added to favorites &lt;/strong&gt;(as of version 5.3)&lt;strong&gt;:&lt;/strong&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;1. Click on the Contacts&lt;/strong&gt; on the left side below the username &lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;2. &lt;/strong&gt;In Contact list&lt;strong&gt; click on the white star on the right of the first contact&#039;s name&lt;/strong&gt; (it becomes grey after a click)&lt;br /&gt; A new category Favorites shows in the left sidebar.&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;3. Keep clicking&lt;/strong&gt; until all your contacts are on the left&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;Not the fanciest solution, but it works.&lt;/p&gt; 
&lt;p&gt;&lt;img class=&quot;no_float&quot; src=&quot;uploads/skype-favorites.png&quot; /&gt;&lt;/p&gt; 
&lt;p&gt;Now the dial pad windows pops up automatically every time I open Skype, but I&#039;m not giving up on new UI yet :)&lt;/p&gt; 
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 20 Sep 2011 06:50:00 +0200</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/193-guid.html</guid>
    
</item>
<item>
    <title>OS X equivalent to lsusb</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/165-OS-X-equivalent-to-lsusb.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/165-OS-X-equivalent-to-lsusb.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=165</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=165</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;This is one of the (not many) annoyances using a Mac computer :). Not all Linux/Unix terminal commands work. One of them is &lt;strong&gt;lsusb&lt;/strong&gt;. I tried it and got &amp;quot;&lt;em&gt;&lt;strong&gt;command not found&lt;/strong&gt;&lt;/em&gt;&amp;quot;. Then I tried to install it via MacPorts (&lt;em&gt;sudo port install usbutils&lt;/em&gt; with no luck).&amp;#160;Then I checked the web and found out that some people &lt;a href=&quot;http://refluxions.wordpress.com/2008/08/18/mac-os-x-mouse-madnessfixed/&quot;&gt;compiled the code and apparently it works&lt;/a&gt; (read comments). But I did not want to compile anything. I knew there should be a OS X equivalent. I found this &lt;a href=&quot;http://blog.frosties.org/post/2009/08/25/Mac-OS-X%3A-%C3%A9quivalent-%C3%A0-lsusb&quot;&gt;French&lt;/a&gt; and this &lt;a href=&quot;http://www.macuser.de/forum/f22/usb-info-ala-384715/&quot;&gt;German&lt;/a&gt; page (both languages that I don&#039;t understand) and found this command:&lt;/p&gt; 
&lt;pre style=&quot;background-color: #ffff78;&quot;&gt;&lt;font size=&quot;4&quot;&gt;$ system_profiler SPUSBDataType&lt;/font&gt;	
&lt;p&gt;&lt;font size=&quot;4&quot;&gt;      PCI Vendor ID: 0x8086 
      Bus Number: 0x3a 

    USB Bus:

      Host Controller Location: Built-in USB
      Host Controller Driver: AppleUSBUHCI
      PCI Device ID: 0x2830 
      PCI Revision ID: 0x0003 
      PCI Vendor ID: 0x8086 
      Bus Number: 0x1d &lt;/font&gt;
&amp;#160;..........&lt;/p&gt;&lt;/pre&gt; 
&lt;p&gt;I wanted to share this in English as well. &lt;/p&gt; 
&lt;p&gt;And yes, the output is not the same as with lsusb.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT (26. 7. 2012)&lt;/strong&gt;: Takaite (comments) shared the tip to &lt;strong&gt;get this info graphically&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click on the &lt;strong&gt;Apple&lt;/strong&gt; in the left top corner&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Select&lt;strong&gt; About this mac&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Click on the button &lt;strong&gt;More info&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;In the contents select &lt;strong&gt;Hardware-&amp;gt;USB&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Or&lt;/strong&gt; you can go to &lt;strong&gt;Applications-&amp;gt;Utilities-&amp;gt;System profiler&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;uploads/Screenshot2012-07-27at00.00.49.png&quot; class=&quot;no_float&quot;/&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 10 Sep 2011 06:18:00 +0200</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/165-guid.html</guid>
    
</item>
<item>
    <title>Running out of inodes, no space left on device, php not cleaning sessions</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/172-Running-out-of-inodes,-no-space-left-on-device,-php-not-cleaning-sessions.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/172-Running-out-of-inodes,-no-space-left-on-device,-php-not-cleaning-sessions.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=172</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=172</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;
Today I run into a weird problem. When &lt;strong&gt;I tried to open my&lt;/strong&gt; (Serendipity)&lt;strong&gt; blog I got&lt;/strong&gt; this strange &lt;strong&gt;error&lt;/strong&gt;:
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;Query failed: 

SELECT 
                    
	e.id,
	...
	ORDER BY timestamp DESC
	LIMIT 15

/ Can&#039;t create/write to file &#039;/tmp/#sql_6ee_0.MYI&#039; (Errcode: 28)
&lt;/pre&gt; 
&lt;p&gt;
I was kind of puzzled. All other sites were working fine (such us wiki and list of pim prototypes). I sshed to a server and &lt;strong&gt;checked the disk usage&lt;/strong&gt;:
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;myusername@pim:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             3.8G  3.0G  685M  82% / 
&lt;/pre&gt; 
&lt;p&gt;
Everything fine here. I &lt;strong&gt;checked the /tmp&lt;/strong&gt; folder
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;myusername@pim:/tmp# ls -la 
total 32
drwxrwxrwt  4 root root 20480 Apr 18 12:42 .
drwxr-xr-x 22 root root  4096 Apr 18 11:20 ..
drwxrwxrwt  2 root root  4096 Mar 24 22:42 .ICE-unix
&lt;/pre&gt; 
&lt;p&gt;
Nothing strange here either. I tried to &lt;strong&gt;login to mysql&lt;/strong&gt;:
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;myusername@pim:/tmp$ mysql -u myusername -p
Enter password: 
Welcome to the MySQL monitor
&lt;/pre&gt; 
&lt;p&gt;
Everything worked fine. So I &lt;strong&gt;checked the ERROR 28&lt;/strong&gt; the web page was giving me
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;myusername@pim:/tmp$ perror 28
OS error code  28:  No space left on device
&lt;/pre&gt; 
&lt;p&gt;
I &lt;strong&gt;tried to create a file&lt;/strong&gt; with no success:
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;myusername@pim:/tmp$ touch bla.txt
touch: cannot touch `bla.txt&#039;: No space left on device
&lt;/pre&gt; 
&lt;p&gt;
Then I googled a bit and found out that I might be &lt;strong&gt;running out of inodes&lt;/strong&gt;.
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;myusername@pim:/tmp$ df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda1             250976  250957      19  100% /
&lt;/pre&gt; 
&lt;p&gt;
Yep, that was it. Now I had to find &lt;strong&gt;which folder had a lot of files that were taking up the inodes&lt;/strong&gt; (as root). Not all results are shown in the below output.
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;myusername@pim:/var$ cd /
myusername@pim:/$ sudo bash 
root@pim:/$ for i in /*; do echo $i; find $i -type f | wc -l; done
/bin 91
/boot 23
/dev 346
/etc 745
/home 5
/lib 1709
/media 0
/proc 11435
/root 5
/sbin 103
/sys 3863
/tmp 0
/usr 45188
/var    186774
&lt;/pre&gt; 
&lt;p&gt;
I &lt;strong&gt;went to /var&lt;/strong&gt; and run the same command
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;root@pim:/var$ for i in &lt;strong&gt;; do echo $i; find $i -type f | wc -l ;done
backups 1
cache 55
lib 173682
log 47
mail 2
run 16
spool 19
www 12950
&lt;/pre&gt; 
&lt;p&gt;
So I needed to check &lt;strong&gt;/var/lib&lt;/strong&gt; &lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;mkljun@pim:/var/lib$ for i in &lt;/strong&gt;; do echo $i; sudo find $i -type f | wc -l ;done
apt 9
doc-base 37
dpkg 2342
misc 2
mlocate 1
mysql 665
php5 170453
screen-profiles 21
ucf 23
xml-core 2
&lt;/pre&gt; 
&lt;p&gt;
The folder &lt;strong&gt;/var/lib/php5 contained 170k files&lt;/strong&gt;! It was kind of strange why all these files were not deleted after a session timeout. I certainly did not have 170k users visiting my pages (I wished this to be true though).
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;root@pim:/var/lib# cd php5
root@pim:/var/lib/php5# ls -l | wc -l
170453
&lt;/pre&gt; 
&lt;p&gt;
I &lt;strong&gt;checked the maximum time set for a php5 sessions to live&lt;/strong&gt;.
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;root@pim:/var/lib/php5# /usr/lib/php5/maxlifetime
24
&lt;/pre&gt; 
&lt;p&gt;
24 minutes. I &lt;strong&gt;decided to delete older files.&lt;/strong&gt; &lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;root@pim:/var/lib/php5# find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 -exec rm {} \;
root@pim:/var/lib/php5# ls -la
total 11768
drwx-wx-wt  2 root     root     12017664 Apr 18 12:35 .
drwxr-xr-x 38 root     root         4096 Sep 22  2010 ..
-rw-------  1 www-data www-data      168 Apr 18 12:23 sess_389b8191e2563e8bb43c41e20e015c0d
-rw-------  1 www-data www-data      118 Apr 18 12:11 sess_52c9acc7779f5cfd7e7e92a900fe7f19
-rw-------  1 www-data www-data      160 Apr 18 12:27 sess_bb8cfa842ceb0027cc9e4082ad8b0419
&lt;/pre&gt; 
&lt;p&gt;
I &lt;strong&gt;checked the inodes usage.&lt;/strong&gt; &lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;root@pim:/tmp# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda1             250976   80524  170452   33% /
&lt;/pre&gt; 
&lt;p&gt; &lt;strong&gt;That was it.
&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;
Why &lt;strong&gt;PHP is not deleting expired sessions&lt;/strong&gt; is another question. I went to my &lt;strong&gt;php.ini file&lt;/strong&gt; and found this:
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;; After this number of seconds, stored data will be seen as &#039;garbage&#039; and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

; NOTE: If you are using the subdirectory option for storing session files
;       (see session.save_path above), then garbage collection does &lt;strong&gt;not&lt;/strong&gt;
;       happen automatically.  You will need to do your own garbage
;       collection through a shell script, cron entry, or some other method.
&lt;/pre&gt; 
&lt;p&gt;
So all I needed to do was to create&lt;strong&gt; a cron job&lt;/strong&gt; (I decided to rut it every hour as root)
&lt;/p&gt; 
&lt;pre style=&quot;font-size: 12px; padding: 10px; margin: 0pt; background: none repeat scroll 0% 0% #f9f99f; display: block; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;root@pim:/tmp# crontab -e 

0 &lt;strong&gt; &lt;/strong&gt; &lt;strong&gt; &lt;/strong&gt;  /usr/bin/find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 -exec /bin/rm {} \;
&lt;/pre&gt; 
&lt;p&gt;
Hopefully this will help some other soul out there.
&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 20 Apr 2011 14:38:00 +0200</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/172-guid.html</guid>
    
</item>
<item>
    <title>A list of open source PDF applications</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/154-A-list-of-open-source-PDF-applications.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/154-A-list-of-open-source-PDF-applications.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=154</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=154</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;A week ago, &lt;a href=&quot;http://lifehacker.com/#!5777213/five-best-pdf-tools&quot;&gt;Lifehacker published a list of 5 best PDF applications&lt;/a&gt;. They are all closed source and some cost money. Nothing wrong with it, but I thought that many open source alternatives exist. So I made &lt;strong&gt;a list of open source PDF applications&lt;/strong&gt; I&#039;m using. Some very often and some occasionally. &lt;br /&gt;&lt;/p&gt; 
&lt;ul&gt; 
&lt;li&gt;&lt;strong&gt;Sumatra&lt;/strong&gt;: a lightweight PDF viewer for Windows

[&lt;a href=&quot;http://blog.kowalczyk.info&quot;&gt;blog.kowalczyk.info&lt;/a&gt;] &lt;/li&gt; 
&lt;li&gt;&lt;strong&gt;PDFCreator&lt;/strong&gt;: a PDF printer for Widows (prints PDF&#039;s from any application)

[&lt;a href=&quot;http://www.pdfforge.org&quot;&gt;www.pdfforge.org&lt;/a&gt;] &lt;/li&gt; 
&lt;li&gt;&lt;strong&gt;PDFsam&lt;/strong&gt;: crossplatform splitting and merging PDF documents [&lt;a href=&quot;http://www.pdfsam.org&quot;&gt;www.pdfsam.org&lt;/a&gt;] &lt;/li&gt; 
&lt;li&gt;&lt;strong&gt;PDFEdit:&lt;/strong&gt; a powerful PDF editor for Linux [&lt;a href=&quot;http://sourceforge.net/projects/pdfedit/&quot;&gt;sourceforge.net&lt;/a&gt;]&lt;/li&gt; 
&lt;li&gt;&lt;strong&gt;PDF import extension for OpenOffice 3&lt;/strong&gt;: a nice crossplatform PDF editor (for OOo Draw or Impress)

[&lt;a href=&quot;http://extensions.services.openoffice.org/project/pdfimport&quot;&gt;extensions.services.openoffice.org&lt;/a&gt;]&lt;/li&gt; 
&lt;li&gt;&lt;strong&gt;Skim &amp;amp; Formulate pro&lt;/strong&gt;: PDF annotating for OS X:

[&lt;a href=&quot;http://skim-app.sourceforge.net/&quot;&gt;skim-app.sourceforge.net&lt;/a&gt;]

[&lt;a href=&quot;http://code.google.com/p/formulatepro/&quot;&gt;code.google.com&lt;/a&gt;]&lt;/li&gt; 
&lt;li&gt;&lt;strong&gt;Ghostscrip and Ghostview&lt;/strong&gt; :) [&lt;a href=&quot;http://pages.cs.wisc.edu/~ghost/&quot;&gt;pages.cs.wisc.edu/~ghost/&lt;/a&gt;]&lt;/li&gt; 
&lt;/ul&gt; 
&lt;p&gt;
I might have missed some. In my opinion these are nice tools that can do pretty much everything wtih PDFs. &lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 30 Mar 2011 07:22:00 +0200</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/154-guid.html</guid>
    
</item>
<item>
    <title>FormulatePro - add an image to a PDF file</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/141-FormulatePro-add-an-image-to-a-PDF-file.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/141-FormulatePro-add-an-image-to-a-PDF-file.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=141</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=141</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;In a previous post I explained how to &lt;a href=&quot;index.php?/archives/110-OS-X-Preview-add-an-image-to-a-PDF-file.html&quot;&gt;add an image to a PDF in OS X Preview&lt;/a&gt;. That procedure involves converting a PDF to an image and than back to a PDF which looses all the PDF benefits. I needed a quick and dirty solution and I did not dig into other applications which could do a better job. I posted the tip to &lt;a href=&quot;http://hints.macworld.com/article.php?story=20101215142059804&quot;&gt;Mac OS X Hints&lt;/a&gt; which received a lot of negative comments :) and a lot of better solutions and I learned about better ways of achieving this.&lt;/p&gt; 
&lt;p&gt;Among all, I liked best &lt;strong&gt;the application called &lt;a href=&quot;http://code.google.com/p/formulatepro/&quot;&gt;FormulatePro&lt;/a&gt;&lt;/strong&gt; which even provides a simpler solution.&amp;#160;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;1. Download&lt;/strong&gt; the &lt;a href=&quot;http://code.google.com/p/formulatepro/&quot;&gt;FormulatePro&lt;/a&gt;&lt;/p&gt; 
&lt;p&gt; &lt;strong&gt;2. Open the PDF&lt;/strong&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Select &lt;strong&gt;&lt;em&gt;File -&amp;gt; Place Image&lt;/em&gt;&lt;/strong&gt;, choose the image and move it to a desired place. &lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;4. &lt;/strong&gt;Select &lt;em&gt;&lt;strong&gt;File -&amp;gt; Save&lt;/strong&gt;&lt;/em&gt; and the job is done.&lt;/p&gt; 
&lt;p&gt;Thanks all for the suggestions in comments at Mac OS X Hints. &lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;no_float&quot; src=&quot;uploads/GeneralFiles/FormulatePro.png&quot; /&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 18 Dec 2010 15:33:50 +0100</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/141-guid.html</guid>
    
</item>
<item>
    <title>OS X Preview - add an image to a PDF file</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/110-OS-X-Preview-add-an-image-to-a-PDF-file.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/110-OS-X-Preview-add-an-image-to-a-PDF-file.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=110</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=110</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;&lt;strong&gt;EDIT 18. 12. 2010:&lt;/strong&gt; I posted &lt;a href=&quot;index.php?/archives/141-FormulatePro-add-an-image-to-a-PDF-file.html&quot;&gt;a better solution with FormulatePro&lt;/a&gt;.&amp;#160; &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT 17. 12. 2010: Before commenting - As said at the end, this procedure is quick and dirty adding an image to an existing PDF AND the end result is an image converted to PDF which has lost all PDF advantages and benefits!&lt;/strong&gt; Such documents are fine for e.g. quick printing. For better results try the command line tool &lt;a href=&quot;http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/&quot;&gt;pdftk&lt;/a&gt; (options &lt;strong&gt;stamp&lt;/strong&gt; or &lt;strong&gt;multistamp&lt;/strong&gt;), &lt;a href=&quot;http://code.google.com/p/formulatepro/&quot;&gt;Formulate Pro&lt;/a&gt;,&amp;#160; or Acrobat Pro.&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;I wanted to &lt;strong&gt;add a logo of a university (a PNG image) on a document I had in PDF&lt;/strong&gt;. It is fairly simple to do this in &lt;strong&gt;Preview&lt;/strong&gt;:&lt;/p&gt; 
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Document.PDF &lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;1. &lt;/strong&gt;Convert the PDF to an image with &lt;em&gt;File -&amp;gt; Save As -&amp;gt;&lt;/em&gt; ... Choose &lt;em&gt;PNG&lt;/em&gt; as &lt;em&gt;a Format &lt;/em&gt;and change &lt;em&gt;Resolution&lt;/em&gt; as desired&lt;/p&gt; 
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Logo.PNG &lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;2. &lt;/strong&gt;Switch to the logo image and select the whole image with &lt;em&gt;Edit -&amp;gt; Select All&lt;/em&gt; (&lt;em&gt;Command+A&lt;/em&gt;) (or select just a part of it with a mouse if you wish)&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;3. &lt;/strong&gt;Copy the selection &lt;em&gt;Edit -&amp;gt; Copy&lt;/em&gt; (&lt;em&gt;Command+C&lt;/em&gt;)&lt;/p&gt; 
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Document.PNG&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;4. &lt;/strong&gt;Back on the document (which is now the PNG image!) paste the selection &lt;em&gt;with Edit -&amp;gt; Paste&lt;/em&gt; (&lt;em&gt;Command+V&lt;/em&gt;) and resize it as you wish&lt;/p&gt; 
&lt;p&gt;&lt;strong&gt;5. &lt;/strong&gt;Save it as PDF with &lt;em&gt;File -&amp;gt; Save As&lt;/em&gt; -&amp;gt; ... Choose &lt;em&gt;PDF&lt;/em&gt; as &lt;em&gt;Format&lt;/em&gt; (&lt;strong&gt;rename it if the original PDF needs to be preserved!!!!&lt;/strong&gt;).&lt;/p&gt; 
&lt;p&gt;There are some drawbacks in this procedure (a PDF made from an image is not searchable), but that&#039;s another story :).&lt;/p&gt; 
&lt;p&gt;&lt;img src=&quot;uploads/GeneralFiles/preview-add-image.png&quot; class=&quot;no_float&quot; /&gt;&lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 15 Dec 2010 08:19:00 +0100</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/110-guid.html</guid>
    
</item>
<item>
    <title>OS X Finder versioning and duplicating files or folders</title>
    <link>http://pim.famnit.upr.si/blog/index.php?/archives/135-OS-X-Finder-versioning-and-duplicating-files-or-folders.html</link>
            <category>Software hints</category>
    
    <comments>http://pim.famnit.upr.si/blog/index.php?/archives/135-OS-X-Finder-versioning-and-duplicating-files-or-folders.html#comments</comments>
    <wfw:comment>http://pim.famnit.upr.si/blog/wfwcomment.php?cid=135</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://pim.famnit.upr.si/blog/rss.php?version=2.0&amp;type=comments&amp;cid=135</wfw:commentRss>
    

    <author>nospam@example.com (Matjaž Kljun)</author>
    <content:encoded>
    &lt;p&gt;I just found out about the interesting file manipulating techniques in Finder file manager:&lt;/p&gt; 
&lt;ul&gt; 
&lt;li&gt; &lt;strong&gt;Option (ALT) + dragging the file or folder in its own parent folder&lt;/strong&gt;: creates a new version of a file or folder by adding a consecutive number in the file or folder name. &lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Dragging a file named &lt;strong&gt;Thesis.doc&lt;/strong&gt; to its parent folder (while holding down the Option key) creates a file named &lt;strong&gt;Thesis 2.doc&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;If the extension of the file is more exotic (e.g. &lt;strong&gt;printer.ppd&lt;/strong&gt;) it will add the consecutive number after the extension (e.g. &lt;strong&gt;printer.ppd 2&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;If the name of the file has the integer number preceded by the space (e.g. &lt;strong&gt;Thesis 2.doc&lt;/strong&gt;) it will add the consecutive number (e.g. &lt;strong&gt;Thesis 3.doc&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;If the number is not integer or is not preceded by the space (e.g. &lt;strong&gt;Thesis2.doc&lt;/strong&gt;, &lt;strong&gt;Thesis 1.3.doc&lt;/strong&gt;) it will just add the number 2 to it (e.g. &lt;strong&gt;Thesis2 2.doc&lt;/strong&gt;, &lt;strong&gt;Thesis 1.3 2.doc&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;If numbers are preceded by zeros (e.g. &lt;strong&gt;Thesis 002.doc&lt;/strong&gt;, &lt;strong&gt;001.doc&lt;/strong&gt;, &lt;strong&gt;00.doc&lt;/strong&gt;) it will delete them (e.g. &lt;strong&gt;Thesis 3.doc&lt;/strong&gt;, &lt;strong&gt;2.doc&lt;/strong&gt;, &lt;strong&gt;1.doc&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;If multiple files are dragged and dropped (e.g. &lt;strong&gt;Thesis 2.doc, &lt;/strong&gt;&lt;strong&gt;Thesis 3.doc, &lt;/strong&gt;&lt;strong&gt;Thesis 4.doc&lt;/strong&gt;), it will add consecutive numbers from the highest of them (e.g. &lt;strong&gt;Thesis 5.doc, &lt;/strong&gt;&lt;strong&gt;Thesis 6.doc, &lt;/strong&gt;&lt;strong&gt;Thesis 7.doc&lt;/strong&gt;)&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;/li&gt; 
&lt;li&gt;&lt;strong&gt;Command + D&lt;/strong&gt;: creates a new file of folder and adds the word copy to it&lt;br /&gt;&lt;br /&gt;E.g.: &lt;strong&gt;Thesis.doc&lt;/strong&gt; will be copied in a new file named &lt;strong&gt;Thesis copy.doc&lt;/strong&gt; &lt;/li&gt; 
&lt;/ul&gt;Original post at &lt;a href=&quot;http://hints.macworld.com/article.php?story=20090529194228820&quot;&gt;Mac OS X Hints&lt;/a&gt;.&lt;br /&gt; 
&lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
&lt;p&gt; &lt;br /&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 20 Nov 2010 08:12:00 +0100</pubDate>
    <guid isPermaLink="false">http://pim.famnit.upr.si/blog/index.php?/archives/135-guid.html</guid>
    
</item>

</channel>
</rss>