Showing posts with label applescript. Show all posts
Showing posts with label applescript. Show all posts

Wednesday, 10 February 2010

The iPad and the new GoogleOS

I like it.

Apple's insistence on using storage to differentiate pricing is an OK idea, but the price difference between models is hard to support.

Anyway, in my last post I dreamt of my ideal device. Now that the iPad has been seen by most, you could visualise my ideal device as an iPad that folds in half.

It, of course, needs a camera, needs to work as a phone and needs to run ChromeOS, but otherwise it is close.

Folded in half it would be about 7.5"x4.8" (190mm x 120mm), 1" (25mm) thick.

The Future

I think the PC has matured and is in decline. 

Netbooks have harmed the laptop market. Their low cost and high portability has meant that laptops and desktop have had to cut margins to sell. Microsoft too, has probably had to reduce margins to ensure their OS - old as it is - is the de-facto standard. I recently saw that Aldi advertised a 17" Core II Duo laptop with everything you could need for $900 AU. Even though it is many times better in almost every respect, the market wants laptops to be sub $1000 AU.

Where a big laptop fails is it's size. Consumers have their adequate 15" laptop or their 22" desktop and it still does the job just fine - even with Windows XP. They now want to be free to roam around their homes or around town with a take-anywhere Netbook.

They have their big-screen touch phones too. Great as a phone and as a media player but they are not too good at web browsing. So a market is born: a small screen web browser.

The Netbook was first and does the job by scaling down a laptop so that it is ultra portable. Apple thought better, and made a smaller device that still offered a 10" screen that could be used in portrait or landscape. And they added 3G for that always-on experience.

What the iPhone, Androids and Nokia's have shown, is that the new killer-app is an app store. A place to buy your software, be it office applications, games, music, video, books or just cool toys.

The OS is irrelevant.

The design is far more important than the hardware. Low powered computers are fast enough - adequate. You don't need to worry about storage, frame rates, resolution and interfaces since they have everything that you typically need. Now it is more important to consider looks, weight, portability, battery life and Apps.

What Apple and Google have also done is to reduce the risk of malware by selecting the ARM microprocessor and a more secure-by-design operating system. ARM processors don't allow some of the techniques used to cause a PC to execute foreign code, and UNIX and Linux have demonstrated that they are resistant to malware.

Apps too, are more likely to be web apps - based on HTML and JavaScript. These can be easily sandboxed to protect the OS and other core applications and services. Google also has their Native Client which allows native compiled code to run safely and securely on a PC or ARM machine.

A new OS will enter the scene.

Perhaps a few. Windows will decline as more devices are sold with Android, Linux and OS-X. I don't think Symbian will survive either.

If the OS is irrelevant then it will shrink and become a specific purpose, custom OS for the particular device. If all the applications run in a browser then applications will no longer depend on OS services. Instead they will mostly depend on browser services - the browser is the new OS and it includes the secure, windowing/graphics environment for games, music, videos, office applications and browsing.

Recently Google released a new programming language called Go. To me, it seems to be a descendant of a language designed at Bell Labs called Newsqueak. Rob Pike developed Newsqueak and is also developing Go. Ken Thompson, who also worked at Bell Labs, is also part of the Go development effort at Google. Both Newsqueak and Go are used to do systems programming - a language to build or experiment with operating systems. Why would Google want that - they use Linux don't they?

Ken Thompson and Rob Pike both worked on Plan 9 and it's descendent, Inferno, which was open-sourced in 2005.

I think Google is looking to use Go to compile a descendant of Inferno to become the base OS for Google and Android. Why? Go makes concurrent programming easy, and future servers and appliances are going to have lots of CPUs and GPUs.

Background

This is a video (2007) of Rob Pike talking about Newsqueak, Plan-9 and a toy window system.

Thursday, 27 November 2008

iPhoto Script to Tag Duplicates

I merged a whole lot of photo folders and albums recently and ended up with hundreds of duplicates. Not wanting to manually clean up the mess I searched for something that would help me out. I eventually found a script from Karl.

