Using VI via putty by default will not work as each key will go back a line before inserting a character.
This can be fixed by “disabling application keypad mode” under Configuration -> Terminal -> Features
Category Archives: Uncategorized
Godaddy’s Retarded Rewrite Rules
The following .htaccess is required to get mod_rewrite to work as expected under godaddy:
# Options Options -Multiviews Options +FollowSymLinks #Enable mod rewrite RewriteEngine On #the location of the root of your site #if writing for subdirectories, you would enter /subdirectory RewriteBase / #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #This last condition enables access to the images and css #folders, and the robots.txt file RewriteCond $1 !^(index\.php|images|robots\.txt|css) RewriteRule ^(.*)$ index.php?/$1 [L]
(The above code was from a google search from someone using CI with the same issue)
vs. original:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
I don’t know why one works, not the other, and I really don’t care.
Running the WHT UnixBench-5.1.2 Benchmark
On a clean installation of centOS, run the following code:
# # Run the benchmark # yum install -y mesa-libGL-devel libXext-devel libX11-devel wget http://byte-unixbench.googlecode.com/files/unixbench-5.1.2.tar.gz tar -xzf unixbench-5.1.2.tar.gz cd unixbench-5.1.2 ./Run
Undo/Redo in VI
You know undo is ‘u’
Redo is ctrl + r
PHP mail() : Recipient names must be specified
This can be resolved by adding the -t
argument to the sendmail_path
in php.ini
Kohana 3: Getting the insert_id after an INSERT query
Since the database library in Kohana 3 is so much different than in Kohana 2, to get the last insert id of a row, use the following code instead:
$insertTable = DB::query(Database::INSERT,
"INSERT INTO table (x, y, z) " .
"VALUES(@x, @y, @z)"
);
$insertTable->param('@x', $x);
$insertTable->param('@y', $y);
$insertTable->param('@z', $z);
$insertTableResult = $insertTable->execute();
$insert_id = $insertTableResult[0];
I’m not too sure what the other ways of doing it is, but this is the only way I found after looking at the code.
No thanks to kohana 3’s non-existent documentation.
Addendum: As Sicabol suggested, the code above can be simplified by using list() instead of manually creating and using a separate array. That is:
$insertTable = DB::query(Database::INSERT,
"INSERT INTO table (x, y, z) " .
"VALUES(@x, @y, @z)"
);
$insertTable->param('@x', $x);
$insertTable->param('@y', $y);
$insertTable->param('@z', $z);
list($insert_id, $total_rows_affected) = $insertTable->execute();
Kohana 3: Unable to find a route to match the URI
If you get Unable to find a route to match the URI: /some/uri/path/args
on Kohana 3 when attempting to request a action with more than one paramter, you will need to update the code in /application/bootstrap.php:
Route::set('default', '(<controller>(/<action>(/<id>(/<overflow>))))', array('overflow' => '.*?'))
->defaults(array(
'controller' => 'home',
'action' => 'index',
));
I don’t get why this wasn’t added by default, along with all the controller, helper, model, views directories in /application similar to Kohana 2. Compounded with the poor documentation, Kohana 3 really is starting to tick me off. The time saved by Kohana is wasted on these things.
Transparent Outter Border Effect
I attempted to make a transparent outter border effect for a design as displayed in this post.
To make this effect in HTML/CSS, I tried to make a outter wrapper that wrapped all the contents of the website with a thick border and opacity set to 8%. Unfortunately, opacities set in parent objects will pass to its children as well; meaning all contents under this wrapper also will have an opacity of 8%. There is no way of getting around this.
The solution to this problem is to make the outter wrapper have an image background consisting of the 8% transparency as needed. Thus, there is no need to adjust the opacity in CSS directly.
HTTP Meta Redirect / Reload
To reload the current page after a certain time period:
<meta http-equiv="refresh" content="600">
To redirect to another page after a certain time period:
<meta http-equiv="refresh" content="2;url=http://steamr.com">
Java exec() results in no output in linux
For some reason, executing something like ping
in java generates no output, but something like uptime
does.
I’m guessing the reason for this is because ping
has the sticky bit set. It seems like any programs that has the sticky bit will fail to run and generate any output in java.
Edit: Actually, this doesn’t seem to be true. mount
has the sticky bit set but it runs fine.
Edit: Running the java program from a shell script causes java to generate output as it normally should….
Edit: The problem solved itself… Try to remove all environment variables by running unset `env | awk -F= '/^\w/ {print $1}' | xargs`
and see what happens by running