Raft o àmad dar Tehran

Mit dabei:
avatar Yara On Air
avatar Michael Support

ای ول فارسی
پادکست شماره ۲
رفت و آمد در تهران

من آلمانی هستم و الان در زوریخ زندگی می‌کنم. من در اروپا به شهرهای کوچک عادت دارم و چند هفته پیش برای اولین بار به تهران رفت .
وقتی در تهران بودم خیلی جاها را دیدم و از وسیله نقلیه‌های مختلفی استفاده کردم. مترو، اتوبوس، تاکسی و ماشین از مهمترین وسیله‌های نقلیه هستند. متروی تهران را خیلی دوست داشتم، چون تمیز، سر‌وقت و خیلی مدرن بود. متاسفانه فقط شش خط وجود دارد ولی خطهای جدید در حال ساخته‌شدن هستند.
اتوبوسهای تهران هم خوب هستند. ولی ترافیک شهر تهران خیلی بالاست و اتوبوسها همیشه در راهبندان گیر‌می‌کنند.
جالبترین یله نقلیه برایم تاکسی است. زیرا مسافرهای ناآشنا باهمدیگر یک تاکسی می‌گیرند. یعنی تاکسی‌ها راه‌های مشخصی را می‌روند و می‌آیند و مسافرها می‌توانند هرجای مسیر که خواستند سوار تاکسی یا از تاکسی پیاده بشوند. این روشِ خیلی خوبیست ولی برای خارجیها و کسانی‌ که راه‌ها را نمی‌شناسند کمی سخت و پیچیده است. آنچه ما در اروپا «تاکسی» می‌نامیم در ایران «آژانس» نام دارد. آدم با تلفن می‌تواند یک آژانس بگیرد، که جلوی آدرسی که می‌خواهد او را بردارد.
اگر آدم ماشین داشته‌ باشد، می‌تواند خودش رانندگی کند و راحت‌تر به جایی برود. ولی چون ترافیک زیاد است، باید خیلی صبر و حوصله داشته‌باشد. خیلی از مردم تهران با ماشین شخصی خود رفت و آمد می‌کنند.
من در این مدت دو نفر را هم با دوچرخه دیدم و فکر می‌کنم که کار آنها دیوانگی است! چون ترافیک خیلی برای رانند‌ه‌های دوچرخه مشکل‌ساز است و راه جدایی برای دوچرخه‌ها وجود ندارد. راننده‌های ماشین دائماً خلاف می‌کنند و این خیلی خطرناک است. مشکل دیگر این است که تهران کنار کوه است و دوچرخه سواری به سمت جنوب شهر آسان ولی به سمت شمال شهر خیلی سخت است. علاوه بر این تهران شهر بزرگیست (تقریباً ۵ برابر پاریس) و بیشتر سال هوای تمیزی ندارد.

رفت و آمد در تهران خیلی ماجراجویانه و باحال است.

Vokabeln

  • an … gewohnt sein :به … عادت داشتن
  • Verkehrsmittel :وسیله نقلیه
  • leider :متاسفانه
  • ständig :در حال
  • hoch :بالا
  • meinen/bedeuten (hier: das bedeutet) :یعنی
  • kennen :شناختن
  • nennen :نامیدن
Tagged , | Leave a comment

Mashin Pashin

Mit dabei:
avatar Yara On Air
avatar Michael Support

Eyval Farsi 01

Tagged , | Leave a comment

Music reverse engineered: Incantations (excerpt)

Here’s the transcription of a small piece from Mike Oldfield’s Incantations 1 & 2 – from the Exposed album (13:12min – 14:17min). Actually it’s the beginning of Part 2 played on an electric guitar.

Incantations.txt

Posted in music | Tagged , , , , | Leave a comment

From the desert with love

Neda Shiukhi

بواسطه ندا شیوخی
Neda Shiukhi

بواسطه ندا شیوخی
Posted in Uncategorized | Leave a comment

Music reverse engineered: Shabda & Aurora

I have ignored Music of the Spheres for a long time. After a discussion with my friend a few weeks ago I decided to give it another try. Conclusion: I’m still not sure how to compare it to classics like Hergest Ridge, Ommadawn, etc. but it certainly doesn’t deserve to be ignored. And Shabda is a masterpiece.
Here’s transcriptions for Shabda and Aurora. I hope you enjoy playing!
Suggestions and corrections are highly appreciated.

Merry Christmas!

Posted in music | Tagged , , , , , | 1 Comment

Using Bonjour for iPhone/desktop application sync

Many Cocoa developers might want to port their application(s) to the iPhone. I’m one of these developers and the first problem I ran into was how to sync my desktop application’s data with it’s iPhone pendant. Some applications like OmniFocus use MobileMe or any WebDav server for synchronisation. Unfortunatly this is not an option for me because I don’t want my users to have a MobileMe account or a Server just to sync with my app.

My solution uses Bonjour to synchronize my app’s data to the iPhone via the network. You can download this demo project which contains a proof of concept version of my solution. The demo project consists of two XCode Projects. One desktop app and it’s iPhone pendant.

The idea is pretty simple: The desktop application needs to share it’s data with the iPhone app via the network. Therefore the iPhone app creates a sync service and publishes it using the Bonjour technology. This way, the desktop application “sees” all iPhones (which are running the sync service) in the local network and offers the user a list from which he can choose the iPhone to sync with.
The application’s data is then transfered onto the iPhone where it is saved as a file. The iPhone app can now work with this data.

