2010年3月22日 星期一

substruct with sqlite3

-- Substruct (download)

-- patch it by sqlite3 support (mysql by default).
diff --git a/config/boot.rb b/config/boot.rb
index dd5e3b6..ad28b5a 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -44,7 +44,7 @@ module Rails
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
- Rails::GemDependency.add_frozen_gem_path
+ #Rails::GemDependency.add_frozen_gem_path
end
end

diff --git a/config/database.yml b/config/database.yml
index 796e976..8c4c899 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -14,29 +14,52 @@
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
-development:
- adapter: mysql
- encoding: utf8
- database: substruct_development
- username: root
- password:
- socket: /tmp/mysql.sock
+#development:
+# adapter: mysql
+# encoding: utf8
+# database: substruct_development
+# username: root
+# password:
+# socket: /tmp/mysql.sock

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
+#test:
+# adapter: mysql
+# encoding: utf8
+# database: substruct_test
+# username: root
+# password:
+# socket: /tmp/mysql.sock
+#
+#production:
+# adapter: mysql
+# encoding: utf8
+# database: substruct_production
+# username: root
+# password:
+# socket: /tmp/mysql.sock
+
+# SQLite version 3.x
+# gem install sqlite3-ruby (not necessary on OS X Leopard)
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
test:
- adapter: mysql
- encoding: utf8
- database: substruct_test
- username: root
- password:
- socket: /tmp/mysql.sock
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000

production:
- adapter: mysql
- encoding: utf8
- database: substruct_production
- username: root
- password:
- socket: /tmp/mysql.sock
+ adapter: sqlite3
+ database: db/production.sqlite3
+ pool: 5
+ timeout: 5000
diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb
index c94db0a..54e3661 100644
--- a/config/initializers/new_rails_defaults.rb
+++ b/config/initializers/new_rails_defaults.rb
@@ -11,11 +11,11 @@ if defined?(ActiveRecord)
ActiveRecord::Base.store_full_sti_class = true
end

-ActionController::Routing.generate_best_match = false
+#ActionController::Routing.generate_best_match = false

# Use ISO 8601 format for JSON serialized times and dates.
ActiveSupport.use_standard_json_time_format = true

# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
# if you're including raw json in an HTML page.
diff --git a/vendor/plugins/substruct/db/schema.rb b/vendor/plugins/substruct/db/schema.rb
index ce71f69..2c13378 100755
--- a/vendor/plugins/substruct/db/schema.rb
+++ b/vendor/plugins/substruct/db/schema.rb
@@ -116,8 +116,10 @@ ActiveRecord::Schema.define(:version => 20100210194537) do
t.integer "country_id", :default => 0, :null => false
end

- add_index "order_addresses", ["first_name", "last_name"], :name => "name"
- add_index "order_addresses", ["country_id", "order_user_id"], :name => "countries"
+ #add_index "order_addresses", ["first_name", "last_name"], :name => "name"
+ #add_index "order_addresses", ["country_id", "order_user_id"], :name => "countries"
+ add_index "order_addresses", ["first_name", "last_name"]
+ add_index "order_addresses", ["country_id", "order_user_id"]

create_table "order_line_items", :force => true do |t|
t.integer "item_id"
@@ -145,7 +147,8 @@ ActiveRecord::Schema.define(:version => 20100210194537) do
t.string "name", :limit => 30, :default => "", :null => false
end

- add_index "order_status_codes", ["name"], :name => "name"
+ #add_index "order_status_codes", ["name"], :name => "name"
+ add_index "order_status_codes", ["name"]

create_table "order_users", :force => true do |t|
t.string "email_address", :limit => 50, :default => "", :null => false
@@ -246,7 +249,8 @@ ActiveRecord::Schema.define(:version => 20100210194537) do
t.integer "related_id", :default => 0, :null => false
end

- add_index "related_products", ["product_id", "related_id"], :name => "related_products"
+ #add_index "related_products", ["product_id", "related_id"], :name => "related_products"
+ add_index "related_products", ["product_id", "related_id"]

