Posts

Showing posts from 2013

Power Save with Atmega16A and Atmega8-PU

Image
In my very first beginning of my electronic project and study (autodidact) was so enthusiast with my Atmega8-PU (the -PU means than could run with 16Mhz crystal). Playing with timer0/1/2 was very fun. And there was a time that i came to power-save-mode, interesting part began. In the power-save-mode there are several ways to wake up the chip (Atmega8): 1. External Interrupts (INT0/INT1) 2. TWI Address Match (I2C peripheral) 3. Timer2 (which has to be run in Async Mode) I choose to use the Timer2 to trigger the wake-up. There is a cost to play with, since i have set the fuses wrongly. The fuses were set to run in low frequency crystal, 32Khz. And right after the setting applied, the chip is no longer be able to be programmed. So how i can achieve to use the 32Khz crystal as my input in TOSC1 and TOSC2? The datasheet shows that it is possible to run the 32KHz crystal at TOSC1 and TOSC2 pins with workaround adding 2 caps of 22pF. The timer2 prescaler set to /128 so a sec

Linux Fedora 19 NVidia Brightness setting

NVidia in Fedora 14 is unable to bet set via GNOME desktop. The workaround was # echo 5 > / sys / class / backlight / acpi_video0 / brightness And to retained the setting, simply add the command line in the /etc/rc.local Now I am in Fedora 19 64bit with kernel updated and NVidia installed. The boot parameter already set  to acpi_mode=vendor . Attempting the same workaround but The result is not like the expected. Right after the # echo 5 > ... The brightness stays at 10, nothing happen. Accidentally suspend (standby) my laptop session and resume runs the new brightness setting. So the conclusion is that the brightness setting will take effect if you somehow shutdown the display and turn it back on. The way that I know is to pm-suspend or going to standby mode. Hope it helps.

Linux STM32F4-DISCOVERY STLINK-V2 not detected

Image
Just got my STM32F4-DISCOVERY from ebay.com , was having hard time to work with. Since i've plugged the USB mini cable to the board and my laptop. I've managed the CN3 jumpers are ON. The LED LD1 or the COM led was blinking the shinny yellow light. Curious... ahah! Just found that my USB mini cable is not a data cable but a power cable that bundled with my portable USB Powerbank.

Linux openOCD build failed 'missing makeinfo texi' of stellaris launchpad, stm32FX discovery

Stuck while building the openOCD? And it stops with error building the docs?? Ouchh... luckily got this . Just set --enable-maintainer-mode in the configure, also as my addition is to install the texinfo ( I am using Fedora 19 64bit), actually got the tip somewhere i forgot. Before: ./configure --prefix=/usr --enable-maintainer-mode --enable-stlink --enable-ti-icdi and it ends up with error building the docs of openOCD After: ./configure --prefix=/usr --enable-maintainer-mode --enable-stlink --enable-ti-icdi --enable-maintainer-mode It works! And now to get the lm4flash to work, first you need to use the usb port next to the switch with device -- debug label then switch it to debug mode. Test the sudo lm4flash blinky.bin. It works like charm! Happy electrifying..

Linux Fedora 19 Nautilus shoot CPU 100%

My laptop's fan keep spinning in high rpm . Curious, i open up the system monitor, Nautilus process is using the CPU to 100% . And i google found this , $ killall nautilus apparently it is a  known issued. Well this is a short article hope it helps.

Linux Fedora 19 Oracle XE 11g Uninstall failed

I just upgrade my fedora 14 to Fedora 19 . Done with some rsync and moving stuffs. And here come the new Oracle XE 11 g installation process, finished and run smooth. Heh?! So what was the problem? The problem is i've messed up with these  impdp system/ system_password full=Y directory=DUMP_DIR dumpfile=DB10G.dmp logfile=expdpDB10G1.log impdp system/ system_password directory=DUMP_DIR TABLE_EXISTS_ACTION=APPEND TABLES=FLOWS_FILES.WWV_FLOW_FILE_OBJECTS$ dumpfile=DB10G2.dmp logfile=expdpDB10G1b.log Which i followed from here which guide me to migrating the whole data of my Oracle XE 10g. The full expdp of XE 10g did not include the whole users tablespace, forgive me i am not that familiar with this thing, so to copy or just create new tablespace or something were not taken or even tested. Since i've frustated Ctrl-C the import process and ended up with broken database. The Oracle refused to start! Ok calm down   lets just uninstall, i did the sudo yum rem

Western Digital External Harddisk: Spinning up Disk Not Responding

Image
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..

Microcontroller connect a Relay

Image
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 configur

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 :In

Flask-SQLAlchemy, Mysql, Error #1005: Can't create table (errno: 105)?

Got Error #1005: Can't create table (errno: 105)? I got the error when the Flask-SQLAlchemy tries to init_db() of my models.py. Well here is the solution you could check. That you have to do is to create index  for the reference ForeignKey column. Hope It helps

MySQL, InnoDB: Operating system error number 13 in a file operation

Yeahh, it took me about an hour to two to figure it out. I am using LAMPP 1.7 (old yes but i just personally decided to use it) in Fedora14 64bit.   The steps were: 1. Check the error in your /opt/lampp/var/mysql/ .err     ** it is assumed that you copy the extracted xampp-linux-xxx.tar.gz in          your /opt 2. What got from #1 130730 13:12:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 130730 13:12:59  InnoDB: Operating system error number 13 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. InnoDB: File name /opt/lampp/var/mysql/ibdata1 InnoDB: File operation call: 'open'. InnoDB: Cannot continue operation. 3. And then i just chmod 777 -Rf /opt/lampp/var/mysql 4. Problem solved and hopefully not to add a new one :) Hope it helps.

