tag:blogger.com,1999:blog-29400753816251492732024-03-13T19:41:23.452+01:00Eikes Blogyet another web developer blog about technical issues i run into. mostly code snippets and stuff.Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-2940075381625149273.post-43410259095388725522015-01-27T00:03:00.001+01:002015-01-27T00:09:45.664+01:00Completely remove devise secret key from git repositoryTook me long enough to figure this out, so I might as well write it down. I'm replacing the secret key with an environment variable:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">git filter-branch --tree-filter "sed -i -e 's/'\''123123123123123123123123123123123123123'\''/ENV[\"DEVISE_SECRET_KEY\"]/g' config/initializers/devise.rb || true"</span><br />
<br />
<br />Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-53574552816854427612014-03-19T13:56:00.001+01:002014-03-19T14:20:37.269+01:00Custom page & controller in Sonata Admin BundleI was stuck for a while trying to figure out how to get my own page into the admin backend of the Sonata Admin Bundle. Specifically, I wanted to have a link in the top menu bar to a page that is created by a controller of mine.<br />
<br />
Let's assume that our bundle is the AcmeDemoBundle, residing in the src/Acme/DemoBundle/ folder, which is where most of the following files are in as well.<br />
<br />
The first step was to extend the <a href="https://github.com/sonata-project/SonataAdminBundle/blob/master/Resources/views/standard_layout.html.twig">standard_layout.html.twig</a> from the SonataAdminBundle by creating a file here: <span style="font-family: Courier New, Courier, monospace;">Resources/views/standard_layout.html.twig</span><br />
<br />
This file contains:<br />
<br />
<pre style="font-family: Courier New, Courier, monospace;">{% extends 'SonataAdminBundle::standard_layout.html.twig' %}
{% block top_bar_after_nav %}
<li>
<a href="{{ path('acme_demo_hello_index', {'name': 'World'}) }}">
Statistik
</a>
</li>
{% endblock %}
</pre>
<br />
<br />
Enable this file by adding this configuration to your config.yml:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sonata_admin:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> templates:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> layout: AcmeDemoBundle::standard_layout.html.twig</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">You can now create the </span><span style="font-family: Courier New, Courier, monospace;">Controller/HelloController.php</span><span style="font-family: inherit;"> with an indexAction function like so:</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">namespace Acme\DemoBundle\Controller;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">use Symfony\Bundle\FrameworkBundle\Controller\Controller;</span><br />
<span style="font-family: Courier New, Courier, monospace;">use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;</span><br />
<span style="font-family: Courier New, Courier, monospace;">use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">/**</span><br />
<span style="font-family: Courier New, Courier, monospace;"> * Hello controller.</span><br />
<span style="font-family: Courier New, Courier, monospace;"> *</span><br />
<span style="font-family: Courier New, Courier, monospace;"> * @Route("/admin/hello")</span><br />
<span style="font-family: Courier New, Courier, monospace;"> */</span><br />
<span style="font-family: Courier New, Courier, monospace;">class HelloController extends Controller</span><br />
<span style="font-family: Courier New, Courier, monospace;">{</span><br />
<span style="font-family: Courier New, Courier, monospace;"> /**</span><br />
<span style="font-family: Courier New, Courier, monospace;"> * @Route("/{name}")</span><br />
<span style="font-family: Courier New, Courier, monospace;"> * @Template()</span><br />
<span style="font-family: Courier New, Courier, monospace;"> */</span><br />
<span style="font-family: Courier New, Courier, monospace;"> public function indexAction($name)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace;"> $admin_pool = $this->get('sonata.admin.pool');</span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> return array(</span><br />
<span style="font-family: Courier New, Courier, monospace;"> 'admin_pool' => $admin_pool,</span><br />
<span style="font-family: Courier New, Courier, monospace;"> 'name' => $name</span><br />
<span style="font-family: Courier New, Courier, monospace;"> );</span><br />
<span style="font-family: Courier New, Courier, monospace;"> }</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<div>
<br /></div>
<div>
finally you need to create the template <span style="font-family: Courier New, Courier, monospace;">Resources/views/Hello/index.html.twig</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"></span><br />
<div>
<span style="font-family: Courier New, Courier, monospace;">{% extends 'AcmeDemoBundle::standard_layout.html.twig' %}</span></div>
<span style="font-family: Courier New, Courier, monospace;">
</span>
<br />
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<span style="font-family: Courier New, Courier, monospace;">
</span>
<br />
<div>
<span style="font-family: Courier New, Courier, monospace;">{% block content %}</span></div>
<div style="font-family: 'Courier New', Courier, monospace;">
Hello {{ name }}!</div>
<div>
<div style="font-family: 'Courier New', Courier, monospace;">
{% endblock %}</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
<span style="font-family: inherit;">PS: Having written this, I also stumbled upon this StackOverflow question wherein two other solutions are discussed: </span><a href="http://stackoverflow.com/questions/15966575/sonataadminbundle-display-non-crud-statistics/22507027">http://stackoverflow.com/questions/15966575/sonataadminbundle-display-non-crud-statistics/22507027</a></div>
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
</div>
Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com3tag:blogger.com,1999:blog-2940075381625149273.post-90233369667785385192013-09-11T16:49:00.001+02:002013-09-11T16:49:32.472+02:00JavaScript API to control loading progress indicator in browser adress barInstead of adding a <a href="http://ricostacruz.com/nprogress/" target="_blank">JavaScript library to indicate the loading progress of a page</a> I propose creating a JavaScript browser API that allows the programmer to set (or get) the position of the loading bar in percent. This is useful because many sites or single-page applications asynchronously load content.<br />
<br />
As an example it could live as an object in the <span style="font-family: Courier New, Courier, monospace;"><b>window.navigator.progress</b></span> namespace and have the following functions:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"><b>reset()</b></span><br />
set the progress bar to zero<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"><b>set( percent )</b></span><br />
<span style="font-family: inherit;">set the progress bar to the given percentage value</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><b>finish()</b></span><br />
<span style="font-family: inherit;">set the progress bar to the full position and possibly hide it</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><b>get()</b></span><br />
<span style="font-family: inherit;">returns the current loading progress in percent</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Having said that, I noticed, that the browsers I use (firefox and chromium) don't even have the loading progress indicator anymore. I can only speculate, that this is because the vendors noticed, that the indicator wasn't helping much anymore due to the increased usage of javascript to control content in the DOM. I think that bringing back the indicator and handing control over it to the developers would be a nice touch in terms of usability.</span>Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-86056427425861621302012-09-09T11:15:00.002+02:002012-09-09T11:15:36.925+02:00External Blogposts and JavaScript Libraries<h2>
Blogposts</h2>
I wrote two blogposts which are not hosted on this blog.<br />
<br />
The first one was about <a href="http://eikes.github.com/suffixtree/" target="_blank">implementing a suffix-tree in JavaScript</a> in order to generate a <a href="http://en.wikipedia.org/wiki/Grammar-based_code" target="_blank">grammar-based code</a> for compressing a given string, because I was playing <a href="http://codegolf.stackexchange.com/questions/6043/were-no-strangers-to-code-golf-you-know-the-rules-and-so-do-i" target="_blank">code golf</a>.<br />
<br />
The second post is about using JavaScript for responsive webdesign using two helper functions I wrote called <a href="http://edenspiekermann.com/en/blog/responsive-javascript-helpers" target="_blank">minwidth.js and relocate.js</a>.<br />
<br />
<h2>
JavaScript libraries</h2>
My most popular JavaScript on github is a <a href="http://eikes.github.com/jquery.fullscreen.js/" target="_blank">jquery plugin for fullscreen gallery slideshows</a>. I don't have a blogpost about it yet, but considering that there are a lot of people watching the project I should write one.<br />
<br />
Another JavaScript library I created is called <a href="http://eikes.github.com/facetedsearch/" target="_blank">facetedsearch.js and it lets you filter and sort an array of objects</a> by the values of keys they share, or, in other words, browse through different facets of the objects.<br />
<br />
I'm actually pretty proud of the <a href="http://eikes.github.com/jump/" target="_blank">jQuery map plugin JUMP</a> that displays OpenStreetMap tiles (or others) using nothing but jQuery, so no OpenLayers, Leaflet, GMap or other libraries required.Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-17048271305355424522011-10-23T22:29:00.000+02:002011-10-23T22:29:29.229+02:00Bookmarklet to Visualize Hacker News PollsToday I stumbled upon a <a href="http://news.ycombinator.com/item?id=3146321">poll on Hacker News on programmer salaries</a>, where I found it difficult to read the results. So I wrote a bookmarklet which makes that easier:<br />
<br />
<a href="javascript:(function(){var a=document.createElement("script");a.setAttribute("src","http://code.jquery.com/jquery.js");document.body.appendChild(a);a.addEventListener("load",function(){var b=jQuery,a=0;b("table tr:eq(3) table:eq(1) ").width("100%");b("table tr:eq(3) table:eq(1) tr td:eq(0)").width("15px");b("table tr:eq(3) table:eq(1) .comhead span").each(function(){var c=parseInt(b(this).text());c>a&&(a=c);b(this).data("val",c)}).each(function(){b(this).css({width:100*b(this).data("val")/a+"%","background-color":"white", border:"1px solid black",display:"block"})})})})();">HNPolls</a> <- Drag this to your bookmarks bar and use it on a HN polls page. The source is available on <a href="https://gist.github.com/1307837">github</a> under the MIT license.<br />
<br />
After using it, the poll looks like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-qxsW0uaJj08/TqR3fGqROhI/AAAAAAAAFQE/7J7P1m5DKrk/s1600/HNPoll.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-qxsW0uaJj08/TqR3fGqROhI/AAAAAAAAFQE/7J7P1m5DKrk/s1600/HNPoll.png" /></a></div>Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-54484990474288074862010-11-10T14:44:00.003+01:002010-11-10T14:58:36.160+01:00Ten+ things you have to do before you launch a websiteAfter reading some good advice, some very specific to <a href="http://www.seomoz.org/blog/launching-a-new-website-18-steps">SEO,</a> what to do <a href="http://sixrevisions.com/website-management/things-you-should-do-immediately-after-launching-a-website/">after launching a website</a> which I ran across on <a href="http://news.ycombinator.com/news">HN </a>I decided to write my own. This is a checklist if you're in charge of creating a website. I wrote it, so I would think about it myself, but I'm looking forward to your comments. I have a "regular" website with mostly text and image content in mind, but lots of it applies to forums, wikis, html5 apps etc.<br />
<ol><li>You may or may not be the person who came up with the idea of the website</li>
<ol><li>Create a list of all features, break them up in smaller pieces until you can approximate how long each step will take. This is called a work-breakdown-structure. Talk to the client / partners about these features and how long you think they'll take.</li>
<li>Figure out what is important about the website. Get the priorities right, some features may not make the initial launch. Suggest less expensive alternatives.</li>
</ol><li>What parts are you responsible for? The <b>content</b>, the <b>design </b>or the <b>implementation</b>? (MVC anyone?)</li>
<li>Find out who the website's audience will be.</li>
<ol><li>What is the audience looking for on the site? How can you help with that?</li>
<li>Does your audience have special needs, think about accessibility.</li>
<li>What kind of traffic will you get? How will you accommodate for that?</li>
</ol><li>If you're responsible for implementing the design, decide which browsers you would like to support:</li>
<ol><li><a href="http://developer.yahoo.com/yui/articles/gbs/">A-Grade as defined by Yahoo</a> maybe?</li>
<li>What about mobile? Separate site or a fluid layout using media queries?</li>
</ol><li>Learn the <a href="http://en.wikipedia.org/wiki/Search_engine_optimization">SEO Basics</a></li>
<ol><li>Make sure the basics of your website work without JavaScript as well as it does without.</li>
<li>Have nice URLs</li>
<li>If it's a relaunch, make sure, the old URLs forward to a sensible place and not a 404 page.</li>
</ol><li>Features</li>
<ol><li>What content types have you identified? Can they be simplified? </li>
<li>Avoid <a href="http://en.wikipedia.org/wiki/Feature_creep">feature creep</a>.</li>
<li>If your editors want to embed videos, mp3s, PDFs, DOCs, PPT etc, how should they do that?</li>
<li>How is search done?</li>
<li>What users and access controls should exist?</li>
<li>What social media integration?</li>
<ol><li>User sign up?</li>
<li>Twitter, Facebook, Google, OAuth etc.</li>
<li>Comments? By Disqus or IntenseDebate or with own user accounts only?</li>
</ol><li>Figure out if you'll need a content workflow, like a review process for new user generated content or regular content from editors.</li>
</ol><li>What development framework do you want to use?</li>
<ol><li>The main point is: Will you use a out-of-the box solution, like a CMS or do you want to use a web development framework? Lots of options, no way of finding out what is the right tool, getting a broad overview is important though.</li>
<li>Will you always be the only one working on it? If not, consider how difficult it is to find smalltalk-devs for seaside... Maybe Drupal is the bettter alternative, lots of PHP devs around, filtering out the bad ones is the bigger task. With Rails its a little more work, but also more control, ruby developers tend to have a better grasp of the technologies they are using. </li>
</ol><li>Security</li>
<ol><li>Avoid all the <a href="http://www.owasp.org/index.php/Top_10_2010-Main">common security vulnerabilities</a>:</li>
<ol><li>SQL injections</li>
<li>HTML injections</li>
<li>XSS</li>
<li>CSRF</li>
<li>...</li>
</ol><li>Protect yourself against session hijacking, have a SSL version available</li>
<li>Set up a backup process and test it</li>
<li>Make sure you're able to apply security updates to the whole stack: OS, WebServer, Database, Language, Framework, Plugins</li>
<li>Apply them.</li>
</ol><li>Testing</li>
<ol><li>Use unit tests</li>
<li>Create integration tests</li>
<li>Do uptime monitoring and set up alerts</li>
<li>How will you do the load-testing?</li>
<li>What are the response times you're aiming for?</li>
<li>Use YSlow to see how you can improve performance.</li>
<li>Will you need more than one database-, web- or cache-server?</li>
</ol><li>Hosting</li>
<ol><li>Have a plan how you'll deploy, also how you'll continue development and testing once it's launched</li>
<li>Avoid a shared hosting environment (it's also a security issue), use a VM at least (they're cheap too).</li>
<li>Try the backup if there is one that comes out-of-the-box by your hosting provider</li>
</ol></ol>If you think this should be a wiki page, let me know if you know the right place where to put it, so people can find it and contribute easily. Wikibooks maybe?<br />
<br />
Edit: Just found this <a href="http://stackoverflow.com/questions/72394/what-should-a-developer-know-before-building-a-public-web-site">pre-launch list</a> as well... <br />
<ol><ol></ol></ol>Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-78649630631176524782010-10-11T13:17:00.008+02:002010-10-20T12:23:45.904+02:00Installing Drupal 7 on a fresh Ubuntu 10.10 (Maverick Meerkat) boxThis is a simple step by step instruction for installing Drupal 7 on a clean Ubuntu server edition slate. Canonical let's you <a href="https://10.cloud.ubuntu.com/">try those out for an hour</a> for free on Amazons cloud.<br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;">Configure Server </span> <br />
<br />
After you have logged in via SSH (use <a href="http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download.html">Putty</a> on Windows) go ahead and install some stuff:<br />
<br />
<b><span style="font-family: "Courier New",Courier,monospace;">sudo apt-get install apache2 php5-gd libapache2-mod-php5 mysql-server mysql-client php5-mysql</span></b><b><span style="font-family: "Courier New",Courier,monospace;"> cvs</span></b><br />
<br />
You will be prompted for the MySQL root password. Type one and remember it, for example <span style="font-family: "Courier New",Courier,monospace;">supersecretpw</span>, which you can then use to log in to mysql:<br />
<br />
<b><span style="font-family: "Courier New",Courier,monospace;">mysql -uroot -psupersecretpw</span></b><br />
<br />
Now it's time to create a database and a user who can access it, what you have to type is highlighted:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">mysql> <b>create database d7db;</b></span><br />
<span style="font-family: "Courier New",Courier,monospace;"> Query OK, 0 rows affected (0.00 sec)</span><br />
<span style="font-family: "Courier New",Courier,monospace;">mysql> <b>create user d7user identified by 'd7password';</b></span><br />
<span style="font-family: "Courier New",Courier,monospace;">Query OK, 0 rows affected (0.00 sec)</span><br />
<span style="font-family: "Courier New",Courier,monospace;">mysql> <b>grant all privileges on d7db.* to 'd7user'@'localhost' identified by 'd7password';</b></span><br />
<span style="font-family: "Courier New",Courier,monospace;">Query OK, 0 rows affected (0.00 sec)</span><br />
<span style="font-family: "Courier New",Courier,monospace;">mysql> <b>exit;</b></span><br />
<span style="font-family: "Courier New",Courier,monospace;">Bye</span><br />
<br />
Alright, the webserver and database server are up and running now. Sweet. You can check the webserver by going to your domain or IP in a browser and you'll see the default apache index.html which we don't need, so we can delete it (replace ubuntu in line 4 with your username from line 2):<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;"><b>whoami</b></div><div style="font-family: "Courier New",Courier,monospace;">ubuntu<b><br />
</b></div><div style="font-family: "Courier New",Courier,monospace;"><b>cd /var</b></div><div style="font-family: "Courier New",Courier,monospace;"><b>sudo chown -R ubuntu:www-data www</b></div><div style="font-family: "Courier New",Courier,monospace;"><b>rm www/index.html</b></div><br />
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;">Install Drupal </span> <br />
<br />
We can get the latest and greatest Drupal version from CVS (Replace DRUPAL-7-0-BETA1 with <a href="http://drupal.org/node/93997">the version you want</a>):<br />
<b><br />
</b><br />
<div style="font-family: "Courier New",Courier,monospace;"><b>cd /var</b></div><b><span style="font-family: "Courier New",Courier,monospace;">cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-7-0-BETA1 -P -d www/ drupal</span></b><br />
<br />
Well done! Configure the Drupal settings to use the database we created (also create the server writeable files directory):<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;"><b>cd /var/www/sites/default/</b></div><div style="font-family: "Courier New",Courier,monospace;"><b>cp default.settings.php settings.php</b></div><div style="font-family: "Courier New",Courier,monospace;"><b>mkdir files</b></div><div style="font-family: "Courier New",Courier,monospace;"><b>sudo chown www-data files</b></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div>Edit settings.php for exmaple with pico or vim:<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;"><b>pico settings.php</b></div><br />
replace this line<br />
<div style="color: blue; font-family: "Courier New",Courier,monospace;"><br />
</div><div style="color: blue; font-family: "Courier New",Courier,monospace;">$databases = array();</div><br />
with this:<br />
<br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;">$databases['default']['default'] = array(</span><br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;"> 'driver' => 'mysql',</span><br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;"> 'database' => 'd7db',</span><br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;"> 'username' => 'd7user',</span><br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;"> 'password' => 'd7password',</span><br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;"> 'host' => 'localhost',</span><br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;"> 'prefix' => '',</span><br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;"> 'collation' => 'utf8_general_ci',</span><br />
<span style="color: blue; font-family: "Courier New",Courier,monospace;"> );</span><br />
<br />
Save the file. I had to reload apache so it would handle the php files correctly:<br />
<br />
<b><span style="font-family: "Courier New",Courier,monospace;">sudo apachectl restart</span></b> <br />
<br />
That's about it. you can now run the drupal install script by going to the ip or domain and opening install.php for example:<br />
<span style="font-family: "Courier New",Courier,monospace;">http://184.72.188.32/install.php</span><br />
or<br />
<div style="font-family: "Courier New",Courier,monospace;">http://example.com/install.php</div><br />
<span style="font-family: Arial,Helvetica,sans-serif; font-size: large;">Bonus points - enable <a href="http://drupal.org/node/15365">clean URLs </a></span><br />
<div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"><b>sudo a2enmod rewrite</b></div><b><span style="font-family: "Courier New",Courier,monospace;"></span></b><b><span style="font-family: "Courier New",Courier,monospace;">sudo pico /etc/apache2/sites-available/default </span></b><br />
<br />
in this section:<br />
<span style="font-family: "Courier New",Courier,monospace;"><directory /var/www/></span><br />
change <br />
<div style="font-family: "Courier New",Courier,monospace;">AllowOverride None</div>to<br />
<span style="font-family: "Courier New",Courier,monospace;">AllowOverride All</span><br />
<br />
Restart apache:<b><span style="font-family: "Courier New",Courier,monospace;"> </span></b><br />
<br />
<b><span style="font-family: "Courier New",Courier,monospace;">sudo apachectl restart</span></b><br />
<br />
Now you can enable clean URLs at:<span style="font-family: "Courier New",Courier,monospace;"><br />
</span><br />
<span style="font-family: "Courier New",Courier,monospace;">http://example.com/#overlay=admin/config/search/clean-urls </span><br />
<br />
<div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: large;">More bonus points - use <a href="http://en.wikipedia.org/wiki/List_of_PHP_accelerators#Alternative_PHP_Cache">APC</a></span></div><br />
<b><span style="font-family: "Courier New",Courier,monospace;">sudo apt-get install apache2-threaded-dev php5-dev php-pear make</span></b><br />
<b><span style="font-family: "Courier New",Courier,monospace;">sudo pecl install apc</span></b><br />
<b><span style="font-family: "Courier New",Courier,monospace;">sudo echo "extension=apc.so" >> /etc/php5/apache2/php.ini</span></b><br />
<span style="font-family: "Courier New",Courier,monospace;"><b>sudo apachectl restart</b></span>Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com12tag:blogger.com,1999:blog-2940075381625149273.post-68459493523682545742010-08-30T17:05:00.004+02:002010-10-06T07:50:50.549+02:00Rails 3 on Ubuntu 9.10I had installed ruby gems (rubygems) using the apt package management system, which is the <a href="https://help.ubuntu.com/community/RubyOnRails">recommended way</a>, but ran into a problem when I wanted to install rails 3:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">Error installing rails:<br />
i18n requires RubyGems version >= 1.3.6</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> </span><br />
The solution was to install the <a href="http://rubyforge.org/frs/?group_id=126">latest version of gems</a> from its source<span style="font-family: "Courier New",Courier,monospace;">:</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz</span><br />
<span style="font-family: "Courier New",Courier,monospace;">tar xvfz rubygems-1.3.7.tgz</span><br />
<span style="font-family: "Courier New",Courier,monospace;">cd rubygems-1.3.7<br />
sudo ruby setup.rb </span><br />
<br />
Now it works like a charm<span style="font-family: "Courier New",Courier,monospace;">:</span><br />
<span style="font-family: "Courier New",Courier,monospace;"><br />
sudo gem install rails</span><br />
<span style="font-family: "Courier New",Courier,monospace;">rails new testapp</span><br />
<br />
That's it for today.<span style="font-family: "Courier New",Courier,monospace;"> </span>Thanks for stopping by.<br />
<br />
PS: Instead of using the system wide ruby gems (like I just showed you) you can also use the <a href="http://rvm.beginrescueend.com/">RVM</a> (Ruby Version Manager), which lets you use different versions of ruby and gems for each ruby/rails project.Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com10tag:blogger.com,1999:blog-2940075381625149273.post-1759806498627556412010-07-11T15:03:00.006+02:002010-07-11T23:03:58.383+02:00Geotagging EmailsToday I was reading a letter my mother had sent to her aunt 3 days after I was born. Handwritten three pages, describing how I was still in the children's ward, how my brother had visited me and more personal stuff. But that's not what this post ist about. It's about the header of the letter, which got me thinking. It read: <span style="font-weight: bold;">"Göttingen, 27.12.79"</span> above the salutation.<br />
<br />
So apart from <span style="font-weight: bold;">senders address on the envelope</span>, the letter included another header stating the location and the date. Where and when the letter had been written is part of the letter. Another clue as to from where the letter is sent is the <span style="font-weight: bold;">postmark</span> on the stamp.<br />
<br />
The way I understand email headers is that they are for adding metadata to the content of the email, similiar to the envelope. First and foremost of course, it includes the addressee, but also the sender's name and email address. Another header is the date the email was sent at. In the old days, an email address may have given you a clue as to where the person is located, the first email to arrive in germany was sent to "rotert@germany", which was a bit unspecific, but you get the idea.<br />
<br />
Things have changed and now most people have an email address that doesn't give a clue about their current location. Sometimes other email headers may provide a clue, for example IP-addresses can be geolocated, but since the rise of smart phones, emails are written from anywhere. The simplest way to let the recipient know about your whereabouts is by simply writing it into the body of the mail, but that's not really machine readable. <br />
<br />
<span style="font-weight: bold;">I propose introducing an optional email header that specifies the senders geographic location.</span><br />
<code><br />
X-Sender-Geo-Location-Lon: 13.409082<br />
X-Sender-Geo-Location-Lat: 52.528087<br />
X-Sender-Geo-Location-Accuracy: 500<br />
X-Sender-Geo-Location-Placename: Berlin, Germany<br />
</code><br />
<br />
If a location is provided, accuracy is required, the address field can be used for displaying, if not available it can be reverse geolocated. But those are just details. I think parts of the <a href="http://dev.w3.org/geo/api/spec-source.html">geolocation API</a> can be used or adopted, like altitude, heading and speed.<br />
<br />
I would love to hear what people think of adding a geo tag to email headers. It shouldn't be too difficult to write <a href="https://addons.mozilla.org/en-US/developers">thunderbird add-on</a> that let's you specify these header components and display a map if they are present. Or a <a href="http://code.google.com/intl/en-EN/apis/gadgets/docs/tools.html">gadget for gmail</a>.Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com9tag:blogger.com,1999:blog-2940075381625149273.post-49161224417890656432010-07-04T15:37:00.007+02:002010-07-04T16:10:59.445+02:00XSS on youtubeI just wrote a mail to the google security team, but I'm sure they're aware of it already anyways. I was telling them about a html injection attack on youtube that's going on. Apparently comments aren't properly escaped so this will actually put a marquee on the page:<br /><br /><script>IF_HTML_FUNCTION?<marquee><b>Woot!<script><br /><br /><br /><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 62px;" src="http://2.bp.blogspot.com/_wBHNnp__7L0/TDCSKnlVa1I/AAAAAAAAEQM/gwqlVteAwHw/s320/Bildschirmfoto+2010-07-04+um+15.51.35.png" alt="" id="BLOGGER_PHOTO_ID_5490048656886557522" border="0" /><br />Supposedly, this XSS attack works too, but I couldn't confirm it:<br /><br /><script>IF_HTML_FUNCTION?<body onload="while(1){ alert('Woot!'); }"><script><br /><br />Edit: <a href="http://www.reddit.com/r/programming/comments/cluc5/html_injection_vulnerability_in_youtube_comments/">Reddit</a> has a good discussion on it.Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-72511145361973710472010-02-25T12:10:00.003+01:002010-02-25T12:19:21.697+01:00CoffeeScript<span style="font-size:100%;">I've just found out about <a href="http://jashkenas.github.com/coffee-script/">CoffeeScript</a> which is a really neat way to make JavaScript look nicer. It can be compiled on the fly to real JavaScript. Here's one example I just wrote:<br /><pre style="font-family: courier new; color: rgb(51, 51, 255);">fibonacci: (x)-><br /> return 0 if x == 0<br /> return 1 if x == 1<br /> return fibonacci(x-1) + fibonacci(x-2)<br /><br />alert fibonacci 10<br /></pre>which compiles into this:<br /><pre style="font-family: courier new; color: rgb(51, 51, 255);">var fibonacci;<br />fibonacci = function fibonacci(x) {<br /> if (x === 0) {<br /> return 0;<br /> }<br /> if (x === 1) {<br /> return 1;<br /> }<br /> return fibonacci(x - 1) + fibonacci(x - 2);<br />};<br />alert(fibonacci(10));<br /></pre>pretty sweet huh?<br /></span>Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-50555058725946032982009-05-21T20:28:00.002+02:002009-05-25T21:58:48.785+02:00A comparison of major open source javascript WYSIWYG HTML editorsThis post is about comparing open source javascript based WYSIWYG (what you see is what you get) HTML editors, which run in the browser. People who are not intimately familiar with the inner workings of html and css need them. They'll usually look something like this (which is the blogger.com wysiwyg editor :)<br /><br /><div style="text-align: center;"><a href="http://3.bp.blogspot.com/_wBHNnp__7L0/SeuBhdOYLdI/AAAAAAAAC2I/YKsVxyBo9Ng/s1600-h/wysiwyg.png"><img style="width: 328px; height: 140px;" src="http://3.bp.blogspot.com/_wBHNnp__7L0/SeuBhdOYLdI/AAAAAAAAC2I/YKsVxyBo9Ng/s320/wysiwyg.png" name="Grafik1" align="BOTTOM" border="0" vspace="5" /></a></div> <p style="margin-bottom: 0.5cm;" align="LEFT">These editors are often referred to as rich text editors (RTE), what they'll do is convert a regular html textarea element into a word processor. Sort of.<br /><br />There's some magic involved: They'll grab the content of the textarea, create an iframe, put the content in there and turn on designMode in the iframe. The content can then be modified. Read more about it <a href="http://devedge-temp.mozilla.org/viewsource/2003/midas/01/index_en.html">here</a>.<br /><br />But because different browsers handle things differently, a good JS editor has to deal with all bugs and ways a browser creates markup, so (cross platform) compatibility counts. Also it the output created by the RTE shouldn't vary from browser to browser.<br /><br />Furthermore it has to be extensible without hacking it, localizable, and customizable. Good documentation is a must as is a clean and open source code base.<br /><br />I'm also looking media integration, as this is a request i see a lot.<br /><br />I looked around and found <a href="http://www.geniisoft.com/showcase.nsf/WebEditors">this site</a> where a lot of editors are compared, but it's not quite up to date. Here is <a href="http://www.standards-schmandards.com/2007/wysiwyg-editor-test-2/">another one</a>. And <a href="http://blog.webdistortion.com/2008/03/09/9-of-the-best-rich-text-editors-reviewed/">another</a>. So i figured, I'll take a new look at some of those editors. Mostly the ones I have worked with before and which are being talked about enough. Here's my selection (it seems like it matches <a href="http://en.wikipedia.org/wiki/Category:JavaScript-based_HTML_editors">wikipedia's list</a>) in alphabetical order:</p> <ul><li>FCKeditor</li><li>Dijit Editor (dojo toolkit)</li><li>Kupu</li><li>Tiny MCE</li><li>YUI Editor</li><li>Xinha (former HTMLArea)</li></ul> <p align="LEFT">I want to start out with a list of things they all have in common:</p> <ul><li>Open source license like GPL, LGPL, BSD Style ...</li><li>Configurable toolbar of available html/css elements, for example: link, strong / bold, italics, underline, font-size, font-family, ordered and unordered list, blockquote, align, indent, img, etc.</li><li>Ability to provide your own plugins</li><li>Skins</li></ul> <p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family:arial;"><span style="font-size:180%;">FCKeditor</span></span></p><p style="margin-bottom: 0cm;" align="LEFT"><a href="http://www.fckeditor.net/">http://www.fckeditor.net/</a><br /><br /><span style="font-size:100%;">It's rock solid and it has the ability to create almost all html entities you can think of, even though i don't see how inserting a form element is all that necessary, which can be disabled of course. It's got everything, h1-h6, pre, code, sub- and superscript... You can even insert a div and choose a css class from a list or enter your own.</span> I18N? You got it.<br /><br /><span style="font-size:100%;">What I really like is how you can use the integrated file browser, if a server side connector is available, sample code is included. Editing in "full-screen-mode" is possible.</span><br /><br /><span style="font-size:100%;">Here's a small thing a don't like so much: If you want to modify a dialogue, for example the "create link" dialogue, which</span> <span style="font-size:100%;">might be necessary to allow easier access to site-internal links, you'll have to hack the corresponding html and js files. While this might be acceptable, it's not clean as changes will be lost in a subsequent updates and it cannot be shared as easily</span> <span style="font-size:100%;">as a plugin can.</span><br /><span style="font-size:100%;"><br />As I understand, it's currently being rewritten to allow exactly that kind of <a href="http://docs.fckeditor.net/FCKeditor_3.x/Design_and_Architecture/Dialog_System">interaction with the dialogs</a>, the next major version will </span>be called <a href="http://ckeditor.com/">CKEditor</a>.<br /><br /><span style="font-family:arial;"><span style="font-size:180%;">Dijit Editor</span></span></p><p style="margin-bottom: 0cm;" align="LEFT"><a href="http://dojocampus.org/explorer/#Dijit_Editor">http://dojocampus.org/explorer/#Dijit_Editor</a><br /><br />This light weight editor is part of the dijit widget library of the dojo framework. It's very basic, but nice to have if you're already using dojo. Apart from that it's not a good choice. There is little <a href="http://docs.dojocampus.org/dijit/Editor">documentation</a>, but none as to how to create or modify existing plugins. No one seems to be writing plugins for it, also it uses block quote for indention, which is semantically incorrect and the html it creates isn't very good what paragraphs and breaks are concerned. The worst part it the limited set and configurability of html elements in the toolbar, there's not even the image tag. I mean common!<br /><br /><span style="font-family:arial;"><span style="font-size:180%;">Kupu</span></span></p><p style="margin-bottom: 0cm;" align="LEFT"><a href="http://kupu.oscom.org/">http://kupu.oscom.org/</a><br /><br />Kupu is centred around the idea of making the whole document (page) editable, so it provides means to edit more than just the html. Testing it proved harder than I would have thought, but I figured I should give it a try, since it's the highly integrated rich text editor for Plone, a CMS of which I think highly. I gotta say though, i hate it when there's so little documentation. I ended up looking at how it is used in Plone, which is awesome, no doubt about it, BUT using it on my own project: not a chance. Still very interesting.<br /><br /><span style="font-family:arial;"><span style="font-size:180%;">Tiny MCE</span></span></p><p style="margin-bottom: 0cm;" align="LEFT"><a href="http://tinymce.moxiecode.com/">http://tinymce.moxiecode.com/</a><br /><br />It's very much like FCKeditor, except there's even more options. Editing inline CSS: not a problem. Plays well with tables: yes. Is the default for wordpress: yes. I18N: sure. It really seems to be quite popular as you can <a href="http://wiki.moxiecode.com/index.php/TinyMCE:CMS_systems">see here</a> (a long list of content management systems) and it's well documented. There's a company called Moxiecode which continuous to develop it, which is good, because they take good care of the code. But that also means they have a financial interest and since it's open source, well, they can't charge you for using it. But they can charge you for plugins, they have created: 50 € for a file manager or 32 € for an image manager. I haven't tried these, but I'm sure, they'll get the job done. It's not a bad monetization strategy either, create a good free product, get lots of users and sell quality plugins.<br /><br />What extending a dialog is concerned, the same that goes for FCKeditor also goes for TinyMCE, mucking about in the source is required.<br /><br /><span style="font-family:arial;"><span style="font-size:180%;">YUI Editor</span></span></p><p style="margin-bottom: 0cm;" align="LEFT"><a href="http://developer.yahoo.com/yui/editor/">http://developer.yahoo.com/yui/editor/</a><br /><br />Honestly, this editor just blows my mind. It's so well structured, it's backed by a big company (Yahoo!) with true open source ambitions. There's a vivid community and a huge collection of <a href="http://blog.davglass.com/2006/06/yui-code-samples/">example code</a> and plugins available. I18N and documentation: Yes, sir. The YUI Editor is part of the YUI JavaScript Library, which is a modular collection of tools for building rich internet applications (RIA) or for simply adding a little functionality to a website. The editor is pretty sweet, but doesn't have all the bells and whistles the FCKeditor or the TinyMCE provide. But you can teach him :D<br /><br />What I like about extending it, is how easy that is, and how you can can literally hop in at any point and change what it does or how it looks. The way it works is that events are fired when a button is pressed or a dialogue is opened. You can then hook into that event and do your thing. Also everything is build from script, so no need to worry about changing static templates, it's all dynamically created.<br /><br /><span style="font-family:arial;"><span style="font-size:180%;">Xinha</span></span></p><p style="margin-bottom: 0cm;" align="LEFT"><a href="http://trac.xinha.org/">http://trac.xinha.org/</a><br /><br />I was looking into this editor, because its predecessor (HTMLArea) is the standard RTE in Typo3, a fairly popular CMS, at least in Germany. It's got tons of buttons, a lot like FCKeditor, some more esoteric ones for formula creation or even music notation... It seems to have a nice file manager integrated. What it lacks is documentation on how to write your own plugin. It also doesn't seem to have a lot of user or developers. I wonder if it'll be the RTE of the Typo3 5.0, my guess would be "no", but you never know. I know that it hasn't gained enough traction yet to use in long term project.<br /><br /><span style="font-family:arial;"><span style="font-size:180%;">Conclusion</span></span><br /><span style="font-size:100%;"><br /></span>There are lots of javascript rich text editors out there, i haven't even looked at the commercial ones. Most are pretty useless as they aren't cross browser compatible or outdated or have no documentation... I tried to look into the most active and promising ones that met my cross browser and open source criteria and found significant differences in capabilities and configurability.<br /><br />For now FCKEditor and TinyMCE aren't a bad choice, as they provide a very large array of buttons, while still being configurable. If you're going for customisation of features or if you're looking for ways to enhance or change the existing dialogues of the editor you should go for the YUI editor.</p><p style="margin-bottom: 0cm;" align="LEFT">One more thing though: Even if YUI might be nicer to enhance and it's all shiny and new, it still might be a better choice to go with the editor that a given blog engine comes with or that the cms of choice has highly integrated.<br /></p><p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family:arial;"><span style="font-size:180%;">Future</span></span></p><p style="margin-bottom: 0cm;" align="LEFT">My impression is that the upcoming CKEditor is definitely something to be on the lookout for, as it implements some nice features.<br /></p><p style="margin-bottom: 0cm;" align="LEFT">Once the third generation of the YUI suite is out, it'll be even more interesting, YUI 3 will provide jQuery like selector expressions, and I think it's a chance to soley rely on one JS lib, because if you use multiple libraries and / or editors they will inevidably duplicate functionality and thus costs more bandwidth. But that's a different story.</p>Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-58220890003322710112009-04-25T13:17:00.004+02:002009-04-25T13:34:20.040+02:00Thunderbird 3 reviewI've just installed the 2nd beta of thunderbird 3, the mozilla e-mail client on my mac. I did so because I wanted to be able to use the address book that mac os x provides, which was not supported in thunderbird 2. After some searching I stumbled upon <a href="http://forums.mozillazine.org/viewtopic.php?p=3003235">this thread</a>, which is quite old, but hints at using TB 3. So I did.<br /><br />The address book intergration works well and I'm happily using those adresses. But I noticed some more changes, which are worthy mentioning:<br /><ul><li>Thunderbird is now a <a href="http://www.mozillamessaging.com/en-US/thunderbird/3.0a1/releasenotes/">native cocoa app</a></li><li>The coolest thing ever though, is how <a href="http://www.mozillamessaging.com/en-US/thunderbird/3.0b1/releasenotes/">tabs have been introduced</a>, keep multiple mails or inboxes or feeds or ... open at a time is really nice. Tabbed browsing for mails: awesome!<br /></li></ul>BTW, i switched from mail.app because it was driving me nuts how it took forever to get mails via imap.<br /><br />Even though it's beta, it's been running just fine, so I recommend <a href="http://www.mozillamessaging.com/en-US/thunderbird/early_releases/downloads/">giving it a try</a>!<br /><ul><li><br /></li></ul>Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-36134720829153526772009-04-07T21:41:00.001+02:002009-04-08T02:57:59.387+02:00The almighty vimI started using vim about two years ago, around the time I started using linux not only on the servers i connected to, but also on my box at home. It takes a little to get used to, but after a while you learn to appreciate having the editor available imediatly on almost any linux/unix/mac os x installation.<br /><br />Yesterday I <a href="http://linuxhelp.blogspot.com/2006/09/visual-walk-through-of-couple-of-new.html">found</a><a href="http://linuxhelp.blogspot.com/2006/09/visual-walk-through-of-couple-of-new.html"> out</a> about the code completion feature, and that just blew my mind! I didn't know that was possible, but apparently since vim 7.0 you can edit a file, say index.php, and press CTRL+X CTRL+O and you'll see a list of available commands for the given programming language, selecting one will also give you the syntax.<br /><br />One less reason to use an IDE, like Eclipse which just doesn't really work for PHP development on remote systems. That's a different story though. (You can use remote system explorer to connect eclipse via FTP to a different host and use pdt for syntax highlighting, BUT: everytime you connect, the whole project is scanned for code used in code completion or something...)Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com1tag:blogger.com,1999:blog-2940075381625149273.post-38687440040309600032009-04-07T21:24:00.000+02:002009-04-08T00:32:34.526+02:00Regular Expressions that come in handy<p>These regexes i seem to need often when polishing static html pages and moving to a css based design. I remove all font related markup like this:</p><p>Finds all opening and closing html font tags:<br /><code><br /><(/)?font[^>]*><br /></code></p> This on is for all "font-family: XXX;" inline css markup:<br /><code><br />font-family:[^;"]*(;|")<br /></code>Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-28823998371469834032009-04-07T21:17:00.000+02:002009-04-07T21:21:17.336+02:00Drupal modul hacking or patching<p>If you want to get a certain module from drupal.org (often referred to as DO) and maybe want to work on it, you really want to check it out from the CVS they have.</p> <p>For example getting the DRUPAL-6--2 revision of the yui_editor module into a new directory called yui_editor works like this (replace yui_editor with the modules name you're working on):</p><p><code> cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-6--2 -d yui_editor contributions/modules/yui_editor<br /></code></p> <p>You can find out which tags are available on this site<br /><a href="http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/yui_editor/" title="http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/yui_editor/">http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/yui_editor/</a></p> <p>you can then modify it and create a patch like this:</p> <p><code> cd yui_editor<br />cvs diff -up > myfirst.patch<br /></code></p> <p>This makes it possible to hack a module and still be able to update it via </p> <p><code> cvs up<br /></code></p> <p>I hope it helps!</p> <p>More:<br /><a href="http://en.wikipedia.org/wiki/Concurrent_Versions_System" title="http://en.wikipedia.org/wiki/Concurrent_Versions_System">http://en.wikipedia.org/wiki/Concurrent_Versions_System</a><br /><a href="http://drupal.org/node/321" title="http://drupal.org/node/321">http://drupal.org/node/321</a></p>Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0tag:blogger.com,1999:blog-2940075381625149273.post-76411263238069899922009-04-07T20:44:00.001+02:002009-04-07T21:07:49.451+02:00Files multiple times in iTunesI ran into the problem that i had imported big parts of my mp3 collection into iTunes more than once. Actually i started importing them a couple of times and for some reason i cancelled the import. I ended up with many of my songs multiple times in my library folder.<br /><br />iTunes has the ability to show me the duplicate files, but they were too many to manually delete them. So I wrote a little python script:<br /><pre><br />import os<br />itunes = os.walk("/Users/" + os.getlogin().capitalize() + "/Music/iTunes")<br />for (path, subs, files) in itunes:<br /> for file in files:<br /> for i in range(0,10):<br /> duplicatefilename = file[:-4] + " " + str(i) + file[-4:]<br /> if duplicatefilename in files:<br /> os.remove(os.path.join(path, c))<br /> print (os.path.join(path, c))<br /></pre><br /><br />You can put that code in a file, say "removeduplicates.py" and then run it by typing<br /><br />python removeduplicates.py<br /><br />It'll take a while depending on your itunes library size, but it'll get them all...<br /><br />After that I had lots of dead tracks in my library, as the files were deleted, but the itunes index not updated. looking around a little, <a href="http://problemstosolve.com/os-x/remove-broken-song-links-in-itunes/">i found a solution</a><br /><br />what i'm still very unhappy about is that ican't use my old .m3u files. :(Eike Sendhttp://www.blogger.com/profile/15425144373928368769noreply@blogger.com0