« first day (531 days earlier)      last day (3480 days later) » 

12:00 AM
Anyone have time for quick PHP/HTML question?
 
RELOAD!
 
I'm getting POST from this radio button:
  <input type="radio" checked="checked" name="timeInterval[]" value="travelDays" />Days
  <input type="radio" name="timeInterval[]" value="travelHours" /> Hours
When I echo it, all it prints is "Array" what am I doing wrong?
 
@konijn thanks for the compliment earlier. It's nice to hear good things about your code now and then.
@mjolka I'm just going to pretend I didn't see that... Yup. Nothing to see here. Move along.
 
@Phrancis try print_r instead of echo?
1510:         for (;;)
1511:           {
1512:         int digit = MPN.divmod_1(work, work, len, radix);
1513:         buffer.append(Character.forDigit(digit, radix));
1514:         while (len > 0 && work[len-1] == 0) len--;
1515:         if (len == 0)
1516:           break;
1517:           }
@RubberDuck just for you
 
So then it printed Array ( [0] => travelBack ) is there a way to make it print/echo just travelBack that you know of?
 
12:09 AM
@Phrancis i'm not seeing the difference
 
Sorry, edited
 
ah
echo $timeInterval[0];
 
That worked! Thanks
 
np :)
 
12:24 AM
Thanks @mjolka. Just what I always wanted. Mid-braces.
 
@RubberDuck No problem, the funny thing is that this new SAP module called 'BPC' uses a lot vba scripting, so I am getting back in to that soonish. I find that hilarious ;)
 
hilarious funny, or hilarious not so much...?
 
I'd say hilarious funny ;) For a multi billion dollar to develop new tech with a basic dialect, muhahaha ;)
*company
You can most certainly expect a number of VBa questions
 
12:45 AM
That is pretty funny. We're doing everything we can to get away from it...
It is a workhorse though. It ain't pretty or fast, but it gets things done.
@Phrancis did you figure out your PHP problem? (Not that I could help, just curious =)
Ahhh. Yeah. You did. Good.
 
-1
Q: java 1 static interest rate

user56068Create class SavingsAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance indicating the amount the saver currently has on deposit. Provide method calculateMonthlyln...

 
@CaptainObvious Homework time!
 
Hahahaha!
 
I tried IE 11 and its developer tools also dump password fields in plain text. In other words, you have more serious problems to worry about than where the spaces are. — Zan Lynx 1 hour ago
 
1:02 AM
@Jamal I wish I had Homework like that ;)
 
@CaptainObvious does it get any more than that?
 
0
Q: Create `suffixes` Function on List

Kevin MeredithI wrote the following suffixes function. Given a list, it returns the list + all sub-lists. suffixes [1,2,3,4] == [[1,2,3,4], [2,3,4], [3,4], [4], []] Please critique my implementation. suffixes :: [a] -> [[a]] suffixes [] = [] : [] suffixes xxs@(_:xs) = xxs : suffixes xs

 
wut, LOLCODE has a ...Terminator brother?
IT'S SHOWTIME
TALK TO THE HAND "Happy Birthday to You"
TALK TO THE HAND "Happy Birthday to You"
TALK TO THE HAND "Happy Birthday Dear ArnoldC"
TALK TO THE HAND "Happy Birthday to You"
YOU HAVE BEEN TERMINATED
 
1:17 AM
Underloved answer
1
A: Convert an `int` to a C string with size limitation

glampertUse some constants: This char buf[sizeof x * CHAR_BIT * 10 / 33 + 3]; Would be a lot better if written like this: char buf[MAX_CONV_CHARS]; (or any other name your might prefer for the constant). Also, do you really care about being that exact with the size of buf? I usually just throw some la...

 
1:49 AM
@RubberDuck I wouldn't know how to answer that
 
2:02 AM
Has anyone present used the Brackets web coding software?
 