How gVim saved my day

Hi, in this article i personally record how gVim come very handy to help me to filter out a CSV file. Steps: # to get rid the header 1.  :g/^Sa...ka,,,,*/d 2.  :g/^"General Ledger Detail",,,,*/d 3.  :g/^"From 01 Jan .*",,,,*/d 4.  :g/^"ACC.* Report",,,,*/d 4.  :g/^"Printed.*",,,,*/d 5.  :g/^"Page.*",,,*/d 6.  :g/^,,,*/d To use :g/regexRules/d <-- and="" d="" delete="" find="" is="" p="" to=""> Hope it helps.

Oracle Split String or Query Result

Hi, just found this Oracle split string . It saves me alot. Since the first thing came into my head is like: 1. Query and fetch result. 2. Explode or split the result (i use PHP). 3. Perform array search. Those are computational expensive due to large records. Hope it helps.

Codeigniter 2 Template Render Doubling

I've been using This Template  in my CI 2 app heavily. And suddenly something happens very awkward today. Everything seems rendered twice. I've tried to var_dump in the Template.php line 549, it returned me: array '_scripts' => boolean false '_styles' => boolean false 'header' => boolean false 'content' => boolean false   'footer' => string ' ' (length=1) array '_scripts' => boolean false '_styles' => boolean false 'header' => boolean false 'content' => boolean false   'footer' => string ' ' (length=1) Then i add debug_backtrace(), a very handy func, right before the var_dump. I was shocked since render() func was called in one of my model, was accidentally pasted. Hope it helps

Flask SQLAlchemy FormAlchemy

Finally ericflo has done a great work, as the integration reference, and hosted it at github. I've spent almost 2-3 hours to search how Flask request.form data to be sent into formAlchemy. Make sure you want to visit his great work, 72 lines of a reference won't hurt you :P Hope it helps

Codeigniter 2.1.2 Disallowed Key Characters

Following up this thread well it just happened that my ci 2 application won't load up and only showed me "Disallowed Key Characters" on screen. Arrghhhh... hate to say this but the only way i got this fixed is to modify the core! Go to your %system/core/Input.php and find "if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))". Modify it to "if ( ! preg_match("/^[a-z0-9:_\/-\|]+$/i", $str))". It stops showing me the disallowed key error. Anyway right before i touched the core, had tried to add the "|" char in to %application/config/config.php. But nothing seems to be happened and error screen still showing. Hope it helps.

Flask-Blog

Just found this cool project in Github . It uses python-markdown which something i've be doing recently. Well rather than reinventing-the-wheel now i've forked the project and completing the project. Why Markdown ? Well you should take a look at it.

To Use Document.ly

Well i hate to write this down but finally i found a tool that i could write something in markdown . I've started similar project of my own to create a blog using Flask and has markdown embedded editor or its Github . I found document.ly from Hackers Newsletter many thanks to Kale Davis of his great work to keep me and others up-to-date. Hope it helps.

Annoying Blackberry with "JVM 102 error"

Spending 4 hours just to troubleshoot "JVM 102 Error" really time wasting and dumb. For almost a year an app, twitter, sitting in my bb 8900. Never had issue until this morning. Frequently my device got "white-screen" and have to release the battery as the "hard-reset". Everything went well before not this morning. The screen showed me "JVM 102 error" and a reset button. Let me think... uhmmm maybe it's just another "bb" things. Alright just take off the battery and put back everything will be fine. Argh!! 2 times of reset and took me almost 15 minutes to get the screen with "JVM 102 error" and a reset button again! What on earth is happening?? Ok calm down just do the "hard-reset" after bed-rest my device for about 10 minutes. Maybe it's just overheat things well that was in my head. Untill the "JVM 102 error" shows up again. Spending hours to search on the web and do the JL_Cmder

Static HTML files in GAE

I've just finished one of my project' reStructuredText documentation. Got it build in HTML and ready to deploy in GAE. With a little searching on the web found static HTML files how to in GAE , saved my day. Hope it helps.. Uhmmm why getting shorter in my article? Just trying to write everything up. All these things are like blazing cloud in my head and have to got them all out in the blog :D. So let the blog memorize and share them.

Python cx_Oracle not working in Cronjob

cx_Oracle error in Cronjob execution. I've found that adding environment variables in the crontab works like charm. Steps to check if the cx_Oracle work: test_cx_oracle.py try: import cx_Oracle print 'cx_Oracle works' except: print 'cx_Oracle error' In your crontab add,  * * * * * python /path/to/test_cx_oracle.py. Notice that the cron will execute every minute. You will received error notification in your email $ tail /var/spool/mail/oracle Edit your cron: ORACLE_HOME = '/path/to/db_1' LD_LIBRARY_PATH = '/path/to/db_1/lib:/lib:/usr/lib' * * * * * python /path/to/test_cx_oracle.py Save and exit, wait for cron to fire then check your mail again. You should received 'cx_Oracle works' notification. Hope it helps.

Installing OpenERP 7

Hello OpenERP 7, well i had downloaded a week ago and just got time to install it. I had installed OpenERP since version 5 and then 6. I had them installed in a virtualenv. They are almost have typical `problems`. And those are: 1. psycopg , usually because of the pg_config     not found, default is in /etc/pg_config, in my case was     in /opt/PostgreSQL/8.4/bin/pg_config 2. PyChart, well just google and you will find it in     sourceforge. Download it then :     $ python setup.py build ; python setup.py install 3. pyparsing, occured in version 7, where current version     is 2.0, as this article created, which only works with     python 3. You will need to install it manually     $ pip install pyparsing==1.5.7 Hope it helps. Happy OpenERP 7.