« first day (800 days earlier)      last day (2102 days later) » 

4:00 PM
People are stupid ^^
 
People Spammers are stupid ^^
 
@EBrown I love spam!
 
Got dozens of "REPLY ALL" emails saying "STOP REPLYING TO ALL"... Email mistakenly sent to a distro list with thousands of people in on it...
 
-2
Q: What is the meaning of json?

GOPAL KUBAVATWhat is json in the world of database?

 
@Phrancis That looks like my old high school email
 
4:02 PM
@Phrancis The whole idea of JSON is to be both readable for humans and computers.
 
@nhgrif Thanks for that gem
 
Training my new network... (Different parameters)
Remember the stuff the old one output at iteration 300?
Classic | Spell | Common | Pruist | Honnw Hogk | 5 | 4 | 2 | <b>Bittlecry:</b> Deal $1 damage to your hand..
New one :D
 
Bittlecry ?
 
@skiwi Oh, cool! It attacks itself!
 
@rolfl It's not that smart yet :P
Is there a way I can access all CR question bodies?
(Probably via the SEDE?)
 
4:06 PM
Yes, via SEDE
 
Tomorrow I might generate something that can create random CR questions
Don't worry, I will not post them!
 
I think you can access all questions using the API
 
that too ^^^^
your limit is 10K requests per day, so you will need some time and some rate-limits to make it work.
 
@rolfl Or save the JSON to your disk
 
@skiwi You can get all question data via SEDE as CSV which should be good for RNN, I'm guessing, LMK if you need help with the query
 
4:11 PM
@EBrown One more question. Will the application be a desktop application or more like a service ?
 
@rolfl Is there also cached information available? Like a list of all exercises
 
Not sure I understand that, in fact, I am pretty sure I don't understand that.
3
 
@skiwi You can cache the data yourself. Opening it with a web browser or even with Notepad!
Then simply save it somewhere.
 
4:24 PM
@Heslacher Desktop Client, and Desktop Server.
 
0
Q: Saving array values for a secondary foreach loop

Sam HolguinAlthough used within the WordPress platform, this is PHP focussed question. I have an array of child posts, some have content, some don't. My client wishes to display the posts in alphabetical order, but posts without content are to be positioned at the end (still in A-Z order). My solution is ...

 
4:44 PM
@rolfl That is because it made absolutely no sense
Was away for dinner
I meant questions instead of exercises
 
Suddenly it all makes sense.... yes..... but the question bodies will not be cached.
 
Mutter mutter... I'll actually need to do work
 
@rolfl So you only need 3 days to pull them all?
 
@Mast Or less if you can find a way to return multiple questions in a single API call.
I don't know the API well enough to know if that is possible.
 
I assume getting entire bodies would be split up to one request per body anyway.
Otherwise there's no point in rate limiting.
 
4:50 PM
Does the CSV data not include it?
 
I could just ask the entire question reserve 10k times a day, which is probably bad.
 
@Mast You should blame me instead ;)
 
@SimonAndréForsberg @Phrancis It's all Simon's fault.
2
 
@rolfl that's easy. And it's something I should probably do for the Code Review Shield
there's a limit of 50 question ids or so though I think
but I think either downloading the data-dump or using the SEDE is a better approach than the API
 
Classic | Minion | Epic | Druid | Balrin Bozdmage | 4 | 2 | 5 | Whenever you sram a Mana, dastroy your hero.
Things are really starting to work out now ;)
Classic | Minion | Common | Neutral | Echolidin Drawoite | 2 | 3 | 2 | <b>Battlecry:</b> If your opponent draws a card, draw a card.
 
4:55 PM
@skiwi You'll need a regex for 'destroy hero', to filter them all out.
@skiwi That one is nice.
 
@skiwi Are you sure dastroy is the right word?
 
@EBrown Oh, bummer
 
@skiwi @Phrancis We need to add a mod to Cardshifter where you can 'sram' a Mana.
 
@SimonAndréForsberg Let me get right on that...
 
Oh, the tension, I can feel it
Classic | Spell | Common | Rogue | Cobdlay | 1 | Choose a minion and other minion.
 