It may be an issue with the code; it works on phpfiddle but not in Brackets. I have a HTML form with an action directing to a PHP file. I fill out the form and click the Submit button, which is supposed to call the PHP file. But when I do in Brackets it says it "Cannot POST" the PHP file
I read this on SO:
> Make sure you don't have any kind of redirects, since you're using index.php to save data, you're probably reloading the page to show the updated comments. And if you're reloading, there'll be no data on $_POST to be printed
But have no idea why it would work one place and not the other
Could this have anything to do with it?
  <button id="submit" type="submit">Submit</button><br /><br />
 
Well....
Sorry, I have no clue
 
OK. I did notice on phpfiddle it does "reload" or go to a new page, with the results. Suspecting could be a phpfiddle bug... maybe?
 
2:17 AM
I'll look into it after. Busy trying to find Uni scholarships..
 
No worries mate.
 
Gah, this is hell
I have a uni where I currently am which WANTS me however as parents are moving south if I stay here it will be hard
 
Umm dude. Now is the time to get out on your own cuz.
Yeah, it'll be hard, but nothing worth it isn't.
The not coming along well @Phrancis?
 
PHP ever comes along well? ;-)
 
@RubberDuck Do you think it will be worth it?
 
2:36 AM
Idk. All I can say is that I've never regretted taking a risk.
You've just gotta be willing to do whatever it takes. You've gotta want it.
I've been adding to it as I run across crazy bs.
 
will do
that is a pretty small list ;)
 
I've only just started...
 
@RubberDuck I got a reply from the uni teacher I was talking to as well about your answer: "Given the importance of this decision, I would suggest seeking advice from professionals trained in student retention, rather than arbitrary strangers on the internet. In fact, the second half of that sentence is probably good advice in general."
2
 
Well, I am off to bed, this was fun ;)
 
I would agree with that. Lol
 
2:45 AM
Going to call up later and see what I can do
Btw, I have really been enjoying my time here :)
 
@TheFailure it's a difficult decision indeed. I moved out on my own at 20 y.o. to attend college. I had to share an apartment with a roommate and have a part time job to stay afloat.
 
To be fair though, Rubberducks give the best advice.
Yeah. I was there too. I ended up dropping out because I was broke. So, it's definitely a risk.
 
I had fun but at the same time I ate a lot of Ramen noodles
 
@RubberDuck true, but why are you so far behind @rolfl in rep?
 
The smell still makes me sick.
 
2:48 AM
@Phrancis 20...... I am 17 YAY!
 
Monkeys gives better advice.
 
^^^ that
 
Monkeys give advice more often, IMO. :)
 
^^^ that too
 
2:49 AM
:)
 
Although, I have given Mat's Mug some excellent SQL advice, but I think he wants to see it work before he comments ;-)
and a bounty-question has received 30-something views since I answered, and I think only the asker upvoted....
See, so rep does not just throw itself at me.
 
(aye, that was me)
 
How good is JDOM and why should I use it ;)
 
not sure why you're not getting votes on it
 
@TheFailure Good question, first ask yourself, do you need to use XML....
 
2:53 AM
@rolfl Actually I do have something I want to use it for
 
If you need to use XML (and Java), and the documents are relatively small (a few meg or less), then you will likely be better off with JDOM than any other in-memory model.
If you want blazing performance, then you want to use SAX, and not DOM
but at the cost of some pretty complicated code
 
@rolfl So a few meg max?
 
At some point you should use regular DOM just to understand why JDOM is so much better
JDOM is better than DOM when it comes to memory, but, none of the in-memory XML models are really worth it when you get to large documents.... where 'large' is about 10% of your system memory in the raw form.
 
Okay
Thanks :)
 
With XML there's two basic systems, streaming, or in-memory
either you process the data as it flies past, or you load it all up, and have 'random access' to it.
the 'random access' system is really intuitive, and easy, but you need to have it all in memory
 
2:57 AM
I will be using in memory
 