create_table "rights", :force => true do |t|
t.string "name"
@@ -290,7 +294,8 @@ ActiveRecord::Schema.define(:version => 20100210194537) do
t.integer "parent_id", :default => 0, :null => false
end

- add_index "tags", ["name"], :name => "name"
+ #add_index "tags", ["name"], :name => "name"
+ add_index "tags", ["name"]

create_table "user_uploads", :force => true do |t|
t.string "filename"
diff --git a/vendor/plugins/substruct/app/models/product.rb b/vendor/plugins/substruct/app/models/product.rb
index 655e1c8..c2f9b5c 100755
--- a/vendor/plugins/substruct/app/models/product.rb
+++ b/vendor/plugins/substruct/app/models/product.rb
@@ -2,9 +2,9 @@ class Product < Item
# Conditions that the product is in stock, or available
# and just out of stock.
CONDITIONS_AVAILABLE = %Q/
- CURRENT_DATE() >= DATE(items.date_available)
- AND items.is_discontinued = 0
- OR (items.is_discontinued = 1 AND (items.quantity > 0 OR items.variation_quantity > 0))
+ CURRENT_DATE >= DATE(items.date_available)
+ AND items.is_discontinued = 'f'
+ OR (items.is_discontinued = 't' AND (items.quantity > 0 OR items.variation_quantity > 0))
/

has_many :product_images, :dependent => :destroy
-- my gem list
*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
appengine-jruby-jars (0.0.6)
appengine-rack (0.0.6)
appengine-sdk (1.3.1)
appengine-tools (0.0.10.1)
authlogic (2.1.3)
authlogic-oid (1.0.4)
bundler08 (0.8.5)
cgi_multipart_eof_fix (2.5.0)
columnize (0.3.1)
daemons (1.0.10)
ezcrypto (0.7.2)
fastercsv (1.5.3)
fastthread (1.0.7)
gem_plugin (0.2.3)
google-appengine (0.0.10.1)
json (1.2.3)
linecache (0.43)
mime-types (1.16)
mini_magick (1.2.5)
mongrel (1.1.6)
passenger (2.2.11)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
RedCloth (4.2.3)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.9)
ruby-openid (2.1.7)
rubyzip (0.9.4)
sqlite3-ruby (1.2.5)
wrest (0.1.0)

-- do bootstrap
rake substruct:db:bootstrap

-- go!
script/server

2010年3月8日 星期一

openocd

Require: OpenOCD with Amontec Tiny JTAG.
Target: ARM7, ARM11

For Windows:

For Linux:
1) get source
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
2) install packages for ubuntu
sudo apt-get install libtool automake autoconf texinfo libftdi-dev
3) compile
./bootstrap
./configure --prefix=/opt/openocd/ --enable-ft2232_libftdi --enable-maintainer-mode
make
make install

JTAG:

integration

Eclipse plugin

2009年7月30日 星期四

android HERO rom for G1

