768x90 Getting Online Shouldn't be Tough- $7.49 .com Domains at Go Daddy

DateTime Range Helper In Rails View

There's some secret that you should know before you make time scaling in ruby on rails specially to the view. I have little smile when seeing helper from a developer that make time helper like in twitter or facebook, example a moment ago, or 3 minutes ago, or 1 hour ago. Why you hurt your brain if Rails already supports it. I think that he doesnt know the secret, now let me tell you the secret:

distance_of_time_in_words_to_now
Reports the approximate distance in time between from Time to time now. Set include_seconds to true if you want more detailed approximations when distance less than 1 min.  example :

<%=  distance_of_time_in_words_to_now(from_time, include_seconds =  false) %> 

distance_of_time_in_words
This is the same like above, but you can get range of time from 2 dateTimes, example :
<%=  distance_of_time_in_words_to_now(from_time, to_time = 0, include_seconds = false, options = {}) %>

below is table list from date range in many conditions:
0  - 29 secs # => less than a minute
30 secs to 1 min, 29 secs # => 1 minute
1 min, 30 secs to; 44 mins, 29 secs # => [2..44] minutes
44 mins, 30 secs to 89 mins, 29 secs # => about 1 hour
89 mins, 29 secs to 23 hrs, 59 mins, 29 secs # => about [2..24] hours
23 hrs, 59 mins, 29 secs to 47 hrs, 59 mins, 29 secs # => 1 day
47 hrs, 59 mins, 29 secs to 29 days, 23 hrs, 59 mins, 29 secs # => [2..29] days
29 days, 23 hrs, 59 mins, 30 secs to 59 days, 23 hrs, 59 mins, 29 secs # => about 1 month
59 days, 23 hrs, 59 mins, 30 secs to 1 yr minus 1 sec # => [2..12] months
1 yr to 1 yr, 3 months # => about 1 year
1 yr, 3 months to 1 yr, 9 months # => over 1 year
1 yr, 9 months to 2 yr minus 1 sec # => almost 2 years
2 yrs to max time or date # => (same rules as 1 yr)

Rainbow for Slow Rack Application

Rainbows! is an HTTP server for sleepy Rack applications. It is based on Unicorn, but designed to handle applications that expect long request/response times and/or slow clients. For Rack applications not heavily bound by slow external network dependencies, consider Unicorn instead as it simpler and easier to debug.

Rainbows is mainly designed for the odd things Unicorn sucks at:

  • Web Sockets (via Sunshowers)
  • 3rd-party APIs (to services outside your control/LAN)
  • OpenID consumers (to providers outside your control/LAN)
  • Reverse proxy implementations with editing/censoring (to upstreams outside your control/LAN)
  • Comet
  • BOSH (with slow clients)
  • HTTP server push
  • Long polling
  • Reverse AJAX
  • real-time upload processing (via upr)
    Rainbows can also be used to service slow clients directly even with fast applications. 

 You may also install it via RubyGems on RubyGems.org
gem install rainbows

for Rack applications

In APP_ROOT, run:
rainbows
 
PS: For more information about tunning you can read here  

How To Create List & Add User Twitter in Flex and Air

A moment ago i have a problem about how to get Home Line or status from a group users list in my Air Application and sort them by date ascending. My analyst is if an account has 20 tweets but the group has 10 users, it means that i have to sort 200 list. Why don't use SortOn for Array? If you try myArray.SortOn("date",[Array.CASE_SENSITIVE, Array.UNIQUE ]), it can't sort date (string type in twitter) very well, we have to convert them from string to millisecond, and it will take time, maybe crashed.

My idea is, unite them in a list in customer twitter account then get the list status, make sense, no ? For this case i use library from Sandro (Thanks Dude) , which is named tweetr, badly no more example about create list like my case. When i read the documentation, it seems simple, but the process is not like that. The list status, only can pull status of users which are public, so if it is protected you can't pull them.

Here is the sample of my work, you can try by clicking the demo link below (this sample not stores your twitter login ^_^), the demo is in flex version, but you can convert it to Air easily.

DEMO
SOURCE (Flex)

Develop SmartPhone Using RhoHub

RhoMobile is a first Development as a Service for Mobile, RhoHub or RhoMobile lets you quickly create native apps in Ruby and HTML for all major smartphones using the award-winning Rhodes framework. RhoHub provides a hosted RhoSync server to synchronize backend data with your users' smartphones.Writing an app on RhoHub consists of generating a set of objects, editing the client side (Rhodes framework) code, the server side (RhoSync) source adapter and building for your target smartphones. Below is an overview of RhoHub's rich IDE and other services.



  1. Debugging Console : Use the collapsible console to quickly view output from your RhoSync source adapters.
  2. File Manager : Navigate and modify your app's files in a simple view.
  3. Rich Editor : Use the powerful Ruby/HTML/CSS/Javascript editor right from your browser, or work locally and upload your app.
  4. Text Search :  Search for text in all files of your app.
  5. Toolbar & Quick Links :  Access all of RhoHub's productivity tools right from the editor.




What you can do in RhoHub ?

RhoHub provides you 3 packages, Free, Basic and Premium. You can start with free 50MB Disk Space.

 
powered by Blogger