It inspired me to develop the idea a bit more. I wanted it to tag exact duplicate photos, photos that should be duplicates but are not, and photos that have been processed in some way. I also added some dialogs to remind you how to use it.

To use it, open iPhoto, select some or all of your photos and run the script.
I have also written a short script to remove the "duplicate", "similar" and "processed" comment tags so that you can 'reset' everything.

Note, this script only tags photos. It will not delete any photo (although it could be altered to do that if you wanted it to).

This is the AppleScript code. Copy and paste it into a file called pcIPhotoMarkDuplicates.scpt.

(*
iPhoto Mark Duplicates

Based on work by Karl Smith
http://blog.spoolz.com/2008/11/03/iphoto-applescript-to-remove-duplicates/
Copyright 2008 Phil Colbourn

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see
.
*)
tell application "iPhoto"
display alert "This script will tag photos that are
* duplicates - identical,
* similar - dates and sizes match but somehow different, and
* processed - dates match but smaller than the 'original'.

WARNING: This script is only effective if the selected photos are in date order. Please ensure that the photos are sorted by selecting the

View - Sort Photos - By Date, Ascending

from the iPhoto menu."
set curPhotos to selection
if (count of curPhotos) ≤ 1 then
display alert "You need to select the photos you want me to process."
else
-- this assumes the selected list of photos is in date order
set lastPhoto to item 1 of curPhotos
repeat with thisPhoto in rest of curPhotos
-- skip tagged duplicates
if comment of thisPhoto = "duplicate" then
else
set dupFound to false
try
if (date of thisPhoto = date of lastPhoto) and (width of thisPhoto = width of lastPhoto) and (height of thisPhoto = height of lastPhoto) then

set thisSize to size of (info for (image path of thisPhoto as POSIX file))
set lastSize to size of (info for (image path of lastPhoto as POSIX file))

if thisSize = lastSize then
set diff to "anything but empty"
try
-- run the unix diff program to compare the files.
-- if they are the same the variable diff will be empty.
-- if they are different or an error occurs then diff will not be empty.
set diff to (do shell script "/usr/bin/diff -q '" & (image path of thisPhoto as text) & "' '" & (image path of lastPhoto as text) & "'")
end try

if diff = "" then
set comment of thisPhoto to "duplicate"
set dupFound to true
else
-- there must be subtle changes so I will mark thisPhoto
--set comment of lastPhoto to "similar" -- for testing
set comment of thisPhoto to "similar"
set dupFound to true
end if
else
-- here I assume that the larger file has more information
-- and therefore it is the original
if lastSize > thisSize then
set comment of thisPhoto to "processed"
set dupFound to true
else
set comment of lastPhoto to "processed"
-- thisPhoto is assumed to be the original
end if
end if
end if
end try
-- Last=This keep using Last
-- Last~This keep using Last
-- Last>This keep using Last - Last is assumed to be he original but the next could be the original
-- Last
<>This step onto This
if not dupFound then
set lastPhoto to thisPhoto
end if
end if
end repeat

beep
beep
display alert "All duplicate, similar and processed photos have been marked.

Switch to the Photos Library and search for one of these keywords: duplicate, similar or processed.

Then delete the photos you do not want.

NOTE: If you do nothing then no photos will be harmed.

(I will now try to switch you to the Photo Library.)"
set current album to photo library album
end if
end tell


This is the AppleScript code. Copy and paste it into a file called pcIPhotoClearDuplicateComments.scpt.

(*
iPhoto Clear Duplicate Comments

Copyright 2008 Phil Colbourn

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see .
*)
-- clear comment field on all selected photos if it is duplicate, similar or processed
tell application "iPhoto"
set current album to photo library album
repeat with thisPhoto in (photos of current album)
if (comment of thisPhoto) is in {"duplicate", "similar", "processed"} then
set comment of thisPhoto to ""
end if
end repeat
end tell