XOM, DOM, JDOM, and others all load the whole thing in to an object-oriented tree structure in memory.
SAX lets you watch the data stream past, and you pull out what you want as it flies by.
If you go with the *OM models, they all have the problem that you have latency restrictions (you have to process the whole XML stream before you can access any of the data), and you are limited by memory too.
So, if you are going the *OM route, your choices are DOM, which is good if you don't want to use external libraries (it is built in to the JVM). JDOM is good because I say it is, and XOM is the other common contender, which has a different philosophy.
 
> JDOM is good because I say it is - rolfl
 
DOM is in wide-spread use, but the problem is that it is a model designed for all languages (C, C++, Java, etc.) which also means it is designed for NO languages.
It has the same interface regardless of what language you use, and it is the lowest-common-denominator of all.
That's nice in a sense that if you change languages and so on, the XML API stays the same.
Unfortunately, it means in Java you can't use iterators, lists, sets, etc. in the places where it would be 'logical'.
JDOM fixes that aspect.
JDOM is all about doing things the Java way...
 
Sounds great
 
3:05 AM
Not bias in any way?
 
I wrote or rewrote JDOM 2.x, not biased at all.
5
(you did know that, right?)
 
Yeah
that's why I asked
 
OK, just checking. Yes, I am biased
 
If something doesn't work I know who to come after ;)
 
If something does not work.... yes, that ^^^ and, I am behind on some issues.
I try not to go on about JDOM here unless I am asked ... so thanks for asking.
 
3:09 AM
No problem
 
@rolfl I think your answer might be the best-performing solution.. but you may want to edit the small mistakes that make it a bit confusing...
 
monkey-typos?
 
> something that happened on date x will contribute to the MTD, STD, and YTD figures, but not the YTD Figures.
and it's sales.InvoiceDate ;)
TTGTB, will let you know how that goes tomorrow (pivot would be more cpu-intensive right?)
 
Thanks, Santa!
 
3:24 AM
@Mat'sMug It's not whether the pivot is faster or not, but the fact that there's no # table, and that the pivot is processing all the data, whereas I am just 'pivoting' one value per date.
@Jamal Wasn't me ... should it have been?
This is why C is complicated:
> You have both <cmath> and <math.h>, but you only need the former. The latter is a C library.
So, cmath is not the C math library, but math is.
 
Only math.h will work in C, while both will work in C++. It's not a super bad thing to use math.h in C++, but I believe it will import some unnecessary things, plus it's not under the std namespace.
 
3:40 AM
1.5gb for the next 5 days....
Maybe I will have to be a little less active
 
here ya go @rolfl i.imgur.com/yBdrB5T.png
 
Nice talking to you too.... :-)
 
Agh, PHP... Do I have to sell my soul to get $_POST to work?
 
@Phrancis Give me 1/2 your soul and I may do something
 
lol
 
3:47 AM
@Phrancis I will do something completely unrelated
 
I don't blame you
 
@konijn I've approved your synonym suggestion in reverse, making the master and the synonym, to be consistent with Stack Overflow.
 
Alright I'm obviously missing something fundamental, been trying to make this work all evening... I'll go to SO if need be but I feel it's something minor...
 
@Phrancis what exactly is wrong?
 
if he knew that ....
TTGTB... night alll
 
3:59 AM
(test.html)
<html><body>
<form action="test.php" method="POST" id="test" name="test">
    <input type="text" value="" size="30" maxlength="100" name="testInput" />Test<br />
    <button id="submit" type="submit">Submit</button>
</form>
</body></html>

(test.php)
<?php
$test = $_POST['testInput'];
echo $test;
?>

(upon typing input and clicking submit)
(output: Cannot POST /test.php)
Stuff in parentheses isn't in the code so you know
 
It's probably a hosting/setup issue rather than a problem in the PHP code itself.
 
No problem with it for me
 
hmm. @200_success issues like that could even show up in locally hosted files all in the same folder, you think?
 
What do you mean by "locally hosted files"?
 
Stored on hard drive in a folder; default folder used by application
 
4:13 AM
There is no webserver that serves it?
 
That's correct
 
Then which process executes the PHP?
 
Hell if I know, maybe that's the problem right there
2
PHP needs a webserver I'm guessing?
If that were the case it would explain why it works on phpfiddle but not locally
 
