Jump to content

thunderousity

Members
  • Posts

    40
  • Joined

  • Last visited

thunderousity's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Ah ok - Done a bit more reading. I thought the ob_gzhandler indicated to the server to run gzip for that page. I have removed both the mod_gzip text from the .htaccess file and the ob_gz_handler part from the page. I removed the mod_gzip text from the .htaccess file as it still wasn't compressing according to whatsmyip gzip test I added the following Deflate text to the .htaccess file instead to see if this would work but still no compression. AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript Using Chrome dev tools I checked the response headers and there is no content-encoding being returned despite Accept- encoding being present in the request header section and returning 'gzip, deflate'.
  2. In a bid to make my site faster I thought I would do as the site tests suggest and implement gzip page compression. I have checked to see that gzip is enabled. Check. I have added the following code to my .htaccess file. (I also tried the AddOutputFilterByType DEFLATE text/plain but that didn't seem to work, which may be down to the fact that I hadn't added <? ob_start("ob_gzhandler"); ?> at that time) <ifModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_include mime ^text/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_include handler ^cgi-script$ </ifModule> Added this code in my php: <? ob_start("ob_gzhandler"); ?> However I get the following error: ob_start(): failed to create buffer in /somefolder/anotherfolder on line 2, referer: https://www.google.com/ ...mod_fcgid: stderr: PHP Warning: ob_start(): output handler 'ob_gzhandler' cannot be used twice... Took me ages to find the fact that I needed the <? ob_start("ob_gzhandler"); ?> in my pages. Annoyingly, most sites tell you to just add the mod_gzip code to .htaccess file. Any ideas?
  3. I have 2 tables. A table full of items with an ID number and various values (Table A) and a table which works as the basis for an Item comparison using the ItemID's (Table B ) Table A ItemID, Item_Name, Value_1 1, Potato, 50 2, Carrot, 45 3, Broccoli, 35... Table B ComparisonID, ItemID1, ItemID2 1, 1, 3 2, 2 ,3 3, 5, 145 Requirement: I want to return the ItemID, Item Name and Value for each row in Table B like so Results: ItemID1, Item_Name, Value_1, ItemID2, Item_Name, Value_1 1, Potato, 50, 3, Broccoli, 35 2, Carrot, 45, 3, Broccoli, 35 5, Courgette, 102, 145, Banana, 274 I can create the basic MySQL to return each of the columns using a Union query. However I don't think this is the way to go. It's the part where I need to iterate through each row in Table B whilst also using separate ItemID's for separate columns from the same row that I can't get my head around. Table B will only be up to 1000 rows so it doesn't need to be too efficient. Any ideas where to start? Cheers.
  4. This looks much neater thanks. However, this seems to randomise the name order but the names always start with an A SELECT n.Name, g.Gender FROM tblnames AS n INNER JOIN tblgender AS g ON n.GenderID = g.GenderID WHERE name Like CONCAT( CAST( CHAR( floor( 65 + rand() * (1+90-65) ) ) AS CHAR(3) ) , '%')
  5. I have been working on a query to return a list of names filtered by a random beginning letter A - Z. The following SELECT gives me a random letter using ASCII characters A-Z or 65-90. 1. SELECT floor(65 + (rand() * (1+90-65))) as RandomBetween65and90 The next statement is my main query which at the moment filters rows using Like by a specified ASCII Decimal. In the example below this is 65 or A I had to CAST the CHAR function to return an ASCII Character rather than a decimal for the Like 'A%' 2. SELECT n.Name, g.Gender FROM tblnames AS n INNER JOIN tblgender AS g ON n.GenderID = g.GenderID WHERE name Like CONCAT((SELECT CAST(CHAR(65) AS CHAR(3))), '%') These both work in isolation, however when I try to combine the 2 statements and replace the 65 in the 2nd statement with the 1st statement as a subquery to give me a random letter I don't get the results I expect. I seem to get random rows rather than rows based on a random beginning letter. SELECT n.Name, g.Gender FROM tblnames AS n INNER JOIN tblgender AS g ON n.GenderID = g.GenderID WHERE name Like CONCAT((SELECT CAST(CHAR((SELECT floor(65 + (rand() * (1+90-65))))) AS CHAR(3))), '%') ORDER BY n.Gender
  6. Nope I've changed it according to my environment I've managed to get it working Stopped Apache; I edited the Hosts file and httpd-vhosts.conf Navigate to C:/xampp/apache/conf/extra or wherever your XAMPP files are located. Open the file named httpd-vhosts.conf with a text editor. Around line 19 find # NameVirtualHost *:80 and uncomment or remove the hash. <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs" ServerName localhost </VirtualHost> <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/mysite" ServerName mysite.localhost <Directory "C:/xampp/htdocs/mysite"> Options Indexes FollowSymLinks ExecCGI Includes Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/ZendApp1" ServerName ZendApp1.localhost <Directory "C:/xampp/htdocs/ZendApp1"> Options Indexes FollowSymLinks ExecCGI Includes Order allow,deny Allow from all </Directory> </VirtualHost> 'Hosts' file edited by un-commenting the first 127.0.0.1 line and adding the two lines for my sites like so # localhost name resolution is handled within DNS itself. 127.0.0.1 localhost 127.0.0.1 ZendApp1.localhost 127.0.0.1 mysite.localhost # ::1 localhost Restarted Apache I can now access the sites via http://mysite.localhost and http://ZendApp1.localhost albeit I can only see the file structure for the ZendSkeletonApplication e.g Index of /
  7. Well I'm trying to install the skeleton application as this seems like a good place to start. I'm at home now on Win 8 with my install which I named "ZendApp1" located here C:xampphtdocsZendApp1 I've managed to get to point 13 on here ok so far, however the next steps seem to be confusing. I've tried both options below but none worked, I started and stopped XAMPP at various points but nothing worked - The first site suggests adding this to httpd.conf but the instructions seem biased towards wamp <VirtualHost *:80> ServerName zf2crud.localhostDocumentRoot C:wampwwwzf2crudpublicSetEnv APPLICATION_ENV "development"<Directory C:wampwwwzf2crudpublic>DirectoryIndex index.phpAllowOverride AllOrder allow,denyAllow from all</Directory></VirtualHost> So I tried this site http://austinpassy.com/2012/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/ which suggests editing the hosts file and editing httpd-vhosts.conf file in the following manner - <VirtualHost *>ServerAdmin admin@localhost.comDocumentRoot "C:/xampp/htdocs" # change this line with your htdocs folderServerName localhostServerAlias localhost<Directory "C:/xampp/htdocs">Options Indexes FollowSymLinks Includes ExecCGIOrder allow,denyAllow from all</Directory></VirtualHost> <VirtualHost eateryengine.dev>ServerAdmin admin@localhost.comDocumentRoot "C:/xampp/htdocs/eateryengine" # change this line with your htdocs folderServerName eateryengine.devServerAlias eateryengine.dev<Directory "C:/xampp/htdocs/eateryengine">Order allow,denyAllow from all</Directory></VirtualHost> Any pointers?
  8. hmmm - Maybe this is the way to install Zend Framework 2 on XAMPP http://www.w3programmers.com/install-zend-framework-2-on-your-wamp-and-xampp-server/
  9. I'm a complete noob to all the Framework apart from the very basic concept. However I want to learn more so I can use things like Zend Translate. I'm trying to set up an environment on my Win 7 laptop with my current XAMPP 1.8.2 install. After reading various installation tutorials I'm still confused as they all seem to be slightly different - some make it look easy others a lot of configuration is required. Maybe it depends upon your environment. I'm using this tutorial as this seems simplest and is tailored to xampp. http://mattbearman.com/2010/05/18/how-to-install-zend-framework-with-xampp/ I've downloaded and extracted the Zend Framework 2.2.4 Full Package from here http://framework.zend.com/downloads/latest Bearmans instructions tell me to install to the include_path. However this is configured out of the box to the pear folder shown in my php.ini file as include_path=".;C:xamppphpPEAR" I assume I can install the Zend framework to another folder to seperate it from PEAR to the following include_path=".;C:xamppphpZend" Do I keep the PEAR include_path and add both paths or do I replace it with the zend path. I have no intention of using PEAR now or in the future. tbh I don't know that much about it so maybe I am using it but don't know I am? Once I have the include_path sorted how do I know that it is installed correctly. I've seen tutorials that create projects using command line. I've also seen something about a Skeleton application that can be used to get started a little quicker. do I download this as a project?
  10. Maybe if I'd have read your signature I would have known it was a CSS issue and not a JS issue. I've just been using Bluefish to edit my website and just using the Source in Chrome to debug. Working blind it seems. Saw a mention of Firebug in this thread when looking back through the posts and also the mention of debuggers in your signature and had a look at the built in Chrome debugger. Cheers justsomeguy - this should help loads.
  11. Wow didn't know this existed. I've had a quick read and watched a few videos. Looks like I'll need to get my head around the Zend Framework but I can see some real potential in Globalising my site. Food for thought.
  12. I tried adding the code you suggested in various places but nothing seemed to work. Could I not use jquery to check for an odd number using some sort of if statement. The script would need to check whether the number of divs that are to be shown is odd. If it is odd then subtract 1. I think this would fix it but I'm unsure how to check for odd numbers and at what point. i.e. On Click
  13. I wasn't sure where to put this thread but seeing it is a php based one I've put it here. Feel free to move it somewhere appropriate if need be. I was contemplating translating my site to other languages. I already use Google Translate on my site but that has it's limitations. The main reason for translating the site is so that my pages rank higher in search for the native language. I assume that to get to my website pages currently is by searching in English first and then use the Google translate functionality on my site to change it to a different language. Translating the site has its added overhead that whenever I change a page I have to translate that into other languages. However, my site relies heavily on numbers and statistics and on dynamic PHP/SQL so the wording doesn't alter that much across my pages. Are there any tools, tips or gotchas in achieving this? Is it worth the effort - I'm thinking about translating to Chinese and Spanish for obvious increases in potential traffic.
  14. http://www.autosnout.com/Cars-0-60mph-Listnew.php Try this. Works fine until you select 'More Rows' a few times and an additional subheading (Between 3 and 4 Seconds) appears. This knocks the increments out of synch as the sub heading adds another div. Removing the div for the sub-heading behaves like this; http://www.autosnout.com/Cars-0-60mph-Listnew2.php
  15. I have a JQuery Script (vers 1.10.2) which shows or hides chunks of rows from a php based list. This works by showing or hiding a specific number of css related div elements by clicking the 'Show More' or 'Show Less' text at the bottom of the visible list. It works fine apart from when the Group Heading for a new group in the list appears and puts the incrementing div elements out of sync. Group Heading: echo "<div><h3 class='listrow'>Between ".$min." and ".$max." seconds.</h3></div>" Hmm - Just remove the div element in the group heading I hear you say. When I remove the div element from the sub heading part of the echo, all the sub headings appear at once but the rows work as they should do. i.e. show or hide upon a click. How can I fix this? Code below CSS: <style>.myDiv div{ display:none;}#MoreRows {color:green; cursor:pointer;}#MoreRows:hover {color:black;}#LessRows {color:red; cursor:pointer;}#LessRows:hover {color:black;}</style> JavaScript: $(document).ready(function () { $('.myDiv div:lt(41)').show(); $('#LessRows').hide(); var items = 50000; var minimum = 40; var shown = 40; $('#MoreRows').click(function () { $('#LessRows').show(); shown = $('.myDiv div:visible').size()+40; if(shown< items) {$('.myDiv div:lt('+shown+')').show();} else {$('.myDiv div:lt('+items+')').show(); $('#MoreRows').hide(); } }); $('#LessRows').click(function () { shown = $('.myDiv div:visible').size(); if(shown> 40) { calco = $('.myDiv div:visible').size()-40; $('.myDiv div').not(':lt('+calco+')').hide(); $('#MoreRows').show();} else {$('#LessRows').hide(); $('#MoreRows').show(); } });}); PHP <div class="content"><div class="listrow"><div class="myDiv"><?php$min = 0;$increment = 1;$max = $min - $increment;$rowclass = 0;while ($row_rs3 = mysql_fetch_assoc($rs3)){ if ($row_rs3['Seconds'] > $max) { while ($max < $row_rs3['Seconds']) $max += $increment; $min = $max - $increment; echo "<div><h3 class='listrow'>Between ".$min." and ".$max." seconds.</h3></div>"; } echo "<div class= row" . $rowclass . "><div class='alignleft'><a title=" . $row_rs3['Seconds'] . " specifications href=specifications.php?SpeedID=" . $row_rs3['ItemID'] . ">" .$row_rs3['Item'] . "</a></div><div class='alignright'> Speed - <b>" . $row_rs3['Seconds'] . "</b> seconds</div><div style='clear: both;'></div></div>"; $rowclass = 1 - $rowclass;}?></div><div id="MoreRows">More Rows</div><div id="LessRows">Less Rows</div> </div> </div>
×
×
  • Create New...