Motherboard BIOS not saving changes

June 22nd, 2010 alf No comments

If your motherboard’s BIOS is not saving changes and you’ve already changed the CR2032 battery, you might have an electric problem. Try changing the transistor near the battery holder, similar to the one shown in the image:

I’ve found in a forum that someone recommends completely eliminate the transistor and connect the positive side of the battery to one of the pins, but I didn’t tried it.

Categories: Hardware repairing Tags:

How to create two wired virtual serial ports on Linux?

February 19th, 2010 fvicente No comments

To create two bridged virtual serial ports use the following command:

socat -d -d pty,raw,echo=0 pty,raw,echo=0

The output will show you which are the virtual ports (or pseudo terminals) created, e.g.:

2010/02/19 16:16:33 socat[9662] N PTY is /dev/pts/3
2010/02/19 16:16:33 socat[9662] N PTY is /dev/pts/4
2010/02/19 16:16:33 socat[9662] N starting data transfer loop with FDs [3,3] and [5,5]

Note: if you are using Ubuntu and you do not have this command, try:

sudo apt-get install socat

Image source

How to calculate the space used by files in Linux?

February 19th, 2010 fvicente No comments

Suppose that you want to calculate the space used by all the png files in current directory and all its subdirectories. From a terminal type:

find . -name '*.png' -exec du -ab {} \; | awk '{total+=$0}END{print total}'

Image source

How do I compare two binary files on Linux?

February 19th, 2010 fvicente No comments

The easiest way I found is dumping the binaries into text files using hexdump and then comparing them with your favourite program (diff, Meld, etc.). E.g.:

hexdump -C a.bin >a.txt
hexdump -C b.bin >b.txt
diff a.txt b.txt

Image source

How do I add VNC to Terminal Server Client in Ubuntu?

February 19th, 2010 fvicente No comments

From a terminal type:

sudo apt-get install xtightvncviewer

Image source

Extracting FLV meta tags with Python

February 5th, 2010 fvicente No comments

I’ve stolen this code from http://code.activestate.com/recipes/457406/ which in turn was stolen / ported from http://inlet-media.de/flvtool2 , made some small fixes in bugs related to the date conversion function, object and array unmarshaling, file name hardcoded, etc… If you want to learn more about the FLV format and metatags read Acrobat’s Video File Format Specification Version 10
Read more…

Categories: Programming FAQ Tags: , , , ,

(HTML) Table cell not inheriting style

June 4th, 2009 fvicente No comments

The goal of this new blog category called “Programming FAQ” is to publish short posts with day to day programming problems and their solutions, or at least provide a tip to find the proper solution to your problem. And today we start with this simple and stupid problem that can happen to anyone with poor HTML experience like me. “My HTML table does not seems to inherit the style from a parent element”, here is the example:

<html>
<body>
<div style="color: blue;">
	<table>
	<tbody>
		<tr>
			<td>BLUE TEXT</td>
		</tr>
	</tbody>
	</table>
<div>
</body>
</html>

In the below example I would expect to see the “BLUE TEXT” in blue, but is not (at least in FireFox). So what the hell is wrong with my code? probably many things but because I’m not interested in following/reading the W3C recommendations for my uncle’s home page, here is one possible solution: Add the transitional DOCTYPE to your document, or the DOCTYPE that adequate better to your page (read more here). E.g.:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

So, now you know. Never forget the DOCTYPE it is very important… Why? read this… It has to do with poor standards, browsers and all that crap.

Categories: Programming FAQ Tags:

Simplified DES (S-DES) file encryption implementation in C

May 8th, 2009 fvicente No comments
Simplified DES

Simplified DES

This encryption algorithm is not secure at all, in fact it was made for educational purposes. It uses a 10-bit key that can be quickly broken by a brute force attack. But, who knows, it may be good for someone interested in some quick encryption where security is not that important, or for embedded devices were resources are limited, or just for lazy students. :D

Read more…

Cool JavaScript Tool Window

March 30th, 2009 fvicente No comments
Tool Window

Tool Window

This JavaScript class wraps a given HTML element into a movable and resizable floating tool window.  Required libraries: scriptaculous and prototype.js

How to use the code:

Download full source (including scriptaculous and prototype). The pieces of code developed by me are released under BSD license, please verify third party libraries licenses before using them.

See the DEMO PAGE!

enjoy it!

File Upload Progress with mod_python

March 28th, 2009 fvicente 1 comment
Upload Progress with mod_python

Upload Progress with mod_python

Now that Gmail has added a progress bar for attachment uploads, everybody wants to do the same including myself :)
So, with the same method that everybody uses consisting in an upload form with a hidden <iframe> as target, and then a periodic Ajax request to update the progress, I made a simple implementation using mod_python on the server side… This is a veeery simple example, like everything that you do with Python.
Additionally I’ve added an upload size limit control based in examples that can be found in the mod_python forum site. Use the source Luke!

See LIVE DEMO!

Read more…