You are guessing correctly.
 
@200_success how I wish you had said that some 3 hours ago lol. Thank you kindly
 
4:29 AM
0
Q: Automatic password security test for WordPress

morissetteI was bored the other day and wrote the following little script to attempt to find insecure passwords for WordPress blog owners so they could be notified of how easy it would be to crack their WP admin password. I am mainly a Perl/PHP developer, so I want to make sure any Python work I do sticks...

 
4:58 AM
Monking @all
 
Monking @Heslacher!
 
0
Q: Logger facade code for configuring multiple loggers are runtime

Mrinal KambojFollowing is the code for a logger facade that I have created, which can be used to log via any of the standard and configurable loggers like log4net, BitFactory, currently I have just integrated these two. Salient features are: Logger can be changed at runtime, every iteration can use a differ...

 
monking @all
 
I'm writing a script like this...
if ( is_numeric($foo) ) {
	// bunch of code here
	// bunch of code here
	// bunch of code here
	// bunch of code here
	// bunch of code here
} else {
	echo "Variable foo is not numeric";
}
Would it be cleaner/smarter to check for numeric after all the //bunch of code here or to keep like that?
Hey @janos
(in other words, I wish there were an is_not_numeric function)
 
@Phrancis if // bunch of code gets long, and the else block is small, you might want to flip the condition
!is_numeric($foo)
 
5:08 AM
Holy crap, you just made my day
 
because, by the time you read the else, you might not remember what it was for
nice :)
works both ways: happy customer makes my day too ;-)
 
It just made sense to check for a negative condition, when expecting otherwise, at first, if just for readability... Never knew what ! operator was for until you mentioned it
Of course, my dumb ass would never have figured that out, having used != operator I never made the link :)
 
it exists in most languages. It's a big surprise that in Python it doesn't, there you have to spell out not
 
In SQL it doesn't either, or at least it's been deprecated
Always found the <> operator instead of != kind of odd.
 
btw, I just saw your messages about php and web server... you know, if you go with Python instead of PHP, the Python-based web frameworks come with a built-in web server, so you don't have to install an apache. So much more straightforward
 
5:16 AM
Well, I do have a web server, just didn't dawn on me until a birdie fishie told me so lol.
 
Flask is a light-weight micro web framework flask.pocoo.org/docs/0.10
 
But you may very well be right about it being more straightforward
 
0
Q: Calculating budget for employee hierarchy

amdubeYou have to write a C++ program that reads in the employee hierarchy of a company and computes a statistic called 'salary budget' for all employees. For this problem, the 'salary budget' of any employee is defined as follows: For employees who are not managers, the salary budget is same as thei...

 
monking @all
 
@CaptainObvious missing some code there?
 
5:29 AM
> What are the problems with this code?
Yeah, I think you've answered that question. ;-)
 
0
Q: Java perfect numbers with only for loops

Grey DawnI made this program to print every number up to whatever number the user and then print the original number, and then its divisors. If the number is perfect, it will say perfect number after the divisors, like this (6: 1, 2, 3, 6, perfect number). The code below works sufficiently; however I cant...

0
Q: Finding is a given number is in a given range based on a flag

AnirudhI am starting out on Python below is the question Description: Given a number n, return True if n is in the range 1..10, inclusive. Unless "outsideMode" is True, in which case return True if the number is less or equal to 1, or greater or equal to 10. in1to10(5, False) → True in1to10(11, ...

 
Monking @chillworld
 
@mjolka comparison operators seem off on that Python one... 1 and 10 input both would return **False** wouldn't they?
 
right @Phrancis
 
@Phrancis i was wrong, it seems to work
 
5:38 AM
if ( !is_numeric ($timeAmount) ) {
    echo "The amount of time you entered is not numeric.";
} else {
}
 
let me use this opportunity to show off some Python coolness, the condition can be written as:

if 1 <= n <= 10: ...
 
Is this else {} block superfluous?
 
yes, if you don't need anything in it, don't put it there
 
Gotcha
 
mjolka beat me to it
 
5:45 AM
@janos great minds ey :)
 
