Monday, September 30, 2013

Western Digital External Harddisk: Spinning up Disk Not Responding

My external harddisk acting weird today. And yes my external harddisk is Western Digital.
Here is the full description of my device, right after the 4th attempt that finally worked.













At my 1st attempt this is the screenshot, dmesg shows me that the system trying to spin up
the disk, but failed! I attached the USB cable to one of my laptop 
(LENOVO Y450, Fedora 14 64bit, kernel is 2.6.35.14-106.fc14.x86_64) usb port.













This the 2nd and i attached the USB cable of my WD external hdd to another port.













Yet it failed. And this is the 3rd attempt, but it showed me that spin up timeout..
Humm.. that was something new.













And at last the 4th is the very first image, at the top, of this article. The system
finally spin up the disk.

Just a personall assumption that my WD Ext-hdd needs warmed-up, since 
it has been 3 months sit inside my drawer. 

Hope this helps..

Sunday, September 29, 2013

Microcontroller connect a Relay

Ohh.. Dear, look! I got an idea to automate my water tap valve.
I got this crazy goal in mind, just too lazy to pour water to
my many fruit-on-pot-plants. After did some research, **Ding**.

I now come up with an abstract sketch, a microcontroller (Atmega8)
a relay (HKE 12V, NC-NO, 230V 6A, 230V 10A) and 2 electric PVC
valves (SANKING, 3/4" - 3/4") would do, well if i am not too lazy,
the 2 valves could be minimized to just 1. But lets skip the
optimization, since it is an evil, so i bought these materials with
the diode and transistor refer to this.
Actually i already have this Atmega8 along with the USB Programmer

the K-125R.

Ok first-thing-first, i have to drive the relay... **BUMP**
The problem begins, i am a total newbie in electronic things.
And got this huge goal, never mind.. calm down.. internet is
a best friend.

Finally got this as my reference. Lets do it! i connect the coil
points on my breadboard. This is how i arrange it in minimum
configuration just to see, actually hear, the relay switching..



**Click** Yeah! As you could see in the video that the relay
still active even that i switch my DC power source down to 4.5V
and not below that. So i think the relay would still working
if the power source set to 9V as my atmega8 requires 9V to
operate (well the LM7805 step it down to 5V though)

*) Edited :
I know this is an old post. But to clarify that the Relay does not work
if i power it up with 4.5V of high-end power supply. In the video
my PSU was set to 4.5V but when i check it with my digital meter
it shows 8.1V, so this is PSU failure.

Well that is the relay part, will share the experience to
drive the electric valve in the next article.

Happy electrifying... ^^

Thursday, September 19, 2013

VIM: Project.vim and ctags

Strange i could not found my function definition...?
Ahh.. I see, the function declaration is in a file with *.inc
extention, PHP is what i am using and working with
frontaccounting (to be short, will called as FA) .
So i search my FA a .vimprj/ inside the working directory.
Aha! No .vimprj/ that is why no tags file created. So i create
the .vimprj/ on the root directory of FA, remember the
"/" trailing of .vimprj to remind you that its a directory.

So i type,
:Project
And new separated window created inside my GVim.
I hit my keyboard with \C (create new project) and
supplied 3 inputs, the root of my FA project directory,
the CD=. and the filters "*.php *.inc *.html *.php*".
After a few seconds the project tree created. Lets get
to work.

Bla bla bla, what! I hit my keyboard with g] which means
"go to declaration", in this case is the declaration of
a function that where my current cursor pointing at,
nothing happened. So tried to
:IndexerDebugLog
Nahh... the debug message throws something like
... C++-Kind=... Well its a PHP scope why c++ being
detected by my ctags? Ok, i realized that my .vimprj/
still has nothing inside so i add a file called mysettings.vim

And copy paste of my other PHP project mysettings.vim,

let g:indexer_disableCtagsWarning = 1

let g:indexer_ctagsCommandLineOptions = " --exclude='*.sql' --exclude='*.js'
--exclude='*.css' --PHP-kinds=+cf --fields=+iaS --extra=+q
--regex-PHP='/(abstract class |class ) ([^ ]*)/\\1/c/'
--regex-PHP='/interface ([^ ]*)/\\1/c/'
--regex-PHP='/(public |static |abstract |protected |private )+function.*([^ ()]*)/\\2/f/'
--regex-PHP='/define[(].([a-zA-Z0-9_]*)/\\1/f/' "

Save the file, done! I restarted GVim, and hit g] at my function name.
Arrghhh.. nothing happened, again??? And i hit
:IndexerDebugInfo
Still it showed me C++-kind, let me think.. After several googling
and "man ctags" i ended up with

let g:indexer_disableCtagsWarning = 1

let g:indexer_ctagsCommandLineOptions = " --langdef=PHP --langmap=PHP:.inc
--exclude='*.sql' --exclude='*.js' --exclude='*.css'
--PHP-kinds=+cf --fields=+iaS --extra=+q
--regex-PHP='/(abstract class |class ) ([^ ]*)/\\1/c/'
--regex-PHP='/interface ([^ ]*)/\\1/c/'
--regex-PHP='/(public |static |abstract |protected |private )+function.*([^ ()]*)/\\2/f/'
--regex-PHP='/define[(].([a-zA-Z0-9_]*)/\\1/f/' -h '.inc' "

I've added with langmap, langdef and -h option. Save and restart my
GVim, hurray.. it works my function declaration inside *.inc is now
there in the ~/.vimprojects_tag/frontaccounting. And if i g] it jumps
to the source file where function declaration is in.

Happy Vim-ing..