It combines several steps... (I am using Drizzy's 2.8 now). In brief, you need to use cm-recovery and partition your sdcard, and then put all images on the sdcard. you will get a HERO build after lots of reboots.

Step 1: get cm-recovery

Download image (right-click, save as): http://n0rp.chemlab.org/android/cm-recovery-1.4.img
MD5Sum: f5135a878c705215f4012786e4261cfe

To install image: copy it to your sdcard and run:

flash_image recovery /sdcard/cm-recovery-1.4.img

If you have problems with a "no space on device" error, try using fastboot and erasing first:

fastboot erase recovery
fastboot flash recovery cm-recovery-1.4.img

Step 2: Formatting you SDcard

You only need to do this once folks..if you already have 3 partitions including linux-swap move to step 2

You need Recovery image 1.31 to do this folks!

To format card SD card with linux-swap WARNING!!! this will reformat you entire SD card!!

You can use the recovery console and parted to format SDcards with 1.31 folks, no more going through hassles you have the tools on you G1!...here is an example of how to do this in recovery console using parted. DO NOT USE MORE THAN 32MB SWAP!!!

Example for 8GB card (this example plays it safe and will leave a small amount leftover regardless of the 8GB card)

Reboot and enter recovery
Enter console
#parted /dev/block/mmcblk0
#print (to verfiy we know what size card we are dealing with, the details should be straight forward)
rm 1
rm 2
mkpartfs primary fat32 0 7200
mkpartfs primary ext2 7200 7700
mkpartfs primary linux-swap 7700 7732

#print (to verify we have the 3 partitions)

Example for my 4GB card

#parted /dev/block/mmcblk0
#print (to verfiy we know what size card we are dealing with, the details should be straight forward)
rm 1
rm 2
mkpartfs primary fat32 0 3420
mkpartfs primary ext2 3420 3932
mkpartfs primary linux-swap 3932-3964

Example for a 2GB card playing it safe

#parted /dev/block/mmcblk0
#print (to verfiy we know what size card we are dealing with, the details should be straight forward)
rm 1
rm 2
mkpartfs primary fat32 0 1200
mkpartfs primary ext2 1200 1700
mkpartfs primary linux-swap 1700-1732


"End?" you need to place the last value for the linux swap eg.3964 for my 4GB card

#print (to verify we have the 3 partitions)

Next we need to "quit" parted and upgrade our ext2 partition to ext3

#upgrade_fs



(just download it at first)

Drizzy Rocks lol NewVision 2.8
MD5:BA13ACBBB63BB96BEFDD4DB2C98FACE2


(just download it at first)

About IMEs

OEM IMEs are input method editors that are included preinstalled on Android products released in regions that don't use a Latin keyboard. As with all preinstalled apps, they are by default contained in the /system partition. These update.zip installers allow you to quickly and simply reinstall an OEM IME onto your 1.5 or higher build Android using the recovery. Note that you must have the test-key certificates installed in order to use these (i.e. you need to be "rooted").

Installation

1. Check your remaining space in /system by opening Terminal Emulator and typing df. The third line or so should be:
Code:
/system: xxxxxK total, xxxxxK used, xxxxxK available (block size 4096)
(Remember that 1024KByte = 1MByte)
2. After confirming you have enough space in step 1, download the desired IME installer.
3. Rename the installer to update.zip and copy it to the root of your sdcard.
4. Reboot into recovery and use Alt+S to flash the updater. Reboot when done.
5. Open your settings to Locale & text and check the box next to the new IME. If you do not wish to use the multi-IME selector then uncheck the other unwanted IMEs.

Quote:
HTC Chinese IME

The Chinese IME bundled with HTC-branded phones sold in Asia (e.g. HTC Magic & HTC Hero). CIME contains multiple input methods, including handwriting recognition, zhuyin, cangjie, pinyin, and stroke. CIME can recognize both traditional and simplified handwriting, but output for keyboard input methods will default to traditional or simplified based on your system locale setting.

15763fb6b374887906744790d6219637 htc_cime_haykuro_hero_6.9mb_update.zip 5.4MByte
74c842315eb779b23c3c315c5dba65fc htc_cime_cht_magic_6.6mb_update.zip 5.3MByte
Step 6

: place ota, spl, HERO in the root of sd card
: boot into recovery
: update ota
: boot into recovery
: update spl
: boot into recovery
: wipe
: boot into and enter these:
# adb remount
(enter)
# adb shell rm -r /system/sd/*
(enter)
# adb reboot recovery
: now wipe again
: repair ext system
: flash
: boot

: adb remount
: adb push system /system
: reboot

GL :)

2009年6月1日 星期一

android must have apps

barcode scanner
google sky map
save MMS
MMS popup
aTrackDog
Finance
Quota Pro
JavaME
rTerm
plukriod
AK notepad
Ringdroid
Shazam
connectbot
MyCloset
softez

2009年4月28日 星期二

2008年9月4日 星期四

FreeRTOS

Xilinx MicroBlaze

http://www.freertos.org/portmicroblaze.html
http://vontaene.de/freertos_microblaze_ise_9.1/freertos_5.0_changes.txt

NXP LPC23xx on IAR compiler

NXP LPC23xx on GNU compiler