If you're Canadian and concerned about your online rights, go visit Online Rights Canada. It's an organization created by the EFF and Canadian Internet Policy and Public Interest Clinic to "promotes the public's interest in technology and information policy".
And while your at it, also visit Micheal Geist blog, Micheal is a law professor at University of Ottawa and very active in promoting and defending our rights (or the ones we should have) regarding technology, copyrights and information policies.
12.09.2005
12.07.2005
Fixing iTunes 6 library with Ruby
Like many people, when I upgraded iTunes to V6, I had problem with my iTunes library. For some reason, in the upgrade process iTunes lost the location of many mp3 files in its library.
I was unable to use the fix proposed by Apple as I do not immediately found out about the problem. I added stuff to my library and would loose all me new playlists and ratings if I followed it. Also, I was not able to find a version of my library dated at the time of the upgrade.
I have something like 1200 songs in my library, more than 200 of them lost the location of the actual mp3 file. Clicking around to try to find them within iTunes would have take me days.... And bored me to death.
So I wanted to add all these files back to my library while keeping their rating (I did not care much for the last play time and play count).
I've started to play with Ruby a few weeks ago. I use it to test web application using Watir. I thought that fixing my iTunes library with a small Ruby script would be a fun thing to try.
So I did... I wrote a small Ruby script that would connect to iTunes using the Win32 OLE interface. The script is fairly simple, it check each tracks in the library and if it's location is an empty string, it try to find the music file (mp3 or m4a), add it back to the library and set it's rating to the same rating as the current track.
Note that I could not just set the Location property of the track as this property is read only using the iTunes OLE interface.
A few minutes later, all the music files that matched to a song name were added back to my library with the proper rating. I did have to get rid of the duplicates entries in my library. But at least iTunes allows one to easily show duplicate songs. It was just a matter of selecting songs with the (i) icon, right-clicking and pressing clear.
I also wrote another Ruby script that would scan my music folder and add music file that were not already present in my library. This was necessary as my first script missed some files. I lost my rating for these files but there was'nt that many of those.
So here are the Ruby script, customize them to your liking (like the music base folder) and use them to fix your own library. But do so at your OWN RISK. I do not garantee that they will work for you!
Script 1 :
Script 2 :
I was unable to use the fix proposed by Apple as I do not immediately found out about the problem. I added stuff to my library and would loose all me new playlists and ratings if I followed it. Also, I was not able to find a version of my library dated at the time of the upgrade.
I have something like 1200 songs in my library, more than 200 of them lost the location of the actual mp3 file. Clicking around to try to find them within iTunes would have take me days.... And bored me to death.
So I wanted to add all these files back to my library while keeping their rating (I did not care much for the last play time and play count).
I've started to play with Ruby a few weeks ago. I use it to test web application using Watir. I thought that fixing my iTunes library with a small Ruby script would be a fun thing to try.
So I did... I wrote a small Ruby script that would connect to iTunes using the Win32 OLE interface. The script is fairly simple, it check each tracks in the library and if it's location is an empty string, it try to find the music file (mp3 or m4a), add it back to the library and set it's rating to the same rating as the current track.
Note that I could not just set the Location property of the track as this property is read only using the iTunes OLE interface.
A few minutes later, all the music files that matched to a song name were added back to my library with the proper rating. I did have to get rid of the duplicates entries in my library. But at least iTunes allows one to easily show duplicate songs. It was just a matter of selecting songs with the (i) icon, right-clicking and pressing clear.
I also wrote another Ruby script that would scan my music folder and add music file that were not already present in my library. This was necessary as my first script missed some files. I lost my rating for these files but there was'nt that many of those.
So here are the Ruby script, customize them to your liking (like the music base folder) and use them to fix your own library. But do so at your OWN RISK. I do not garantee that they will work for you!
Script 1 :
require 'win32ole'
iTunes= WIN32OLE.new('iTunes.Application')
tracks= iTunes.LibraryPlaylist.Tracks
totalTracks= 0;
tracks.each {|t|
totalTracks+= 1
if t.Location == ''
puts t.Name
name= t.Name
Dir.glob(File.join("D:\\My Music", "**", "*#{name}*.{mp3,m4a,MP3}")) {|l|
puts "Adding #{l} to iTunes"
status= iTunes.LibraryPlaylist.addFile(l)
while (status.InProgress) do
sleep(0.5)
end
status.Tracks.each {|track|
track.rating= t.rating
}
}
end
}
puts totalTracks
iTunes= WIN32OLE.new('iTunes.Application')
tracks= iTunes.LibraryPlaylist.Tracks
totalTracks= 0;
tracks.each {|t|
totalTracks+= 1
if t.Location == ''
puts t.Name
name= t.Name
Dir.glob(File.join("D:\\My Music", "**", "*#{name}*.{mp3,m4a,MP3}")) {|l|
puts "Adding #{l} to iTunes"
status= iTunes.LibraryPlaylist.addFile(l)
while (status.InProgress) do
sleep(0.5)
end
status.Tracks.each {|track|
track.rating= t.rating
}
}
end
}
puts totalTracks
Script 2 :
require 'win32ole'
iTunes= WIN32OLE.new('iTunes.Application')
tracks= iTunes.LibraryPlaylist.Tracks
totalTracks= 0
Dir.glob(File.join("D:\\My Music", "**", "*.{mp3,m4a,MP3}")) {|l|
found= false
tracks.each {|t|
if t.Location.rindex(File.basename(l)) then
found= true
break
end
}
if (!found) then
totalTracks+= 1
puts "Adding #{l} to iTunes"
status= iTunes.LibraryPlaylist.addFile(l)
while (status.InProgress) do
sleep(0.5)
end
end
}
puts totalTracks
Have fun!iTunes= WIN32OLE.new('iTunes.Application')
tracks= iTunes.LibraryPlaylist.Tracks
totalTracks= 0
Dir.glob(File.join("D:\\My Music", "**", "*.{mp3,m4a,MP3}")) {|l|
found= false
tracks.each {|t|
if t.Location.rindex(File.basename(l)) then
found= true
break
end
}
if (!found) then
totalTracks+= 1
puts "Adding #{l} to iTunes"
status= iTunes.LibraryPlaylist.addFile(l)
while (status.InProgress) do
sleep(0.5)
end
end
}
puts totalTracks
12.06.2005
RE: Benevolent Worms
Bruce Schneier wrote about Benevolent Worms.
While I mostly agree that Benevolent Worms are not necessarely a good idea. I don't think they are as bad as Bruce says.
The main problem of benovelent worms in Bruce opinion is that they act without the user knowledge and consent. While this may be true, this is just a design issue. Upon arriving on a computer, the worm can always ask permission to the use to install itself and activate. It's true that the initial "infection" is without consent, but it is mostly like Automated Update were an update is automatically downloaded and the software ask for the user consent to install and activate it.
Computer viruses and worms spread a bit like their biological counterpart (the mecanism is different, but the spreading model is close enough). So I beleive it's fair enough to create counter measure mechanism that mimics more or less the biological system.
With that idea in mind, benevolent worms are not necessarly a bad thing. It would make sense that when a threat is detected a system create defenses and spread them accross it's system. We can see a computer network as a system and the computers within it as it's cells. A benevolent worm could easily do that. When new cells are added to the system, the benevolent worm would migrate to them to make sure they have the proper self-defense machanism.
Now, for the benevolent worm to be of no danger, it should stay within well defined boundaries. It should never "infect" another network without that network consent. It should also be easily removable or upgradable.
The problem right now, is that the actual benefit that a benevolent worm can provide (automated threat defense) is not much better that managed automatic update. And it comes with it's load of potential problems : bugs, uncontrolled spreading, vulnerabilities within the worm, etc. The fact that we need to limit the potential spreading of the worm to external network makes it less effective. For true effectiveness, the worm should be allowed to spread across networks and to patch system (at least temporarely) without the user consent. Then how would a system react to an infection of a "good" agent? How can a system can make sure that the payload of a worm is for it's own benefit? It simply can't.
Benevolent worm sounds good... They also sound bad! I believe researcher should continue to invistigate the implication of this idea. Maybe, sometime in the future, we will find out that they are the only mechanism to defend a complex network against threat. Then maybe not...
10.27.2005
Moving to Blogger
I just moved my blog from Bloglines to blogger. You can check my old blog here (http://www.bloglines.com/blog/terminus).
6.01.2005
Toronto cops return bike they stole from homeless guy
URL: Toronto cops return bike they stole from homeless guy
I'm flabergasted by this story... Since when one have to prove that he own something to the cops? I can understand if the good in question was reported stolen, but it was not and the homeless guy had the receipt!
Is it because the guy in question is homeless... Then the cops assume he should not own a brand new bike? This is really crazy... I hope that the cops that stole this guy bike will be reprimanded!
5.05.2005
Longlasting effect of terrorism
Yesterday, four people were inconvenienced by a mysterious white powder, discovered by custom officials, at Pierre-Elliot Trudeau international airport in Montreal.
The inconvenience they had ranged from headache, throat irritation to cardiac faintness.
Now, it turns out that the mysterious white powder was not a chemical or toxic agent, but was flour or maybe sugar (it's kinda weird that after 24 hours they still not able to differenciate flour from sugar).
So the symptoms these people experienced were psycho-somatic. It was all in their minds. This is the real consequence of terrorism. While acts of terrorism kill people, it is how they affect the living people that makes them act of terrorism. And the real cost of terrorism is not the immediate lost of lives but the long lasting effects they have on people.
Everybody remembers of the Anthrax scare that happened soon after the 9/11 attack. Since then, nothing relly happened. We had many unfounded scares, but no real threats. So even if the Anthrax scare directly affected only a handfull of people, they have long lasting effects that spans many years. It may even kill again. People of so fearful that they can get an hearth attack just by looking at some unknown white powder. In this case, the anxiety probably reach one person of the group (there was 11 people in the room where they examined the package) and he exibited anxiety related symptoms. The anxiety gradually reached more people and one of them (with historical hearth condition) had cardiac faintness.
Because these threats don't happen very often, they strike our imagination a lot more. Nobody get stressed out like that when they climb into their cars, even if they have a greater probability of being killed in a car accident than in an act of terrorism.
References :
* De la poudre aux yeux (french site) (sorry, the link no longer work and I can't seems to find the article in this web site archives)
Subscribe to:
Posts (Atom)