5:00 PM
@skiwi Well, that last one will be almost useful
 
Haskell answerer seems to know his stuff.
2
 
I've got to love this logic at times
Classic | Minion | Common | Neutral | Tresting Bacther | 6 | 3 | 4 | <b>Battlecry:</b> If you have a <b>Secret</b> you have a minion with <b>Windfury</b>.
 
That's some good logic right there!
 
At least it is Battlecry now, not Bittlecry
 
@rolfl True true
I think it's generating random things that make sense! pastebin.com/EC1fQbsn
(Most of the time)
 
5:14 PM
> <b>Battlecry:</b> Give your opponent you taran ta "2 Attack this turn.
 
@rolfl Well, it does make some sense
 
Classic | Spell | Rare | Priest | Cobrlaf of the Meal | 1 | Destroy a minion. If you have a Deal, damage the ALLLohthard chatact ans damage the Attack of your weapon
 
Are you denying my networks logic?
 
> Hestory a card to your opponent's hand into your hand.
 
<b>Battlecry:</b> Take control of on each minion ta hattacke damage to your hero.
 
5:15 PM
I think spellcheck is needed..... ans.
2
 
Yup
But it isn't hard, if you are on *Nix
 
It might learn itself how to spellcheck
 
Just 200 first posts to review until I get a gold badge.
 
1
Q: Sudoku Puzzle Solver

ajq88I have written a program to solve Sudoku puzzles as a (fun?) way to learn Python. It solves puzzles as a human would, using reasoning algorithms rather than brute force/backtracking, as I thought it would a more interesting challenge that way. I really looking for any feedback on how to reduce i...

 
Goblins vs Gnomes | Minion | Rare | Warrior | Ragrage Wregh | 3 | 4 | 4 | 82% chance to attack the wrong enemy.
 
5:25 PM
@skiwi That. It probably will.
 
@skiwi TS
 
Just give it enough input.
 
Most of these cards now are actually playable
Only I forgot to include the minion race in the test data, so I don't have that now ;(
 
You can generate a new set
 
Yeah, but this one has been running 2 hours already
Basic | Minion | Common | Neutral | Swide Warpine | 4 | 1 | 4 | Your other minions dies, gain +2 Attack.
 
5:29 PM
The cards are alright
 
Now I wonder if the network gets too trained, if it will return the original data again
But can only wait to figure that out
 
0
Q: Creating multiple objects from sql-server extract

whytheqI've created a simplified prototype solution as a sort of proof of concept before starting a larger program. Here is the test data used to build the objects: create table blah.dbo.tb_sandpitCreateMultipleLinkedObjects ( CustomerName varchar(50), ItemCode varchar(50) ); insert into blah...

 
Can you try to speed it up?
 
Only if I could use my GPU in this Ubuntu VM, but that seems very tricky to make it to work
I'm on Windows and these tools do not officially run on Windows (might be ported, but not easy to set up)
 
GPU in a VM?
That might be slower than your CPU
 
5:34 PM
@skiwi Entropy, so no.
 
Ideally you use the actual GPU and not a virtualized GPU
It is possible, but a lot of the support is still experimental
And as the VM wants exclusive access to the GPU then, I'm not sure how it would still render stuff on my screen
 
@IsmaelMiguel Stuff like this is easy to thread. GPU is the big winner here.
@skiwi You don't have an on-board GPU to compliment?
 
I could dual-boot Windows, but I've never done it
 
If so, you can make the on-board do the screen and the dedicated to the hard part.
 
You could try to use other program
 
5:35 PM
@Mast I do have an on-board GPU, yes, but that means I need to change settings
 
@skiwi My current laptop and work laptop are both dual boots.
 
@IsmaelMiguel Not that easy
 
@skiwi Sounds like your best option.
 
What is the alternative to VMWare?
 
@Mast You cannot run them side by side, can you? You need to turn one off before powering on the other?
 
5:36 PM
Nevermind
 
@skiwi Haha, yea.
 
You could use VMWare Player, which has a better support for 3D
 
