Netshine Software Limited






Home arrow Developer Blog Make Text BiggerMake Text SmallerReset Text Size

Dec 10
2008

Capturing content from nicEdit when form is submitted by Javascript

Posted by netshine in wysiwygonsubmitnicEditJavascripthtmlforms

nicEdit is a very lightweight wysiwyg HTML editor, distributed under the MIT license (which means that as long as the copyright info remains intact, you can do pretty much anything with it, including distribute it with a commercial application). There are a couple of drawbacks to nicEdit - first, it does not produce standards compliant HTML. If it did, it would not be anywhere near as lightweight, so that's a bit of a tradeoff (it relies on the browser's own HTML editing features, so if you use a decent browser you should get pretty good results). The other main problem I found though, is that if you have a form containing a nicEdit editor, and submit the form using Javascript ie. form.submit(), the content of the editor is not posted back to the server!

If you would like to know why that is, and what you can do about it, read on...

Nov 07
2008

Restricting access to a URL by IP address using mod_rewrite

Posted by netshine in URLrestrict accessquerystringmod_rewriteip address

There are gazillions of articles out there telling you how to restrict access to a directory using either FilesMatch or mod_rewrite rules in .htaccess. But trying to find out how to restrict access to a page based on a URL is somewhat more difficult. FilesMatch and RewriteRule only work on the first part of the URL - they ignore the querystring. But mod_rewrite is capable of restricting access to a page based on the querystring value and the IP address of the visitor if you can find the right syntax - and here it is...

Nov 05
2008

PHP date function displays dates a day early after the clocks changed

Posted by netshine in timezonePHPdateclocksBritish Summer Time

I was surprised to find that after the clocks changed on 26th October 2008, all of the dates on my billing records were showing up a day early. Invoices paid on 28th September showed as being paid on 27th. I tried it out on 3 different servers as well as my local PC. On the 3 Linux servers, it always calculated the wrong date, but on my PC (running Windows XP), it showed the correct date. The explanation was fairly simple, but I found it infuriatingly difficult to fix!

Oct 29
2008

Rounding Numbers in Javascript

Posted by netshine in roundingJavascriptfloatdecimal places

Javascript is incapable of rounding numbers to a certain number of decimal places accurately. The problem occurs because Javascript treats decimal numbers as floats, which, as most programmers know, are a pain in the proverbial. As such, if you try to round a number like 0.285 using Javascript (using either Math.round or the toFixed function) you end up with 0.28 instead of 0.29. After a half-hearted search on google, I could not easily find a sample script that I could use in nBill to calculate this accurately (because nBill is commercial, and the only sample I found would not allow me to use it for commercial purposes). So I wrote my own function from scratch...

Oct 29
2008

Welcome to my new blog

Posted by netshine in Untagged 

I have finally decided to start a blog. Not that I will have time to update it very often, but every now and then I get stuck on a problem and have to spend some time researching the answer or developing some code to address the issue - and it seems a waste not to publish the resolution so that others can benefit from it too. So if and when I get time, and have something worthwhile to say, or some gem to pass on that might save another developer a few hours work, I will try to remember to post an entry here.

Joomla! Tutorial
Take a look at our free tutorial for Joomla! Administrator...


 
 
© 2004-2009 Netshine Software Limited   Terms and Conditions   Search Engine Optimisation by Blogstorm