IE 8 beta 2 has a nasty little bug with Background Images. If they have a width or height of 1px because you use it for repeat-x or repeat-y backgrounds you will get very dissapointed if zooming your Template smaller than 100%.
Somehow IE calculates 1px < 100% must be 0px which means the background dissapears even with repeat statement.
Workaround ist to use bigger sizes, at least 2px but i am not sure if you will get problems at < 50% so i use 10px now, at least for IE8 (conditional comments are a savior).
Showing posts with label Cooding. Show all posts
Showing posts with label Cooding. Show all posts
Thursday, November 27, 2008
Wednesday, April 26, 2006
googles personalized home
Today i got a call in the morning that we need a module for the personalized home at google and it's urgent.
Well of course i knew about the personalized home feature, but i did not have any time to look how to implement something for my own.. until now.
And it is really easy, just look at the guide from google. It's just a xml File with the Data in it. Ingenious, although there is a little problem involved.
I don't know why, but when i tried testing my module i got an error until i found a server which correspond with google. I looked into the groups and all i could find was someone from israel having the same problem, but no answer.
After some testing all i could find out is that google does not like certain websites. Best is you use a server at US.
Well of course i knew about the personalized home feature, but i did not have any time to look how to implement something for my own.. until now.
And it is really easy, just look at the guide from google. It's just a xml File with the Data in it. Ingenious, although there is a little problem involved.
I don't know why, but when i tried testing my module i got an error until i found a server which correspond with google. I looked into the groups and all i could find was someone from israel having the same problem, but no answer.
After some testing all i could find out is that google does not like certain websites. Best is you use a server at US.
Tuesday, April 25, 2006
javascript handling fileupload through popup
Since the dawn of Ajax everyone tries to implement it even more often than before.
I, for instance happen to work on an old project, which already uses ajax technology for about 2 years. There is a form where the user can enter data and at one part you can add additional information indefinetly by clicking on a button which generates a popup to add the data, then click on save and the data is in the form.
Everything was fine, until i had to also add files ... and that was a little tricky. Everyone knows
that you can't change the value of a file input field for security reasons. But i had to find a way the user can add a file in the popup and then it apears in the form.
The idea took about 12 Seconds.. the implementation took longer ;-)
In the Popup i have a js Routine that sends the data to the js Function of the Form. I changed it so it also sends the File Input field with it. (document.getElementById();)
The Form Function takes the data and build the new elements into the dom. Now i look for the File Input Field and if i get it, i just append it where i need it.
So i have the Input Filed moved from the popup into my Form with all the data it has in it. Now i can submit the Form and get the Files i added in the popup.
I, for instance happen to work on an old project, which already uses ajax technology for about 2 years. There is a form where the user can enter data and at one part you can add additional information indefinetly by clicking on a button which generates a popup to add the data, then click on save and the data is in the form.
Everything was fine, until i had to also add files ... and that was a little tricky. Everyone knows
that you can't change the value of a file input field for security reasons. But i had to find a way the user can add a file in the popup and then it apears in the form.
The idea took about 12 Seconds.. the implementation took longer ;-)
In the Popup i have a js Routine that sends the data to the js Function of the Form. I changed it so it also sends the File Input field with it. (document.getElementById();)
The Form Function takes the data and build the new elements into the dom. Now i look for the File Input Field and if i get it, i just append it where i need it.
So i have the Input Filed moved from the popup into my Form with all the data it has in it. Now i can submit the Form and get the Files i added in the popup.
Thursday, March 09, 2006
googlemaps api
As i was thinking the other day why shouldn't somebody try to use the googlemaps engine, or sort of it for fantasy worlds, it just happen to be me one week later ;-)
My first approach was to try to understand the engine just by examing their code and the dominspector... but after a while of searching i found something great. You can use the googlemaps api from google themselves. Just create your onw code and voila everything is working..
http://www.google.com/apis/maps/
Also there are a mass of tutorials and helps how to work with the api and how to add custom maps, although they only think of adding just parts of the map and not a completely new map.
http://www.mapki.com/index.php?title=Main_Page
http://www.econym.demon.co.uk/googlemaps/index.htm
I would also recommend looking into the Google Group for the Api for help. There is always something you can work with.
Happy mapping!
My first approach was to try to understand the engine just by examing their code and the dominspector... but after a while of searching i found something great. You can use the googlemaps api from google themselves. Just create your onw code and voila everything is working..
http://www.google.com/apis/maps/
Also there are a mass of tutorials and helps how to work with the api and how to add custom maps, although they only think of adding just parts of the map and not a completely new map.
http://www.mapki.com/index.php?title=Main_Page
http://www.econym.demon.co.uk/googlemaps/index.htm
I would also recommend looking into the Google Group for the Api for help. There is always something you can work with.
Happy mapping!
Wednesday, February 15, 2006
get rid of the white flashes when loading a flash
Everyone knows it... the little white flash when loading a flash into your website... and it get really on our nerves....
Well finally i managed to find a very little trick.. it is so easy i feel ashamed i did not come up with it further..
just add the wmode="transparent" to the object (and of course the same to the embed part) and you have no more flashes. Of course you should check if the background is working accordingly and does not add aditional problems..
Well finally i managed to find a very little trick.. it is so easy i feel ashamed i did not come up with it further..
just add the wmode="transparent" to the object (and of course the same to the embed part) and you have no more flashes. Of course you should check if the background is working accordingly and does not add aditional problems..
Friday, January 20, 2006
PHP5 parent:: Object
Working with PHP5 getting you used to work with real Object Orientatet Classes. Extended Classes or using the parent:: Object in such an extended Class is nothing new.
But i did not know (till now) that it is possible to jump over an extended Class to that parent.
To explain what i mean we have this Example:
But what if you need an extend on fooA, but you don't want to run through it, you just want to run through fooB->bar and then foo->bar, without fooA?
I thought there is no solution for it, but there is! If you just change the function in fooB, where it says: "parent::bar();" to "foo::bar();" it will jump directly to foo, without fooA and it is not static as you may first think!
The Result will display: "fooBfoo: 2"
But i did not know (till now) that it is possible to jump over an extended Class to that parent.
To explain what i mean we have this Example:
class foo {In this example we have 3 Classes, each extended by the next. Normally calling $oFoo->bar(); will output: "fooBfooA:foo: 3" which indicates that it starts with the latest class fooB, then runs through fooA to foo.
protected $iFoo = 0;
protected function bar() {
$this->iFoo++;
echo "foo: {$this->iFoo}
";
}
}
class fooA extends foo {
protected function bar() {
$this->iFoo++;
echo 'fooA:';
parent::bar();
}
}
class fooB extends fooA {
public function bar() {
$this->iFoo++;
echo'fooB';
parent::bar();
}
}
$oFoo = new fooB();
$oFoo->bar();
But what if you need an extend on fooA, but you don't want to run through it, you just want to run through fooB->bar and then foo->bar, without fooA?
I thought there is no solution for it, but there is! If you just change the function in fooB, where it says: "parent::bar();" to "foo::bar();" it will jump directly to foo, without fooA and it is not static as you may first think!
The Result will display: "fooBfoo: 2"
Tuesday, November 22, 2005
PHP5 reading XML using DOM
Working with XML Files in php5 you definetly want to work with DOM. Using DOM is very easy, but unfortunately the documentation is not complete and there are one or two things missing, which stop your work for several hours.
We use XML for multiple languages on websites, so our content is in the XML File written in XHTML.
If you use XML Files for different Languages like for example german, you need specific characters. This made us some troubles, but in the end it's more than easy.
First you have to tell the xml File which language you are using in the "xml" header through using encoding. For Example a german File looks like this:
Loading a XML File using DOM is very easy. First you have to create a new DOMDocument Object and then load the File:
Remember: If you are just using a couple of Entities, it's quicker to just put them directly in the File or create your own File with just the entities you need and link to that File. There were some comments on php.net that enabling that Variable will slow down the load Procedure for some time.
Now the load Procedure will not send you any more Warning Messages and possible an Exception, but you will still miss the HTML Entities in your Object.
Instead of Hello World which should look like that: Hello World, you will get a HelloWorld. You are still missing the Final Variable:
Addition:
We had the additional Problem that we used htmlentities in the text like "&" .. but we needed it also in php this way and using a doctype from w3c converted our entity into &, so we wrote our own Doctype File where we made a little hack so we could use htmlentities.
To use "ü ;" for ü we wrote into the dtd File the following:
We use XML for multiple languages on websites, so our content is in the XML File written in XHTML.
If you use XML Files for different Languages like for example german, you need specific characters. This made us some troubles, but in the end it's more than easy.
First you have to tell the xml File which language you are using in the "xml" header through using encoding. For Example a german File looks like this:
<?xml version="1.0" encoding="iso-8859-1">Next if you are using HTML Entities like or ü you have to define a DOCTYPE. Since we used XHTML Entities we used a dtd from w3.org:
<!DOCTYPE shiva SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">Now we get to the PHP Part:
Loading a XML File using DOM is very easy. First you have to create a new DOMDocument Object and then load the File:
$oXML = new DOMDocument();Now if you have a external DOCTYPE like we did, you have to enable a Variable or it will not work before the ->load(..) Function:
$oXML->load(Filename with Path);
$oXML->resolveExternals = true;This enables to read external DOCTYPE Files.
Remember: If you are just using a couple of Entities, it's quicker to just put them directly in the File or create your own File with just the entities you need and link to that File. There were some comments on php.net that enabling that Variable will slow down the load Procedure for some time.
Now the load Procedure will not send you any more Warning Messages and possible an Exception, but you will still miss the HTML Entities in your Object.
Instead of Hello World which should look like that: Hello World, you will get a HelloWorld. You are still missing the Final Variable:
$oXML->substituteEntities = true;With that you will get your Hello World and all other Entities your DOCTYPE defines.
Addition:
We had the additional Problem that we used htmlentities in the text like "&" .. but we needed it also in php this way and using a doctype from w3c converted our entity into &, so we wrote our own Doctype File where we made a little hack so we could use htmlentities.
To use "ü ;" for ü we wrote into the dtd File the following:
<!ENTITY uuml "&uuml ;">
Monday, November 07, 2005
squid error maybe solved
I might have solved my squid error Problem today. It seems like i just reached the memory limit of the host, but i would have supposed to get an php error instead.. or an apache error.. but nothing at all is not ok.
I found the calculation you need for imagecreatetruecolor at: http://www.boutell.com/gd/faq.html
So you need 4 bytes per pixel and that meant 26MB just for the source image.. and i have about 32 MB to work with ;-(
I found the calculation you need for imagecreatetruecolor at: http://www.boutell.com/gd/faq.html
Of course, opening truly huge images can cause real memory problems, if several are open at once. 8,000 pixels times 8,000 pixels times four bytes for truecolor equals a walloping 256 megabytes.
So you need 4 bytes per pixel and that meant 26MB just for the source image.. and i have about 32 MB to work with ;-(
Friday, November 04, 2005
squid error while Uploading Image with PHP
I have a very strange problem with Squid on a host provided by a company in vienna. While triing to upload an Image with HTTP Post (normal Form Element with input File) i get a
Zero Sized Reply
ErrorMessage from Squid. The Problem only occures only when using Images greather than 1MB.
At first we checked the Parameters for php and apache (post_max_size,..) but they were set at least at 16MB... So this is not the source of our problems.
I have to clarify one thing: The Image normally would be uploaded, resized and then saved. Becouse of the Problems i changed the upload to first upload the image to a temporary File and then work with it, same Problem, but the File has been uploaded before the Error occured.
That made me a little curious and i checked the code where the Error exactly happen to be...
Another little Info is required here:
Odd, i though, and tried to create a Image with a less size... worked perfectly. Then i aligned the size step by step to the one calculated... and at about 300x200 there was the end.
Ok, this meant for me: The Function has not enough Memory to acquire for the Image.. The Provider also worked on the Problem on their site and they have another Problem: It works Perfectly on their site... why is it working when they are triing and when i try it not?
They asked me to outsource the code to a single file for testing, which i did. I tested it myself first and wow, everything is working...
Now i thought: That's it, here it ends, i am completely at the end of my knowledge and went home for some sleep ;-)
The next day i thought over it again and found the reason.. i used a couple of classes for the System, which i did not use on the outsourced File. This classes also needed some Memory which now they don't, so i have more memory for the Upload.
The quickest test was to change the end Resolution to 800x600, which worked on the server at my work fine, but not on the other host. (Got Ya!)
I simplified the outsourced code, killed the calculation code (since the end Size is 800x600) and so on until i just had the basic part. While working on that i found out if i don't call session_start() at the end of the file, the Code also stopps at the same position, but no error Message was called... (no Zero Sized Reply)...
Now we are still searching for that error.
Zero Sized Reply
ErrorMessage from Squid. The Problem only occures only when using Images greather than 1MB.
At first we checked the Parameters for php and apache (post_max_size,..) but they were set at least at 16MB... So this is not the source of our problems.
I have to clarify one thing: The Image normally would be uploaded, resized and then saved. Becouse of the Problems i changed the upload to first upload the image to a temporary File and then work with it, same Problem, but the File has been uploaded before the Error occured.
That made me a little curious and i checked the code where the Error exactly happen to be...
Another little Info is required here:
- First i upload the File, which works fine.
- Then i create an object from that image, which happens to be in jpeg Format, so i use imagecreatefromjpeg.
- After that i have some code for resizing the image and
- then i create a new Image Object by using imagecreatetruecolor with the calculated Size and copy the image into that new Object
- At last the Object is saved as a File.
Odd, i though, and tried to create a Image with a less size... worked perfectly. Then i aligned the size step by step to the one calculated... and at about 300x200 there was the end.
Ok, this meant for me: The Function has not enough Memory to acquire for the Image.. The Provider also worked on the Problem on their site and they have another Problem: It works Perfectly on their site... why is it working when they are triing and when i try it not?
They asked me to outsource the code to a single file for testing, which i did. I tested it myself first and wow, everything is working...
Now i thought: That's it, here it ends, i am completely at the end of my knowledge and went home for some sleep ;-)
The next day i thought over it again and found the reason.. i used a couple of classes for the System, which i did not use on the outsourced File. This classes also needed some Memory which now they don't, so i have more memory for the Upload.
The quickest test was to change the end Resolution to 800x600, which worked on the server at my work fine, but not on the other host. (Got Ya!)
I simplified the outsourced code, killed the calculation code (since the end Size is 800x600) and so on until i just had the basic part. While working on that i found out if i don't call session_start() at the end of the file, the Code also stopps at the same position, but no error Message was called... (no Zero Sized Reply)...
Now we are still searching for that error.
Tuesday, October 25, 2005
mysql changed format for Timestamp
As you can see on the Mysql Homepage they changed the Format for Timestamp:
From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases:
TIMESTAMPcolumns are displayed in the same format asDATETIMEcolumns. In other words, the display width is fixed at 19 characters, and the format isYYYY-MM-DD HH:MM:SS.Display widths (used as described in the preceding section) are no longer supported. In other words, for declarations such as
TIMESTAMP(2),TIMESTAMP(4), and so on, the display width is ignored.
Sunday, October 02, 2005
DbDesigner Problems with MySQL
When working with Databases i use DbDesigner, since it is a free tool and is working great although they have stopped working on it a long time ago. The whole development team is working for MySQL now and are working on MySQL Workbench, but there is only an alpha yet.
So the only open source solution is still DbDesigner..
A couple of days ago i come up with a big problem .. DbDesigner on my PC was not able to connect to my Servers Database... i was looking over an over again and found the Problem...
Since i am using Debian, my MySQL Version was updatet a couple of times now and now there is a new adjustment in the my.cnf File called bind-address.
If you use:
bind-address 127.0.0.1
only the localhost can access the database. Since i am using a Server behind a FireWall and only for development purpose i just had to disable the Line and now everything is working again.
Thanx for this tipp to a good friend of mine ;-)
So the only open source solution is still DbDesigner..
A couple of days ago i come up with a big problem .. DbDesigner on my PC was not able to connect to my Servers Database... i was looking over an over again and found the Problem...
Since i am using Debian, my MySQL Version was updatet a couple of times now and now there is a new adjustment in the my.cnf File called bind-address.
If you use:
bind-address 127.0.0.1
only the localhost can access the database. Since i am using a Server behind a FireWall and only for development purpose i just had to disable the Line and now everything is working again.
Thanx for this tipp to a good friend of mine ;-)
Subscribe to:
Posts (Atom)