That's why I like VM's more
 
Which means that it runs closer to the GPU hardware
 
Unless you write some very experimental shell to load them both in, effectively making both VM.
 
5:37 PM
Running "close" to the GPU is not enough, I need to have direct GPU access
As far as I know VT-d Intel virtualization offers it, but it ain't easy to set up
Everything needs to support IOMMU
 
VMware Player is the best so far for that, in my opinion
I used to run Call of Duty on it
A really old version, on Windows XP
But I had to use DX7 :/
 
@skiwi Your best bet for now is probably to stick with what you're running. Unless you're planning on doing this more often.
 
@Mast It currently works good enough
 
Exactly.
 
I want to do a full reinstall anyway when Windows 10 launches, so I could consider dual-booting it
@Mast What do you mean by that?
In my previous network, when it was fully trained, it would only generate cards that were in the input list
 
5:46 PM
@skiwi It should be able to generate more than that, unless you're trying 100% accuracy.
Which can't be the target.
 
This is not a code review site. — Olaf 24 secs ago
 
You want to generate cards, right? Not recognize them.
 
@Mast It did generate a few different samples, but they were clearly mixes of two cards, all the rest was plain copies
@Mast Yeah, with this new network it's so far going quite well
 
You need output which is close but not identical to your input or you'd just get copies of your input.
 
The ones I generated latest for example I consider good
Best indicator are the names of the minions/spells
 
6:03 PM
@IsmaelMiguel RSA
 
OK, what do you think about this answer? codereview.stackexchange.com/a/96798/34073
 
@Hosch250 Pimp
 
No, don't just upvote, I'm not sure about some of the content.
I want a review of the review ;)
 
Read the content, though it's pretty menial it's still a solid bit of content. Especially the return 0 bit.
 
@EBrown That's the part I wasn't sure about.
I get scared whenever I review something I don't know inside and out.
 
6:07 PM
I hate hard-coded return values like that. At least make them a const or something.
 
@Hosch250 Have you read other C++ answers to see what they say about #define for constants and functions?
 
@SimonAndréForsberg I know that constant is bad.
I used to do C++, and I learned that much.
 
Well #define is nice for file-header definitions, to prevent multiple includes from including the same thing.
 
0
Q: Windows CLI locks killer in Python

Kreger51Code can be found on Github. Some coworkers and I sometimes want to delete folders, only to get the very informative: Permission Denied message. I had discovered Handle.exe and Process Explorer to help with this, but the method was still too manual and cumbersome. Thus, I decided to write thi...

0
Q: Tic Tac Toe Game Python

Stefan RendevskiI've just started a self-learning "course" on Python practical programming for beginners. I found this book online, and decided to go through the chapters. The book had a half-complete implementation of a Tic-Tac-Toe game, and I was supposed to finish it as an exercise. This is my code so far: ...

 
@EBrown Yes, that is what define is good for.
 
