
SuperBlue
Members-
Posts
305 -
Joined
-
Last visited
Everything posted by SuperBlue
-
Ok. I'm pretty sure i have this problem solved now. Turned out the location header alone was redirecting trough a 302 response, rather than a 303. After i added the 303 thing, everything now appears to behave as expected. If the server just responds with a 302, it appears that the browser just re-loads the page from the cache, without performing the re-validation that the server originally requested for the given page. When using a 303 however, it would seem that it properly re-checks the cache headers of the page.
-
Is it good practice to make PHP and Javascript based CSS files?
SuperBlue replied to Ivan Ivković's topic in CSS Help
Its a very bad idea to just place your CSS directly in a style element on your page. It does make each of your pages load faster, but when you got multiple pages using the same CSS, it quickly starts to load slower than it would with External CSS files. That's because these External files are cached by the browser. If you just got a single page, then its fine to just throw in your CSS in a style element on the page, and save the time involved in making another HTTP Request. You can however minimize your CSS files dynamically on the server-side, removing all white space and linebreaks. This can sometimes provide a huge performance increase, and still maintain readability in the raw files. Obviously it takes a little server CPU to process the files, so you shouldn't do this if your server doesn't have the resources. But for most sites, this won't be an issue, not even on shared hosts. You basically just need to deliver the correct Content-type, in this case text/css for CSS files. But you would also want to control the caching of the files manually, either based on the last-edited tag of the files themselves, or from a timestamp saved in your database. You could even save a minimized version of your CSS and deliver this directly, which would save you CPU on the minimizing process. Without the caching, there's little point using PHP to minimize the files, since the browser would just re-download the files on each request, rather than using the version from the cache. The same can be done to markup such as HTML, but this would likely require that you output the entire page at once, similar to whats done in python. For example, if you got the entire page in a variable, then its easy to remove whitespace and linebreaks where you don't want them, and increase the speed for your site even more. Can be done in PHP as well, but you would most likely want a better approach, than just escaping in and out of your HTML/Markup. -
Its better to just install a free CMS solution, then mess with these poor WYSIWYG tools, but even then you must be careful with the WYSIWYG tools in the CMS system. Not all CMS systems handle WYSIWYG very well, and likely most of them will still provide features in their WYSIWYG modules that shouldn't be there in the first place, simply because a user wouldn't be able to use them currectly. Beginners often make the mistake to assume that WYSIWYG tools will let them create their own website, without knowing HTML/CSS. Of cause its possible, but you mostly end up with invalid HTML, often using div in place of p and crap like that. I've even seen cases where someone would use blockquote to force indention of elements, and this is even a default feature provided in the WYSIWYG editor for indention in their CMS, (a very expensive CMS I'd might add).
-
Really strange problem with P-2601HN-F1 router
SuperBlue replied to SuperBlue's topic in Miscellaneous
Yes only the LAN clients are effected. I disabled all security in the router for now, until i figure out what is going on. The router has the ability to run a loopback test, which returns with a success message. I also updated the firmware, and had to restart the router in that process, so regardless if that solved the problem, the restart it self has solved it temporarily. I'll likely get back if it turns out the update didn't fix it. -
Sometimes we cant access the HTTP server from its own WAN IP, this goes both when trying to enter the WAN in the browser (should throw a 403), and when trying the hosted domains. The only way to solve the problem that i know of, is to turn off the router and turn it on again (not the same as a settings reset), this is of cause a smaller inconvenience. When i try to access one of the hosted websites, or the WAN IP from the server, i simply get a connection time out error, like a firewall has blocked connections from the WAN IP. But there's no software firewall running on the server. People from the outside can still access the websites, and i can also access the websites if i use a proxy server. Pinging the WAN ip of the server, from the server also works, so it seems its only related to HTTP access for now. I made sure that the firewall in the router was disabled, and that DoS prevention was disabled as well. I was thinking that perhaps the router accidentally blocked the WAN, but that doesn't seem to be the problem. The LAN IP of the server is reserved to the MAC address of the server, but i also don't think this can be the problem, since the server still gets connections from the outside. In other words, i don't think its a conflict on the LAN. Another thing i don't really get, is why the memory usage in the router is at an all-time high, about (95%). We only got a few PCs connected.
-
I'm having a problem with a bit of code, which works for everything else, but just doesn't work when used for deletion of comments. The relevant code: mysql_query("UPDATE $table SET LastEdited = '$time' WHERE PID = '$ID'", $Connection) or die(mysql_error()); header('Location: /'. $URL; This works, the resource is getting updated. What doesn't work is the revalidation after the redirect. The code I'm using for caching is: header("Cache-Control: must-revalidate"); header("Last-Modified: ".gmdate("D, d M Y H:i:s", $Header['LTIME'])." GMT"); header("Etag: $etag"); header('Content-type: text/html; charset=UTF-8'); if ((@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $Header['LTIME']) && ( trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)) { header("HTTP/1.1 304 Not Modified"); exit; } Its the exact same code used when posting comments on the site, aside from the query of cause. What i don't get, is why i have to hit update in my browser, to get it to re-validate. The $etag will only be updated if the sites source have been changed.
-
You just need to apply a min-width to your accountContent, a width would also work, but it depends on what you want to accomplish. Also remember that margin: 0 auto; will center the div. IE6 will need text-align:center; on the parent.
-
I'd recommend a fixed min-width and a max-width, and a percentage value for the width property.. Then simply throw IE6 a fixed width in a conditional comment, and advice users to upgrade on a support page or something. Keep in mind that resolutions change over time, and are likely to continue to do so for at least years to come.
-
preg_match is always returning true, problem with UTF-8?
SuperBlue replied to SuperBlue's topic in PHP Coding Help
You are right, strange though, because i was pretty sure i tested this when i first wrote it.. I think i have this thing figured out, i need to have e ^ for start, and $ for end, otherwise it will return true if a matching pattern was found anywhere in the string. if (preg_match("/^[a-zA-Z0-9]+$/", $_POST['title'])) { echo $_POST['title'];exit(); } Thanks.. Well now i finally get when to include the start and end stuff. -
preg_match is always returning true, problem with UTF-8?
SuperBlue posted a topic in PHP Coding Help
I had some code that I'm pretty sure used to work, basically something like the below. if (preg_match("/[a-zA-Z0-9]+/", $_POST['title'])) { echo $_POST['title'];exit(); } Now i just don't get why it always returns true, even when entering special characters like "!#%?".. The only thing which comes to mind, is that i recently made a move to UTF-8.. -
Ok i found a solution to my problem, I'm almost sure that this is a bug in phpMyAdmin. In any case, what i did to solve the problem, was to follow a suggestion posted on this forum http://www.developpez.net/forums/d105647-2/php/outils/phpmyadmin/utf-8-phpmyadmin-problemes-dencodage/ I can't quite make out what these people are saying, but i understood the "Merci" part, so I'll better pick up that French book again sometime. Anyway, a modification to mysql.dbi.lib.php was needed, and i just inserted the below, just before "return $link;" in the PMA_DBI_connect function. The mysql.dbi.lib.php file is located in libraries/dbi. mysql_query("SET SESSION CHARACTER_SET_RESULTS =latin1;",$link); mysql_query("SET SESSION CHARACTER_SET_CLIENT =latin1;",$link); I hate using code i don't understand, and i don't understand why they would set the character set to latin1, when its utf8 they want. But in any case, phpMyAdmin seems to be correctly saving data in UTF-8 now, and i got the desired output, so i guess this is solved, for now..
-
Just located some information, which might be relevant. http://wiki.phpmyadmin.net/pma/garbled_data Turns out they had an old closed bug report, where this link was posted. Maybe I'll find a solution there.
-
I'm not sure how those links should help me, mostly they contain stuff i already know (never mind the specifics, who cares about that anyway). What i want to know, is why phpMyAdmin submits the data in a wrong character set. I even tried to force my Browser to use UTF-8, but phpMyAdmin will still submit in the wrong format. I also checked in the /setup directory, and it was correctly set to use UTF-8, its also setup to use UTF-8 for MySQL connection collation. I'm not sure where else to check. And I've verified that the data that I'm submitting from my own scripts is valid UTF-8. I only got a problem with phpMyAdmin.
-
I just successfully validated content submitted from the website, wheres the content that i submitted from phpMyAdmin fails validation. So i must have missed a setting for phpMyAdmin somewhere.
-
I recently discovered doing a checkup in phpMyAdmin, that i couldn't enter danish letters directly from phpMyAdmin, and still have them show up correctly on my site. I suspect it must be a server configuration, or bug with phpMyAdmin it self. Isn't UTF-8 supposed to support these letters, without having to use their HTML entities? The problem is.. I can post these characters in comments from the website, and they will also show up correctly. But then they will be messed up when viewed from within phpMyAdmin. The really strange part is, when i submit these characters from phpMyAdmin, then it will be the other way around, and they will just show up as � when viewed on the website. The MYSQL default character set is UTF-8, inside of my.ini. And i also tried to change the Collation of the table, and the effected field from latin1_swedish_ci to utf8_general_ci, which made no difference whatsoever.
-
Its a very bad idea to use conditional comments, especially since they specifically target IE, so don't unless you got really good reason. I.e. To make the site usable. Don't use it simply to add rounded corners in older browsers, its to much work on your part. Supporting old browsers is quickly becoming a bad practice, especially now that new HTML and CSS features are gaining ground. I.e. Article, and section to mention a few. Another good way to reset, is to simply do a * {/* Declarations here */ }, which is often better then these crazy reset files. On the matter of styling lists, make sure you don't have overlapping tags in your source, and keep in mind that list items are displayed as list-item rather then block, this means that they may add an extra space when you have nested lists. I had to deal with this problem some months ago, and that was where i realized what the problem was.
-
The only thing i really dislike about such cases, is when companies intentionally force people to use their solutions. So its not that i dislike open source, (far from). But bundling software can hardly be considered that. What i would personally like to see improved about Windows, rather then removing otherwise good components like WMP and IE, is Windows Update. This is where Microsoft could learn a lot from the package feature in linux. Basically they should have an integrated feature in Windows, which includes a list of free, and commercial software for Windows! Anyway, what are your thoughts on the whole Microsoft case?
-
As you may know, there was a case against Microsoft, which claims that Microsoft abused their market dominance by having bundled Windows with certain software comportments. It smells like the commission acted in their own interests to me, and disregarded the rights of the individual company. It was not like Microsoft blocked the installation of other browsers or media players. Which may raise the question, what will we see next? Notepad alternatives making case against Microsoft for bundling notepad? Advertising for competitors? If you read the Wikipedia article on the case, then it should be obvious that some injustice toke place, (unless its been manipulated). Mainly around the bundling of software, where i personally find the argumentation to be totally flawed. Windows has been like that traditionally after all, and basically everyone is free to create their own OS if they don't like it. Who is to interfere when the system fails like that? Its also rather disturbing how the EU can fine whomever they seem fit, just because they have a proprietary business model, which they happen to dislike. In that regard, many open source fanatics seem to be careless crocks, who disrespect the right of ownership, and the right to make your own rules around what you own. Requiring licensing fees of technologies, is perhaps a tad over the top. But nothing can change, that its up to the individual company how they want to distribute their software.
-
Its almost never recommended to spend to much time nitpicking about how things will look on lesser capable devices and browsers, its not even your responsability. You can, if you really find it nessesery, design a seperate version for such. But it would require proper testing, in which case i would strongly recommend using an emulator. I.e. http://www.mobilexweb.com/emulators
-
You need to place the images before the paragraphs, and then float them to either the left or the right. I.e. <!DOCTYPE html"> <html lang="en-US"> <head> <title>How to wrap text around images</title> <style type="text/css"> #Basement { width: 300px; } img { float:right; clear: both; margin: 1em; } </style> </head> <body> <div id="Basement"> <img src="Testing.png" alt=""> <p>This example shows how to make text wrap around images. Floating the image to either the left or the right, should make the text wrap. You can then apply a margin to the images, to avoid ugly collusions with the text.</p> </div> </body> </html>
-
When using images as borders, the best technique is my border technique, found at http://brugbart.com/Examples/Bordertechnique.html This technique allows images to be used on a fully fluid box, something the other techniques that I've seen doesn't allow without using scripting. But for for simple borders, CSS radius would be the best option, i wouldn't even say that its bad that some browsers don't display the borders properly, as long as the page doesn't get to ugly for my taste as a result. Consider that some corner images, likely isn't much larger then 100-1000bytes, i actually got corner files that are no larger then around 150 bytes. Well the size of the border-radius.htc file is a good 4kb. Its still practically nothing i know, but preferring to use these tedious workarounds, is quite simply a bad-practice from the past.
-
This is totally unnecessary, since most hosts dose this by default. Its only server-sided scripts you have to set the caching headers for, which is easily done using the etag and if-modified-since HTTP headers. The meta tags you mentioned are practically useless. Its best to make sure your server handles the validation properly, which most servers already do for static content. You can also install the livehttpheaders plugin for Firefox, to analyze the headers which are sent by your server, and check if they are sent properly.
-
You can however increase the number of parallel downloads, by using a sub domains to host a few files, hence the difference is negligible on decent connections. Keeping things separate is nice for readability, so another option would be to combine the files into one big file before uploading it to your server.
-
What haku said only goes for the hight property, not the min-height property. Your problem is that you have positioned the text class absolutely. Using absolute positioning is not bad in it self, in fact i use it on most of my sites to some degree. But it just doesn't work well when you have footer, so if you want to maintain a footer, and still allow all your columns to push the footer further down, depending on what column is highest, then you should really use a tabel based approach. There are float based layouts, but they require additional wrappers for each column in the page. I modified your source a little, but it could really use some cleaning up as well. @charset "utf-8"; /* CSS Document */ @charset "UTF-8"; /* CSS Document */ html, body { margin:0; padding:0; height:100%; background:#abe0f4 url(images/bg.jpg) repeat-x; /* BG MAIN COLOR and or IMAGE color code is: background-color:#333333; */ font-family: Verdana, Geneva, sans-serif; color:#666666; font-size:14px; line-height:19px; } #container { min-height:100%; position:relative; background-image: url(images/bgcloud.jpg);/* header background */ background-position:top center; background-repeat: no-repeat; } #headerbg { width: 100%; background-image: url(images/greatdeals.png); background-position:top center; background-repeat: no-repeat; } .header { width: 882px; padding:0px 10px 10px 10px; margin:0 auto; position: relative; min-height: 750px; } .headersub { width: 882px; padding:0px 10px 10px 10px; margin:0 auto; position: relative; min-height: 722px; padding-bottom:308px; } .appcloud { width: 203px; position: absolute; left: 85px; top: 175px; } .headertxt { width: 504px; position: absolute; left: 370px; top: 318px; } .headertxtthree { width: 480px; position: absolute; left: 417px; top: 366px; } .logo { width: 299px; position: absolute; left: -52px; top: 22px; } .text { width: 800px; position: relative; margin: 0 0 308px; left: 56px; top: 403px; font-size: 14px; color: #000; } .headertxttwo { width: 520px; position: absolute; left: 340px; top: 532px; text-align: right; } #body { height: 1600px; padding-bottom:308px; /* Height of the footer */ width: 100%; } #bodysub { padding-bottom:308px; /* Height of the footer */ width: 100%; } #footer { position:absolute; bottom:0; width:100%; height:308px; /* Height of the footer */ background: url(images/footer.jpg) no-repeat; background-position:top center; } .footerholder{ margin:0 auto; position: relative; width: 883px; } .footercontent{ position: relative; width: 700px; margin:0 auto; padding-top: 250px; float: right; } .wrapper{ margin:0 auto; position: relative; width: 882px; margin-bottom: 10px; } .left1{ position: relative; float: left; left: 5px; width: 400px; padding-bottom: 10px; } .left2{ position: relative; float: left; left: 15px; width: 400px; padding-bottom: 10px; } a { text-decoration:none; } .link { color: #FFF; font-size: 11px; position: absolute; } .link2 { color: #FFF; font-size: 10px; position: absolute; text-align: center; top: 252px; } .link a{ color: #FFF; font-decoration: none; font-weight: bold; } .link a:hover{ color: #FFF; text-decoration: underline; font-weight: bold; } #topmenu { right: 0; position: absolute; background: url(images/topmenu.png) no-repeat top right; width: 760px; /* MENU width */ height: 38px; } ul#topmenu { margin:0px; padding:0px;/* MARGIN MOVES MENU DOWN */ padding: 5px 40px 0px 0px; position:absolute;/* MAKE SURE .CONTAINER POSITION IS RELATIVE TO KEEP MENU RIGHT ALIGNED WHEN ADDING MORE PAGES */ right:0px;/* MAKES MENU RIGHT ALIGNED */ text-align: right; } ul#topmenu li { display:inline;/* INLINE MAKES MENU HORIZONTAL */ margin-left:60px; } ul#topmenu li a { font-size:14px; line-height:19px; text-decoration:none; color:#FFFFFF;/* MENU FONT COLOR */ font-weight:bold; text-transform:none; } ul#topmenu li a.active, ul#topmenu li a:hover { color:#eae63d;/* MENU ROLLOVER COLOR */ } HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Select and order your favorite pics directly from your iPhone with MyCSS</title> <link href="style.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="images/favicon.ico" /> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> </head> <body> <div id="container"> <div id="headerbg"> <div class="headersub"> <!-- Header start --> <ul id="topmenu"> <li><a href="index.html">Home</a></li> <li><a href="about.html">About</a></li> <li><a href="mediapress.html">Press</a></li> <li><a href="contact.html">Contact</a></li> <li><a href="http://MyCSS.zendesk.com/forums/292331-faq">FAQ</a></li> </ul> <div class="text"> <span style="font-size: 30px; color:#2595c8; line-height: 30px; font-weight: bold;">CONTACT US</span><br /> <p> </p> <p><strong>General information</strong><br /> <br /> For all general inquiries, please email at info(at)MyCSS(dot)com</p> <p><strong>Support</strong></p> <p>sadsa</p> <p> </p> <p> </p> <p>ds</p> <p> </p> <p> </p> <p> </p> <p>ds</p> <p> </p> <p> </p> <p> </p> <p>ds</p> <p> </p> <p> </p> <p> </p> <p>ds</p> <p> </p> <p> </p> <p> </p> <p>ds</p> <p> </p> <p> </p> <p> </p> <p>ds</p> <p> </p> </div> <!-- Header end --> </div> </div> <div id="footer"> <!-- Footer start --> <div class="footerholder"> <div class="footercontent"> <div class="link" style="left: 310px;"><a href="contact.html">Contact Us</a></div> <div class="link" style="left: 60px;"><a href="http://MyCSS.zendesk.com/forums/292331-faq">FAQ</a></div> <div class="link" style="left: 209px;"><a href="privacypolicy.html">Privacy Policy</a></div> <div class="link" style="left: 10px;"><a href="mediapress.html">Press</a></div> <div class="link" style="left: 103px;"><a href="partnerwithus.html">Partner with Us</a></div> <div class="link" style="left: 389px;"><a href="http://facebook.com/MyCSS"><img src="images/facebook.png" alt="facebook" width="142" height="39" border="0" /></a></div> <div class="link" style="left: 550px;"><a href="http://twitter.com/MyCSS"><img src="images/twitter.png" alt="twitter" width="100" height="39" border="0" /></a></div> <div class="link2" style="left: -256px;"> ɠCopyright 2011, MyCSS </div> </div> </div> <!-- Footer end --> </div> </div></div> <div id="fixeddiv" style="position:absolute; width:32px;height:75px;left:0px;top:330px;background:none;"> <table border="0" width="32" cellspacing="0" cellpadding="0"> <tr> <td width="100%"><a href="http://facebook.com/MyCSS"><img src="images/facebook_32.png" alt="facebook" width="32" height="32" border="0" /></a></td> </tr> <tr> <td width="100%"><a href="http://twitter.com/MyCSS"><img src="images/twitter_32.png" alt="twitter" width="32" height="32" vspace="5" border="0" /></a></td> </tr> </table> </div> </body> </html> If you can live with only having the main content column push the footer, then fine. But this would pretty much call for a redesign, if the height of your navigation columns later extends that of the content column.
-
I wouldn't personally go for equal heights, with variable width columns. Its plain nasty with CSS and divisions alone, and way more complicated, then just throwing in a table and be done with it. Nevertheless, you may want to read: Equal Height Columns Avoid using fancy stuff like display:inline-block; I've experimented a lot with the display property, with my early layouts. It rarely works as you intend, and the rules are sometimes a bit to exotic. May be better with IE8, but then you might be looking for display:table; or something like that. I'd much rather use a hack currently, but i haven't really worked with that type of layout for some time. I tend to work around stuff, until i got a real reliable approach.