I'm running Vista x64 SP2 and Windows Media Player 11. I have an NVIDIA GeForce 8600 graphics card. I also make sure that the "Allow screen saver during playback" is unchecked in WMP -> Tools -> Options. After 20 minutes my screen saver kicks in.
Anyhow I've solved the problem with the screen saver. I like to keep my system as updated as possible, so I install NVIDIA's drivers directly from their website. Yesterday I removed NVIDIA's drivers, and I let Windows install it's own drivers for the graphics card. Of course Microsoft is just packaging a form of NVIDIA's drivers, but now my screen saver stays disabled when I play a movie.
Thursday, February 18, 2010
Saturday, February 6, 2010
Interesting HW interview question... Serial binary input divisible by 5
I'm in California at the third round of interviews and I'm asked a question that baffled me. Given a serial input of a binary number, write a state machine that tells if that value is divisible by 5.
I first solved the problem thinking the input was MSB first. This is pretty trivial. 5 states and some very simple movements. Then it was clarified that they wanted it solved LSB first. I thought about it but I could not come up with a solution.
It is now the next day and I approached the problem again. I have a good and clear solution, but I'd love to know if there is a better one.
WARNING - Solution below:
A single bit, in any location, when converted to decimal will always end in either 2, 4, 8, or 6 except of course the least significant bit which is 1.
1, 2, 4, 8, 16, 32, 64, 128, 256...
1, 2, 4, 8, 6, 2, 4, 8, 6...
A divide by 5 problem at any given time can be in one of five situations. It's either 0, 1, 2, 3, or 4 from being divisible by 5. Ie: it is 0 and is divisible, or 1 and needs another 4, or 2 and needs another 3...
By combining both of these ideas you can build a state machine with 20 states that easily solves this problem. It's like 5 small 4-stated machines. The 4-stated machine keeps moving between 2, 4, 8, and 6 when there's a 0 input, and moves to one of the other machines when there is a 1. Of course you need an extra start state to deal with the first bit. And anytime you are in the 0 4-stated machine then the value is divisible.
Best way to explain is by example:
current value, add value (c, a) where c goes from 0 to 4 and a is 2, 4, 8, or 6.
Starting in first bit state:
Value that will be given is 25 (11001).
1: First bit state moves to (1, 2) since current value is 1 and next bit will add 2.
0: (1, 2) moves to (1, 4) since current value is still 1 and next bit will add 4.
0: (1, 4) moves to (1, 8) since current value is still 1 and next bit will add 8.
1: (1, 8) moves to (4, 6) since current value is now 4 (9 divided by 5 leaves a remainder of 4) and next bit will add 6.
1: (4, 6) moves to (0, 2) since current value is now 0 (10 divided by 5 leaves a remainder of 0) and next bit will add 2.
That's it.
I first solved the problem thinking the input was MSB first. This is pretty trivial. 5 states and some very simple movements. Then it was clarified that they wanted it solved LSB first. I thought about it but I could not come up with a solution.
It is now the next day and I approached the problem again. I have a good and clear solution, but I'd love to know if there is a better one.
WARNING - Solution below:
A single bit, in any location, when converted to decimal will always end in either 2, 4, 8, or 6 except of course the least significant bit which is 1.
1, 2, 4, 8, 16, 32, 64, 128, 256...
1, 2, 4, 8, 6, 2, 4, 8, 6...
A divide by 5 problem at any given time can be in one of five situations. It's either 0, 1, 2, 3, or 4 from being divisible by 5. Ie: it is 0 and is divisible, or 1 and needs another 4, or 2 and needs another 3...
By combining both of these ideas you can build a state machine with 20 states that easily solves this problem. It's like 5 small 4-stated machines. The 4-stated machine keeps moving between 2, 4, 8, and 6 when there's a 0 input, and moves to one of the other machines when there is a 1. Of course you need an extra start state to deal with the first bit. And anytime you are in the 0 4-stated machine then the value is divisible.
Best way to explain is by example:
current value, add value (c, a) where c goes from 0 to 4 and a is 2, 4, 8, or 6.
Starting in first bit state:
Value that will be given is 25 (11001).
1: First bit state moves to (1, 2) since current value is 1 and next bit will add 2.
0: (1, 2) moves to (1, 4) since current value is still 1 and next bit will add 4.
0: (1, 4) moves to (1, 8) since current value is still 1 and next bit will add 8.
1: (1, 8) moves to (4, 6) since current value is now 4 (9 divided by 5 leaves a remainder of 4) and next bit will add 6.
1: (4, 6) moves to (0, 2) since current value is now 0 (10 divided by 5 leaves a remainder of 0) and next bit will add 2.
That's it.
Tuesday, January 12, 2010
Spice circuit simulator - part 2
I did it! I made a circuit and I got it to run. I have returned back to Berkeley's 3f5 spice. Using cspice I can input the file circuit.txt:
My first circuit
.op
vcc high 0 dc 10
r1 high bw 3
r2 bw 0 4
.end
This is a very simple circuit with 10v going to a 3 ohm resistor and then a 4 ohm resistor and then back to ground. 10v -- 4ohm -- 3ohm -- gnd
I run this simulation with this command on Windows: cspice.exe < circuit.txt
This results in actual output! Much of this I learned from Berkeley's documentation at http://bwrc.eecs.berkeley.edu/classes/IcBook/SPICE/ under Interactive User Guide. I also referenced Kevin Cosgrove's article 'Analyzing Circuits with SPICE on Linux' at http://www.linuxjournal.com/article/2169.
I am not anywhere near the point of running spice to do transient analyses. I only want very simplistic static results of basic digital circuits. This is what I now feel confident that I can do.
My first circuit
.op
vcc high 0 dc 10
r1 high bw 3
r2 bw 0 4
.end
This is a very simple circuit with 10v going to a 3 ohm resistor and then a 4 ohm resistor and then back to ground. 10v -- 4ohm -- 3ohm -- gnd
I run this simulation with this command on Windows: cspice.exe < circuit.txt
This results in actual output! Much of this I learned from Berkeley's documentation at http://bwrc.eecs.berkeley.edu/classes/IcBook/SPICE/ under Interactive User Guide. I also referenced Kevin Cosgrove's article 'Analyzing Circuits with SPICE on Linux' at http://www.linuxjournal.com/article/2169.
I am not anywhere near the point of running spice to do transient analyses. I only want very simplistic static results of basic digital circuits. This is what I now feel confident that I can do.
Monday, January 11, 2010
Spice circuit simulator
I'm learning electrical engineering... Pretty tough to understand this stuff, but www.allaboutcircuits.com really helps. Another tool I'm trying to use is a spice simulator. This way I can write tiny circuits and see if I understand what they're supposed to do, and spice can verify that.
Anyhow, I started searching for spice, and that was a bit of a challenge just because of it's name... Google doesn't bring you to what you're looking for directly, so here's a good starting point: http://bwrc.eecs.berkeley.edu/Classes/IcBook/SPICE/ - Homepage
http://bwrc.eecs.berkeley.edu/Classes/IcBook/tools.html - List of available spice simulators
OK. So which one to download. I like to work as manually as possible to increase my understanding as much as possible, so this meant I wanted a tool that was as much like the UNIX version (I'm on Windows) as possible. I also want a text based tool for now. This led me to download Berkeley's spice3f5.tar.gz, and to figure out how to compile this with Visual C++ 2008. A good starting point is http://rayslogic.com/Spice/compile_berkeley_spice_3f5.htm. I did some things differently from what he listed, but I believe his directions will work too. A tip would be to use GnuWin32's find, xargs, and sed tools to perform the necessary changes to the files. Also when following the /OUT: directions you have to add that line to only the files he listed, otherwise the lib files won't get added correctly. I chose a more generic method of modifying the batch files with something like this in the relevant msc51.bat files:
set LIBPARAM=
set LIBNAME=..\..\dev1.lib
if not exist %LIBNAME% set LIBPARAM=/OUT:
lib %LIBPARAM%%LIBNAME% @response.lib >> ..\..\..\msc.out
... After getting it to compile I realize that it doesn't create spice3.exe, and only really creates bspice.exe and cspice.exe. I don't currently know much about spice so I don't really know what those files do for you, but from what I can see they aren't what I was looking for.
At this point I started looking for another alternative. I found ngspice: http://ngspice.sourceforge.net/download.html. The download page is http://sourceforge.net/projects/ngspice/files/. I know it says that they only release sources, but that's not true, download the zip file and you'll see it has Windows binaries. I'm guessing that they never bothered to update that information.
Last thing... Seems that spice uses something referred to as decks (input decks). Trouble is no one bothers to tell you what that is. I am once again positing that this term comes from very old systems that accepted commands on actual cards. Each command was put on a card and the cards were fed into a machine. The combined cards were referred to as decks. I found a reference to cards and decks here: http://www.eecg.toronto.edu/~johns/spice/part1.html. So an input deck seems to just be a set of input commands.
Will update as I learn more. At this point I'm still just a fish flapping around on dry land with regards to spice.
Anyhow, I started searching for spice, and that was a bit of a challenge just because of it's name... Google doesn't bring you to what you're looking for directly, so here's a good starting point: http://bwrc.eecs.berkeley.edu/Classes/IcBook/SPICE/ - Homepage
http://bwrc.eecs.berkeley.edu/Classes/IcBook/tools.html - List of available spice simulators
OK. So which one to download. I like to work as manually as possible to increase my understanding as much as possible, so this meant I wanted a tool that was as much like the UNIX version (I'm on Windows) as possible. I also want a text based tool for now. This led me to download Berkeley's spice3f5.tar.gz, and to figure out how to compile this with Visual C++ 2008. A good starting point is http://rayslogic.com/Spice/compile_berkeley_spice_3f5.htm. I did some things differently from what he listed, but I believe his directions will work too. A tip would be to use GnuWin32's find, xargs, and sed tools to perform the necessary changes to the files. Also when following the /OUT: directions you have to add that line to only the files he listed, otherwise the lib files won't get added correctly. I chose a more generic method of modifying the batch files with something like this in the relevant msc51.bat files:
set LIBPARAM=
set LIBNAME=..\..\dev1.lib
if not exist %LIBNAME% set LIBPARAM=/OUT:
lib %LIBPARAM%%LIBNAME% @response.lib >> ..\..\..\msc.out
... After getting it to compile I realize that it doesn't create spice3.exe, and only really creates bspice.exe and cspice.exe. I don't currently know much about spice so I don't really know what those files do for you, but from what I can see they aren't what I was looking for.
At this point I started looking for another alternative. I found ngspice: http://ngspice.sourceforge.net/download.html. The download page is http://sourceforge.net/projects/ngspice/files/. I know it says that they only release sources, but that's not true, download the zip file and you'll see it has Windows binaries. I'm guessing that they never bothered to update that information.
Last thing... Seems that spice uses something referred to as decks (input decks). Trouble is no one bothers to tell you what that is. I am once again positing that this term comes from very old systems that accepted commands on actual cards. Each command was put on a card and the cards were fed into a machine. The combined cards were referred to as decks. I found a reference to cards and decks here: http://www.eecg.toronto.edu/~johns/spice/part1.html. So an input deck seems to just be a set of input commands.
Will update as I learn more. At this point I'm still just a fish flapping around on dry land with regards to spice.
Sunday, December 27, 2009
Secure Your Password - Chrome extension
https://secureyourpassword.com
http://code.google.com/p/secureyourpassword/
Passwords are notoriously insecure. Secure Your Password changes that.
How your password is exposed
1. Logging into a non-secure website from a public WiFi network
2. All website which you log into have access to your password
3. 3rd party password security sites keep your password
What Secure Your Password does for you.
1. Never stores or receives your password, your password never leaves your computer
2. Creates a salt (random word) which obfuscates your password on a website by website basis
3. Stores the salt on a secure (https) server, and retrieves that salt whenever you want to access the website
4. Does all of this transparently after the initial creation of the password
http://code.google.com/p/secureyourpassword/
Passwords are notoriously insecure. Secure Your Password changes that.
How your password is exposed
1. Logging into a non-secure website from a public WiFi network
2. All website which you log into have access to your password
3. 3rd party password security sites keep your password
What Secure Your Password does for you.
1. Never stores or receives your password, your password never leaves your computer
2. Creates a salt (random word) which obfuscates your password on a website by website basis
3. Stores the salt on a secure (https) server, and retrieves that salt whenever you want to access the website
4. Does all of this transparently after the initial creation of the password
Sunday, December 20, 2009
libpst and readpst... the hacked way on vista / xp - fixed
So have you ever backed up your PSTs and then needed a good way to look at them. Well I have. I backed up my PSTs, and without Outlook I was a bit stuck. After checking around I found that the only free option is libpst. libpst has an executable called readpst which can open up the folders and parse your files. Problem is that libpst is written for Linux. Nobody packages a Windows friendly readpst.
I looked around to see what should work, and I didn't want to pollute my newly installed Vista with all sorts of stuff. Here are the steps I took to make readpst compile without too many installations:
libpst:
libpst-0.6.45.tar.gz
MinGW:
Install MinGW (MinGW-5.1.6.exe), choose GCC only.
GnuWin32 tools:
Install GNU Regex for Win32 (regex-2.7-setup.exe).
Install GNU ICONV for Win32 (libiconv-1.9.2-1.exe).
Now you can compile readpst, here's the command:
From the libpst src directory run:
"c:\MinGW\bin\mingw32-gcc.exe" -DHAVE_REGEX_H -I"c:\Program Files (x86)\GnuWin32\include" -include "C:\MinGW\include\inttypes.h" -DVERSION=\"0.6.45\" -include "C:\MinGW\include\errno.h" -include "C:\MinGW\include\sys\stat.h" -include "C:\MinGW\include\limits.h" -DHAVE_ICONV -DICONV_CONST=const -L"c:\Program Files (x86)\GnuWin32\lib" debug.c libpst.c vbuf.c -liconv libstrfunc.c timeconv.c lzfu.c readpst.c -lregex -o readpst.exe
Modify your path to include 'C:\Program Files (x86)\GnuWin32\bin\;'. This is how the required DLLs will be found. Thank you to everyone who pointed out that it was missing libiconv2.dll. Since I use the GnuWin32 tools all the time I naturally had this set in my path before I had ever heard of libpst.
If you are running on a 32 bit OS then you will have to change the 'Program Files (x86)' to 'Program Files', or if you install 64 bit versions you'll have to change stuff around, and so on and so on.
If anyone has some good pointers on an easier way to compile readpst I'd love to hear it, and no I'm not interested in a full MSYS or cygwin install!
Link to readpst x32 : https://www.dropbox.com/s/gfeyp1tn5yuv7rk/readpst.exe?dl=0
I looked around to see what should work, and I didn't want to pollute my newly installed Vista with all sorts of stuff. Here are the steps I took to make readpst compile without too many installations:
libpst:
libpst-0.6.45.tar.gz
MinGW:
Install MinGW (MinGW-5.1.6.exe), choose GCC only.
GnuWin32 tools:
Install GNU Regex for Win32 (regex-2.7-setup.exe).
Install GNU ICONV for Win32 (libiconv-1.9.2-1.exe).
Now you can compile readpst, here's the command:
From the libpst src directory run:
"c:\MinGW\bin\mingw32-gcc.exe" -DHAVE_REGEX_H -I"c:\Program Files (x86)\GnuWin32\include" -include "C:\MinGW\include\inttypes.h" -DVERSION=\"0.6.45\" -include "C:\MinGW\include\errno.h" -include "C:\MinGW\include\sys\stat.h" -include "C:\MinGW\include\limits.h" -DHAVE_ICONV -DICONV_CONST=const -L"c:\Program Files (x86)\GnuWin32\lib" debug.c libpst.c vbuf.c -liconv libstrfunc.c timeconv.c lzfu.c readpst.c -lregex -o readpst.exe
Modify your path to include 'C:\Program Files (x86)\GnuWin32\bin\;'. This is how the required DLLs will be found. Thank you to everyone who pointed out that it was missing libiconv2.dll. Since I use the GnuWin32 tools all the time I naturally had this set in my path before I had ever heard of libpst.
If you are running on a 32 bit OS then you will have to change the 'Program Files (x86)' to 'Program Files', or if you install 64 bit versions you'll have to change stuff around, and so on and so on.
If anyone has some good pointers on an easier way to compile readpst I'd love to hear it, and no I'm not interested in a full MSYS or cygwin install!
Link to readpst x32 : https://www.dropbox.com/s/gfeyp1tn5yuv7rk/readpst.exe?dl=0
Saturday, December 19, 2009
Registry editing - powerful and very dangerous - made easier
I started playing around in the Windows Registry on Windows 98 and it was a time when registry editing was much easier. Sure it didn't have the robustness of an XP or Vista registry, but there also wasn't all the hassle of permissions everywhere. With the onset of this permission madness the steps it takes to delete a key can be daunting. Take ownership, replace permissions, take ownership and replace permissions of newly appearing subfolders one by one... It's a pain. The solution:
Registrar Registry Manager! http://www.resplendence.com/, there is a lite version that can be downloaded for free.
Permissions don't matter anymore! This way you can still edit the registry as if you're the administrator of the system, and I mean real administrator (like root), not just wimpy Windows cut-down version of the administrator.
Enjoy,
Registrar Registry Manager! http://www.resplendence.com/, there is a lite version that can be downloaded for free.
Permissions don't matter anymore! This way you can still edit the registry as if you're the administrator of the system, and I mean real administrator (like root), not just wimpy Windows cut-down version of the administrator.
Enjoy,
Subscribe to:
Posts (Atom)