Tuesday, May 22, 2012

Y-Slow Reports no gzip on https gzipped files

Y-Slow Reports no gzip on https gzipped files, so to test:

curl --verbose -o file https://www.example.com/css/style.css | more

Saturday, May 19, 2012

Remove Contacts from Gnome 3 Search

I never search for contact this way - do you? Because I never search for contacts using meta search, there's an extension for that...

Monday, May 14, 2012

Cinnamon on OpenSUSE - Gnome 2 style



 

If I had to start someone on linux today, I would probably start them on openSUSE with Cinnamon.
It's a more familiar, Windows XP/Gnome 2 style interface, without too many surprises.


But I still prefer Gnome3 with Docky, panel docklet s,evil icon status forever and pidgin integration.
And Tom's Hardware offers some fixes for Gnome 3 too, in their review of Fedora 16
Windows Vista is still my favorite desktop ui. Discuss.


Number/Money Format woes with PHP 5.3

PHP upgrade caused problems with number_format
Message: E_WARNING Caught: number_format() expects parameter 1 to be
double, string given in /srv/www/vhosts/class.inc on line 2383

replaced

"$" . number_format($_wo["expense_total",2);

with good ol'

sprintf("$%01.2f", $_wo["expense_total"]);

Friday, April 27, 2012

Getting IE to really, really, load fresh content

I was really laughing when I read the description of this guy's problem on superuser:

When using Internet Explorer 8 to test my web application I often find it doesn't reload the page, so I don't see my changes. This has resulted in a lot of wasted time and frustration wondering why my fix "didn't work" - when in fact the browser never loaded the fixed version.
I've tried the Refresh button. I've tried F5, Control-F5, Control-R, Control-Shift-R, holding Control while clicking the Refresh button, everything I could think of - it doesn't actually load the new contents from the server. I've confirmed this with Fiddler.
How do I tell IE "I don't care what you think you have cached, I want to reload the page - no really, I mean it this time, honest-to-God, I want you to actually go to the server and download everything again"?

I laughed, because I get it. I've had to work with IE hanging on to stuff - like favicons, for example.

But what I learned from the page was from a comment:


Ev: The user-facing side of this is usually fixed by changing the URLs for all scripts and stylesheets every time you touch the code, typically by adding a ?version-number query string suffix.bobince Dec 10 '09 at 1:53

My sysadmin suggested that we could even add a server side option to change the querystring every 24 hours.


The side note to this was even stranger, and another recurring problem that I have. I found that page, because I was having some IE users not able to update a shopping cart after an upgrade, and I thought they might not have been getting the right file.

Turns out - the customer was using IE Compatibility mode. Not that they were aware of that, or that it was intentional....

Takeaways:
1. Javascript/CSS versioning to force update
2. Check Cache and Compatibility Mode when there are issues.

Thursday, April 19, 2012

Using SQL Union to examine reference for Delete


 <?php
 public function deletef()
 {
 # check for post variables */
   if (!isset($_POST["cust_id"])) die("{success: false}");
   try {
     $fID = $_POST["cust_id"];

   # delete */
     # check referential links
     $reference="";
     $checkRefSQL = "SELECT * FROM (
       SELECT COUNT(*) AS count, 'x' as tabl FROM x WHERE cust_id = $fD
       UNION
       SELECT COUNT(*) AS count, 'd' as tabl  FROM d WHERE cust_id = $fID
       UNION
       SELECT COUNT(*) AS count, 's' FROM s  WHERE cust_id = $fID
       UNION
       SELECT COUNT(*) AS count, 'w' FROM w  WHERE cust_id = $fID
       )";

     $rs=$this->db->query($checkRefSQL);
     while ($_row = $this->db->fetch($_rs)){
      if($_row["count"]>0) {
       $reference.=":" . $_row["tabl"]
      }
     }
     if($reference=="") {
     $delCustSQL = "DELETE FROM master WHERE cust_id = " . $_POST["cust_id"];
     $this->db->query($delCustSQL);
     die("{success: true}");
     } else { 
       die("{success: false, message: 'reference exists in tabl' . $reference}");
     }
   # check for errors and report */
   } catch (PDOException $_e){
     mail('someone@example.com','Customer Delete',$delCustSQL);
     die("{success: false}");
   } catch (Exception $_e){
     die("{success: false}");
   }
 }
 ?>

--
Bill Creswell



--
Bill Creswell
Web Development, IT Support, Captioning
http://billcreswell.com
http://www.linkedin.com/in/billcreswell

Thursday, April 12, 2012

Using SYSLOG to debug Web Apps

syslog(LOG_DEBUG, sprintf("thisfx is going is going to add %s ",
$_value));
db->query($thisinsertSQL);
syslog(LOG_DEBUG, sprintf("thisfx added %s ", $_value));
catch (PDOException $_e)
syslog(LOG_DEBUG, sprintf("thisfx failed to add %s ", $_value));

Finding SYSLOG
Recent
[root@server]# tail -f /var/log/messages
Apr 12 11:07:01 server httpd[506]: ....
^C
Specific
[root@server]# grep -i thisfx /var/log/messages
[root@server]# grep -i "thisfx added" /var/log/messages
[root@server]# grep -i "thisfx failed" /var/log/messages