Add torrents to Transmission from anywhere
Requirements:
- Transmission - http://www.transmissionbt.com/
- Dropbox Account – Referral Link, if you use it, we both get 250MB extra
- Dropbox App – http://www.dropbox.com/downloading
- Open Transmission preferences;
- Check “Start transfers when added”;
- Uncheck “Display a window when opening a torrent file”;
- Check “Watch for torrent files in : {a folder on your dropbox}”
Installing Redis on Mac OS X
Get source and install
$ wget http://redis.googlecode.com/files/redis-2.2.12.tar.gz$ tar xzf redis-2.2.12.tar.gz$ cd redis-2.2.12$ make$ make install
And it should be up and running on:
/usr/local/bin/redis-server
For Redis server to start on boot
$ sudo nano /Library/LaunchDaemons/org.redis.redis-server.plist
Copy the following to the the file you just created.
Create the log dir if it doesn’t exists yet
sudo mkdir /var/log/redis
Load and launch the Daemon:
sudo launchctl load /Library/LaunchDaemons/org.redis.redis-server.plist sudo launchctl start org.redis.redis-server
Hope it helps
Capturing touch events
While developing an iPhone application I needed to detect all touch events. I found some tips on how to do it in objective-c but I’m mostly using MonoTouch.
Here is my solution:
Since I’m doing a Window based application, I thought that I could probably get the touch events by overriding the standard UIWindow with my own version.
Taking a look to the default generated code (MainWindow.xib) we can see that the application is based on a UIWindow:
// Base type probably should be MonoTouch.Foundation.NSObject or subclass
[MonoTouch.Foundation.Register("AppDelegate")]
public partial class AppDelegate {
private UIWindow __mt_window;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("window")]
private UIWindow window {
get {
this.__mt_window = ((UIWindow)(this.GetNativeField("window")));
return this.__mt_window;
}
set {
this.__mt_window = value;
this.SetNativeField("window", value);
}
}
}
To create our custom windows class we can double-click the MainWindows.xib file and do it on InterfaceBuilder.
Step by step what to do on Interface Builder:
- Click on the Window and change the class to “EventUIWindow”;
- In the “Library” select “EventUIWindow”
- Set the inheritance super class to UIWindow
- Save and close Interface Builder
Now if we look at the generated code we have this:
// Base type probably should be MonoTouch.Foundation.NSObject or subclass
[MonoTouch.Foundation.Register("EventUIWindow")]
public partial class EventUIWindow { }
[MonoTouch.Foundation.Register("AppDelegate")]
public partial class AppDelegate {
private EventUIWindow __mt_window;
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("window")]
private UIWindow window {
get {
this.__mt_window = ((EventUIWindow)(this.GetNativeField("window")));
return this.__mt_window;
}
set {
this.__mt_window = value;
this.SetNativeField("window", value);
}
}
}
Now the only thing we need to do is to implement the EventUIWindow. We can do this since it is a partial class. On the implementation we need to override the SendEvent method.
Some sample code:
public partial class EventUIWindow : UIWindow
{
public EventUIWindow () : base() {}
public EventUIWindow (IntPtr handle) : base(handle) {}
public override void SendEvent (UIEvent evt)
{
// Send the event to its original destination
base.SendEvent (evt);
// Get touchs from the event
var touchs = evt.AllTouches;
// Count will be one most of the time (single touch) but multitouch will appear here. E.g. Pinch touchs.Count = 2
if (touchs.Count > 0)
{
// Get one touch event from the array
UITouch touch = touchs.AnyObject as UITouch;
if (touch != null)
{
// You can get the touch phase
// UITouchPhase.Began || UITouchPhase.Cancelled || UITouchPhase.Ended || UITouchPhase.Moved || UITouchPhase.Stationary
// touch.Phase;
// How many taps the click had
// touch.TapCount
// Target view
// touch.View
// Target Window
// touch.Window
// Touch event timestamp
// touch.Timestamp
// And a few more things
}
}
}
}
You can find the full source code for this sample at http://github.com/reistiago/monotouch-samples/
Hope it helps
