Case Insensitivity with .htaccess files

If you have an .htaccess file to control the flow of URI’s on your site you may want to look at adding a nice little “case insensitive” feature to each line/item. So an example of a line of .htaccess without any case insensitive bells and whistles looks like this: 1 RewriteRule ^AndrewOdendaal$ index.php?go=2964 We add our Case Insensitive feature by just adding a [NC] to the end of the line, like this:

Actionscript2: Split string by line length with & without word-wrap

Split string into sentences by max line length. This uses a character array but doesn’t use word-wrapping. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 var personalMessage: String = "You got this far so we reckon that you could be curious enough to learn a little more, we?

Search and Replace Anchor Href using Javascript

I have a site that is under development and it was made really badly so I needed a quick way to replace all anchors on page to the relevant path. The problem is because it was a testsite that lived away from the public facing domain, the anchors had to be changed because they were all coded in as absolute paths. I included a JavascriptDebug file and put the following in there:

Error 29506 while installing SQL Server Management Studio Express

I was trying to install Microsoft SQL Server Management Studio Express (what a long name) on a machine and kept getting error 29506 right near the end with a Rollback action thereafter. To get this program installed you will need to run Command Prompt as Administrator and then run the MSI (installer) from there. Navigate to C:\Windows\System32\ then right click on cmd.exe and select Run as Administrator. Once the console has loaded, you can “cd” to the directory and then run the installer from there.

Swap HTML Elements Using Javascript

It is quite easy to use javascript to swap between divs or any other html dom elements. Using the function below you can pass the id of the element to show and to hide. 1 2 3 4 function swapDivs(show, hide){ document.getElementById(show).style.display = "block"; document.getElementById(hide).style.display = "none"; }

A PHP Mail Class

Below is a Mail class I created in PHP, it requires 4 arguments on initiation of the class via the constructor and uses the method ->send() to send the created mail once complete. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 class Mail { var $to; var $subject; var $content; var $headers; function Mail($to, $subject, $content, $from){ $this->to = $to; $this->subject = $subject; $this->content = $content; $this->headers = "Content-type: text/html; charset=iso-8859-1\r\nFrom: $from"; $this->content = "".

iTunes keeps maximizing!

Oh my goodness, this can be an annoying issue with iTunes. The problem is: iTunes will restore itself or maximize itself all the time every 20 or so seconds without being clicked on, it will also get main focus and whatever you were doing will have to wait! I solved this by right clicking on the iTunes program icon where I launch it from and selecting Properties, then selecting “Compatibility” then making sure “Run this program as an administrator” was checked.

Replace newline break in Excel

Ever needed to find & replace the newline character in a large excel document? In the Replace Dialog (Ctrl+F) Find: Hold down [alt] and type 010 on the numeric keypad. Replace: Replace with a space ” ” (without quotes)

PHPExcel Class Usage

I just finished adding an export xls (excel) export feature to a web application. I used the PHPExcel Class from CodePlex, its really great to work with – as far as the world of exporters go that is. In the example below the “exportCheckpoints” function requires an imploded string seperated as “|||||”. Hopefully it gives an example of how easy it “could” be to export something from mysql to excel using php.

unexpected T_IF

Getting “Parse error: syntax error, unexpected T_IF” ? Check if the preceeding line ends with a ;

Worst Websites of All Time – beware, alert boxes coming! Think you’ve found the worst website of all time? Post it below!

Set line leading / line spacing in flash actionscript 2

This is how to add text leading using Actionscript 2 for Flash. 1 2 3 4 var txtFormat:TextFormat = new TextFormat(); txtFormat.leading = 5; // change this to whatever you need it to be ttt.setTextFormat(txtFormat); ttt2.setTextFormat(txtFormat); There is also a GUI way of doing this: Select your textfield and and under the paragraph section, set the top/right hand icon (Line Spacing) to whatever you like.

MySQL Main Query Types used in PHP to select, insert, update and delete data

MySQL Main Query Types SELECT SELECT * FROM tablename INSERT 1 INSERT INTO tablename (col1, col2, col3,..) VALUES (val1, val2, val3,...) UPDATE 1 UPDATE tablename SET `col1`=`val1`, `col2`=`val2`, `col3`=`val3`,... DELETE 1 DELETE FROM tablename WHERE `col4`=`val6` Note You will use a lot of WHERE clauses as well along with the above. e.g. 1 SELECT * FROM tablename WHERE `id`='15' In PHP Calling to MySQL is really easy in PHP, just use the mysql_query() function.

Connect to mysql database from php

If you need to connect to a mysql database from php you can do it like this: 1 2 3 4 5 6 7 8 <?php $DBH = 'localhost'; $DBU = 'root'; $DBPWD = 'password'; $DBN = 'petstore'; $conn = mysql_connect($DBH, $DBU, $DBPWD) or die ("Error: Could not connect to database."); mysql_select_db($dbname); This allows you to make a connection to the mysql database and gets it ready for you to make queries and manipulate the data.

htaccess file and error 500 internal server error

I have a question for anyone that can answer it: I create an .htaccess file in the root of a subdomain, but if I enter either of these two lines I get an erro 500 Internal Server Error: 1 2 php_flag magic_quotes_gpc off php_flag register_globals off Any suggestions anyone?

Quake 4 – Fatal Error: could not create destination file

If you get an error message similar to this one when trying to run Quake 4… Fatal Error: could not create destination file C:/Program Files (x86)/id Software/Quake 4 Multiplayer Demo/q4mp/gamex86.dll …then you should run the exe as Administrator. So Right-click, “Run as Administrator” and all will be sorted.

phpMyAdmin – Invalid field count in csv input on line 1

I was trying to import a massive csv dataset into phpMyAdmin and it kept throwing error: Invalid field count in csv input on line 1 This is quite annoying as I followed all the usual steps as per normal. To solve this I had to do the following: Import Browse for your CSV file. Select CSV using LOAD DATA (rather than just CSV) Change “Fields terminated by” from “;” to “,” Make sure “Use LOCAL keyword” is selected.

Choosing a programming IDE

This is somewhat of a debatable topic, but it has come up a lot of times without any real final clarity, so I will try and cover it all. Lets begin by explaining exactly what an IDE is and then we can move onto the more debated areas of choosing the right one for you. An IDE stands for “Integrated Development Environment” and is often used by programmers when creating their applications.

Double border in CSS

CSS allows you to add a border to almost all html elements. If you would like a double border you can use CSS like this: style="border:double"

[Exception… “Could not convert JavaScript” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)”

What the heck is.. uncaught exception: [Exception… “Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.appendChild]” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)” location: “JS frame :: PATH_TO_MY_JAVASCRIPT_FILE :: THE_METHOD_NAME :: line #” data: no] For me it was just an appendChild() that was causing the problems. You can always try the innerHTML+= way if all else fails 😉