Latest Post

Error: No input file specified.

While trying to run a codeigniter app the other day I came across this error just after I had finished uploading the files and making the ne...

Saturday, November 30, 2013

DOS - Auto execute mysql scripts in a folder

I recently had to run multiple *.sql scripts on a mysql database on my dev machine. My first thought was to do a quick google search to see if i could get a quick and easy example i could just copy/paste/edit/run but i had no such luck unfortunately. Then i remembered I could use my old school DOS knowledge to get a listing of the sql files and recursively run mysql < script.sql on each of these files. I ended up with the following DOS command and it worked like a charm:

for /f %f in ('dir /b c:\FOLDER\WHERE\SQL\SCRIPTS\ARE') do mysql -u root <%f

Note that this was a quick fix on a dev pc that has root with no password

ciBonfire - jQuery [Enter] to [Tab]

I started working on bonfire a couple of weeks ago and i must say i'm loving it so far. Being a codeigniter die-hard when i came across bonfire i decided to give it whirl and i have not looked back since.

I recently had to implement a piece of jquery code to prevent users from submitting forms via the [enter] key so what i did is in the specific module/view i added this piece of inline js and viola! my users are happy people now. Find below the code snippet:

$inline  .= '$(document).ready(function() {';
//$inline  .= 'var myinputs = $(":input").not(\'textarea\').not(\'[type="image"]\').not(\'[type="submit"]\');';
$inline  .= 'var myinputs = $(":input").not(\'[type="image"]\').not(\'[type="submit"]\');';
$inline  .= '  myinputs.keydown(function(e) {';
$inline  .= '    if (e.keyCode == 13) {';
$inline  .= '      e.preventDefault();';
$inline  .= '      var current = myinputs.index(this),';
$inline  .= '              next = myinputs.eq(current + 1).length ? myinputs.eq(current + 1) : focusables.eq(0);';
$inline  .= '      next.focus();';
$inline  .= '    }';
$inline  .= '  });';
$inline  .= '});'; 
Assets::add_js( $inline, 'inline' );
This by the way works

Friday, August 30, 2013

Error starting apache service on Windows 2008 Server R2 Standard

WAMP Package: VertrigoServ 2.29  
OS: Windows 2008 Server R2 Standard  

ERROR(in the event log): Syntax error on line 134 of xxxx/apache/conf/httpd.conf: Cannot load xxxxxxxxx/php/php5apache2_2.dll into server: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail. ... Line 134: LoadModule php5_module "xxx/php/php5apache2_2.dll" NOTE: xxx is where my WAMP package is installed.  

RESOLUTION: I fixed my problem by installing the Visual C++ 2008 32-bit Redistrible Package from Microsoft.

ADDITIONAL INFO: While researching this problem i found that Apache was reporting that port 80 was in use yet doing a netstat -aon for example did not reveal any process using the port. But when checked the error logs i found this side-by-side config error and decided to google that, and viola! problem solved.

Another thing i learnt during this is searching through DOS commands results for specific text e.g.

netstat -aon | find ":80"   OR  netstat -aon | findstr ":80"

where the command checks for programs using port 80

Chitika Ads