• Web Development Questions That Don't Need Their Own Thread v2
    3,079 replies, posted
[QUOTE=StinkyJoe;31030719]When that happens, leave the question untouched and add your answer, it might be helpful for someone else.[/QUOTE] ok, thanks [editline]10th July 2011[/editline] [QUOTE=Alcapwne;31030843]Repost since nobody seemed to notice it earlier: Is there any way/tool/site that allows me to view traffic for 1 particular page on a website which I don't own? Thanks[/QUOTE] not unless you can input a script directly to the site, no. You can use a URL shortener though, and those tell you the statistics.
[CODE] $(document).keypress(function(event) { var data = event.which || event.keyCode; if ( data == 26 ) { alert( 'undo' ); } }); [/CODE] It seems that chrome has control-z built in yet ff does not. Can someone show me how to achieve cross browser support of control-z.
[QUOTE=LiamBrown;31027294]Yes, parseInt: [url]https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseInt[/url][/QUOTE] You can also do: [code] var stringOrNumber = '32', int = +StringOrNumber; [/code] Using a mathematical objects converts any string to a number.
[code]$(window).keydown(function(e) { console.log(e.which); });[/code] CNTRL has a key code of 17, Z has a key code of 90. Watch and be amazed: [code]window.cntrl = false; $(window).keydown(function(e) { // if the control key is pressed if(e.which == 17) window.cntrl = true; // if control and z are both pressed else if(window.cntrl && e.which == 90) { console.log("CNTRL Z"); } }); $(window).keyup(function(e) { // release the control key if it's not pressed if(e.which == 17) window.cntrl = false; });[/code] keypress doesn't seem to like cntrl. If you wanna override a default function, just stick a "e.preventDefault();" in there for when you are pressing the S key, like: [code]window.cntrl = false; $(window).keydown(function(e) { // if the control key is pressed if(e.which == 17) window.cntrl = true; // if control and z are both pressed else if(window.cntrl && e.which == 90) { console.log("CNTRL Z"); // do something } else if(window.cntrl && e.which == 83) { e.preventDefault(); console.log("CNTRL S"); // do something } }); $(window).keyup(function(e) { // release the control key if it's not pressed if(e.which == 17) window.cntrl = false; });[/code] [editline]10th July 2011[/editline] of course I may be wrong but w/e
Not sure if anyone has experience with this kind of stuff, but: If I'm interested in real-time web applications, and I'm looking for a solution that will perform well and have the least cross-browser/platform issues, should I be focusing on Comet protocols like Bayeux, or WebSockets with a [URL=https://github.com/gimite/web-socket-js]fallback[/URL] option for browsers that don't support it?
I'd go for WebSockets with a fallback option (I know there's implementations in Flash), aim for the newest protocol version with fallback for older browsers or for when it's disabled on the UA. Edit: I see you linked to a Flash implementation, but it supports the older protocol by default, you have to use a branch for the latest protocol (Which is needed for Firefox 6+)
found it on the interwebz is the regex code right? [php]$character = 'LINK?!?!?!?!?!? http://google.com'; echo makeLinks($character); function makeLinks($str) { return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%,]+)/i', '<a href="$1://$2" title="$1://$2" target="_blank">$1://$2</a>', $str); }[/php]
Anyone know why unserialize() returns bool(false)? I'm using file_get_contents to grab the data feeds from game-monitor, but can't seem to get unserialize() to work properly.
[QUOTE=Snowden42;31059068]Anyone know why unserialize() returns bool(false)? I'm using get_file_contents to grab the data feeds from game-monitor, but can't seem to get unserialize() to work properly.[/QUOTE] Unserialize returns false and throws an error if the string you're working with cannot be unserialized. Try again in an environment where you have errors enabled and visible (and with an error reporting level that includes E_NOTICE), or check your logs. If no error is being thrown, the unserialized return value may actually just evaluate to false, which would point to an issue elsewhere (maybe in your [b]file_get_contents[/b] call?).
Haha, just realized that. I accidentally typed the function wrong. But even though it's wrong in the previously post (sorry, typo), it's correct in the code. I had a brain fart for some reason. I'll go do a little more digging, but if I can't get this serialized PHP feed to work, I'm gonna use the XML feeds they offer as an alternative, and use regex, I suppose. Speaking of which, does anyone know of a good resource for regex patterns, or regex tutorials?
[QUOTE=Snowden42;31059753]Haha, just realized that. I accidentally typed the function wrong. But even though it's wrong in the previously post (sorry, typo), it's correct in the code. I had a brain fart for some reason. I'll go do a little more digging, but if I can't get this serialized PHP feed to work, I'm gonna use the XML feeds they offer as an alternative, and use regex, I suppose. Speaking of which, does anyone know of a good resource for regex patterns, or regex tutorials?[/QUOTE] If you're using regular expressions to parse XML you're just asking for trouble. I haven't worked with XML in a while, so I may be a bit outdated on this matter, but the [url=http://php.net/manual/en/book.simplexml.php]SimpleXML[/url] class is probably what you're looking for. It's also likely that whatever service you're working with offers a JSON feed, which is much easier to work with.
regular expressions are awesome, but (I think) they're really hard to work with. a quick google search: [URL="http://www.regular-expressions.info"]http://www.regular-expressions.info/[/URL] also, watch out for [URL="http://en.wikipedia.org/wiki/Regular_expression#Lazy_quantification"]greedy quantifiers[/URL]. [editline]11th July 2011[/editline] [QUOTE=StinkyJoe;31059994]If you're using regular expressions to parse XML you're just asking for trouble. I haven't worked with XML in a while, so I may be a bit outdated on this matter, but the [URL="http://php.net/manual/en/book.simplexml.php"]SimpleXML[/URL] class is probably what you're looking for. It's also likely that whatever service you're working with offers a JSON feed, which is much easier to work with.[/QUOTE] and yeah, that's much better than regexp for XML.
For what ever reason I can't get the font style on a certain division to change. What would be the possible causes?
The div tag supports two different attributes that you'll want to use. If you've already specified the font to a certain class in your CSS, do "<div class="classwithfontproperty"></div>". Otherwise, you can do "<div style="font: 12px, arial, sans-serif"></div>".
ok i need newsbot's for my community anyone know where i can obtain these auto-posting newsbots?
[QUOTE=Snowden42;31073927]The div tag supports two different attributes that you'll want to use. If you've already specified the font to a certain class in your CSS, do "<div class="classwithfontproperty"></div>". Otherwise, you can do "<div style="font: 12px, arial, sans-serif"></div>".[/QUOTE] Ew no, never use inline style attributes. Read up on semantic markup. The whole point of CSS is to separate your presentational code from your markup...
[QUOTE=KmartSqrl;31074937]Ew no, never use inline style attributes. Read up on semantic markup. The whole point of CSS is to separate your presentational code from your markup...[/QUOTE] Hence why I mentioned the class attribute. Obviously that's preferred. But if he doesn't have CSS already, the style attribute will work just fine.
[QUOTE=RELAXiN;31065995]For what ever reason I can't get the font style on a certain division to change. What would be the possible causes?[/QUOTE] How are you trying to do it? Post the code (CSS and HTML)
[QUOTE=Snowden42;31076654]Hence why I mentioned the class attribute. Obviously that's preferred. But if he doesn't have CSS already, the style attribute will work just fine.[/QUOTE] If he doesn't have CSS already he should give the div a semantic id or class and style that.
I'm trying to upload wordpress to my cpanel in x10 hosting. I right click the wordpress.zip file and hit extract but it gives me an error, End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. I dont know what to do honestly. Go easy on me. I'm trying to start my first website.
Has this happened to anybody else: I sent (proper) JSON data to a PHP file on my server, and PHP automatically escapes the quotes (both " and ' ), which fucks up json_decode. It took me a few minutes to figure out what exactly the fuck was going on, because wampserver has PHP 5.3.0 and my webserver has 5.2.something, so they both did different things. [editline]12th July 2011[/editline] [QUOTE=Dogass;31081450]I'm trying to upload wordpress to my cpanel in x10 hosting. I right click the wordpress.zip file and hit extract but it gives me an error, End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. I dont know what to do honestly. Go easy on me. I'm trying to start my first website.[/QUOTE] sounds like the ZIP file is corrupt, I'd redownload it
[QUOTE=Ac!dL3ak;31081510]Has this happened to anybody else: I sent (proper) JSON data to a PHP file on my server, and PHP automatically escapes the quotes (both " and ' ), which fucks up json_decode. It took me a few minutes to figure out what exactly the fuck was going on, because wampserver has PHP 5.3.0 and my webserver has 5.2.something, so they both did different things. [editline]12th July 2011[/editline] sounds like the ZIP file is corrupt, I'd redownload it[/QUOTE] I think you're referring to [url=http://php.net/manual/en/security.magicquotes.php]Magic Quotes[/url]. It was a good idea but caused more problems than it solved, and as such, has been disabled in PHP 5.3+. You should really update PHP/WAMP, or just wrap the part that writes to the page in [url=http://php.net/manual/en/function.stripslashes.php]strip_slashes[/url].
[QUOTE=cas97;31081774]I think you're referring to [URL="http://php.net/manual/en/security.magicquotes.php"]Magic Quotes[/URL]. It was a good idea but caused more problems than it solved, and as such, has been disabled in PHP 5.3+. You should really update PHP/WAMP, or just wrap the part that writes to the page in [URL="http://php.net/manual/en/function.stripslashes.php"]strip_slashes[/URL].[/QUOTE] no, wamp's fine, it's my webserver that has 5.2.whatever and ok [editline]12th July 2011[/editline] thanks
[editline]13th July 2011[/editline] [QUOTE=TheDecryptor;31078192]How are you trying to do it? Post the code (CSS and HTML)[/QUOTE] CSS: [html] #leftdiv{ width:317px; padding-top:30px; font-family: Verdana; font-size: 1em; height:auto; } #rightdiv { padding-right: 10px; font-family: Verdana; font-size: 1em; height:auto; } [/html] HTML: <!-- Contact Detail's Area --> <td> <div name="newboxes2" id="newboxes4" style="display: none;padding: 5px;"> <table width="400"> <tr> <td> <div class="clearboth"></div> <!-- clearboth --> <div id="rightdiv"> <p>Mobile: 021 243 3640<br/> P.O Box 1276, Hamilton<br/> Email: [EMAIL="nightshelter@xtra.co.nz"]nightshelter@xtra.co.nz[/EMAIL]<br/> <br/> Womans shelter: Hamilton East<br/> Mens Shelter: 63 Rostrevor Street, Phone: 07 839 7480<br/> </p></div> </td> <td> <div id="leftdiv"> <img src="images/map.png" alt="Map" /> 63 Rostrevor Street </div> </td> </tr> </table> </div> </td> <!-- End Contact Detail's Area --> [editline]13th July 2011[/editline] Sorry about no html bbcode. For what ever reason it adds random scripts on here. Also th issue is that the text won't be formated and for whatever reason become very large.
Is this active anywhere? Things like this are usually best solved using DOM Element inspectors (Firebug for Firefox, and default in Chrome/IE9), they can show you the CSS hierarchy, which styles are being applied to the specific element, and where that styling is coming from.
For what ever reason its working again. I'm unsure what I did/if I did anything to it. Thanks for the help though and I'll make sure I get firebug for future troubles.
Not too sure if this is more of a web dev or a programing question, but i have an idea for a good firefox/chrome add-on/extension and was wondering where is the best place to learn how to make extensions
[QUOTE=Richy19;31088154]Not too sure if this is more of a web dev or a programing question, but i have an idea for a good firefox/chrome add-on/extension and was wondering where is the best place to learn how to make extensions[/QUOTE] Said browsers documentation.
[QUOTE=RELAXiN;31082395][editline]13th July 2011[/editline] CSS: [html] #leftdiv{ width:317px; padding-top:30px; font-family: Verdana; font-size: 1em; height:auto; } #rightdiv { padding-right: 10px; font-family: Verdana; font-size: 1em; height:auto; } [/html] HTML: <!-- Contact Detail's Area --> <td> <div name="newboxes2" id="newboxes4" style="display: none;padding: 5px;"> <table width="400"> <tr> <td> <div class="clearboth"></div> <!-- clearboth --> <div id="rightdiv"> <p>Mobile: 021 243 3640<br/> P.O Box 1276, Hamilton<br/> Email: [EMAIL="nightshelter@xtra.co.nz"]nightshelter@xtra.co.nz[/EMAIL]<br/> <br/> Womans shelter: Hamilton East<br/> Mens Shelter: 63 Rostrevor Street, Phone: 07 839 7480<br/> </p></div> </td> <td> <div id="leftdiv"> <img src="images/map.png" alt="Map" /> 63 Rostrevor Street </div> </td> </tr> </table> </div> </td> <!-- End Contact Detail's Area --> [editline]13th July 2011[/editline] Sorry about no html bbcode. For what ever reason it adds random scripts on here. Also th issue is that the text won't be formated and for whatever reason become very large.[/QUOTE] Why are you floating divs inside a table? Wat?
I want know if anyone has a good book to learn how to create modules/scripts for magento and how magento itself works. magento is a eCommerce platform, [url]http://www.magentocommerce.com/[/url]
Sorry, you need to Log In to post a reply to this thread.