Why we don’t choose MSSQL!

Everybody always raves how great Microsoft SQL Server is, and how much data it can hold, and how much bigger it’s “package” is than your own. But the truth is that I hate it with a passion! I use RDBMS‘ on a daily basis and never used to hate MSSQL so much until recently when I had to modify a very large site that was built in Classic ASP(yuck) and MSSQL.

How Do You Fire A Client?

How do you fire a client? Let’s face it, some clients can be a real nightmare. There are a whole bunch of tell-tail signs that a client is going to be a major problem for you shortly after or sometimes during your first interaction with them. This can be a phone call, a few emails or worst of all, a face to face meeting. Remember that you need to be selective when it comes to work you take on, as a bad client can cause more trouble than they’re worth.

How to get ‘how many days in February’ using Javascript?

It is quite handy to have a function that can tell you how many days there are in February due to the leap year shift of either 28 or 29 days. Below is a function created in Javascript to return the exact amount of days according to the year given: 1 2 3 function daysInFebruary (year){ return (((year%4==0)&&((!(year%100==0))||(year%400==0)))?29:28); }

Weird Pagination on a Google Page

Not sure how long this one will last, but for now: Go to: http://www.google.co.za/search?q=MFI/06/ASA-778658&hl=en&start=0&sa=N If you scroll to the bottom, there are 4 pages (pagination), press Next, now there are only 2, WEIRD HUH!

Actionscript 2 – PHP Data Transfer

In the below example we will use Actionscript 2 to call a remote PHP file that will return data to it. It is a simple way of transferring data between the server and client. Actionscript 2 Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 callRemoteFile = function(ourVariable:String) { var result_lv:LoadVars = new LoadVars(); result_lv.onLoad = function(success:Boolean) { if (success) { if (result_lv.

Unique Random Numbers in PHP

If you would like to show random numbers using PHP you can do this: 1 2 3 4 5 6 7 8 9 10 11 12 <?php $min = 1; $max = 100; $total = 100; $arrItems = array(); while ( count($arrItems) < $total ) { $item = mt_rand($min,$max); if (!in_array($item,$arrItems)) { $arrItems[] = $item; echo $item."<br />"; } }

HTML mail() Sending as Plain Text

1 2 3 4 5 6 7 $to = "[email protected]"; $subject = "SUBJECT"; $message = "<b>MESSAGE</b>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Mailer ' . "\r\n"; mail($to, $subject, $message, $headers); The above code does not always send emails in HTML as it should, it turns out there is a PHP Bug (http://bugs.php.net/15841) that comes into play with QMAIL and carriage returns.

Turbo C++ in DosBox for Windows 64bit

I had to compile a C++ application under a DOS environment and was running Windows 7 64bit. Firstly, Turbo C++ is a 32 bit x86 application and therefore will not run when initialised from an x64 environment. This can easily be solved by installing the DOS Emulator called DosBox. One can then mount the Turbo C++ folder as a drive and install it under a subdirectory. 1 e.g. mount c c:\PathToMyTurboCppDirectory\ Once in there it’s quite easy to open and compile the source code, but good luck to anyone that tries to write anything from scratch, it’s really painful and half the keys are not mapped in the DosBox, eventhough you can press Ctrl+F1 to open the Keymapper.

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

http://www.arngren.net/ http://www.lingscars.com/ http://www.theworstwebsite.com/ – beware, alert boxes coming! http://havenworks.com/ http://www.msy.com.au/ http://www.5safepoints.com/ http://www.pixyland.org/peterpan/ http://www.aiseikai.or.jp/ http://www.jfw.ie/ 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.