Saturday, September 4, 2010

Twitter auth changes

There are over 250,000 applications built using the Twitter API. To use most applications, you first authorize the application to access your Twitter account, after which you can use it to read and post Tweets, discover new users and more. Applications come in many varieties, including desktop applications like TweetDeck, Seesmic, or EchoFon, websites such as TweetMeme, fflick, or Topsy, or mobile applications such as Twitter for iPhone, Twitter for Blackberry, or Foursquare.
Update 1: New authorization rules for applications
Starting August 31, all applications will be required to use “OAuth” to access your Twitter account.
What's OAuth?
  • OAuth is a technology that enables applications to access Twitter on your behalf with your approval without asking you directly for your password.
  • Desktop and mobile applications may still ask for your password once, but after that request, they are required to use OAuth in order to access your timeline or allow you to tweet.
What does this mean for me?
  • Applications are no longer allowed to store your password.
  • If you change your password, the applications will continue to work.
  • Some applications you have been using may require you to reauthorize them or may stop functioning at the time of this change.
  • All applications you have authorized will be listed at http://twitter.com/settings/connections.
  • You can revoke access to any application at any time from the list.

Update 2: t.co URL wrapping
In the coming weeks, we will be expanding the roll-out of our link wrapping service t.co, which wraps links in Tweets with a new, simplified link. Wrapped links are displayed in a way that is easier to read, with the actual domain and part of the URL showing, so that you know what you are clicking on. When you click on a wrapped link, your request will pass through the Twitter service to check if the destination site is known to contain malware, and we then will forward you on to the destination URL. All of that should happen in an instant.
You will start seeing these links on certain accounts that have opted-in to the service; we expect to roll this out to all users by the end of the year. When this happens, all links shared on Twitter.com or third-party apps will be wrapped with a t.co URL.
What does this mean for me?

Thursday, July 15, 2010

HTML5 Mobile App Framework

www.sencha.com

Sunday, July 4, 2010

Convert .dmg files to .iso files


hdiutil convert /path/to/filename.dmg -format UDTO -o /path/to/savefile.iso

Wednesday, June 30, 2010

Business Logic Toolkit for .NET

NServiceBus

http://www.techdays.ru/videos/2295.html
http://www.nservicebus.com/Documentation.aspx

Tuesday, June 29, 2010

Анонимная рекурсия на C# и лямбды

Лямбды есть анонимные функции, а рекурсия требует определения имен.
Определение функции, которая вычисляет число Фибоначчи:

Func fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;

Но работать это не будет, т.к. компилятор выдаст ошибку:
Use of unassigned local variable 'fib'

Проблема в том, что правая сторона выражения оценивается до того, как fib будет определена.

Быстрый обход этой проблемы - присвоить fib null, то есть явно определить fib перед тем, как она будет использована.

Func fib = null;
fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;
Console.WriteLine(fib(6));                        // displays 8

Но это решение не является настоящей рекурсией. Рекурсия требует, чтобы функция вызывала саму себя. В данном случае функция fib просто вызывает делегат, на который ссылается локальная переменная fib. На первый вгзгляд, это игра слов, но рассмотрим следующий пример:

Func fib = null;
fib = n => n > 1 ? fib(n - 1) + fib(n - 2) : n;
Func fibCopy = fib;
Console.WriteLine(fib(6));                        // displays 8
Console.WriteLine(fibCopy(6));                    // displays 8
fib = n => n * 2;
Console.WriteLine(fib(6));                        // displays 12
Console.WriteLine(fibCopy(6));                    // displays 18

Можно заметить, как меняется результат вызова fib и даже вызов fibCopy отличается от вызова fib. Этот беспредел можно остановить, передавая функцию, которая будет использоваться для рекурсивного вызова:

(f, n) => n > 1 ? f(f,n - 1) + f(f,n - 2) : n

Таким образом, лямбда выглядит почти так же за тем исключением, что она первым параметром принимает функцию f. Когда вызывается фунцкия f, нужно передать ее в себя первым аргументом.

Чтобы это реализовать и преобразовать лямбду к делегату, необходимо определить тип делегата. Начнем с типа fib, Func. Возвращаемый тип - int, принимаемым вторым аргументов типом также должен быть int. Что касается первого аргумента, им должен быть делегат, который должен вызываться с теми же аргументами, которые мы определяем в данном случае, что и есть рекурсия:

delegate int Recursive(Recursive r, int n);

Этот делегат можно обобщить через параметризацию аргумента и возвращаемого типа:

delegate R Recursive(Recursive r, A a);

Теперь можно использовать лямбду, определенную выше:

Recursive fib = (f, n) => n > 1 ? f(f,n - 1) + f(f,n - 2) : n;
Console.WriteLine(fib(fib,6));                      // displays 8
Хотя это является решением, выглядит оно не так красиво, как первоначальный код...

(продолжение следует)

Powered by Blogger.