As I’m short of time at the moment I could only implement this basic solution yet but I’m sure I will extend it as soon as I’ll find the time.
In a real world scenario the synchronization process might be a bit more complex. In most cases you may want to import your iPone app’s data into your desktop app and vice versa. For this I’d suggest to put the whole sync logic into your desktop app and perform something like this:

  1. Fetch the data from the iPhone
  2. Check it against your desktop app’s data
  3. Resolve conflicts if they exist
  4. Import the data into your desktop app
  5. Put the whole data back to the iPhone

Most Important: Security
Whenever you deal with network services you have to keep security in mind. When you start a network service on your iPhone it might be a potential security risk, since it opens a “door” to your applications data and everyone in the local network may be able to download this data.

So you may want to create some kind of pairing or authentication protocol as well as encryption for your sync service. This means that when the app syncs for the very first time the user must enter some “secret” which identifies the the iPhone whic the user wants to sync with. Of course this mechanism becomes useless when you use an unencrypted protocol so you should think about encryption too.
Besides, you shoud ensure that the sync service is only stated when it is really needed. E.g. stop the service when the user swithes to some view other than the sync view, etc.

Conclusion
Since the iPhone supports Bonjour, it could be used to sync data with any desktop application.
A full featured example project resides on your HD in /Developer/Examples/Foundation/PictureSharing and /Developer/Examples/Foundation/PictureSharingBrowser. This is where I took some code from :).

Since I’ve never held a real iPhone in my hands I only tried the example Project with the simulator. It would be nice to see if it works on real hardware. So, if you have tried it, please drop me a line.

Posted in iPhone, Networking | Tagged , | 13 Comments

Ojective-C dot notation

This blog post by Marcus Zarra made me happy. Now I know that I’m not the only person who dislikes the dot notation which has been introduced in Objective-C 2.0.
The “Properties” feature is great, since it takes a lot of work writing accessor methods away from the developer. But accessing your object members sing the dot syntax makes your code ugly and cofusing.

Ok, what shall I say? Marcus’ post says it all …

Posted in Uncategorized | Tagged | Leave a comment

simpleTAN translated into english

Did I mention that simpleTAN is available in english? At the moment we are working on translating the website but it seems to take us longer than we thought. But if you want, you can give the app a try. A short description is available via this recent Blog Post. Enjoy using it :).

Edit: simpleTAN isn’t available anymore. The project has been closed. If you are interested in it give me a shout and I’ll send you a copy. But I’m pretty sure it won’t run on OS X >= 10.5.7

Posted in Bidli Software, simpleTAN | Tagged , , | Leave a comment

Relaunch an application

Some tasks, e.g. restoring an application’s data files from a backup should be performed while the application is not running to make sure there won’t be any concurrent access to the files. A desirable behaviour would be: Quit the application, perform the work and finally relaunch the application – just as Sparkle does when installing an update.

I’ve created a simple but well-working solution for that problem. My solution is using a small helper application which performes the work which has to be done while the main application is not running and relaunches it afterwards. You can download the sample project to try it out by yourself.

The RelaunchHelper is just an ordinary binary which has to be launched by your application just before it terminates itself. Of course, you can pass arguments to the RelaunchHelper. In the example project the path to the main application’s bundle is the sole argument. After invoking the helper, your application should terminate itself and let te helper take over.
I let the helper app sleep for a few seconds befor it relaunches the application to ensure, all files opened by the main application (in this example this is not an issue) are properly closed.

These are the steps you have to follow to create a project:

  • Create a target for the helper
  • Add all needed source files to that target
  • Make that target a direct dependency of your main app’s target to make sure the helper is also build when you build your main app
  • Create a Copy Files build phase for your main app’s target and add the helper to it. This is necessary to make the helper binary appear in your app’s bundle
  • Build and go 🙂
  • So, that’s my solution to the relaunch issue. Maye it’s not the most elegant way to do this. If you have a better solution, let me know. I really appreciate any comment.

    Update:
    A much better way to implement a relaunch helper has been provided by Cédric Luthi in his Blog post.
    Please check it out.

    Posted in Uncategorized | Tagged , , , | 4 Comments

    Synchronizing the content of multiple NSArrayControllers

    As an application grows and it’s UI becomes more complex, you definetly want to split the UI into multiple views and hold each of it in a seperate Nib File. This makes your project a lot more cleaner and helps you to keep overview.

    If you’re using Core Data and you want to access your entities from all of your views you need to put an Array Controller in each of your Nib. But now you’re running into the problem of synchronizing the contents of your Array Controllers since you have to provide the complete application data to all the views in which you need it. Fortunatly Cocoa Bindings help you to solve this issue quite elegantly.

    Download this sample project which is an excerpt of a project I’m currently working on.

    Now, let me explain what this project does in general: Basically you need some

    Master Array Controller” which is bound to your applications ManagedObjectContext and actually holds your application’ data. Then you need to bind the arrangedObjects key of the Array Controller(s) which you want to synchronize with the Master Controller to the Master Controllers contentArray. Then, you need to bind the managedObjectContext of your Slave Controller(s) to the app delegate’s managedObjectContext. That’s it! Here’s some code which illustrates this process:

    1
    2
    
    	[[(MainWindowController*)[self windowController] arrayControllerMaster] bind:@"contentArray" toObject:slaveArrayController withKeyPath:@"arrangedObjects" options:nil];
    	[slaveArrayController bind:@"managedObjectContext" toObject:[NSApp delegate] withKeyPath:@"managedObjectContext" options:nil];


    This example assumes, that the Master Controller is accessible in some way. In my example, I put it in the MainWindowController class and created a read-only accessor method. Take a look at the sample project to see what I mean.

    Conclusion:
    As you can see, Cocoa Bindings enable you to synchronize the ArrayController of your application in a very easy manner. This helps you to keep your Nib Files and controller classes clean and well arranged.

    Posted in Uncategorized | Tagged , , | Leave a comment