How to capture HTTP Response headers of the same page using PHP

Filed Under (Software Development) by admin on 24-02-2009

Hi All, I have a requirement of displaying HTTP Response headers in the same page being redered using PHP.
This is to track various responses sent by the Apache Server for same page on different scenarios (like 200, 304, 503)
Read the rest of this entry »

Java inside Java

Filed Under (Software Development) by admin on 17-02-2009

I have a client that wants to run a .js file inside a .js file because of the registration form. *(

if (notes2 == “yes”) {
document.write(‘<fieldset><legend>’);

document.write(‘Notes Area<br></legend>’);

document.write(‘<center>Blurb Text Here that shows up on webpage<br><br><script type=”text/javascript” src=”http://forms.example.com/form/XX/4#*$!#*$!xx.js”></script><br>More blurb text that shows up after the reg. box</center>’);

document.write(‘</fieldset>’);
document.write(‘<br><br>’);
}
)*

This code places the box where it should be in Firebox but in IE 7 the registration box is at the bottom of the table, not between the two text blurbs. Any idea how I can get this to show up in IE? if it’s “just not rendering” try breaking up the code. Weird things sometimes happen with Javascript within document.write.

document.write(‘<scr’+'ipt type=”text/jav’+'ascr’+'ipt” src=”http://forms.example.com/form/XX/4#*$!#*$!xx.js”></scr’+ipt>’);

Second, your formatting is likely a result of a combination of Quirks mode and deprecated tags/discouraged approaches to formatting. Use a valid document type and validate your pages, this will make 90% of your formatting problems go away, Javascript or not.

To solve that, here is how I’d handle this (but move inline styles to external style sheets.) You may have to insert text-align:center and width:400px (or some valid value) to get the effects you want:

document.write(‘<fieldset style=”margin:auto;”>’);
document.write(<legend>’Notes Area<br></legend>’);
document.write(‘<p style=”text-align:center”>Blurb Text Here that shows up on webpage</p>’);

document.write(‘<div style=”margin:auto;”>’);
document.write(‘<scr’+'ipt type=”text/jav’+'ascr’+'ipt” src=”http://forms.example.com/form/XX/4#*$!#*$!xx.js”></scr’+ipt>’);
document.write(‘</div>’);

<!–
if you still have problems
add document.write(‘<div style=”clear:both;”></div>’);
right here
–>

document.write(‘<p style=”text-align:center”>More blurb text that shows up after the reg. box</p>’);
document.write(‘</fieldset>’);

Note the clearing div, you probably won’t need it, or can set the last p to clear, or overflow: none on the div containing the script – but overall, Standards Mode and semantic output should help you.

Site Graphics and Multimedia Design Overview

Filed Under (Graphics and Design) by admin on 04-02-2009

I am putting some product images on my website.So what is the best way of resizing jpegs to get them all the same size (roughly)?

Irfanview in batch mode. Takes a few clicks to resize any number of images.
And the best part….. It’s free. :) It has many other features as well. Irfanview is one of the best image utility programs around. For basic image manipulation that most of the population is doing it’s really all that is needed.

If you have it, use Photoshop. You can automate a batch to get everything done very quickly. Or, if the images are already compressed well for the web and similar in size, just not exact, you can just use CSS on your page.In my view the very best software for this is … smart saver pro by ulead.

You can set up a batch very easily and set the resize to a max width and/or height, thus all your pics of whatever size will be resized to the same height or width.

There is a free 30 trial, i don’t know if it’s been updated recently but my copy is several years old and works like a dream. The compression is better than photoshop/image ready and easier to use. eg better images with smaller file size.

The best batch processing software is and has been for many years DeBabelizer.
There is a bit of a learning curve, but it does exactly what you are looking for and much, much more.
Read the rest of this entry »

How to block W3 validator from accessing your site?

Filed Under (Software Development) by admin on 13-01-2009

It was a bit difficult to put this in the right category but I guess HTML was the best choice:

I am trying to figure out how you can block the w3 validator from accessing your site. As an example I looked at <a particular website>.

Go to http://validator.w3.org and enter the URl there and you see what I mean. It will show as “couldnt access page…… 403 forbidden”.

How did thy do this? Thought first it had to do with the robots….but it apparently is something else as I tried copying the robots into a test site…but after that the site could still be accessed by the validator. Read the rest of this entry »

PHP Server Side Scripting

Filed Under (Software Development) by admin on 05-01-2009

Just a few questions and thoughts regarding the issue that I am wondering how can I know when it is time to add more servers to a balanced setup of web servers, database slave servers and master database?

The number seems to be from 10K to 15K users per web server, how can I know I am not over using the servers or not using them at full capacity?

Each web server has 16 processor with 32 GB of ram, each DB has same amount of processor, plus RAID 10 for the DB and 16GB of ram. All servers are interconnected on a private network with two nic cards; one nic for the public network and the other for the private.

I am just missing to implement memcached for the SQL objects and the HTML pages (an existing cache system is on place working like a charm for the HTML pages). Will this last “thing” push the limit from 10K/15K to 20K/30K per server?

If you guys have any thoughts – feel free to leave comment. Read the rest of this entry »