In the following code, we are creating a new variable called my_character and storing ‘a’ there.” This will be one byte in size. Whenever you create a string of text in the C language with quotes, you are actually storing that string somewhere in memory. That means that a string of text, just like all variables, has some address in memory where it lives. Now a pointer can only contain a memory address, so “Hello World!” must be a memory address.
#!/usr/bin/perl -w
# For each tab (worksheet) in a file (workbook),
# spit out columns separated by “,”,
# and rows separated by c/r.
use Spreadsheet::ParseExcel;
use strict;
my $filename = shift || “Book1.xls”;
my $e = new Spreadsheet::ParseExcel;
my $eBook = $e->Parse($filename);
my $sheets = $eBook->{SheetCount};
my ($eSheet, $sheetName);
foreach my $sheet (0 .. $sheets - 1) {
…
Start by going to the hooks directory in your repository and copying pre-commit.tmpl as pre-commit. Then add the line to disallow changes to tags and run it. All is well, the change didn’t get committed, right? What just happened was the commit failed because the pre-commit wasn’t marked executable!
This is so handy, I can’t believe i’ve never used or even heard of this until today! You can easily run your bash shell scripts in debug mode to watch what they’re doing behind the scenes in real time. You get to see the levels of nesting when you’re inside loops and variables get replaced with their actual contents at the time of execution.
This might come in handy if you have multiple levels of nesting in ‘for’ and ‘while’ loops or a few if/then/else statements and you want to see just what is getting passed in the comparisons.
If you check the contents of a post variable that never got passed, you get warnings. If you like keeping your verbosity set that high and want to avoid this warning, or you just want to avoid checking against a non-existent variable, try this
The oneliner ob_gzhandler only works for Apache and you have to have the mod_gzip module loaded. This method is crap. So to send gzipped PHP output to users browser’s to save bandwidth, try this. It also helps for slow Internet connections and large pages too.
I don’t care what anyone says, I like lots of debug output available in my programs. It helps me crank out code faster with less errors. You can keep a private member called debug and just flip it on and off when you want to see the output. It’s a lot cleaner than interjecting prints and echos all over the place.
Now when go.php loads, you can check to see if there’s anything in the post_arr, and if there is, cycle through the array and store all the elements. I couldn’t find a working example of this just by googling. It seemed like tons of people would ask for this, but any responses on forums would be, “well what are you really trying to do”. So here it is.
This is the easiest way I could think of to figure out the directory given a full path in PHP. I reverse the whole string, then look for the first slash and break off that part. Then reverse it back. You could drop each part into an array, so the first element could be the path to the present working directory, and the second element would be the directory itself. Or you could write a second function called getPWD and return the path instead of the directory.
So I just wrote this in 2 minutes so I could kill some things in /etc and /home and be done with it. Short and simple, don’t you think?