JOMYUT.NET Just a normal guy in binary world

24Apr/13Off

uninitialized constant Draper::Base

ทำไม Line นี้

config.cache_classes = true

จึงทำให้เกิด Error นี้ :/ . หา คำตอบไม่ได้ แต่ Comment แล้ว Appfog update ผ่าน.

DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/config/environment.rb:5)
/mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/app/decorators/goal_decorator.rb:1:in `<top (required)>': uninitialized constant Draper::Base (NameError)
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in `each'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in `block in eager_load!'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in `each'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in `eager_load!'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/config/environment.rb:5:in `<top (required)>'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/config.ru:3:in `block in <main>'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/config.ru:in `new'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/config.ru:in `<main>'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /mnt/var/vcap.local/dea/apps/done-0-5f97e3776b2a3e76c4a89fbe4be1e836/app/rubygems/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

 

 

Filed under: Rails Comments Off
7Apr/13Off

Old Video DVD Recovery

Back to about 15 years ago, DVD introduce to the market with the benefits to store more data in the same size physical media. On that time, I have moved a lot of data and also camcorder video from CDs to DVDs. On that time I was in High school and worries less about the lifetime of DVD media and there are no facts information about which DVD brand contains most quality that take longer lifetime of DVD. When have more knowledge I have move data from low quality DVD disc to higher one. Write on low speed for more important data, however, I haven't realize that there are some of first DVDs use the difference place to store. I found it later when it was like 15 years and DVD discs so damaged, hard to read by the most DVD drive.

However, I still keep those DVDs in case that one day, it may have good DVD drive enough to read those broken DVD data. and that day come. I just brought my new laptop, with the new DVD reader head, it be able to read some content of DVD data. Badly, it cannot read the whole disc, mostly it be able to read inner burned DVD section (like first 800MBs). After that, it always show message on checksum error. Something like "L-EC Uncorrectable Error" (From ImgBurn software).

Luckily, some investigation is corrected! I think that sometime it may be possible that DVD reader head is too hot (when it beam the READ laser from the crystal, if it too hot, the light wavelength may be also change which should impact to read quality). So, luckily, ImgBurn be able to Pause during make the disc image, so, when the drive working for 15 minutes, I make the manual pause for another 15 minutes to sure that drive is cool down enough, then resume the operation, .... and that is work!. It be able to read more data after resume the operation back after pause it.

Hope that this technical may help someone who have some old data on DVDs. note that it may not help to fully recovery your data from damaged DVD. but at least some data like Video DVD is prepared to be broken can continue to see the movie inside.

Filed under: Uncategorized No Comments
5Apr/13Off

Move to SSD from default HDD on Win8 with UEFI enabled GPT secure drive

I just brought Dell 5521 with 1TB harddisk. However, I would like to replace it with SSD drive. The OEM OS version come with laptop without OS media. No serial number on the back of the laptop.

After stuck when try to install Solid-state drive with the new laptop (Dell 15R 5521) finally, 24 hrs, I am be able  to change be on SSD drive. Usually it should take much longer like these, but by lack of resource about Win8 and new introduced technology UEFI and GPT, I am totally lost the way, until I said that if this round not working, I will be defeat and move back to Win7 instead. And then,.... it become working in this round.

2013-04-05 00.12.38

Boot Error Screen - Winload.efi error. Your PC needs to be repaired. Error Code : 0xc0000225

 

 

To make it work, I don't have fully correct step-by-step but this blog may help in case that you experience the same problem.

First, open the command line and run `diskpart` .... Tool provided from Windows. select SSD drive, in a DISKPART prompt,

  • list disk
  • select disk 2  #select your SSD drive
  • convert GPT # assume that you have unformatted SSD, this will convert your drive as GPT structure
  • hm, you may follow instruction from Microsoft link here.

After that, use the Macrium Reflect (Cloning tool) to clone all partitions on your original harddisk to SSD drive

  • use Win8 create recovery drive tool, to create your USB drive (At the time I created, it request for 16GB+ USB device)
  • swap the harddisk to SSD drive
  • remove Secure boot from your bios (may not require)
  • Boot by recovery USB drive
  • open the command line
  • run diskpart again
  • select disk 1 # your SSD drive
  • select part 1 # your EFI boot partition
  • detail part
  • assign letter=S # assign S:\ to your EFI boot partition
  • run bcdboot c:\windows /s S: /f UEFI
  • if you got the sucessful statement, you are luck! if not, go to check BIOS secure drive configuration
  • now, try to boot with your SSD harddisk
  • if you are lucky, you may got the Win8 back!.

 

Tagged as: , , No Comments
5Feb/13Off

Crash Putty when make a SSH tunnel

Experience on Putty become crash when try to make a SSH tunnel. Found that I use Putty (Development Snapshot 2011-11-15:r9326). After change to Release 0.62, this problem gone.

 

Tagged as: No Comments
29Jan/13Off

Resize RaspberryPi root partition is so simple

Using the Debian-Wheezy Beta image, there is a configuration utility built in that makes this easy:

There is a utility called raspi-config. This runs on first boot if you're connected directly to the RPi. If you're over SSH you can run it manually using $ sudo raspi-config. (I think you can re-run the tool manually at any time).

The second option on the blue dialog that follows is titled expand_rootfs, with the description "Expand root partition to fill SD card".

Selecting this will cause your root partition to be resized to fill the card the next time you boot your RPi.

(By Jon Egerton)

source: http://raspberrypi.stackexchange.com/questions/499/how-can-i-resize-my-root-partition

