Yesterday, I said goodbye to a dear friend.
I will remember him for the joy, and for the good times.
love you, Shay!
Look over us.
Tuesday, November 30, 2010
Thursday, November 11, 2010
Rails Application variable II
Ah, it turns out that my heist and ignorance in Ruby and Rails I missed out on the Rails.cache options.
All you need is...
def self.alive? (id)
if Rails.cache.read(id)!=nil and (Time.now - Rails.cache.read(id))<10
true
else
Rails.cache.delete(id)
false
end
end
def self.present(id)
Rails.cache.write(id,Time.now)
end
(...love)
All you need is...
def self.alive? (id)
if Rails.cache.read(id)!=nil and (Time.now - Rails.cache.read(id))<10
true
else
Rails.cache.delete(id)
false
end
end
def self.present(id)
Rails.cache.write(id,Time.now)
end
(...love)
Sunday, October 31, 2010
Rails Application variable
It almost seemed that there was no easy way out of putting application scope variables in the database.
But there is a way out:
if Thread.main[:uuid] == nil
Thread.main[:uuid]=0
end
uid = Thread.main[:uuid] += 1
This code accesses the mail thread of the rails process and puts a variable on it. (the thread is an object and can have key => value sets)
And since rails has only one main thread... its shared with all the threads underneath.
Good Luck
But there is a way out:
if Thread.main[:uuid] == nil
Thread.main[:uuid]=0
end
uid = Thread.main[:uuid] += 1
This code accesses the mail thread of the rails process and puts a variable on it. (the thread is an object and can have key => value sets)
And since rails has only one main thread... its shared with all the threads underneath.
Good Luck
Friday, October 29, 2010
Multilingual Support for Flex
Some Cowboy coding techniques for supporting multilingual flex interfaces:
Instead of the usual form (from an Adobe development center post):
...text="{resourceManager.getString('resources', 'POSTDISPLAY_POST_TITLE')}"...
My label looks like:
...text="{gS['POSTDISPLAY_POST_TITLE']}"...
Which is so much shorter and nicer to read when you are coding.
The gS is actually a static object (i.e. hash map) that I load with all the key:value pairs of the language.
Once you declare gS as [Bindable] you can replace the object at runtime with other languages, resulting with the replacement of all the strings in the application.
Note: the compiler issues a warning that since you are using square brackets, the GUI object will not be able to detect changes in the data source. Well, it does.
Independent on Sundays
Instead of the usual form (from an Adobe development center post):
...text="{resourceManager.getString('resources', 'POSTDISPLAY_POST_TITLE')}"...
My label looks like:
...text="{gS['POSTDISPLAY_POST_TITLE']}"...
Which is so much shorter and nicer to read when you are coding.
The gS is actually a static object (i.e. hash map) that I load with all the key:value pairs of the language.
Once you declare gS as [Bindable] you can replace the object at runtime with other languages, resulting with the replacement of all the strings in the application.
Note: the compiler issues a warning that since you are using square brackets, the GUI object will not be able to detect changes in the data source. Well, it does.
Independent on Sundays
Thursday, October 28, 2010
"localhost" Server isn't working? Blame Skype!
Solution:
Kill the Skype process.
Good Luck.
Wednesday, October 27, 2010
Exporting from SQLServer to SQL insert script
The problem:
Export data from an MS SQL server to an SQL script of insert statements
It appears that there is no built in option for performing such a simple a task. After all, SQL is the common protocol for SQL based databases.
What i did manage to find is a script (stored procedure) for SQLServer 2000 and SQLServer 2005
The original post and instructions are available here.
Good luck
Export data from an MS SQL server to an SQL script of insert statements
It appears that there is no built in option for performing such a simple a task. After all, SQL is the common protocol for SQL based databases.
What i did manage to find is a script (stored procedure) for SQLServer 2000 and SQLServer 2005
The original post and instructions are available here.
Good luck
Subscribe to:
Posts (Atom)
