• Web Development Questions That Don't Need Their Own Thread v2
    3,079 replies, posted
[url]http://stackoverflow.com/questions/6595935/problem-with-algorythm-to-shorten-sentences[/url]
[QUOTE=TeratybeS;30935719]My query looks something like this right now SELECT id, body, upvotes, downvotes FROM suggestions WHERE id = :id I understand what you mean, but using multiple limits won't work [editline]6th July 2011[/editline] Maybe I'm just doing it wrong though [editline]6th July 2011[/editline] SELECT id, body, upvotes, downvotes FROM suggestions WHERE id = 22 OR id < 22 OR id > 22 LIMIT 3 This doesn't work. Selects the following two, not the previous one.[/QUOTE] You're going to need a separate query it seems
I want to blur the left and right edges of the page, I'm using CSS3 for the blurring, and tried " -webkit-box-shadow-left: 0px 0px 15px 0px #000000; " and it was quickly apparent that I cannot use "-left" to just blur one side :rolleyes: So how will I do this? by using three separate divs, one of left another for right and one for content and a mix of overflow:hidden? Visual reference below; [IMG][URL]http://i.imgur.com/HtuE2.png[/URL][/IMG] I'll appreciate any help :downs:
Can people use a site with AJAX without javascript enabled?
[QUOTE=Richy19;30945558]Can people use a site with AJAX without javascript enabled?[/QUOTE] No. The J in AJAX stands for Javascript.
[QUOTE=StinkyJoe;30945675]No. The J in AJAX stands for Javascript.[/QUOTE] So how can you provide the ajax functionality for users that dont have js
[QUOTE=Richy19;30946512]So how can you provide the ajax functionality for users that dont have js[/QUOTE] You make it so people cant access your site without javascript.
[QUOTE=Richy19;30946512]So how can you provide the ajax functionality for users that dont have js[/QUOTE] you can't
[QUOTE=Richy19;30946512]So how can you provide the ajax functionality for users that dont have js[/QUOTE] You can always make some fallbacks. For example, a link that would normally trigger content to load dynamically VIA AJAX will just take you a static version of the page.
Uhm i wanted to make my url from [url]http://link.com/blah?p=VARIABLE[/url] to [url]http://link.com/VARIABLE[/url] and right now i have [php] RewriteRule ^$ coolstuffbrah.php [L] RewriteRule ^(.*)$ coolstuffbrah.php?p=$1 [L][/php] just doesn't work.
[QUOTE=zzlawlzz;30952503]Uhm i wanted to make my url from [URL]http://link.com/blah?p=VARIABLE[/URL] to [URL]http://link.com/VARIABLE[/URL] and right now i have [php] RewriteRule ^$ coolstuffbrah.php [L] RewriteRule ^(.*)$ coolstuffbrah.php?p=$1 [L][/php] just doesn't work.[/QUOTE] [code]RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L][/code] Be sure to enable mod_rewrite in your httpd.con file.
[QUOTE=StinkyJoe;30952565][code]RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L][/code] Be sure to enable mod_rewrite in your httpd.con file.[/QUOTE] Ya, the rewrite isn't a problem. when I add a 'page' it works fine [code]RewriteRule ^$ coolstuffbrah.php [L] RewriteRule ^page$ coolstuffbrah.php [L] RewriteRule ^page/(.*)$ coolstuffbrah.php?p=$1 [L][/code] but I dont want an extra page, I just want it to be like url.com/VARIABLE
With my method you use $_SERVER['REQUEST_URI'] to get the original request uri, you have to work with that.
[QUOTE=Chuushajou;30945486]I want to blur the left and right edges of the page, I'm using CSS3 for the blurring, and tried " -webkit-box-shadow-left: 0px 0px 15px 0px #000000; " and it was quickly apparent that I cannot use "-left" to just blur one side :rolleyes: So how will I do this? by using three separate divs, one of left another for right and one for content and a mix of overflow:hidden? Visual reference below; [IMG][URL]http://i.imgur.com/HtuE2.png[/URL][/IMG] I'll appreciate any help :downs:[/QUOTE] The easiest way would be to just use an image as the background, but it should also be possible if you applied the blur to a smaller element behind the main body content.
I can't seem to get data from a JSON object. Can someone help me and explain please? I'm still a noob with this stuff. [code] <html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready( function() { $.getJSON("http://staff.tumblr.com/js/json?num=3&callback=?", function(data){ $.each(data, function(i, tumblr_api_read) { var posts ="<li>"; posts += '<a href="' + tumblr_api_read.tumblelog.posts[i].url '">' + tumblr_api_read.tumblelog.posts[i].url + "</a>"; posts += "</li>"; $("#posts").append(posts); }); }); }); </script> <head> <body> <ul id="posts"></ul> </body> </html> [/code]
[QUOTE=Richy19;30946512]So how can you provide the ajax functionality for users that dont have js[/QUOTE] You realize that AJAX stands for Asynchronous [b]Javascript[/b] And XML right?
[QUOTE=Richy19;30946512]So how can you provide the ajax functionality for users that dont have js[/QUOTE] Why wouldn't someone have javascript enabled?
[QUOTE=Jelly;30956700]Why wouldn't someone have javascript enabled?[/QUOTE]your kind using noscript
[QUOTE=TehWhale;30956711]your kind using noscript[/QUOTE] Anyone with the technical know how to use noscript would know the downsides to using so, either they enable it or use a dysfunctional website.
[QUOTE=R1Z3;30955739]I can't seem to get data from a JSON object. Can someone help me and explain please? I'm still a noob with this stuff. [code] $(document).ready( function() { $.getJSON("http://staff.tumblr.com/js/json?num=3&callback=?", function(data){ $.each(data, function(i, tumblr_api_read) { var posts ="<li>"; posts += '<a href="' + tumblr_api_read.tumblelog.posts[i].url [highlight]+[/highlight] '">' + tumblr_api_read.tumblelog.posts[i].url + "</a>"; // Forgot a + right...........................................^ posts += "</li>"; $("#posts").append(posts); }); }); }); [/code][/QUOTE] That should work, you forgot a + to concatenate the strings. I pointed it out in the posted code.
[QUOTE=deadeye5362;30958362]That should work, you forgot a + to concatenate the strings. I pointed it out in the posted code.[/QUOTE] I added the + but it still doesn't seem to run. [editline]7th July 2011[/editline] Debugged it and this came up: [IMG]http://i52.tinypic.com/121ybrq.png[/IMG]
[QUOTE=R1Z3;30960921]I added the + but it still doesn't seem to run. [editline]7th July 2011[/editline] Debugged it and this came up: [IMG]http://i52.tinypic.com/121ybrq.png[/IMG][/QUOTE] This means that tumblr_api_read.tumblelog is undefined. Make sure you're understanding the usage of $.each(). The function parameters used within $.each() are in the from of key, value (PHP's foreach style). The way you're going about this looks more like 'for (var i in obj)'.
I'm working on a web application that has to be able to play sound files and skip ahead and back, pause/resume, etc. The soundfiles have the PCM S16 LE (araw) codec (at least that's what VLC tells me). I have absolutely no idea what player I could use. HTML5 audio doesn't support skipping and probably doesn't support the codec either and I've never used Flash in my whole life. Are there any free players I could use and can control from Javascript? It would be optimal if they were invisible.
[QUOTE=StinkyJoe;30952815]With my method you use $_SERVER['REQUEST_URI'] to get the original request uri, you have to work with that.[/QUOTE] awesome, it works thanks. [editline]7th July 2011[/editline] I'm not sure how to describe this.. but anyways! I have a code with array [php] $code = array('something','something1','something2','something3'); [/php] then i have foreach [php] foreach ($code as $scrap => $code1) { if (!($code1 == $somethingelseoverhere)){ echo'THIS IS SUPPOSE TO SHOW ONCE'; } else { echo'Ok'; } } [/php] How do i make it show only once when the 2 variables aren't equal to each other? [editline]7th July 2011[/editline] Automerge doesn't work after 30min ? whoaaaaa [editline]7th July 2011[/editline] uhm, nevermind. [editline]7th July 2011[/editline] instead of arguing on WAYWO, help? [editline]7th July 2011[/editline] [SUB]T[/SUB]h[SUP]i[/SUP]s [SUB]p[/SUB]o[SUP]s[/SUP]t [SUB]i[/SUB]s [SUP]g[/SUP]o[SUB]i[/SUB]n[SUP]g[/SUP] [SUB]u[/SUB]p [SUP]a[/SUP]n[SUB]d[/SUB] [SUP]d[/SUP]o[SUB]w[/SUB]n
[php] $somethingdone = false; $code = array('something','something1','something2','something3'); foreach ($code as $scrap => $code1) { if (!($code1 == $somethingelseoverhere)){ echo'THIS IS SUPPOSE TO SHOW ONCE'; } else { echo $somethingdone ? 'Ok' : ''; $somethingdone = true; }} [/php] Perhaps?
Is there a place where I can learn simple PHP script for sessions/logins? Most tutorials are outdated because they show how to use session_register().
[QUOTE=R1Z3;30970500]Is there a place where I can learn simple PHP script for sessions/logins? Most tutorials are outdated because they show how to use session_register().[/QUOTE] [url]http://net.tutsplus.com/tutorials/php/user-membership-with-php/[/url] Look harder
Ok, so i have this code right here. I the problem here is that when I get a wrong URL depending on the amount of 'pages' in the array, it will show '404' that much times. Ex. It will show 2 times if you get it wrong using this. [php=24,25,26,27,28,29,30,31,32,33,34]<?php if ($_SERVER['REQUEST_URI'] == '/testmore/' || $_SERVER['REQUEST_URI'] == '/testmore/home') { $_SERVER['REQUEST_URI'] = '/testmore/index'; } echo $_SERVER['REQUEST_URI']; echo '<br>'; $page = $_SERVER['REQUEST_URI']; function dostuff($pagesC) { echo 'yes!<br>'; echo $pagesC.'<br>'; } $directory = '/testmore/'; //If you are in a directory! else leave it blank $pagesB = array('index','mhm'); foreach ($pagesB as $scrap => $pagesC) { if (!($directory.$pagesC == $page)){ echo '404<br>'; } else { switch ($page) { case $directory.$pagesC: dostuff($pagesC); break; } } } ?>[/php]
[php]$pageArray = Array('index', 'mhm'); $directory = '/testmore/'; // Directory if in one. Otherwise, leave it as '/'. $uriArray = explode('/', strstr($_SERVER['REQUEST_URI'], $directory, '' )); if (in_array($uriArray[0], $pageArray)) { dostuff($uriArray[0]); } else { echo '404'; }[/php] No no need to loop.
Damn, i'm so fucking bad with SQL.
Sorry, you need to Log In to post a reply to this thread.