16Jan/13Off

Reverse Tunnel

I'm plan to place my Raspberry Pi in my parent home, so, it will help me on mange my parent home devices when I have away from home in many month. Raspberry Pi is really cheap compare to another solution. just only 60$S, I can custom make everything available on my parent home. VoIP Gateway, ADSL Router, Wireless Access Point, CCTV, NAS, Print server.

The way to manage is not much easy like connect to Raspberry Pi because the IP address is change as a daily by the ISP. I don't like to rely on ADSL router because it has a case that I lost of control of all devices in a house because the ADSL router have reset its state and nobody know how to configure it.

So, my way is that make the Reverse secure shell tunnel connect from Raspberry Pi inside a house to my EC2 instance. This way will ensure that even the ADSL router haven't forward any ports, I still can manage devices in a house.

Now, the way is not much hard. Just install AutoSSH -- this application will help to restart a service if SSH connection is dead. and run a command as below on a Pi.

autossh -2 -N  -M 20000 -R $SERVER_PORT:localhost:22 $USERNAME@$SERVER

that's all. so, simple. Manageable. ^^

By this way, to connect to a Pi, I just SSH to $SERVER and the SSH on that server terminal to a Pi. or, just make tunnel from my machine direct to Pi!. Yeh!.

16Jan/13Off

Pi is alive

This is my first script which wrote on the raspberry Pi. The purpose is that I don't have HDMI monitor, so, what I needs is IP address which I can remote access though the secure shell. This simple script is so simple call by crontab every minutes and then revoke a destination URL to get the IP address which send from rPi itself. Actually there are many ways to get the IP address of rPi device which will tell later on.

So, below is a script to retrieve IP address from `ifconfig` linux command then save in a file. After that, it will revoke remote URL and pass an IP as query string.

ifconfig -a | grep inet |head -n1 > /home/pi/ipaddress.txt
IP=`cat /home/pi/ipaddress.txt`
curl --url "http://<remote_addr>/detect_ipaddress.php" -L -G --data-urlencode "$IP" > /dev/null
<?php

$h = fopen('ipaddress_of_pi_device.txt','w');
fwrite($h,'QUERY:' . urldecode($_SERVER['QUERY_STRING']) . "\n");
fwrite($h,'Remote Addr:' . $_SERVER['REMOTE_ADDR'] . "\n");
fwrite($h,'X:' . $_SERVER['HTTP_X_FORWARDED_FOR'] . "\n");
fwrite($h,'Client IP:' . $_SERVER['HTTP_CLIENT_IP'] . "\n");

fclose($h);

So, this script also simple. It got the query string and put into a file on a  server side which can access from anywhere. Right now, I can know the IP from REMOTE_ADDR and the internal IP address from QUERY_STRING.

What we can do for another way?

  • If you are in the same network area, you may detect the IP address from ARP command
  • If you use DHCP server and you have access to DHCP table, you may look into a Pi IP address from the table
  • Static IP address to your Pi Mac address

 

30Nov/12Off

Testing Email gateway with local mail server

This is the method to redirect all emails by doesn't care what is the recipient list of emails that it send to. It will send to local email account in local mail server only. The purpose is for testing anything that related to email gateway.

Software : hMailServer for Windows

  1. Create the local domain, domain.local
  2. Create user account, test@domain.local
  3. Create new Rules (in the root tree)
    1. Criteria: Delivery attempts Greater than 0
    2. Criteria: Recipient list not contains domail.local
    3. Action: Forward email to test@domain.local
    4. Action: Delete email
Some other link for solution
http://www.synet.sk/php/en/155-testing-php-mail-on-localhost-with-fake-smtp-server-hMailServer-and-outlook
Done.

 

Filed under: Uncategorized No Comments
18Oct/12Off

Slow response when Copy-Cut-Paste in the Eclipse

I have experience the slowness problem in the Eclipse 4.2.1 and some early version. The function by short-keys such CTRL+C, CTRL+V, CTRL+X take long time before release the response back to the User. For me, I take about 30-120 seconds before I can get back to the Eclipse. I haven't deep investigate on the issue but I think that there are some key event-hook in the Eclipse that take long respond which binding with the key CTRL+C.

So, what I done here are

* Unbind the command which binding with CTRL+C, CTRL+V, CTRL+X

You will still use the shortcut key to Copy-Cut and Paste as the basic as the Windows can do without use the function from the Eclipse.

Tagged as: No Comments
17Oct/12Off

Git Fetch and the Error Message from cat-file ‘Bad Object’

I have experienced the problem when use `git svn fetch`. There are the message throw out as below

user@WARUNLAPTOPPG /d/var/dd_dev (local/dd_dev)
$ git svn fetch
fatal: git cat-file bbecab29fb11d90e09dd53a59e13320a296bd632: bad file
cat-file commit bbecab29fb11d90e09dd53a59e13320a296bd632: command returned error: 128

There are missing object in the repository. Luckily I am, that there are git-svn clone in the other machine, and I use the same command `git cat-file commit bbecab29fb11d90e09dd53a59e13320a296bd632` and found the contents inside.

So, to solve this problem, I just copied the content of the working machine to the corrupted repository machine by use the following command

git cat-file commit bbecab29fb11d90e09dd53a59e13320a296bd632 > make_it_magic.txt

Then, copy the file to the machine which have the broken tree. Run the following command

cat make_it_magic.txt | git hash-object -w -t commit --stdin

And after that, pray to have problem resolved.

 

Tagged as: , No Comments