Skip navigation

Monthly Archives: July 2008

fantastic article on good programmers

loven it.

what a splendid title

i’m reading it now

as i read, i’ll maintain a collection of quotations i like:

  • like a compass needle that points north, a man’s accusing finger always finds a woman
  • what’s the sense schooling a girl like you? it’s like shining a spittoon

	ob_start();	# use the output buffer

	echo('hello there! i am data echod into the output buffer');

	$data = ob_get_contents();
	# variable $data now contains the string 'hello there! i am data echod into the output buffer'
	ob_end_clean(); # basically just turn off output buffering and clean it out

# alternatively, use ob_get_clean() to get buffer contents and clean it immediately afterward with a single function call!


You CAN!!

expensive solution that must be licensed

pdflib is a proprietary, expensive, well maintained and fabulous library for creating pdf documents from your php scripts. Download for free eval @, but must pay $1000 or so to remove the annoying watermark.

FREE! solution for generating pdf pages from your php scripts

SO, if you’re part of a commercial organization and need to generate pdfs from your php but don’t want to pay the licensing fee, you can use the PECL version for FREE.

Steps to use it:

  1. get php 5.2.5
  2. get the windows binaries for pecl for php 5.2.5
  3. extract that pecl archive somewhere
  4. copy php_pdf.dll TO phpdir/ext/
  5. open php.ini and make sure extension_dir param is set correctly
  6. add a line:


    to php.ini where the rest of the extension= declarations are.

  7. consult the docs and let the confusion begin
  8. WARNING: It tends to be a bit finicky, and there’s deprecated stuff ALL OVER this library (many, many potholes to fall into).


    class PDF
    	var $pdf;
    	var $sysfontdir = "C:/windows/fonts";
    	function __construct()
    		$this->pdf = pdf_new();
    		if (!pdf_open_file($this->pdf, ""))
    		   exit('pdf generation failed');
    	function createSamplePDF()
    		PDF_begin_page($this->pdf, 595, 842);
    		// set the textformat parameter to utf8
    		pdf_set_parameter($this->pdf, "textformat", "utf8");  
    		# Tell php WHERE fonts on system are
    		$this->setFont( 'Arial', 'ARIAL.TTF', 12 );
    		# print a message
    		$msg = 'Hello world.' ;
    		pdf_show_xy($this->pdf, $msg, 40, 700);  
    		#end page, close.
    	function setFont( $fontName, $ttfFile, $fontSize )
    		pdf_set_parameter($this->pdf, "FontOutline", "$fontName=$this->sysfontdir/$ttfFile");
    		# Load desired font
    		$fontObj = PDF_load_font($this->pdf, $fontName, 'iso8859-1', '');
    		pdf_setfont($this->pdf, $fontObj, $fontSize);  
    	function sendToBrowser()
    		#send to browser
    		$buf = pdf_get_buffer($this->pdf);
    		$len = strlen($buf);
    		header("Expires: 0");
    		header("Pragma: public");
    		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    		header("Accept-Ranges: bytes");
    		header("Content-Description: File Transfer");
    		header("Content-Type: application/pdf");
    		header("Content-Transfer-Encoding: Binary");
    		header("Content-Length: $len");
    		header("Content-Disposition: attachment; filename=\"myPDF.pdf\"");
    		echo $buf;
    	function __destruct()
    $pdf = new PDF();

on win o/s, i sometimes want to block all users from accessing my server, just temporarily, while still being able to give some people access.

to do this i edit httpd.conf:

Leave this as:

<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

But change this to

# Possible values for the Options directive are “None”, “All”,
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# Note that “MultiViews” must be named *explicitly* — “Options All”
# doesn’t give it to you.
# The Options directive is both complicated and important. Please see
# for more information.
Options Indexes FollowSymLinks

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride None

# Controls who can get stuff from this server.
AuthType Basic
AuthUserfile “C:/pass.txt”
Require valid-user

this is getting ridiculous.

I have 478 comments in my askimet spam filter. I emptied my spam yesterday.

