August 15th, 2009
Normally in rails you would configure a production, test and development database in the database.yml file. If some of your rails data comes from a different database you can configure it in database.yml as well. For example I wanted two rails applications to synchronize their databases occassionally.
To do this I created a remote db in one of the rails application that looks like this in database.yml:
remotedb:
adapter: mysql
database: remote_rails
username: remote_user
password: remote_pwd
host: remote server
Inside the script that is executed by script/runner I did the following to access the new db.
admin_cfg=Rails::Configuration.new.database_configuration["remotedb"]
if remote_cfg.nil?
raise “admindb is not configured. Cannot pull data from admin db.”
end
dbh = Mysql.real_connect(remote_cfg["host"], remote_cfg["username"], remote_cfg["password"], remote_cfg["database"])
Now use ruby’s mysql library to work with dbh
Tags: Mysql, Ruby
Posted in Uncategorized | No Comments »
August 14th, 2009
A friend told me suggested apple was making a cradle that allowed you to connect your iphone to a monitor , keyboard and mouse. This is an interesting idea. Could apple try to make a dent into the desktop market by replacing the desktop. After all windows XP’s minimum requirements includes a 233 MHz processor. The iphone runs 600 MHz and Im sure the iphone’s OS is not nearly as bloted as XP. What is the real difference between an iphone and a Mac.
Tags: apple, iphone, mac
Posted in Uncategorized | No Comments »
May 30th, 2009
writeMultiByte is not working for linux (though it is fine in Windows) in Flashplayer 10. It failed for me in the ByteArray class and I’ve seen other postings that the issue exist for the binarySocket class as well. At least for the us-ascii encoding.
A For loop around a writeByte is thework around
Posted in flash, flex, linux | No Comments »
April 1st, 2009
Normally what I would do with radio buttons is to look for a click event and set variables accordingly. However there is another way to use radio button if you are operating more in a ‘filling out a form’ approach.
Here it is
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Label text="{'Radio Selected :'+ rg.selectedValue.toString()}"/>
<mx:RadioButtonGroup id="rg"/>
<mx:RadioButton x="10" y="26" value="RADIO 1" selected="true" label="radio1" groupName="rg"/>
<mx:RadioButton x="10" y="52" value="RADIO 2" label="radio2" groupName="rg"/>
</mx:Application>
It now works more like a combobox instead of individual buttons. The label will alwys show the button group’s selected Value.
Posted in flex | No Comments »
March 27th, 2009
Working a lot with ItemEditors in DataGrids.
One of the issues I’ve been dealing with is adding validation to the item editor text entry. I’ve been attaching my validations to the item editor objects themselves however the Datagrid object throws out ItemEditEnd events. You have to check the event’s DataGridReason to see whether it is a cancel or not and then you have the opportunity to validate the data. If the data is bad then do a event.PreventDefault to interrupt the data acceptance and set the target’s errorString to the error message.
More details can be found here.
http://www.adobe.com/devnet/flex/articles/itemeditors_pt2.html
Posted in flex | No Comments »
March 19th, 2009
>> foo = ActionView::Base.new
=> #<ActionView::Base:0x2aaab0ac2af8 @assigns_added=nil, @assigns={},
@helpers=#<ActionView::Base::ProxyModule:0x2aaab0ac2a58>, @controller=nil, @view_paths=[]>
>> foo.extend YourHelperModule
=> #<ActionView::Base:0x2aaab0ac2af8 @assigns_added=nil, @assigns={},
@helpers=#<ActionView::Base::ProxyModule:0x2aaab0ac2a58>, @controller=nil, @view_paths=[]>
>> foo.your_helper_method(args)
=> "<html>created by your helper</html>"
Tags: Ruby
Posted in Ruby | No Comments »
February 28th, 2009
Here is a rewrite of the adobe flex policy server written in C.
FlexPolicyServer
This is useful if you are adding a flex based web interface to an embedded system (something running openwrt). You can use this policy server instead of the ones written in perl and python.
Posted in flex | 3 Comments »
February 7th, 2009
I just got a mini SA board from dunehven.com. My goal was to write a flex UI for a spectrum analyzer. Somr ething I’ve done at work but unable to demo or discuss. So I’ve been looking for a cheap spectrum analyzer to supply the rf data. I’ve been considering a wi-spy but am unable to bring myself to buying a $200 device for this project. Ebay never gave me joy on finding a cheaper model. I’ve bidded on 2 or 3 models bug gave up at 120 dollars.
Then I found the MiniSA for $50 at dunehaven. Just from the specs it looks like it is better than the Wi-spy. However it is a little bit bulkier because in addition to the $50 SA you must buy a open source .Arduino board (~40). I like this solution better because I wanted to get into the AVR microcontrollers anyway.
First impressions of the MINISA is that the software is pretty minimal compared to what I’ve seen Wi-spy does. Wi-spy gives you templates, Spectrum screen, waterfall graphs, statistical displays and all sorts of daemon software.
MiniSA’s windows only client is a minimal Spectrum screen.
The other problem is that minisa’s usb protocol is not documented. I have email out to the designer hoping he will give me some info. Until then I might try my hand at some USB snooping.
Posted in Uncategorized | No Comments »
November 14th, 2008
I always assumed DBs were IO bound but my work at Retek and now from what I am reading here on join performance seems like it might be more CPU bound. Maybe its time for a Nvidia Cuda based storage engine for mysql.
Posted in Mysql, cuda | No Comments »
October 27th, 2008
Outsourcing the scaffolding is an article from a fellow Atlantian discussing how best to oursource code. His thesis is that you should only outsource the the initial version or core product. Once you get into the details where the problem is nolonger simple you need to bring it in house.
I agree and I think this applies to outsourced development even when it is a division of the same company. When the designers and requirement gathers are far away from the developers you are asking for trouble.
Posted in Uncategorized | No Comments »