Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
-snip-
[editline]27th February 2014[/editline]
[QUOTE=lowlifeuk777;44060488]Is Webplus x7 a place to start making a website simply? or does anyone know any other programs that are drag and drop, can't be bothered with code right now.[/QUOTE]
You'd be surprised how easy it is to set up something basic with code, though that depends what you are seeking.
Could someone explain to me why using LESS is a good idea?
[QUOTE=josm;44067005]Could someone explain to me why using LESS is a good idea?[/QUOTE]
Variables, nested rules, functions.
It essentially makes it easier to do CSS, for me anyways.
I have more control over my code with the nested rules and using variables to remember what colors where.
[QUOTE=Moofy;44067045]Variables, nested rules, functions.
It essentially makes it easier to do CSS, for me anyways.
I have more control over my code with the nested rules and using variables to remember what colors where.[/QUOTE]
So how do I start using it?
[QUOTE=josm;44067797]So how do I start using it?[/QUOTE]
Easiet way is client-side usage.
[url]http://lesscss.org/[/url]
You do as the guide says, link like this:
[code]<link rel="stylesheet/less" type="text/css" href="styles.less" />[/code] to your stylesheet. Looks familiar to CSS accept that you say [B]stylesheet/less[/B]!
Download it from their page, copy all the text you see when you click the button and save it in a less.js file. Link to that [B][I]underneath[/I][/B] your style tag, very important!
[code]<script src="less.js" type="text/javascript"></script>[/code]
So it will be like:
[code]
<head>
<link rel="stylesheet/less" type="text/css" href="styles.less" />
<script src="less.js" type="text/javascript"></script>
[/code]
Read the docs for what it can do and examples!
[editline]27th February 2014[/editline]
But for a final product compile it into a .css file.
This one is killing me:
I've got a 10-digit unique ID being generated and queried like so:
[CODE]
$quoteid = mt_rand(1000000000, 9999999999);
$quoteIdEXISTS = FALSE;
do
{
echo("QuoteID: " . $quoteid . "\n");
$quoteIdSQL = $db->prepare("SELECT QuoteID FROM QuoteInfo WHERE QuoteID = :quoteid");
$quoteIdSQL->bindParam(':quoteid', $quoteid, PDO::PARAM_INT, 10);
$quoteIdSQL->execute();
$quoteIdCOUNT = $quoteIdSQL->rowCount();
if ($quoteIdCOUNT > 0)
{
$quoteIdEXISTS = TRUE;
$quoteid = mt_rand(1000000000, 9999999999);
$quoteid = ($quoteid < 0 ? ($quoteid*(-1)) : ($quoteid));
echo("QuoteID: " . $quoteid . "\n");
}
else
{
$quoteIdEXISTS = FALSE;
}
} while($quoteIdEXISTS == TRUE);
$quoteSrcSQL = $db->prepare("INSERT INTO QuoteSource (QuoteID) VALUES (:quoteid)");
$quoteSrcSQL->bindParam(':quoteid', $quoteid, PDO::PARAM_INT, 10);
$quoteSrcSQL->execute();
[/CODE]
The MySQL Column is a bigint(10) unsigned and zerofill.
For some reason, when I query this 10 digit number into the MySQL table, the value changes! Every time! Without fail!
I've started echoing the generated value before and after the query, and it is exactly the same. Just a 10 digit integer. However when I query it into the table, it literally completely changes. Sometimes it will turn negative (before I made the column unsigned), sometimes it will not even be 10 digits. And the queried value is [u]nowhere near[/u] the generated value. I've checked and double checked and I'm like 99% positive I'm not hitting and maximum integer limit. There is no ceiling that the number hits, it's just changing as soon as it's queried.
This is making no sense and I'm about ready to throw my computer against the wall and then probably throw my own body against the wall and then form two fists and start punching the wall and my computer with my bare hands out of pure code rage.
Please help!
[editline]27th February 2014[/editline]
Just as an example:
I just ran the script and got a generated random value of
[CODE]
QuoteID: 5682811013
[/CODE]
But the queried value in the MySQL table is:
[CODE]
1387843717
[/CODE]
WTF?!
I don't know if related, but
[code]$quoteid = mt_rand(1000000000, 9999999999);
$quoteid = ($quoteid < 0 ? ($quoteid*(-1)) : ($quoteid));[/code]
it's ALWAYS going to be bigger than zero, if it starts from 1000000000...
[QUOTE=Coment;44069514]I don't know if related, but
[code]$quoteid = mt_rand(1000000000, 9999999999);
$quoteid = ($quoteid < 0 ? ($quoteid*(-1)) : ($quoteid));[/code]
it's ALWAYS going to be bigger than zero, if it starts from 1000000000...[/QUOTE]
Yeah I know, I only did that because I thought it was something in my PHP which was making my integers randomly go negative, or shorten, or change completely. But now I know it's something in the MySQL database - although I have not the slightest idea what.
[editline]27th February 2014[/editline]
Thank you for the input though. Everything and anything helps.
Second look at it.
Correct me if I'm wrong (and I probably am), but wouldn't the do()while not execute since $quoteIdEXISTS is FALSE outside of the do?
This would make that random number to be always updated on the database, which (if I understood correctly) is what was wrong for you.
[QUOTE=Coment;44070705]Second look at it.
Correct me if I'm wrong (and I probably am), but wouldn't the do()while not execute since $quoteIdEXISTS is FALSE outside of the do?
This would make that random number to be always updated on the database, which (if I understood correctly) is what was wrong for you.[/QUOTE]
Do-While loops will always execute once and then evaluate the "While" condition at the end to see if it should run again.
I really do appreciate the effort, though! I've been struggling with this since yesterday morning so really anything to make me question my code is considered helpful to me!
[editline]27th February 2014[/editline]
Wow OK, so I've done some really shawdy troubleshooting and discovered some stuff:
It looks like my BIGINT column is acting like a regular INT column.
I tried querying the ID with the largest accepted INT value (2147483647) and it worked!
But the strange part is it's not capping my integers like it would usually do if the value doesn't fit the datatype. It's very randomly choosing integers to just replace my 10 digit BIGINTs. The BIGINT column won't even accept anything larger than a 10-digit number!
What is going on here?!?!
[QUOTE=Poo Monst3r;44068615]For some reason, when I query this 10 digit number into the MySQL table, the value changes! Every time! Without fail!
I've started echoing the generated value before and after the query, and it is exactly the same. Just a 10 digit integer. However when I query it into the table, it literally completely changes. Sometimes it will turn negative (before I made the column unsigned), sometimes it will not even be 10 digits. And the queried value is [u]nowhere near[/u] the generated value. I've checked and double checked and I'm like 99% positive I'm not hitting and maximum integer limit. There is no ceiling that the number hits, it's just changing as soon as it's queried[/QUOTE]
[code]$quoteSrcSQL->bindParam(':quoteid', $quoteid, PDO::PARAM_INT, 10);[/code]
[i]PARAM_[b]INT[/b][/i]
There's your problem. [url=http://stackoverflow.com/questions/11938384/how-do-i-store-a-bigint-in-mysql-using-pdo](more info here)[/url].
Because of the PARAM_INT, PDO automatically crops $quoteid to the limit of MySQL's INT, which is 2147483647.
[QUOTE=Khub;44071115][code]$quoteSrcSQL->bindParam(':quoteid', $quoteid, PDO::PARAM_INT, 10);[/code]
[i]PARAM_[b]INT[/b][/i]
There's your problem. [url=http://stackoverflow.com/questions/11938384/how-do-i-store-a-bigint-in-mysql-using-pdo](more info here)[/url].
Because of the PARAM_INT, PDO automatically crops $quoteid to the limit of MySQL's INT, which is 2147483647.[/QUOTE]
Just tried PARAM_STR and it doesn't work either.
I'll try removing that parameter altogether and see what that does.
[editline]27th February 2014[/editline]
Yep, that worked!
Unreal!!! I've always done the same thing and never run into this problem before. Maybe because I set up this version of MySQL myself on a DigitalOcean Droplet. Maybe there's some sort of configuration for MySQL or PDO that changes this?
Thank you, thank you, thank you, Khub!
I can finally finish my work day with satisfaction.
Is there any (good) way of accessing a phones 'features' (Say camera or geolocation/GPS) in Javascript?
The best way would be HTML5
Geolocation: [URL]https://developer.mozilla.org/en/docs/WebAPI/Using_geolocation[/URL]
Video here [URL]http://www.html5rocks.com/en/tutorials/getusermedia/intro/[/URL] (first part seems to be about recording video to a file but I think further down it shows you how to use it otherwise)
[QUOTE=djjkxbox360;44071815]The best way would be HTML5
Geolocation: [URL]https://developer.mozilla.org/en/docs/WebAPI/Using_geolocation[/URL]
Video here [URL]http://www.html5rocks.com/en/tutorials/getusermedia/intro/[/URL] (first part seems to be about recording video to a file but I think further down it shows you how to use it otherwise)[/QUOTE]
yeah, I tried that and my phone isn't supported, which is a problem.
Is there an addon for sublime text or a program like Sublime Text that displays real time website changes?
[QUOTE=xianlee;44076810]Is there an addon for sublime text or a program like Sublime Text that displays real time website changes?[/QUOTE]
[URL="http://stackoverflow.com/questions/12823873/does-the-sublime-text-2-editor-support-real-time-html-css-preview"]I just googled Sublime Text live changes.[/URL]
[QUOTE=Moofy;44076936][URL="http://stackoverflow.com/questions/12823873/does-the-sublime-text-2-editor-support-real-time-html-css-preview"]I just googled Sublime Text live changes.[/URL][/QUOTE]
Isn't that just the same press F5 tho?
[QUOTE=xianlee;44076810]Is there an addon for sublime text or a program like Sublime Text that displays real time website changes?[/QUOTE]
[url=https://sublime.wbond.net/packages/LiveReload]LiveReload[/url]
You will need Package Control.
[QUOTE=gokiyono;44076516]yeah, I tried that and my phone isn't supported, which is a problem.[/QUOTE]
What phone have you got? Is it Android or?
[QUOTE=xianlee;44077317]Isn't that just the same press F5 tho?[/QUOTE]
Pretty sure this is the reason WHY he wants real time changes. It will change as he types, f5 requires you to switch applications, then you have to press f5, then the webpage has to reload and then you have to switch applications again
Thanks guys, Does anyone know how to change the background of your posts on Anchor?
[img]http://i.cubeupload.com/mFroS4.png[/img]
Can't seem to find it anywhere in the files as its inline css?
[QUOTE=djjkxbox360;44077842]What phone have you got? Is it Android or?[/QUOTE]
Yeah, an android phone.
(Samsung galaxy x1)
[QUOTE=xianlee;44077935]Thanks guys, Does anyone know how to change the background of your posts on Anchor?
[img]http://i.cubeupload.com/mFroS4.png[/img]
Can't seem to find it anywhere in the files as its inline css?[/QUOTE]
What do you mean by inline css? Just find the class that makes the background an overwrite it
[QUOTE=Moofy;44078139]What do you mean by inline css? Just find the class that makes the background an overwrite it[/QUOTE]
[IMG]http://i.cubeupload.com/jIBRKu.png[/IMG]
Its the top one.. 'inline' where as if it was in a style sheet it would say like the bottom
[QUOTE=gokiyono;44078067]Yeah, an android phone.
(Samsung galaxy x1)[/QUOTE]
Did you mean the S1? This is the only problem with Android, the whole issue of fragmentation of different Android versions. It's difficult to develop web applications when the browser is outdated. There's not really much I can suggest, your best option would be to try find a browser that supports the latest technologies (I don't know whether Opera mobile does) or use a custom ROM on your Android device to get a later version of Android
[QUOTE=xianlee;44078365][IMG]http://i.cubeupload.com/jIBRKu.png[/IMG]
Its the top one.. 'inline' where as if it was in a style sheet it would say like the bottom[/QUOTE]
Oh yea sorry I just forgot it's called inline when it's applied on the element.
Can't you just link your own stylesheet and overwrite the style though, it should work alike.
[QUOTE=Moofy;44079125]Oh yea sorry I just forgot it's called inline when it's applied on the element.
Can't you just link your own stylesheet and overwrite the style though, it should work alike.[/QUOTE]
I'm not sure how it all works, I don't understand PHP much, so I dunno which file links to the current sheets
[QUOTE=xianlee;44079573]I'm not sure how it all works, I don't understand PHP much, so I dunno which file links to the current sheets[/QUOTE]
Just find the <head> tags somewhere that links all files, and link your own stylesheet.
[QUOTE=Poo Monst3r;44070854]Do-While loops will always execute once and then evaluate the "While" condition at the end to see if it should run again.
I really do appreciate the effort, though! I've been struggling with this since yesterday morning so really anything to make me question my code is considered helpful to me!
[editline]27th February 2014[/editline]
Wow OK, so I've done some really shawdy troubleshooting and discovered some stuff:
It looks like my BIGINT column is acting like a regular INT column.
I tried querying the ID with the largest accepted INT value (2147483647) and it worked!
But the strange part is it's not capping my integers like it would usually do if the value doesn't fit the datatype. It's very randomly choosing integers to just replace my 10 digit BIGINTs. The BIGINT column won't even accept anything larger than a 10-digit number!
What is going on here?!?![/QUOTE]
It's wrapping around, not capping them. Sometimes when ints get too big they go to the largest negative value and then count up and keep looping around like that, that's why you were getting negative numbers sometimes.
So because Anchor uses PHP, is it possible to implement something on my actual website to display my most recent blog post? would it be simple to do? if so, which language?
Sorry, you need to Log In to post a reply to this thread.