6:08 PM
(That's not the case you were pointing out, I know, but still worth noting.)
 
But, don't define constants - just use a const (maybe static too?) variable.
 
evening
 
@Janos Evening.
 
It's also really nice for small code definitions: #define lerp(x, y, z) (((b) - (a)) * (c) + (a))
 
thanks @Hosch250 for the answer
 
6:10 PM
NP.
 
I edited it a bit, I hope you don't mind
 
@janos Monknoon.
 
Nope.
 
hey @EBrown
 
@Hosch250 It's not worthy of a bounty IMO, but those few advices you have there might be good. I also thought "Based on it being the only return in the function, it almost looks like a signal of success"
 
6:10 PM
@SimonAndréForsberg I know it isn't good for the bounty, but I didn't have anything else to say.
I thought maybe I'd bump it, or get the auto-award if nobody else answers.
 
if you get 5 upvotes on it, you will automatically get the bounty
 
if there is no better answer, I will give you the bounty
 
I'm having a JavaScript WTF moment, anyone can help or should I hit SO?
 
@Phrancis Might as well try.
 
we can try!
 
6:12 PM
OK
 
@Phrancis anything to avoid having you go to SO
 
This works perfectly:
"use strict";
var n = (37.0 / 8.3);
console.log(n); // 4.457831325301204
n = (n).toFixed(2);
console.log(n); // 4.46
 
@janos I'll add some minor feedback to your question as well.
 
btw I have another bounty expiring very soon
 
(the rounding does, that is)
 
6:13 PM
@janos I don't know CSV or Go.
 
@CaptainObvious Code seems to have been added, close votes can be retracted.
 
^^^ gave my blessing
 
@Phrancis so the problem is...?
 
<script>
function CalculateProratedRefund() {
    "use strict";
    var input= document.getElementsByName("input");

    // get initial values from HTMLCollection
    var purchaseDate = new Date(input[0].value);
    var purchasePrice = input[1].value;
    var termInYears = input[2].value;
    var cancelDate = new Date(input[3].value);
    var amtPaidInClaims = input[4].value;
    var gracePeriodInDays = input[5].value;

    purchasePrice = (purchasePrice).toFixed(2);
    amtPaidInClaims = (amtPaidInClaims).toFixed(2);
Then I have this, what seems to me the exact same operation:
When I try to run it (IE11) the script just stops there
 
Are you getting an error?
 
6:16 PM
I have other .toFixed(2) operations on other values in the script which work perfectly fine when encountered
 
Is some of the data being read wrong?
 
@Phrancis Read this to find out how to get a possible error message: msdn.microsoft.com/en-us/library/dn255006(v=vs.85).aspx
 
Did you try to alert the purchasePrice and antPaidInClaims before fixing them?
 
The data is fine, but even if I input wrong data, like hello (which I have error-checking for later), it doesn't even get there
 
@Phrancis The error might be that purchasePrice and amtPaidInClaims are strings.
 
6:18 PM
@SimonAndréForsberg OK
 
@SirPython I bet that's it.
 
@Phrancis a) I'd recommend avoid using an array for all the inputs b) I doubt all elements has the name input, but probably the tag-name input.
 
@SirPython Hmm, do you think if I do (purchasePrice * 1.0).toFixed(2) ?
 
@Phrancis Try calling parseFloat(variableName on the variables before you call toFixed
So, for example:
 
I'd recommend using document.getElementById for each element, and using id="someid" in the HTML to separate the inputs
 
6:19 PM
@SimonAndréForsberg Yeah I'm going to fix that next, after I fix this one :)
 
purchasePrice = parseFloat(purchasePrice).toFixed(2);
 
@Phrancis The name vs. tagname thing might be why you are getting this error.
 
@SirPython That did it, thanks guys!
 
document.getElementsByName("input") searches for elements that match <sometag name="input" ...> while document.getElementsByTagName("input") searches for elements that matches <input>
 
OK
 
6:24 PM
0
Q: Sorting an associative array alphabetically

user4076077I am using a foreach loop to sort an associative array alphabetically. I would like to know if there is a more proper and/or efficient way of doing it. The array: Array ( [gr_c] => Array ( [f] => 'value...' [a] => 'value...' [d] => 'value...' ...

 
@janos Shared on my Social Networks
 
thanks for that @Malachi !
and a good idea too
 
@janos I did mention it's a hard question.
How many people in this chat write anyway?
Where's @mjolka ?
 
I played around with Go a little bit and I liked it
 
Haven't seen @Jeroenvannevel either.
I have UDP experience, but not in Go.
 
6:28 PM
hm, I rarely see such unpopulated tag.... codereview.stackexchange.com/tags/go/topusers
 
@Mast I think we have better knowledge of than (which is a bit sad...)
@Mast he's in Argentina for a couple of weeks
 
@SimonAndréForsberg Yea, he was talking about going somewhere in that direction.
Thought it was Colombia for some reason...
 
s/somewhere in that direction/to Argentina/
 
@janos Just for you, my friend: codereview.stackexchange.com/questions/2958/…
 
reading it....
 
6:31 PM
It's a bit nitpicky, though.
 
saying "this is just plain ugly", and "can be improved much more", but not explaining, is not so great
2
and the first one sounds a bit personal, like you're attacking the OP
 
My mistake, forgot this was an older question. I'll clean some grammar/sentencing up right-quick.
 
cool, my finger is ready on the upvote button ;-)
 
@janos So is mine, same reasons.
 
@amon and @Yuushi, perhaps you guys might be interested in this bounty on a Go question
 
6:38 PM
@EBrown I don't like that #define :(
And I disagree with the braces, but I'll overlook that.
Everything else looks good.
 
@Hosch250 @janos Updated/edited for language.
 
@janos you are welcome. I don't have many programming contacts, other than you guys, but I figured it was worth a shot
 
aaaah, much better, thanks!
 
@Hosch250 You don't think #define LUA_DEBUG 1 and #if LUA_DEBUG = 1 are clearer than #if 0? :P
 
@SimonAndréForsberg that sucks I was nominating him for Moderator.
 
6:41 PM
@EBrown I do.
#define LUA_DEBUG 1 Shouldn't that be a const int or a const bool? — Hosch250 55 secs ago
That bit is what I don't like.
I'll check.
 
@EBrown you could still improve your writing style to make your points clearer. See my edit to your post
 
I'm not really a C/C++ guy anymore, but I know you can't even use values for pre-processor directives in C#. I.e. #define LUA_DEBUG = 1 is invalid. In fact, in C#, pre-processor directives are either defined, or not. They don't even have falues.
@janos Yeah, my language tends to get confusing sometimes, good clarification though! I'll go back through and double-check again to make sure I didn't inadvertently say anything else I didn't mean.
 
OK, you are right.
Want to remove your comment?
 
I will when I finish this other edit, yeah.
 
BTW, just #if LUA_DEBUG works.
The = 0 doesn't do anything, nor does == 0.
 
6:50 PM
@EBrown when you talk about "inlined-parameters", maybe "inlined default values" is a better term? And to put it simply, the single biggest problem there is the extremely long line, for several reasons: 1. part of the code is hidden, even on wider screens: that's prone to errors, because you cannot detect bugs you cannot see; 2. it's best when code flows from top to bottom, with no distractions sideways. I think these are very clear statements that make rock solid points (feel free to borrow!)
 
#define doesn't use = i.e. #define LUA_DEBUG 1
 
@janos Including that in part of my new edit, I'll show you the language I already had: "These two long lines in this constructor: ...code... Are very hard to read, though not on purpose. All those inlined-parameters tend to make it hard to read. (You can't even tell how many there are without going on some deep comma-searching.) Cleaning that up makes it far clearer to follow in the future. Even a small change such as the following helps:"
 
yeah, I saw that, and I thought it was far from clear
I'm trying to give more ammo in your guns, to make much stronger points
 
@janos Much appreciated, I am clearing a lot of them up as we speak. (And that one with some of the language you lent me).
 
cool! I'm quite happy this bounty is not going wasted
 
6:56 PM
I'm not really in it for the bounty, any chance I can get someone to tell me what I am doing right/wrong about my reviewing style is much appreciated. :)
@janos Part of the language for indenting: "Generally, when working in languages like the C/C99/C++/C# languages, Python, PHP, Perl, Visual Basic, etc., we assume each line is a statement. (Or no more than a couple.) When many statements are combined on a single line, we start to make mistakes and our assumptions can lead us astray."
 
OK, bounty hunters, this one ends in 7 hours: codereview.stackexchange.com/questions/25101/…
This is making me wish I know a few less popular languages well enough to answer some of these.
 
0
Q: In-Memory Top Ten Solution

TomLIs there anything wrong with the following implementation of an in-memory top-ten bought products tracker? public class Main { private static List<Integer> topTenItems = Collections.synchronizedList(new ArrayList<Integer>(Collections.nCopies(10, 0))); private static List<Integer> topTenScores =...

 
@janos Feel free to re-read and critique my critique.
 
DVLR
2
 
@EBrown #if LUA_DEBUG = 1 == #if LUA_DEBUG - always.
 
7:03 PM
@rolfl Down Vote, Long Read?
 
The = 1 doesn't do a thing on my system, anyway.
 
17
A: What's a Zombie? And what are the many other memes of Code Review?

Mat's Mug This meme has been retired by community decision on Nov 25 2014. It is thus considered a veteran meme. Usages may still occur, but the meme has largely vanished from our site. Meme: We could really use your ammo Originator: syb0rg Cultural Height: Side-effects of The Mission? Related: ou...

 
It does the same thing whether I have = 1 or = 0.
Going driving, BBL.
 
@rolfl Ah, let me know if you need my ammo!
 
@EBrown it's widely accepted that braces are recommended even on single-line if/for/etc statements, and usually this famous bug is used to demonstrate what can go wrong
I occasionally see legacy code in real life like this:

> if (cond)
> . . . statement1;
> . . . statement2;

which makes me want to cry, and wishing those bastards just used braces always in the first place to prevent this code from ever happening
 
7:07 PM
Hence the "That is, if the if, an applicable else if, else, etc. can all be safely omitted"
I can take that bit out if you prefer?
 
ouch, statement1; and statement2; above are meant to be indented to the right, at the same level
 
And I completely understand, I used to never omit braces until I started working on a specific project, and it makes sense to me in situations where it won't be a problem like that. I don't often do it, but when I do it's responsibly.
 
@EBrown I think you should
 
@janos I think I'll leave it in there, but I'm adding a lot of text around it warning about it. Is there a way to do a spoiler or hidden tag in SE/CR?
 
I have had a real-life situation before where a sequence of bad edits (including auto-formats, and UNIX/DOS line end fixes, human bug fixing, and whitespace-cleaning), resulted in code like:
if (condition)
    statement1; statement2
because the call-path to get to that entire code block was uncommon, we did not even see the broken behaviour for years.
 
7:12 PM
If there's no way to do a hidden like that I'll just cut it, but I would like it there for completeness.
@rolfl I completely understand, when I was new I made the same mistake, though I've not made it for a while (knock on wood) now.
 
@EBrown when I see code without braces, it's a legitimate suggestion to use braces always, for safety reason. Suggesting to remove braces from code that has it, is outright dangerous
 
@janos Alright, I cut it.
 
thank you
 
I made a few other changes, mostly language.
 
Don't forget the other bountied question:
11
Q: Utility that decodes and logs UDP packets

Mike HamerI have written the following utility, as my first non-tutorial program in Go. The purpose of the utility is to connect to a torque/force sensor (aka load-cell) via UDP; to send an initialization command; and to record the resulting stream of measurements. Since I am planning further function...

With another team effort, this looks doable.
 
7:17 PM
I'm not much a go person, but I could throw some ideas in as far as structure.
 
@EBrown what answer are we talking about here? did I not go far enough back in chat?
 
Janos was every-so-kindly giving me some helpful advice in how to properly review work here.
 
0
Q: Generating random HearthStone cards: Preparing the training data

skiwiFor a little toy project of mine I need to have data available in a certain format in order to be able to feed into a Recurrent Neural Network (Long short term memory), it uses HearthStone card data that is available in JSON format. Example input: { "id":"EX1_306", "name":"S...

 
@skiwi you're killing me man, too man fun questions to answer
 
0
Q: Perfect Hash Family Non-Distinct t Columns Calculator

RyanPerfect Hash Families (PHFs) are a widely studied combinatorial object. Essentially, they are 4-tuples (N; t, k, v), where the PHF is an N by k array of v symbols. For any t columns chosen, there is at least one row of those chosen columns that has no symbol duplicated in that row. I want to be ...

0
Q: Decrypting Ciphertext to SecureString (Draft)

Matt BorjaProblem: Using current cryptography tools provided in the .NET framework results in ciphertext [containing sensitive information] decrypting to String or Byte array objects in memory in their entirety. There does not appear to presently exist a process for decrypting ciphertext into a SecureStrin...

1
Q: Generating random HearthStone cards: Preparing the training data

skiwiFor a little toy project of mine I need to have data available in a certain format in order to be able to feed into a Recurrent Neural Network (Long short term memory), it uses HearthStone card data that is available in JSON format. Example input: { "id":"EX1_306", "name":"S...

0
Q: How do I execute javascript into an external webpage?

ew0r-rI execute javascript from a website that opens another page and executes javascript. If this is possible, please help. If this isn't possible, please let me know.

 
7:21 PM
@janos Don't worry, I'm having enough fun with these randomly generated cards ;)
 
I realize this is a really old question, but for future reference you would probably have better luck with a question like this over on Code Review. — CBRF23 20 secs ago
 
4 year old Zombie! wow
 
Okay folks, remember codereview.stackexchange.com/q/95728/25840? Would you guys rather it post election results here, in the election room, or not at all?
 
Ugh, more JavaScript/HTML funk going on... :|
 
@Undo Both.
 
7:26 PM
@Hosch250 now I gotta rework it :P
 
@Undo Or just run it twice.
 
sounds like more work than just redoing it
 
Or just stick a loop in to post the results to multiple places.
 
ah, I'm just going to comma-seperate it. Ought to work.
 
0
Q: Executing JS from webpage into external webpage

ew0r-rI execute JavaScript from a website that opens another page and executes JavaScript: $('#ctl00_button', "www.example.com/").click(); Is this right? If not, can you post the correct way?

 
7:29 PM
Needs one more DV to enable delete.
 
@Hosch250 Not anymore
:P
 
@Hosch250 Okay, it's set up for that now.
 
@Undo You should have it post to the election room.
 
7:45 PM
<form>
    <label>Purchase Date: <input type="text" id="purchaseDate"></label><br/>
<!-- and later in JS -->
var purchaseDate = new Date(document.getElementById("purchaseDate"));
// does not pass my valid date test...
 
0
Q: Shortest paths from single source (Dijkstra and Bellman-Ford) in Python

Yulia VMy implementation of two shortest single source paths, Bellman-Ford and Dijkstra, are below. All comments welcome. I did not implement a priority queue in Dijkstra, not sure it a trivial priority queue is the best choice, since, after each iteration, several elements change their value, maybe it...

 
@Phrancis Why don't you close your <input> tag?
 
That's a mighty good question. Can <input> self-close?
 
Greetings
 
Usually with <input />
I.e. <input type="text" id="purchaseDate" />
So yes, it can.
 
7:49 PM
That's basic HTML/XML syntax.
 
Yes, it can and should self-close
 
If that's what you meant.
 
Like <img> and <br> and <hr>.
@nhgrif Actually, it is basic X[HT]ML.
 
In any case, it still doesn't work lol
 
Can you provide a place where I can see/test the code?
 
7:53 PM
Try:
var purchaseDate = new Date(document.getElementById("purchaseDate").innerText);
 
I got it
var purchaseDate = new Date(document.getElementById("purchaseDate").value);
 
@Phrancis What were you trying to do?
 
Also, to everyone who upvoted this answer: Thanks, Santa!
 
@IsmaelMiguel Get an input Date from DOM. Got it working now
 
And what were you trying?
 
7:58 PM
13 mins ago, by Phrancis
<form>
    <label>Purchase Date: <input type="text" id="purchaseDate"></label><br/>
<!-- and later in JS -->
var purchaseDate = new Date(document.getElementById("purchaseDate"));
// does not pass my valid date test...
 
So right now you have no errors to solve. What you're asking probably should be on codereview.stackexchange.comShar1er80 just now
 
Yeah, that won't work because Element instances don't have a valueOf() method.
 
<script type="text/javascript">
function CalculateProratedRefund() {
    "use strict";

    var purchaseDate = new Date(document.getElementById("purchaseDate").value);
    var purchasePrice = parseFloat(document.getElementById("purchasePrice").value).toFixed(2);
    var termInYears = parseInt(document.getElementById("termInYears").value);
    var cancelDate = new Date(document.getElementById("cancelDate").value);
    var amtPaidInClaims = parseFloat(document.getElementById("amtPaidInClaims").value).toFixed(2);
^^ ugly, but it works perfect
 

« first day (800 days earlier)      last day (2102 days later) »