Published March 19, 2013
Oggi è andato in onda il mio primo episodio su Dart per Google Developers Live, una velocissima panoramica sulle caratteristiche fondamentali del linguaggio e di Dart Editor, l’editor ufficiale.
Questo episodio fa parte del programma GDL Italia che potete seguire sul blog ufficiale Developers Italia curato da +Alfredo Morresi.
Published January 09, 2013
Today’s blog post is about a sample application that uses Web UI and js libraries and shows some information about you on Google+. To retrieve these informations, application uses the Google APIs Client Library for JavaScript.
Funny story: I chose to use Google API javascript client (handled with dart js-interop library) instead of dart client since the latter was outdated and while I was editing the code an interesting project appeared on GitHub: dart-google-oauth2-library by +Gerwin Sturm. dart-google-oauth2-library simplifies the whole authentication process in a significant way, so please consider the following just as an example of how js-interop works.
Published October 13, 2012
Copy/paste lines below and put in your password when prompted to disable OS X startup chime.
sudo sh -c "echo '#'"'!'"'/bin/sh\nosascript -e \"set volume without output muted\"'>/usr/local/bin/unmute"
sudo sh -c "echo '#'"'!'"'/bin/sh\nosascript -e \"set volume with output muted\"'>/usr/local/bin/mute"
sudo chmod a+x /usr/local/bin/mute /usr/local/bin/unmute
sudo defaults write com.apple.loginwindow LoginHook /usr/local/bin/unmute
sudo defaults write com.apple.loginwindow LogoutHook /usr/local/bin/mute
This code will create two shell scripts, /usr/local/bin/unmute
, /usr/local/bin/mute
that will execute these AppleScripts:
set volume without output muted
and
set volume with output muted
After this, the code will bind those scripts to the LoginHook and LogoutHook handlers: when you will log out, sound will be muted, after you logged in, sound will be un-muted.
If you want to restore startup chime, type:
sudo defaults delete com.apple.loginwindow LoginHook
sudo defaults delete com.apple.loginwindow LogoutHook
sudo rm /usr/local/bin/mute /usr/local/bin/unmute
Published September 27, 2012
OSX as is doesn't allow users to set keyboard shortcuts to launch applications, but there are a bunch of 3rd-party softwares and workarounds to achieve that.
If you don't want to use a 3d-party app then the best way to do that is creating a service that just launches an application, and then bind it to a given keyboard shortcut. Let's start:
Open Automator.app and choose new "Service" document
In the right tab, set "Service receives" to "no input", then drag and drop "Run AppleScript" action to the workflow:
"Run AppleScript" is located under "Utility" section.
Set the content of the script to:
on run {input, parameters}
tell application "Terminal"
reopen
activate
end tell
end run
Go to System Preferences->Keyboard->Keyboard Shortcuts->Services, then scroll until you find your new service under General section and assign it a shortcut.
This works with all of the applications, you just have to replace Terminal
with what you want.