tag:blogger.com,1999:blog-82502141929810587022024-03-13T10:54:53.118-07:00Machine ReadableUnknownnoreply@blogger.comBlogger17125tag:blogger.com,1999:blog-8250214192981058702.post-74500635879007446182012-12-27T01:38:00.001-08:002012-12-27T01:53:44.241-08:00Smart "Back" Button for Wordpress posts/pages<div dir="ltr" style="text-align: left;" trbidi="on">
While coding a Wordpress site, I wanted to add a back button for posts and pages.<br />
Hierarchical pages should obviously point back to their parents, but what of non hierarchical pages?<br />
<br />
If a user navigated from the "Gallery" page to the "About" page - I would like the sites "back" button to return him to the "Gallery" page. This could be easily implemented using JavaScript but why use user-side scripting when you can generate the code on the server side?<br />
<br />
The obvious solution would be to use the referring URL as a target for our "back" button. We must now avoid two special cases:<br />
<br />
<ol style="text-align: left;">
<li>The page is a sub-page and the back button should point to its parent.</li>
<li>The previous URL was an off-site URL, and the back button should not appear at all.</li>
</ol>
This code snippet solves both problems: if the post is non-hierarchical, the referring URL is checked - if no URL is provided, or if the URL is off-site, no "back" button is displayed.
<br />
<pre class="brush: php; gutter: false;">$ref_url = wp_get_referer();
$ref_parse = parse_url($ref_url);
$my_parse = parse_url(get_permalink());
if (($ref_url==get_permalink() || empty($ref_url)) && $post->post_parent) {
$show_back_to_parent=true;
$ref_url = get_permalink($post->post_parent);
}
if ($ref_parse[host]==$my_parse[host] || $show_back_to_parent) {
echo $ref_url;
}</pre>
</div>
Unknownnoreply@blogger.com17tag:blogger.com,1999:blog-8250214192981058702.post-56542828511831602102012-06-08T14:40:00.000-07:002012-08-04T01:39:14.045-07:00When transmission-daemon settings won't update<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
</div>
The transmission-daemon <a href="https://trac.transmissionbt.com/wiki/ConfigFiles">wiki</a> instructs users to edit settings.json at
<br />
<pre class="brush: bash; gutter: false;" style="clear: none;">$HOME/.config/transmission-daemon</pre>
But you may find that editing that file has no effect on your daemon. In such cases, you might want to try the following:<br />
1. Stop the daemon (sudo may be required)<br />
<pre class="brush: bash; gutter: false;">/etc/init.d/transmission-daemon stop</pre>
2. Edit the settings.json file found at:<br />
<pre class="brush: bash; gutter: false;">/etc/transmission-daemon/settings.json</pre>
3. Restart the daemon<br />
<pre class="brush: bash; gutter: false;">/etc/init.d/transmission-daemon stop</pre>
<br />
If that doesn't work, you may want to look for the settings file here as well:<br />
<pre class="brush: bash; gutter: false;">/var/lib/transmission-daemon/info</pre>
<br />
This solution by <a href="http://ubuntuforums.org/member.php?u=1130241">elico</a> of the <a href="http://ubuntuforums.org/showpost.php?p=9720068&postcount=10">Ubuntu Forums</a> ended hours of frustration caused by useless edits to the settings.json file in my home directory. I hope you find it helpful as well.</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8250214192981058702.post-32952896014434208732012-06-06T06:33:00.000-07:002012-06-06T13:21:07.406-07:00How Dropbox saved me from an SSD faliure<div dir="ltr" style="text-align: left;" trbidi="on"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDf_xgbN7R7T64WYx6WcZBZso2nAa-4TV8fjlol2_RmL5u6M5gSTPQQkenNTqKuuv1NOf76HPY4E0h0rwNe72pnkTwzbj1qK4tMvTY6t5yUYOkpDMQonoVut-YTDFMWl1OQnvoVVn-qLQ/s1600/Photo+Jun+06,+11+47+28.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDf_xgbN7R7T64WYx6WcZBZso2nAa-4TV8fjlol2_RmL5u6M5gSTPQQkenNTqKuuv1NOf76HPY4E0h0rwNe72pnkTwzbj1qK4tMvTY6t5yUYOkpDMQonoVut-YTDFMWl1OQnvoVVn-qLQ/s200/Photo+Jun+06,+11+47+28.jpg" width="200" /></a></div>I've long held that laptops are an inherently unsafe place for your data. Laptops can be stolen or lost, HDDs are prone to damage due to frequent transportation and of course: laptops tend to be used in dangerous places and are consequentially prone to drops and liquid spills.<br />
<br />
About two months ago I figured I'd remove one risk factor from the equation, and got myself a spankin' new SanDisk SSD (the <a href="http://www.amazon.com/gp/product/B005F3000W/ref=as_li_ss_tl?ie=UTF8&tag=boaara-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=B005F3000W">60GB 'Ultra'</a> model). Unfortunately, that disk just died without warning this morning.<br />
<br />
While that SSD contained several academic assignments due in mere days as well as the images from my latest commercial photo-shoot, you might expect to find me up a certain creek without a paddle.<br />
<br />
Fortunately, I was well prepared for such occurrence:<br />
All my critical data, including my image catalog reside within my <a href="http://www.dropbox.com/referrals/NTM1MTk5MDY5">Dropbox</a> folder. This reduces my risk of data loss - as I can only lose un-synced files.<br />
Since I rarely venture too far from a high-speed internet connection it's unlikely that I'd lose more than a days work. In this case, I lost nothing (excluding possibly some saved <a href="http://www.machinereadable.com/2012/04/slim-down-your-bloated-starcraft-ii.html">StarCraft II</a> replays).<br />
<br />
Backup is actually a secondary function of my Dropbox setup, the main perk is immediate synchronization with my desktop. By the time I get home, my lecture notes are already on my desktop. I can spend a weekend away from home, work on my projects, and return to my desktop without ever worrying about merging file revisions.<br />
<br />
A convenient smartphone app even allows me to send out links to my Dropbox files on the go. This is very handy for sending out a resume at a moments notice or submitting a paper at the last minute.<br />
<br />
<a href="https://www.dropbox.com/referrals/NTM1MTk5MDY5">Dropbox</a> only comes with 2GB of free space, which would usually cover any schoolwork you might have but hardly a photography catalog. You can get more space by refereeing customers to the service (you'll notice my deviously placed referral code in the previous links), or pay for 50-100GB plans.<br />
<br />
I manage just fine with a free <a href="https://www.dropbox.com/referrals/NTM1MTk5MDY5">Dropbox</a> account and some referral awarded space. If you need more, <a href="http://drive.google.com/">Google Drive</a>, <a href="https://www.icloud.com/">Apple iCloud</a> and *shudder* <a href="https://skydrive.live.com/">Microsoft SkyDrive</a> offer similar services. Depending on your needs, you may find one suites you better than the other. Engadget has a nice comparison article up <a href="http://www.engadget.com/2012/04/24/google-drive-vs-the-competition-dropbox-skydrive-icloud/">here</a>. Note that Dropbox is the only provider that allows you to earn extra free space.<br />
<br />
If you are unfortunate enough to be using a laptop as your main computing platform - you should consider <a href="http://www.crashplan.com/">CrashPlan</a> as a backup solution. They offer unlimited backup plans for about $50/yr. which is much cheaper than the above mentioned services and well worth the price if you can do without folder syncing.<br />
<br />
I use CrashPlan to backup my desktop(s), and since my Dropbox folder syncs to my main desktop - it is automatically backed up with CrashPlan as well!<br />
<br />
As for SanDisk - I'll be replacing the drive under warranty. I hope the next one lasts longer...</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8250214192981058702.post-45346876054680505272012-04-11T10:41:00.001-07:002012-04-11T10:41:36.404-07:00Slim down your bloated Starcraft II installation.<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizYsIvMHsY-8MYrpGRBwvfPGJLscR0hi0xhJbUyIbjpqy-shztQ_Esv_21Hinp59rdpeF0l_vx-utH84g9I5QcCtfcUTSqBZths9cqslPIfN7TPIHU9poP4lNeuO9Rq8N1HaT7HMLZL5M/s1600/StarcraftSSD.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizYsIvMHsY-8MYrpGRBwvfPGJLscR0hi0xhJbUyIbjpqy-shztQ_Esv_21Hinp59rdpeF0l_vx-utH84g9I5QcCtfcUTSqBZths9cqslPIfN7TPIHU9poP4lNeuO9Rq8N1HaT7HMLZL5M/s320/StarcraftSSD.jpg" width="320" /></a></div>
Having recently replaced my laptops spacious 250GB HDD with a measly 60GB SSD, it became hard to justify wasting 10GB of space just so I could play an occasional game on Battle.net.<br />
<br />
Opening up my SC2 directory, I found approximately 5GB of files under the "Campaigns" folder, and an extra GB of files under the "Versions" folder.<br />
<br />
Having already finished the campaign, I began to wonder if I really need these extra 6GB of game files...<br />
<br />
<span style="color: red;">WARNING!</span> removing files from your SC2 directory may mess up your installation, erase saved games, replays and possibly cause severe bodily harm (though the latter is VERY unlikely). Also, note that the Blizzard support staff explicitly stated that you <span id="goog_2060741291"></span>should not delete any game file in this <a href="http://eu.battle.net/sc2/en/forum/topic/1776589198">forum post</a> - attempt at your own risk!<br />
<br />
That said, I've found that you can delete the two folders under the "Campaigns" directory, as well as all but the latest (highest number) "Base#####" and "Shared####" folders under the "Versions" folder.<br />
<br />
I'm told that deleting the old "Base" and "Shared" folders will prevent you from viewing old replays, so you might want to keep them around, since they don't take up that much space.<br />
<br />
Withe these files removed, my SC2 installation takes up less than 4GB of space, and I can still play multiplayer games on Battle.net without issues.</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8250214192981058702.post-39408491647715970362011-05-01T14:06:00.000-07:002011-05-01T22:56:35.519-07:00Disable Dropbox While Running on Battery Power<div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgr8DJODJ0uxrCZ-W-u160dcjY61TcjovbIIVtcsvpl2DvxQWVxpzhWBdV6ulwJDGrJju5aZDbPCj4P34_GxjmeFc1JqCJfu76O7GfXYNIrTrb0lXHoB07F7vMg48p-ss7s7p8h5hrmhs/s1600/dropbox_power.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgr8DJODJ0uxrCZ-W-u160dcjY61TcjovbIIVtcsvpl2DvxQWVxpzhWBdV6ulwJDGrJju5aZDbPCj4P34_GxjmeFc1JqCJfu76O7GfXYNIrTrb0lXHoB07F7vMg48p-ss7s7p8h5hrmhs/s1600/dropbox_power.jpg" /></a></div>This Autohotkey script allows you to run custom commands based on your systems AC power status.<br />
By default, the script will disable <a href="http://db.tt/shBxUcE">Dropbox</a> when the battery is discharging, and restart it once AC power is restored.<br />
<br />
The script can be easily modified to preform any task on either "AC Power On" or "AC Power Off" events by modifying the corresponding function. Please note that if your Dropbox daemon is not installed in the default directory, you may have to modify the script appropriately.<br />
<br />
I was inspired to write this after reinstalling my laptop when I suddenly discovered a dramatic improvement in battery life. With Dropbox as a prime suspect, I was looking for a simple way to turn it on and off depending on the laptops power state. I hope you find this script useful for keeping Dropbox, and any other power hungry apps you may have in check.<br />
<br />
If you've found any other original uses for the script, I'd love to hear about them in the comments!<br />
<br />
<a href="http://goo.gl/xam39"><span class="Apple-style-span" style="font-family: inherit;">Download the AHK Script</span></a><br />
<br />
<u>Source Code:</u><br />
<br />
<div dir="ltr" style="text-align: left;" trbidi="on"><pre class="gutter: false;">;; Close Programs Based On Laptop Power State
;; By Boaz Arad
;; http://www.boazarad.com
;;http://www.machinereadable.net/2011/05/disable-dropbox-while-running-on.html
;;Define Custom commands to be run while switching from battery-
;;power to AC power or vice versa
ACPowerOn() ;Run when plugged in
{
;Default Dropbox install dir - modify if necessary
DropBoxExe=%A_AppData%\Dropbox\bin\Dropbox.exe
Run %DropBoxExe%
;MsgBox "AC Power On"
}
ACPowerOff() ;Run when unplugged
{
Process, close, Dropbox.exe
;MsgBox "AC Power Off"
}
/*
Notes:
Since "On AC Power" and "On AC Power, Charging" are two seperate events
"ACPowerOn" may be run twice When the is plugged in and it's battery is
already charged to over 95% of capacity. This issue can be solved by
setting "B_Threshold" (below) to the maximum charge level of your laptop
battery. This is necessary since if your battery is at full capacity,
plugging in your laptop will not set the battery status to "Charging".
*/
B_Threshold=95
/*
Made Possible by:
Wrapper to catch Power Management events by TheGood
(http://www.autohotkey.com/forum/topic40008.html)
Shimanov's ReadInteger function:
(http://www.autohotkey.com/forum/topic6144.html)
AC/Battery status by antonyb
(http://www.autohotkey.com/forum/topic7633.html)
*/
ReadInteger( p_address, p_offset, p_size, p_hex=true )
{
value = 0
old_FormatInteger := a_FormatInteger
if ( p_hex )
SetFormat, integer, hex
else
SetFormat, integer, dec
loop, %p_size%
value := value+( *( ( p_address+p_offset )+( a_Index-1 ) ) << ( 8* ( a_Index-1 ) ) )
SetFormat, integer, %old_FormatInteger%
return, value
}
OnMessage(536, "OnPBMsg") ;WM_POWERBROADCAST
Return
OnPBMsg(wParam, lParam, msg, hwnd) {
If (wParam = 10) { ;Power state change detected
VarSetCapacity(powerstatus, 1+1+1+1+4+4)
success := DllCall("kernel32.dll\GetSystemPowerStatus", "uint", &powerstatus)
acLineStatus:=ReadInteger(&powerstatus,0,1,false)
batteryFlag:=ReadInteger(&powerstatus,1,1,false)
batteryLifePercent:=ReadInteger(&powerstatus,2,1,false)
batteryLifeTime:=ReadInteger(&powerstatus,4,4,false)
batteryFullLifeTime:=ReadInteger(&powerstatus,8,4,false)
output=AC Status: %acLineStatus%`nBattery Flag: %batteryFlag%`nBattery Life (percent): %batteryLifePercent%`nBattery Life (time): %batteryLifeTime%`nBattery Life (full time): %batteryFullLifeTime%
;MsgBox %output% ;Debug - show full powerstatus info
If (acLineStatus=0)
ACPowerOff()
Else ;If (batteryFlag>=8 | batteryLifePercent>%B_Threshold%) ;Plugged in and charging (http://msdn.microsoft.com/en-us/library/aa373232(v=vs.85).aspx)
ACPowerOn()
}
;Must return True after message is processed
Return True
}</pre></div></div><br />
<span class="Apple-style-span" style="font-family: inherit;"><a href="http://goo.gl/xam39">Download the AHK Script</a></span></div>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-8250214192981058702.post-73217657028814399062011-03-09T04:12:00.000-08:002011-03-09T04:12:03.705-08:00Retrieving external URL's with PHP without overloading your server<div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on">Retrieving external URLs via PHP has already gotten me kicked off a shared server in the past. A handful of visitors may be enough to incur the wrath of your admin. While redesigning my <a href="http://www.boazarad.com/">personal homepage</a>, I wanted to scrape my recent running mileage from an <a href="http://www.endomondo.com/widget">Endomondo widget</a> (login required) and embed it into the site text. The simplest way to do this, would be to retrieve and process the widget code from the Endomondo site for each page load.<br />
This approach has two drawbacks: first - increased pageload times due to the remote retrieval, and secondly - increased server load.<br />
<br />
To solve this problem, I decided that updating my mileage daily would be sufficient, but I still wanted the updated process to be automatic, and take place on the server.<br />
<br />
To accomplish this, I wrote the following code. The concept is simple - scraped data is held in a file on the server, on each page load, the modification time of the file is checked, if it is over a day ago, new data is scraped and written to the file.<br />
<br />
This way, remote fetching and it's associated slow-down and server load happen at most once a day.<br />
<br />
The code is pretty much self explanatory, but I'll discuss some of it's finer points below.<br />
<br />
<div dir="ltr" style="text-align: left;" trbidi="on"><pre class="brush: php; gutter: false;">function howfar() {
$rep = "many";
if (!($mfile = @fopen('mileage.txt','r'))) {
$latest_mod = 0;
}
else {
$latest_mod = filemtime('mileage.txt');
fclose($mfile);
}
$today = date(U);
if ($today-$latest_mod > 86400 ) {
//echo "OLD!";
$mfile = fopen('mileage.txt','w+');
$endo_url = "http://www.endomondo.com/embed/user/summary?id=92256&sport=0&from=20110101&measure=0&zone=Gp0200_JER";
$endomondo = file_get_contents($endo_url);
$loc = strpos($endomondo,'Distance:');
$loc2 = strpos($endomondo,'</span>',$loc);
$distance=substr($endomondo,$loc+21,$loc2-$loc-21);
fwrite($mfile,$distance);
fclose($mfile);
}
else {
$mfile = fopen('mileage.txt','r');
$distance=fread($mfile,4);
fclose($mfile);
}
if (is_numeric($distance)) {
$rep = $distance;
}
return $rep;
}
</pre></div></div><br />
First, we attempt to open the 'mileage.txt' file, the @ suppresses any possible error messages we don't want the user to see. If the file doesn't exist, latest_mod will be set to zero, thus forcing an update.<br />
If the file is readable, latest_mod is set to its latest update time. The times are then compared, and if the difference is greater than 86400 (a day in Unix timestamp format) - new data is fetched.<br />
Otherwise, the file is opened, and the old data read.<br />
You could easily modify the code to fetch nearly any for of data, and store it locally, the minimum "freshness" of the data is also easily tweakable.<br />
<br />
I hope you find this snipplet useful, and I'd love to hear about it in the comments if you did.</div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-8250214192981058702.post-716514349307935192011-01-17T06:17:00.000-08:002011-01-19T00:35:26.104-08:00Leaving Flickr - How to download all your photos<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 0em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMeUzLsReYaBWnRDAGiYk6elWxreXPsN85kna3j96oW1xEG6gsL7K-r2tPRmTUDFQrpQA71_FkwAGSzPxu7o2Yjo3gWag188dD4Ug1o_5ZlFSQ8aLGaznFjbIhiXoCbNg2oYAIYvGyWag/s1600/flickr_lock_50.jpg" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CC-BY: <a href="http://www.flickr.com/photos/dazzied/">Dazzie D</a></td></tr>
</tbody></table>Your "Pro" membership might be expiring, you may be nearing the 200 photo limit for free account or recurring rumors of a Yahoo!-Microsoft merger might be prompting you to consider alternative services. Either way - odd are that Flickr has all your precious photos, and you want them back! This is how I did it:<br />
<br />
First, I'll warn you that this guide may get a bit technical, as it includes a little command line work, if you're comfortable with that - read on.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">The backstory</span><br />
I've been using Flickr for almost four years, and shortly after joining, I decided to upgrade to a pro status so my account could double as an image backup solution. Since then, I got my first SLR, and by 2009, I was shooting only RAW. Flickr's poor RAW support plus the fact that restoring anything larger than one photo set from Flickr would not be a simple matter - both prompted me to find an alternative backup solution.<br />
Today, I backup my whole photo library to both a local mirror drive, and<a href="http://b2.crashplan.com/consumer/crashplan-plus.html"> crashplan+</a> - a remote online backup service.<br />
Once I no longer needed a Flickr Pro account for backup purposes, 25$ a year became rather pricey for the questionable privilege of "Access to your original files" and "Unlimited sets and collections" - seriously Flickr, it's my data! let me have it back!<br />
<br />
All that remained to be done before I could let my Pro account expire was to download my photostream, and make sure that I indeed had local copies of all my Flickr photos.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">Downloading the photostream</span><br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 0em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2715t_ZJOcU2I41VeYfLcdw86GWjcvFthvfFx7FQIXZ4OMkHBdODG9zBh5BO0FreeVED3L1Ley6ftA4xEUq8cvG_8eKjpzRfAuTf1pnFCo0rNt6bYVv7FE4Y3v-4sEtu5zyJzghDPnwA/s1600/photostream.jpg" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CC-BY-SA: <a href="http://www.flickr.com/photos/rbrwr/127580577/">rbrwr</a></td></tr>
</tbody></table>There are quite a few programs out there that can help you download full resolution imgaes from your Flickr account, to name a few: <a href="http://sunkencity.org/flickredit">FlickrEdit</a>, <a href="http://janten.com/downloadr/">Downloadr</a> the for-pay <a href="http://clipyourphotos.com/bulkr">Bulkr</a> and the now banned <a href="http://blog.greggman.com/blog/flickrdown/">Flickrdown</a>.<br />
If you only have about 1,000 photos to back up - FlickrEdit is your best choice, it has a user friendly graphic interface, and works rather well.<br />
<br />
If, on the other hand, you have thousands of photos to download (over 33,000 in my case) - your best bet it <a href="https://github.com/dan/hivelogic-flickrtouchr">FlickrTouchr</a>. This python script will log on to your Flickr account, and download all your images, into folders based on your Flickr sets!<br />
The original script was set to download "Large" size images rather than originals, and seemed a bit slow on my connection, so I modified to to download originals and... (drumroll) ... use concurrent threaded downloads!<br />
<br />
You can download my modified version - <a href="https://github.com/boazarad/flickrtouchrthreaded">FlickrTouchrThreaded</a>. To use it, you'll have Python installed. If your using Linux, you probably know how to do this yourself, Mac users should already have python installed by default, and windows users can find installation instructions <a href="http://python.org/download/">here</a>.<br />
Once you have Python installed, backing up your entire photostream is a easy as typing:<br />
<blockquote><span class="Apple-style-span" style="color: #222222; font-family: 'andale mono', 'lucida console', monospace; font-size: 14px; line-height: 21px;">python flickrtouchrthreaded.py FlickrBackupFolder 3</span></blockquote> Where "FlickrBackupFolder" is the name of the folder you want to back up to, followed by the number of download threads you want to run (in this case - three). This will begin downloading you whole photostream to the your selected backup folder, with sub folders based on your Flickr sets. Images not in sets will be downloaded to a "No Set" folder.<br />
<br />
In my case I found that using more than 3 threads didn't improve my overall download speed, you can play around with the number of threads the script uses, but I wouldn't increase it over 10 so Flickr doesn't get too mad at you :)<br />
<br />
The first time you run it, it will send you to the Flickr website and request authorization for your Flickr account, subsequent runs will start downloading immediately. You'll also note that if the script was interrupted, you can just re-run it, and it will pick up where it left off, just be sure to point it to the same folder.<br />
<br />
A few hours later (or in my case, one week 33,640 photos and about 80GB later) you'll have your entire Flickr photostream backed up.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">Finding Corrupt Images</span><br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 0em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdkOeQK-vHLCF4BmWUM01D5v5Qwlm6wanRhdDdpoPW1XdYkEVCoadE1WuiFkqYvdaqdmJGzMroAijL1h_ZV5XhdEhb8zVkrrhmjR4p7_Su_3HLzoP5IFmTHbmCxGsl_Oc8vmeeBmX7c5c/s1600/corrupt.jpg" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Photo: Boaz Arad</td></tr>
</tbody></table>Once you've got your whole photostream backed up, you'll want to be sure that all your images downloaded correctly. FlickrToucher does a rather good job, and will rarely corrupt any images in transit, but even one corrupt photo out of thousands could really ruin your day - especially if it happens to be your best wedding picture, or the only group of your speedskating group (see left).<br />
<br />
To scan for corrupt JPG images, i used <a href="http://cpicture.net/en/">cPicture</a>.<br />
cPicture is a commercial product ($19.99 per license), but the freely available trial will allow you so scan for corrupt images without limitation. Just pick a folder, and click "Check Pictures". After churning through your photos, it will output a text file with a list of corrupt images.<br />
If you used FlickrTouchr to download your photostream, the filenames of the images should be their Flickr photo-id's - so you can easily find them online by browsing to<br />
<blockquote>http://www.flickr.com/photos/<span class="Apple-style-span" style="color: red;">your_flickr_username</span>/<span class="Apple-style-span" style="color: red;">photo_id</span>/</blockquote>If anyone can reccomend a similar utility for Max and Linux users, I'd love to hear from you in the comments.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">Finding duplicate photos</span><br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 0em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8eLRnPW1mSE-qBNgbscCxxlzoRNqJWyCCu3ggn9YdQYEOCBfC6vl4TBIKSrEI3e5emuYUfFqy1WjhxX7Dbn8lqik60xV4w8qvoPIz9RR-CuDdKmtGo3rGq1hK4wwUoX92xPBXzrlf6-A/s1600/dupe.jpg" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Photo: Boaz Arad</td></tr>
</tbody></table>Some of the downloaded photos from your photostream will no doubt be duplicates of photos you already have on your hard-drive. In order to prevent wasted space - you should scan the downloaded photos for duplicates. I recommend MindGem's<a href="http://www.mindgems.com/products/Fast-Duplicate-File-Finder/Fast-Duplicate-File-Finder-Download.htm"> Fast Duplicate File Finder</a> (FDFF) - again, a commercial product, but the trial version likely contains all the features you'll need.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">Conclusion</span><br />
Once you've weeded out corrupt and duplicate images, it's time to merge the backup back into your local photo library. Both Google's (free) <a href="http://picasa.google.com/">Picasa</a> and Adobe's (pricy!) <a href="http://www.adobe.com/products/photoshoplightroom/">Lightroom</a> do a great job of keeping you pictures in order, and I recommend using one or both regularly.<br />
It's also a good practice to always keep local copies of all your images, and never relay on online services (Flickr, Facebook etc.) as your only photo storage solution - as these can be <a href="http://thomashawk.com/2009/01/how-would-you-feel-if-your-flickr-account-were-permanently-deleted.html">notoriously</a> <a href="http://en.wikipedia.org/wiki/Criticism_of_Facebook#Disabling_of_user_accounts">unreliable</a>.Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-8250214192981058702.post-23996701903248572872011-01-17T03:56:00.000-08:002011-01-19T00:32:58.963-08:00FlickrTouchrThreaded - Download all your Flickr Photos FAST!<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 0em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUtN02R1oUaDJ0KQ8Aj1Xb7WUQpbo1A61A6urw0cLfXMN3dv5BR0Dr3QUWc1xA7bDLJLKRYnBnskTpzB8JSlfEW95rD6MhqQG-0M5tLepI5oIZXWkQZdscPt0P5cIsT5zkTGYdWaYUzDw/s1600/flickrtouchr.jpg" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CC-BY: <a href="http://www.flickr.com/photos/a6u571n/3207185886/">AgustÃn Ruiz</a></td></tr>
</tbody></table>FlickrTouchr is a nifty little python script that lets you automatically download your whole Flickr photostream. Unfortunately, I found that it worked rather slowly - and traffic would plummet to zero between images.<br />
<br />
Enter FlickrToucherThreaded! This modified new version of FlickrTouchr allows simultaneous downloading of multiple images, using concurrent download threads. The number of threads is user configurable - in order to allow optimization for each individuals connection and CPU.<br />
<br />
<a href="https://github.com/boazarad/flickrtouchrthreaded">FlickrToucherThreaded</a> Version 0.1 is available for download <a href="https://github.com/boazarad/flickrtouchrthreaded/blob/master/flickrtouchrthreaded.py">here</a>.<br />
<br />
FlickrToucherThreaded is based on FlickrToucher - originally by<a href="http://at.allcosts.net/photos/"> Colm MacCarthaigh</a>, and improved by <a href="http://hivelogic.com/">Dan Benjamin</a>. Both scripts are distributed under the Apache 2.0 License.<br />
<br />
I intend to continue developing this script in the near future, coming soon:<br />
Cleaner Thread Shutdown.<br />
Configurable default image size.<br />
Incorporation of improvements by <a href="https://github.com/tonyduckles">tonyduckles</a>.<br />
<br />
So stay tuned!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8250214192981058702.post-35749084697252923842010-01-30T10:54:00.000-08:002010-10-01T05:14:56.636-07:00Blogger: Filter posts by label on your main pageI spent quit a while phishing around google trying to figure out how to prevent posts with a certain label from appearing on my main page over at blogger/blogspot. Eventually, I used an adaptation of this method (also detailed here).<br/><br/>To applay this method, edit your blogger sites XML template (be sure to back it up first!), and click "Expand Widget Templates". Now look for the line:<br/><br/><b:loop values='data:posts' var='post'><br/><br/>And find the matching </b:loop> tag.<br/><br/>Replace them and everything between them with the following code:<br/><br/><b:loop values='data:posts' var='post'><br/><b:if cond='data:blog.url == data:blog.homepageUrl'><br/><b:if cond='data:post.labels'><br/><b:loop values='data:post.labels' var='label'><br/><b:if cond='data:label.isLast == &quot;true&quot;'><br/><b:if cond='data:label.name != "<span style="color: #ff0000;">Label_To_Filter</span>"><br/><b:include data='post' name='printPosts'/><br/></b:if><br/></b:if><br/></b:loop><br/></b:if><br/><b:else/><br/><b:include data='post' name='printPosts'/><br/></b:if><br/></b:loop><br/><br/>Now look for the last </b:includable> tag you can find, and paste this code directly after it:<br/><br/><b:includable id='printPosts' var='post'><br/><b:if cond='data:post.dateHeader'><br/><h2 class='date-header'><br/><data:post.dateHeader/><br/></h2><br/></b:if><br/><b:include data='post' name='post'/><br/><b:if cond='data:blog.pageType == "item"'><br/><b:include data='post' name='comments'/><br/></b:if><br/></b:includable><br/><br/>Note that this code has a few bugs:<br/><ol><br/> <li>Posts with no label will not be displayed on the main page.</li><br/> <li>The filtered label must be the last label of a filtered post.</li><br/> <li>If all your recent stories belong to the filtered category, your blog may appear empty.</li><br/></ol><br/>I consider these "Features" as they suit my need over at <a href="http://www.luxphile.com" target="_blank">www.luxphile.com</a> - preventing any of my <a href="http://www.luxphile.com/search/label/Textures" target="_blank">Texture</a> labeled posts from showing up on the main page, and also hiding unlabeled "Blog this" posts from Flickr.Unknownnoreply@blogger.com62tag:blogger.com,1999:blog-8250214192981058702.post-88275278157548310122008-07-05T09:25:00.000-07:002010-10-01T05:13:26.855-07:00Sharing the Xerox 6125 N With Linux clientsIn this post I will describe how to share a Xerox 6125 or 6125N printer with a Linux machine through a windows host.<br/><br/>The <a target="_blank" href="http://www.google.co.il/url?sa=t&ct=res&cd=1&url=http%3A%2F%2Fwww.office.xerox.com%2Fprinters%2Fcolor-printers%2Fphaser-6125%2Fenus.html&ei=DHBvSOanFJ3SQI3l6NMC&usg=AFQjCNFv3vjinrwg6uoN2lwYoGnFuHLEhg&sig2=qjwgDRT0yKvPD3BLKi7E6g">Xerox 6125</a> (or 6125N) is an amazing deal - a 300$ network-enabled color laser printer.<br/>Unfortunately, this great price tag comes with one major downside - absolutely no linux compatibility WHATSOEVER.<br/>The Xerox 6125 uses a Host Based <acronym title="Page Description Language">PDL</acronym> and as opposed to most Xerox machines - does not support Postscript or PCL printing languages. Xerox has not released any proprietary drivers for it, and for this reason the Open printing database has categorized it as a <a target="_blank" href="http://openprinting.org/show_printer.cgi?recnum=Xerox-Phaser_6125">paperweight</a>.<br/><br/>There is, however, a way around this - if you have at least one windows machine on your network. By creating a virtual postscript printer, and routing its output to the Xerox 6125 through the windows driver - you can share the printer with any machine capable of printing postscript - namely any major Linux distribution (and mac-os X of course!).<br/><br/>Henrik Schmiediche has written a great guide to setting up a virtual gostscript printer on your windows machine - wich can be found <a target="_blank" href="http://www.stat.tamu.edu/~henrik/GSPSprinter/GSPSprinter.html">here</a> or mirrored in PDF format <a href="http://www.boazarad.com/wp-content/uploads/2008/07/GSPSprinter.pdf">here</a>.<br/>Once you have set up your virtual postscript printer, and shared it over the network - set up your linux clients to print to it - either using the same driver as the virtual printer, or the generic "Raw Queue" driver (The HP Color Laserjet 4550 PS suggested in the article works great - make sure you use the postscript version of the driver!).Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-8250214192981058702.post-24963928622849872772007-10-04T17:01:00.000-07:002010-10-01T05:13:26.857-07:00Configuring Lenovo 3000 N100 sound card on LinuxI just got a new Lenovo Laptop, the Lenovo 3000 N100 0768-FSG to be exact. I installed SUSE 10.2, and also played around with a Ubuntu 7.04 live cd - neither of which recognized the sound-card. Actually, the sound card was recognized, and configured with the snd-hda-intel driver - but the speakers simply didn't work, neither did headphones.<br/><br/>I solved this in SUSE 10.2 by manually updating the ALSA drivers from the bundled <a rel="nofollow" title="ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.14.tar.bz2" class="external text" href="ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.14.tar.bz2">1.0.14</a> version to the <a rel="nofollow" title="ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.15rc3.tar.bz2" class="external text" href="ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.15rc3.tar.bz2">1.0.15rc3 development version</a><span class="external text"> </span>- this required manual compilation, and installing my distributions kernel source package. The latest ALSA drivers can be found at <a target="_blank" href="http://www.alsa-project.org/">www.alsa-project.org</a>.<br/><br/>Instructions for installing the latest ALSA drivers from source can be found <a target="_blank" href="http://www.alsa-project.org/main/index.php/Download">here</a>, you will only need the alsa-driver package to get the sound working on your laptop, the rest of the packages should have been bundled with your linux distribution and do not require updating.<br/><br/>There are several sites that report getting the sound to work by adding <strong>one</strong> of the following lines to <strong>/etc/modprobe.d/alsa-base</strong>:<br/>options snd-hda-intel model=auto<br/>options snd-hda-intel model=lenovo<br/>options snd-hda-intel model=laptop-eapd<br/>options snd-hda-intel model=3stack<br/>And then restarting the sound module. Different lines seem to work for different ALSA versions, and different Lenovo 3000 or other intel powered laptop models. so you might want to try some of these before installing the development drivers.<br/><br/>In SUSE this can also be accomplished by running YaST -> Hardware -> Sound, selcting your sound card and clicking "Edit" you will be able to set the mode option to any of the above there.<br/><br/>UPDATE: On open SuSE 10.3, the sound card works out of the box!Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8250214192981058702.post-14746273685314444552007-06-08T03:52:00.000-07:002010-10-01T05:13:41.617-07:00Getting Gmail java app on Motorola i760<img align="left" alt="gmail on i760" id="image39" title="gmail on i760" src="http://www.boazarad.com/wp-content/uploads/2007/06/i760_gmail.jpg" />My <a target="_blank" href="http://www.phonescoop.com/phones/phone.php?p=758">i760</a> came without a proper web-browser - so I could not download the <a target="_blank" href="http://www.google.com/mobile/mail/index.html">Gmail java app</a> through the phone, or access m.gmail.com to check my mail.<br/><br/>The solution to this problem is downloading the Gmail java application files from the google servers here:<br/><a href="http://gmail.com/app/v1.1.0/L1/gm-Generic-Advanced_MIDP2.jad">gm-Generic-Advanced_MIDP2.jad</a><br/><a href="http://gmail.com/app/v1.0.0/en/gmail-g.jar">gmail-g.jar<br/></a>Then upload them to your phone using a data cable, and a J2ME media loader application like <a target="_blank" href="http://www.gomyteam.com/myjal.aspx">myJal</a>. Depending on the software you use, you may have to rename the above files so that they have identical filenames (i.e. rename "gm-Generic-Advanced_MIDP2<strong>.jad</strong>" to "gmail-g<strong>.jad</strong>" - do not change the extensions!)<br/><br/>Once you load the files up to your phone "gmail" should appear in you Java applications folder. Clicking "gmail" will preform a short installation process, after which you will be prompted for your Gmail user-name and password. Once you enter your information, you'll be logged on to your Gmail account and able to read and write mail!Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8250214192981058702.post-91789721694936073712007-02-12T03:37:00.000-08:002010-10-01T05:13:26.859-07:00Image previews not showing up in konqueror and kFlickrI just got a new digital camera, and was annoyed that for some odd reason, konqueror and kFlickr were no longer showing image previews for pictures taken with the new camera.<br/><br/>The solution for this problem was simple - apparently, konqueror has a configureable limit to the size of file it displays previews of. This setting can easily be changed in konqueror through:<br/>Settings -> Configure Konqueror -> Previews & Meta Data -> Maximum file size.<br/><br/>Turns out, that all the pictures from my 2 Mega Pixel cellphone camera were under 1MB in size, while the pictures from my new digital camera (set at 3 Mega Pixels) were just over 1MB. The default setting for previewable file size in my distribution was 1MB - hence the problem.<br/><br/>Changing the settings in konqueror also immediately solved the problem in kFlickr.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8250214192981058702.post-33264737004922471972006-05-25T17:36:00.000-07:002010-10-01T05:13:41.619-07:00phpWebsite CafePress Integration Module<p><a class="imagelink" title="phpWebsite CafePress Mod ScreenShot" target="_new" href="http://www.boazarad.com/wp-content/uploads/2006/05/cp_mod_ss.jpg"><img align="left" title="phpWebsite CafePress Mod ScreenShot" id="image32" alt="phpWebsite CafePress Mod ScreenShot" style="border: 1px solid black; margin: 5px" src="http://www.boazarad.com/wp-content/uploads/2006/05/cp_mod_ss.thumbnail.jpg" /></a>The CafePress Integration Module for <a title="phpWebsite" href="http://phpwebsite.appstate.edu/">phpWebsite</a> will allow you to display your CafePress shop (basic or premium) within your phpWebsite driven site.</p><br/><p>Keeping visitors on your site is important, especially if you are trying to sell something. This module will allow your visitors to shop in your CafePress store without leaving your site until the final checkout.</p><br/><p>The screen shot shows the module in action under phpWebsite's default theme, though it should work just fine with any other theme.<br/>I wrote this module based on Mark McClelland's "<a target="_blank" href="http://www.caaseproductions.com/modules.php?name=Downloads&d_op=viewdownloaddetails&lid=2&ttitle=OLD_CafePress_Addon_version_2.1">PHP-NUKE CafePress Addon</a>" for the <a target="_blank" title="Molecular Shirts" href="http://www.molecularshirts.com">Molecular Shirts</a> and <a title="Shirt Wisdom" target="_new" href="http://www.shirtwisdom.com">Shirt Wisdom</a> websites I help run. I decided to publish it after receiving a request for it via e-mail.</p><br/><p>The current version 0.1 is obviously a beta - please keep me posted about any bugs you find or problems you have with it.</p><br/><p><strong>phpWebsite CafePress Integration Module v0.1 - <a target="_self" href="http://www.boazarad.com/wp-content/uploads/2006/05/phpws_cafepress0.1.zip">Download</a></strong><br/></p>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8250214192981058702.post-85512735543975912262006-04-13T05:26:00.000-07:002010-10-01T05:13:26.860-07:00Flickr upload tool for KDEAfter shelling out 25$ for a <a rel="tag" target="_new" id="flickr_www" href="http://www.flickr.com/photos/boazarad/"><strong style="color: #3993ff">flick<span style="color: #ff1c92">r</span></strong></a> account I needed a Linux based uploading tool. After several unsuccessful attempt to install <a rel="tag" href="http://micampe.it/things/flickruploadr">FlickrUploadr</a> for Linux by Michele Campeotto, and <a title="Virtual Filesystem for Flickr" target="_new" href="http://sourceforge.net/projects/flickrfs">Flickrfs</a> - i finally stumbled upon a <a title="Phil Wilson .com - Blog Posting Client Needed" href="http://philwilson.org/blog/2005/11/kde-blog-posting-client-needed.html">blog post</a> by Phil Wilson that solved all my problems:<br/><br/><a rel="tag" href="http://kflickr.sourceforge.net/">Kflickr</a> is a simple, efficient and easy to install Flickr uploading tool for the Linux KDE desktop environment. Supports tags, descriptions privacy settings and batch operations - most importantly, it has saved me from the horror of the Flickr Upload page.<br/><br/>I'm putting up this post, since it took me quiet a while to find Phil's page and Kflickr, I'm hoping this page will make it a bit easier.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8250214192981058702.post-26719142215734465062006-04-08T12:08:00.000-07:002010-10-01T05:13:41.621-07:00Imageshack Transloader<span id="misp_compose_1" class="hm">ImageShack</span>.us used to offer a simple java tool enabling you to quickly <span id="misp_compose_2" class="hm">rehost</span> any image from the website you are currently viewing without downloading it first.<br/><br/>After dragging a <span id="misp_compose_3" class="hm">snipplet</span> of java your bookmark toolbar, clicking it would display all the images on your currently viewed page. Clicking an image would automatically host it on <span id="misp_compose_4" class="hm">ImageShack</span>.<br/>I'm guessing that <span id="misp_compose_5" class="hm">ImageShack</span> decided that this <span id="misp_compose_6" class="hm">Transloader</span> was cutting into their advertising profits, because it was removed quiet some time ago from their "tools" page.<br/><br/>The <span id="misp_compose_7" class="hm">transloader</span> can still be found <a title="ImageShack Transloader" target="_blank" href="http://reg.imageshack.us/content.php?page=transloader">here on <span id="misp_compose_8" class="hm">ImageShack</span></a>, Though I can't seem to find a link to the <span id="misp_compose_9" class="hm">transloader</span> page from anywhere in <span id="misp_compose_10" class="hm">ImageShack</span>.Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-8250214192981058702.post-48940133952165159592006-04-04T08:49:00.000-07:002010-10-01T05:14:56.637-07:00Migrating to wordpressAs of today, BoazArad.com has migrated to <a target="_new" href="http://www.wordpress.org">Wordpress</a>.<br/>The previous site engine was a homegrown, and very high maintenance PHP engine. Since posting and editing in my old engine were too time consuming - the site barely got any updates. Wordpress should help fix that problem.<br/><br/>Obviously, there will be some growing pains, and as you can see, most of the previous site content is offline. Old articles will be added retroactively, and I'm hoping to get the image and computer mod galleries back up soon.<br/><br/>The old site is still available <a href="http://old.boazarad.com">here</a>.<br/><br/>Thanks for your patience.Unknownnoreply@blogger.com3