April 8, 2009Tags: Funny
It seems like over 61% of Americans feel like this country is headed in the wrong direction, but at the same time, 60% approve of Obama’s performance.
I realize that Obama isn’t the only one running this country, but it appears to me that he has the most influence on what’s happening right now and what will happen in the future. I don’t believe the majority of people spend too much time thinking…
April 2, 2009Tags: bode, matlab, systems
This is mostly for my own reference, but I hope someone else will benefit from it. It’s mainly to play with transfer functions.
First, generate the transfer function:
% numerator coefficients for s^2 + 2s + 4
num = [1 2 4]
% denominator coefficients for s + 6
den = [ 1 6 ]
% build the transfer function
H = tf(num, den)
% now we can do fun stuff like get a bode plot
bode(H)
% or plot it over a range of frequencies, 100 to 200 radians/s
bode(H,{100,200})
% or we could get the gain and phase shift for a certain frequency, 4pi here
[gain, phase] = bode(H, 4pi)
% how about zeroes and poles? Okay...
tzero(H)
poles(H)To add some more stuff, the transfer function can also be generated when you have the factored form of it to begin with:
% if the denominator looks like (s-1)(s-2)(s-3)
poles = [1 2 3]
% same for zeros: (s+1)(s+2)(s+3)
zeros = [-1 -2 -3]
% and finally, gain K
k = 1
% now we can get the system like so:
H = zpk(zeros, poles, k)
I may add more at a later point. Not too fancy stuff here, but pretty helpful to what I needed done.
March 21, 2009Tags: dtrace, entropy, leopard, osx, php
Similar to Xdebug, DTrace also didn’t want to work and failed with the same error, so I tried the same trick, and it worked.
Follow the instructions from Lee Packham’s blog but configure it as a 64-bit application:
- tar xzf dtrace-1.0.3fixtar.gz
- cd dtrace-1.0.3+fix
- phpize
- CFLAGS=’-arch x86_64′ ./configure –with-dtrace
- make
- make install
So far so good, the module is loaded. Now let’s see if Instruments will do its thing.
Tags: entropy, leopard, osx, php, xdebug
Since I have been struggling with this for forever and finally found an answer, here’s an attempt to spread the wealth knowledge around.
Blog: Compiling & installing Xdebug for PHP 5.2.5 (Entropy.ch build) on OS X 10.5
Just to give the web crawlers some more info, the error message was:
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so’ – (null) in Unknown on line 0
The solution is to compile it manually as a 64-bit application like so:
CFLAGS=’-arch x86_64′ ./configure –enable-xdebug
Hope this helps someone out there.
March 14, 2009Per Wesley J. Smith’s blog Secondhand Smoke comes this story about adult stem cells being successfully used to treat spinal cord injuries. No one seems to care that these uncontroversial treatments are showing a lot of promise already, and everyone flocks around Obama as he “restores science to its rightful place” by continuing to fund controversial embryonic stem cell research and also cutting funding for adult stem cell research. You won’t find this last one widely reported either. It’s about time the mainstream media lost their influence.
March 11, 2009Tags: bush, deficit, obama, rove
Yeah I’m on a financial roll. This is interesting though. Karl Rove in the WSJ:
Mr. Obama cannot dismiss critics by pointing to President George W. Bush’s decision to run $2.9 trillion in deficits while fighting two wars and dealing with 9/11 and Katrina. Mr. Obama will surpass Mr. Bush’s eight-year total in his first 20 months and 11 days in office, adding $3.2 trillion to the national debt. If America “cannot and will not sustain” deficits like Mr. Bush’s, as Mr. Obama said during the campaign, how can Mr. Obama sustain the geometrically larger ones he’s flogging?
Interesting article here on truthout.org. Wonder if I should really go into that line of work….
February 24, 2009Tags: sowell
Another good article by Thomas Sowell on where this country is headed. Among other things, he says that our pension plans dwindling and our house values crashing isn’t quite so bad when compared with former hardships of Americans.
February 5, 2009Tags: circuits, electronics, IR, op amps
First of all the video. Music by lostprophets. That’s what I was listening to at the time and thought I’d leave it to make it more interesting.
Schematics and explanation below.
Schematics (click to enlarge):

The IR LED acts just like any other LED. It’s rated for 100mA continuous current, but to play it safe I only provide about 80mA at approximately 6V. The IR photo transistor acts like a simple transistor with the base current being determined by the IR receiver part. This way, when no IR light is detected, the transistor is in shutoff mode, i.e. it acts like an open, so no current flows and the voltage at node A = Vcc. As more IR light is detected, the transistor changes to active and then saturation mode, eventually acting like a short, which makes the voltage at node A = 0V. So the voltage range, depending on the amount of IR detected, is 6V – 0V. The voltage change is just about linear.
The output voltage is then fed into four op amps that act as comparators. That means the voltage on the positive and negative pins is compared. When the voltage on the + side is larger than on the – side, the output bounces to the positive rail, Vcc. Otherwise it bounces to the negative rail, in this case 0V or ground. The + voltage is regulated using one potentiometer per comparator.They act like a simple voltage divider, so I can adjust the threshold to a value between 6V and 0V, the same range I get from the photo transistor. The outputs of the op amps are connected to one LED each.
Using the pots, I adjusted the threshold such that no LEDs are on when no IR is detected, and all are on when IR is maxed out. That means LED 1 will come on when the voltage is lower than about 4.5 V, LED 2 when the voltage is lower than 3V – the midpoint -, LED3 at anything lower than 1.5 V, and LED 4 at just little over 0 V.
Overall a fun project that wasn’t too difficult to do, but fun to get my hands wet with.