Every few minutes, a new spam or two is submitted to my blog by either rimslot or bredpyt.

rimslot | | | IP:

bredpyt | | | IP:

What’s going on here? Each spam comment is 842 lines long. WordPress, you should BLOCK these two ip addresses permanently, because I can’t browse my spam for good spam comments this way unless I empty the queue every 15 minutes!

Does anyone else have problems with rimslot and bredpyt jamming up their spam filters?

looking for a cure for bruxism

Well, the NTI device has recently been FDA approved. The NTI device causes the bruxer to put pressure on only the front teeth, as opposed to allowing the rear teeth to make contact.

Don’t get excited yet. The NTI device is NOT all peaches and roses.

I got an NTI device, but I had to stop using it after 2 days because my jaw felt like it was being displaced. When I first woke up in the morning, there wasn’t any pain, but my rear bottom molars contacted the GUM TISSUE BEHIND my last molar at the top, where my wisdom teeth used to be.

That’s bad news if I ever saw it. I was on my way to developing “Anterior Open Bite”, or AOB.

If I kept using the NTI device, it’d be weeks before I had really bad AOB (see also this, slide #34 in the presentation). AOB is a bad problem in dentistry and can be corrected by surgery.

What made me REALLY stop the nti device though, was the new tinnitus noise it introduced. The day after I used the NTI splint, I developed (during the __day__, not while sleeping) a new tinnitus noise that I didn’t have before.

The NTI seems to have done weird things with my TMJ and I believe it can exacerbate or produce tinnitus; I’m not willing to try this long enough to prove it, but I think I’ve had a taste. Notice that nowhere on the NTI site is tinnitus acknowledged. NTI solves migranes. NTI doesn’t say anything about tinnitus.

SO, before you plunge in and just go BUY an NTI, I think what you should do first is try the Stop Bruxing Now! course with MyoTrac. Check out my other post (‘extreme solution for tmj’) and use the software I wrote (and will be updating soon!) to help, OR connect the output of your MyoTrac to a big stereo to amplify the noise. You need a 2.5mm adapter to connect the output of MyoTrac to your stereo, just go to Radio Shack or The Source and ask.

its amazing how so many of the video games have influence from studio ghibli films.

for instance, watch castle in the sky.

airships! they look just like the ones in the final fantasy series. in ff6, we finally see big airships like the Goliath in Setzer’s ships.

laputa! its tiamat’s castle.

also the ‘cube’ in that michael bay transformers movie looks an awful lot like the inside of Laputa.

aetherium is like the Floater stone you get from the ice cavern in ff1!

the mines are a bit like narshe in ff6!

anyway. the ff series seems to have some real heavy influence from that film!

Depression makes you stupider?

That’s the message I’m taking home from this Boston Globe article, which basically says that depression is an atropying of the cells of the brain.

"The best way to think about depression is as a mild neurodegenerative disorder," says Ronald Duman, a professor of psychiatry and pharmacology at Yale. "Your brain cells atrophy, just like in other diseases [such as Alzheimer's and Parkinson's]. The only difference with depression is that it's reversible. The brain can recover."

Wow! I don’t get very depressed often — I’m normally very happy. And now I have a reason to do ANYTHING to avoid being sad and depressed — it destroys your brain!

It is jarring to think of depression in terms of atrophied brain cells, rather than an altered emotional state. It is called “depression,” after all. Yet these scientists argue that the name conceals the fundamental nature of the illness, in which the building blocks of the brain – neurons – start to crumble. This leads, over time, to the shrinking of certain brain structures, like the hippocampus, which the brain needs to function normally.

Isn’t that amazing?

Original article:

works in ie only:


<script type="text/javascript">
function copy_to_clipboard(field)
  var val = document.getElementById( field );;

  if (document.all)
    range = val.createTextRange();
    alert('Quote successfully copied. Press Ctrl + V to paste');



      Type text and copy it.
      <input id="textfield" type="text" value="testdata" />
      <input type="button" onclick=" copy_to_clipboard( 'textfield' ); " value="click" />


got idea from


Amyloidosis is a condition where the bone marrow produces a sticky, insoluble protein that clings to the vital organs.

Amyloidosis is like cancer in that it is caused by bad plasma cells in the bone marrow.


  • bubbly urine (caused by excessive excretion of protein in urine due to kidney dysfunction, due to amyloid proteins damaging the kidneys)
  • dizziness upon standing
  • numbness in the feet
  • enlargement of tongue, perversion of taste
  • shortness of breath
  • Treatments:
    Bone marrow transplant
    melphalan and dexamethasone
    interferon (experimental – NOT PROVEN)

    It is a very rare disease – estimated 8 in a million, so many doctors simply aren’t aware of the disease.

    Well, its time to write about something else other than computer programming.

    Its time to write about TMJ.

    TMJ is a SERIOUS problem.

    What’s TMJ? Well, the TMJ in the human body is that really cool jaw joint that allows your jaw to move up and down and also side to side. Its located right in front of your ear, at the “temple”.

    If you put your pinky in your ear (GENTLY!) and move your jaw, you’ll feel some motion in your ear canal.

    Grinding your teeth at night, or excessive teeth clenching is called “BRUXISM”. Bruxism can RUIN your TMJ, making it click and pop and even causing your ears to really really hurt.

    So people usually write TMJD or just TMD to stand for “Temporomandibular Joint Disorder”. The “disorder” is basically that you’re ruining your own TMJ through not treating it properly.

    My story is a long one, and I’m not going to write it all here. But let’s just say that the TMJD got out of control. It had to stop, immediately.

    How do you stop TMJ? How do you stop bruxing? Is there a cure for TMJ? Is there a cure for bruxism?

    I’ve tried everything.

    And I found something that works to stop bruxing, and by virtue of that, over time, seems to start to allievate some of the symptoms of TMJD.

    I’m also on a soft food diet (mashed potatoes!) to help my jaw to heal.

    Well, one thing is “bruxing” is apparently aggravated by stress.

    For me, the “bruxing” was aggravated BY MY EARS. For some reason, I bruxed more because of the condition of my ears. So, the problem fed itself, and it was a very, very vicious cycle.

    I needed to STOP BRUXING IMMEDIATELY. But night after night, it would happen again and again.

    I tried a lot of different things, many of which simply didn’t work, as I am a very heavy sleeper and when my body wants to bite or clench, it FINDS A WAY TO DO IT, which is very very frustrating to wake up to. Then I finally found

    LIFE SAVER. I purchased the MyoTrac device for $650, paid for customs and all that, and finally I’ve hooked it up to my computer.

    WELL. IT WORKS. I got a 2.5mm to 3.5mm audio adapter and plugged in the audio output of the MyoTrac device to my computer’s mic input. I put the mic on “live” and jack the computer volume way up, so the beeping is now louder (but not ear-damagingly loud, of course). The beeping of the MyoTrac just isn’t loud enough to wake me up reliably.

    I also

    wrote a MyoTrac support application

    that plays music when you clench or grind your teeth. Music is nicer to wake up to than strange beeping. Plus you’ll memorize whatever song you load up… its gonna happen really often.

    Hey Betty Boop you got me droolin’

    I’m using Aerosmith’s My Fist Your Face

    The MyoTrac is VERY good and VERY reliable. In fact, it generates quite a few false alarms when you move your eyebrows or if the electrodes come off your face.

    I actually have a hard time with the electrodes coming off my face. That happens often, because of the way my face curves. So I have to tape it down really hard and turn the sensitivity way down. [WARNING: DO NOT USE JUST ANY TAPE. USE SURGICAL TAPE. OTHER TAPE TYPES USE __TOXIC__ ADHESIVE AND CAN REALLY HURT YOU!

    Every night, I’m waking up 10-15 times, and I’m GLAD THAT I’M DOING IT. Its MUCH BETTER than waking up with compounded, unbearable pain in your teeth, jaws and ears.

    listen to white noise @