Is n as a variable name for a number used commonly, or only in short/example scripts? (generally)
 
only in Python you'll see 2 people produce exactly the same code: thanks to the strict formatting rules and standards like PEP8. Make life so much easier
n for "number" is acceptable in formulaic functions like this one
 
there's so much that's nice about python... but i just can't imagine going back to dynamically typed langs
@janos do you understand OP's comment?
Well you could do this but I tried to use python's verbose mode for high level translation, too many logical operators make it more confusing, don't you think? — Anirudh 2 mins ago
 
what is "python's verbose mode for high level translation" ?
 
nfi
 
5:50 AM
@mjolka nfi?
 
no flippin idea
 
:)
 
sorry, thought that was a universal expression
 
maybe it is. tons of things I don't know
I learned JK in this chatroom, for example
 
you mean you didn't waste your youth in chat rooms like i did? :O
 
5:55 AM
haha, maybe, making up for it now :)
 
@mjolka if that makes you feel better I got it right away ;)
Is this good or should I connect with an elseif {}?
if ( $userName == '' ) {
	echo "User name must not be blank."
}
if ( !is_numeric ($timeAmount) ) {
    echo "The amount of time you entered is not numeric.";
}
Or a better way to check for blank input...?
 
@Phrancis What language
 
Well, that doesn't even work, so I guess there is my answer
 
php
 
6:02 AM
 
HAhahaha, I realized how stupid I was asking
 
Just found IsNullOrEmptyString wordy but that should work
 
@Phrancis ^^^^
 
I don't know... why not?
So many different ways to do the same thing... if (strlen($str) == 0){}
 
@Phrancis elseif is good when you have mutually exclusive conditions. In this case these 2 conditions look unrelated, so the two ifs side by side seem natural
empty($userName) ?
 
6:08 AM
What about isset($userName) ?
 
hasLength($userName, length)
 
Seems like there is not one that checks for null and empty string together...
Or would hasLength work for that?
How about this?
if ( isset($userName) || is_null($userName) ) {
	echo "User name must not be blank or null."
}
 
night all, have a great weekend :)
 
you too @mjolka
 
Night @mjolka :D
 
6:14 AM
empty returns true for both empty and null: sounds like what you want
 
Ah ok perfect
The more I work on this script, the more it feels like a hack. Hopefully when I post for review I am proven so :D
 
6:32 AM
morning
 
morning, I gotta go, will be back later
 
Morning @JeroenVannevel
 
6:51 AM
function isValid($string) {
    if ($string == null) return false;
    return (strlen($string) >= 1);
}
 
Monking
 
0
Q: Simple TakeOut Menu

ParanovaThis is for my intro level C++ class. This is the assignment: Write a program that displays a takeout menu from which a user can place an order. The program begins by displaying the menu and prompting the user to enter a choice. If the user enters 1, 2, or 3, the program responds by a...

 
Monking again
 
@Phrancis
Oh strlen will return false if given a null value
News to me
Whoops
 
7:03 AM
?
 
@CaptainObvious <-
 
@EngieOP I may take a shot at it
 
Ouch... hard-coding much?
 
How much ammo do I get?
 
I think 20 votes on CR and 20 stars in here
 
7:05 AM
"it" referring to whoever wrote the code
2
 
40 votes,
 
I want to answer it....
 
@TheFailure it or "it"?
 
Don't go blind.
 
@EngieOP you shouldn't be so... aggressive in your review.. and you should spell out for OP what he did wrong,....
and not tell him "this is crap"
 
7:07 AM
Why not?!
 
without explaining why, so that he can understand.
 
21
Q: How to be a nice reviewer?

Pimgdfrom Remove Nth Node from End of Linked List: Bug: n < 0 leads to you removing the last node. Your solution should have comments: I have NO idea how it works. And that's after reading it a couple times. If this was production code, I'd have wrapped it with unit-tests, thrown the impl...

@EngieOP ^^^
 
