C++ Questions and Answers

Solve problems and approach solutions. Just ask and lurkers wi...
Aug 23, 2016 08:38
Thanks. I will give it a read
Aug 23, 2016 08:35
Well, I think the problem lies somewhere else. I made a working example on coliru.stacked-crooked.com/a/9567999bc13d9e1a and it works just fine.
Aug 23, 2016 07:23
Well, I'll try investigating by myself some more. Yesterday, I was slightly confused and slightly frustrated (oh, and sleepy) so in the end I just came here and posted my question. If it still doesn't work, I'll post a working example.
Aug 23, 2016 07:20
I thought I had clicked the fixed font button while inserting the code. I probably messed up something.
Aug 22, 2016 22:05
I think the second statement should become
y = y;
when xtr is false.
Aug 22, 2016 22:03
well, I wanted to ask what's the difference between

if (xtr) {
y = y - x % 2 + (yt > (this->hexagon_height * 0.5f));
}

and

y = y - (x % 2 + (yt > (this->hexagon_height * 0.5f))) * xtr;

whereas xtr is a boolean. The if statement seems to produce the right result while the second statement does not.
Aug 22, 2016 22:01
woops
Aug 22, 2016 22:01
if (xtr)
y = y - x % 2 + (yt > (this->hexagon_height * 0.5f));
y = y - (x % 2 + (yt > (this->hexagon_height * 0.5f))) * xtr;
 

PHP

Support group for those afflicted with PHP. Don't ask to ask, ...
Sep 19, 2015 07:22
Oh, and good morning
Sep 19, 2015 07:22
I really shouldn't do things first thing in the morning as I even failed to ask the question that I actually wanted to ask and now I know the answer myself :I
Sep 19, 2015 06:35
Oh, and it would be more of a service kind of CMS, meaning that I generate files on my server and send the static content to their hosts.
Sep 19, 2015 06:28
I'm thinking of a theme for my thesis paper and need some opinions. Would writing a CMS that always generates static files upon every update would be actually beneficial? It would be aimed at people who update their websites rarely (about once a week or less) or to people that have, let's say, 5 static pages and they would like to have the ability to change their content in an CMS environment without fiddling with HTML
Aug 25, 2015 08:37
Heh, my convenient way of programming resulted in a 10 minute long script due to database queries inside loops.
Aug 24, 2015 21:37
Well, I gathered a lot of useful information today. I should probably rest for today and have a go at optimizing my little tool tomorrow. Thank you for your input everyone c:
Aug 24, 2015 21:34
There's also settype()
Aug 24, 2015 21:33
doesn't PHP pick the best suitable datatype for you? And if I remember there are (int) and such (or was it in javascript)
Aug 24, 2015 21:27
Yeah, I'll use a query like that for creating a temporary table with the new data and then compare it with the existing on the backup database. Though that's the one query I can't think of. I mean I have to compare if it exists, if the "likes" and "source" are updated and update them. Same for new or deleted tags.
Aug 24, 2015 21:20
oh and who could forget TOP
Aug 24, 2015 21:20
I just can't wrap my head around how to properly write the SQL queries I need. We had like a full year on databases, half a year dedicated to SQL and all we did was SELECT, INSERT, UPDATE, DELETE, INNER/LEFT/RIGHT JOIN, ORDER BY, GROUP BY and that's pretty much it
Aug 24, 2015 21:10
I wonder how can I make them not in loops
Aug 24, 2015 21:09
"<...> take care to not do sql queries in loops" :I
Aug 24, 2015 21:06
@ThW oh it's not an app, just my blog's backup tool. Though it takes 10 minutes to fully resync all of the data so I was wondering how could I optimize it
Aug 24, 2015 21:01
If that worked on a console window, it'd be great :D
Aug 24, 2015 20:56
hm, probably I misunderstood something
Aug 24, 2015 20:55
@PeeHaa "by storing precompiled script bytecode " isn't that what HHVM does?
Aug 24, 2015 20:54
I'll look into it :)
Aug 24, 2015 20:54
@ThW OPcache description reminds me of HHVM a bit
Aug 24, 2015 20:45
though I should probably write a proper program instead of running a php script as my blog's backup tool :/
Aug 24, 2015 20:39
I wonder what impact rate would have using single quotes instead of doubles on something like a Raspberry Pi. Though I use new lines and color codes so I can't switch to single quotes probably :/
Aug 24, 2015 20:14
Oh, you can even save some processing time? Neat
Aug 24, 2015 20:13
It's just that I see double quotes used when there are no variables nor new lines or other things that can be used and that somehow doesn't go well with me...
Aug 24, 2015 20:12
@Machavity I am aware of that. Though I forgot that at the same time c:
Aug 24, 2015 20:10
I myself like more when people use single quotes in PHP versus doubles, though double quotes really seem appealing sometimes
Aug 24, 2015 20:09
@Machavity Say, do you feel the same when people use echo 'this and that'; versus echo "this and that"; or the other way around?
Aug 24, 2015 20:06
@tereško the more you know
Aug 24, 2015 20:04
and congrats
Aug 24, 2015 20:04
oh they're valid
Aug 24, 2015 20:02
is it valid html to use single quotes instead of double? First time seeing someone use single quotes
Aug 24, 2015 19:59
is there some new specification or what?
Aug 24, 2015 19:59
why don't you use value="" instead of value=''?
Aug 24, 2015 19:42
Maybe you need to escape it?
Aug 24, 2015 19:39
it shows me an error in json
Aug 24, 2015 19:39
Aug 24, 2015 19:34
@Tsea did you try
$array = json_decode('[{"name":"Penguins.jpg","featured":"0","category":"0","caption":"","alt_text":""‌​,"blog_ide":"ugNQpbo6G7E"}]');
echo $array['name'];
?
Aug 24, 2015 18:30
Oh and I found what was hogging all of my server's RAM @Orangepill - systemd-journal was at fault. I disabled it for now.
Aug 24, 2015 18:27
I think that they probably silently sign you up for some "special services" that bill you annually. Now that I reread the Privacy Policy it only talked about email and credit cards and no mention of a phone number nor anything related to it
Aug 24, 2015 18:23
I just randomly discovered it through stackoverflow and that massive discount really interested. Not in a way that "I want to buy it" but "what's the catch?"
Aug 24, 2015 18:15
I tried accessing the same website through a proxy and it doesn't show the offer while when I access from my IP, it shows that the offer is limited to my country
Aug 24, 2015 18:14
Well this is interesting
Aug 24, 2015 18:13
Well, the Privacy Policy say that they would never do that. Though the offer seems too good to be true