Answering these beginner questions is the only way I get rep
 
@TheFailure answering beginner questions is perfectly fine, there are many of them. It's just using some tact is beneficial, especially with beginners. I feel that is largely what determines whether or not they will come back to CR next time they feel icky about a piece of code
 
instant mod-nuked question inb4
 
7:19 AM
alright alright .-. ._.
 
0
Q: Why am i getting different output every time I put in the same input?

Armon SafaiThis is a program where i make a linked list and print out the values of the linked list. When i enter a specific sequence of numbers, sometimes the program terminates out of nowhere, and sometimes it doesn't terminate. This happens when i enter in the same input. Sometimes it would work and some...

 
@Phrancis Is this better?
 
@EngieOP can you link "this" again for me please?
 
@EngieOP Ok the code is a mess
 
0
Q: Simple TakeOut Menu

ParanovaThis is for my intro level C++ class. This is the assignment: Write a program that displays a takeout menu from which a user can place an order. The program begins by displaying the menu and prompting the user to enter a choice. If the user enters 1, 2, or 3, the program responds by a...

 
7:29 AM
5
Q: Where do birds go when it rains?

PimgdXKCD inspired... I was reading the comic and went "well, where do they go when it rains?" I know that when it rains you usually don't see any birds flying through the sky. I imagine they hide in trees. But what if they're busy trekking to warmer lands? They can't just keep hiding until it's dry ...

Sooo... 2347 views and no good answers yet
now what
 
@Pimgd wait and drink [beverage of choice, but preferrably tea]
 
Cuke
 
lol nice @Pimgd
 
@EngieOP that is quite nicely worded IMO.
 
ah okay, xP
engieUNion
 
7:34 AM
@Pimgd it may be too broad of a question, more Wikipedia-style answer/article needed. I've seen different birds act way differently in rain. Just take crows vs. chickens for instance
 
IT Crowd anyone?
 
Ducks, finches, hawks, albatross, pelicans, turkeys...
 
:)
 
I'm getting a Unix timestamp error... and they are calculated in seconds from 1970. Awesome, this is gonna be fun.
 
7:41 AM
Computerphile anyone?
 
@EngieOP Gah I want to give up on this question
 
yeah but its approaching 2.5k views... and it's been only 17 hours.
I think I've got more views on my question than on all the other questions asked in the past 3 days on Biology SE
 
> When Tue, 19 Jan 2038 03:14:07 UTC rolls around, timestamps will rollover—to a value that equates to Fri, 13 Dec 1901 20:45:54 GMT.
 
See also: Numberphile - the end of time
Question... how would you guys order a "answering guideline"??
 
lol who starred "engieUNion"? We were the reason behind all those Mann vs. Machine trolling engineer rants on Steam Community. I'm sorry, but it was hilarious. ._.
 
7:47 AM
> Avoid stating absolutes:
> Understand the askers level of expertise:
> Be a nice reviewer:
> Short answers are okay:
or would you do it differently?
 
> Remember when you once were less skilled;
> Share tips to improve what would have helped someone of your skill at that time;
> Share a few more advanced, but not too advanced concepts to improve further;
^^ my take :)
 
urgh.. rewrite inc...
 
@TheFailure ( ͡° ͜ʖ ͡°)
 
@EngieOP I am still going on it
 
@EngieOP the star was me... it just sounded funny, had no BG information :)
 
7:56 AM
0
A: Checklist or General Directions on how to write a good CR-ish answer

Vogel612There's a few things you might want to follow when reviewing code: Understand the asker's level of expertise: Some answers here on codereview are really in-depth. They address issues, that only experts could find, sometimes in ways, that only experts understand. While these answers are awesome,...

here goes, critique wanted ;)
 
@EngieOP why the face btw?
 
Kudos @Vogel612, I might chime in; the insomnia is strong in me tonight.
 
/me bows
the permanent pinging is like applause...
 
No reason lol.
I frequent 4chan a lot. 11.18.12 Nvr 4get.
 

« first day (531 days earlier)      last day (3480 days later) »