« first day (1874 days earlier)      last day (2146 days later) » 
00:00 - 19:0019:00 - 00:00

7:00 PM
Comment wanted:
0
Q: How can I find a subarray with arbitrary elements randomly?

Saman2018I have an array with 100 elements. Array elements are a set of ones and zeros. For example, Array[100] = {0,0,1,0,1,0,1,1,1,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,1,....,1} If we assume that variable needed has the value of 2, then the "find_gap_randomly" function selects 2 contiguous zero elements (A ...

I can't quite see why that one's closed...
@200_success @StephenRauch @SamOnela ^^
 
Calling for specific rewrites.
2
 
0
Q: Bash evaluation using crazy passwords

Christian BongiornoI have some code that is loading passwords from AWS SSM and then using them through the script. I am really concerned that some funky password character is going to be used that is going to get interpreted/escaped/munged by bash. The code in question is below. Are there any obvious problems here?...

 
7:22 PM
@SimonForsberg Comment added
 
@SimonForsberg I agree with 200, I'd VTC as feature request as well.
@202_accepted That's usually the moment to shine up your resume.
Before it gets to the GTFO stage.
Which is usually 6-8 weeks later.
 
Should I flag a code-dump answer as NAA? Or is downvoting and commenting sufficient?
 
depends, actually.
usually you'll want to flag it for us mods to put a notice on it. If there is one already, we usually won't do much with the flag
do comment (and optionally downvote) regardless of the flagging status
 
@bruglesco I usually NAA it unless it already has a notice.
Pythonista's around?
"You don't want your user to type in something crazy and crash the program." That's not the only problem either. I can probably whipe the harddrive of my computer by inputting the (exact) wrong operation. Isn't exec just as bloody dangerous as eval? — Mast 45 secs ago
 
Okay thanks
 
7:32 PM
welp. haven't seen that many flags since I was a mod...
 
@Mast Nah this is the usual bickering.
This feud is 16 years old at the moment.
3
 
Wot
 
0
Q: Find minimum depth in a binary tree

CodeYogiDescription: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no children. Leetcode Code: class Solution { public int minDepth(TreeNode root) { ...

 
@Mast Yep.
 
Sorry, but I have to downvote for the suggestion to use exec. That is a firable offense in my book. — Hosch250 9 secs ago
Future employees take warning ^
 
7:45 PM
Yuck, that's a horrible "solution"
 
@Hosch250 Agreed.
Code Review answers should make the code better. Not worse.
 
@Mast: At least not without good reason
 
8:10 PM
0
Q: Console based Vocabulary Trainer

Sandro4912I wrote a console based Vocabulary Trainer to practice C++. Its possible to add and remove Vocabulary and practice it with it. I safe and read the vocabulary from a file to be able to read it. Also certain settings like target and source language color of the console get saved in a settings f...

 
This is not an answer, this is part of your question as what you have tried. And if you have a solution but looking for a better way, code review is where you want to post, not here. — anishtain4 28 secs ago
 
I think today has been exciting enough. Just had an employee collapse and I ran around the building looking for a defibrillator, then broke into his phone to get his emergency contacts.
 
8:27 PM
welp.
hope they made it...
 
He's doing alright at the moment.
He was responsive when EMS took him out.
He's a real nice, guy. Real young, too. I feel bad for him.
 
@200_success @Mast "Now, I am curious to know how I can write this program in a more readable code with or without using random library, preferably for OPNET network simulator." ? I don't see that as "asking for specific rewrites" at all.
> with or without using random library
> preferably for
that's as vague as it can get.
> I am curious to know how I can write this program in a more readable code
^^ this however, is clearly our area.
 
@SimonForsberg Maybe "preferably for OPNET network simulator"?
I think it's fine, though. (Cast a reopen vote, anyway.)
 
@SimonForsberg Yes, but not what was asked.
We can give advice about just about any code. That's not the problem. But if OP doesn't want the advice, it stops.
A feature request is not a request for review. Simple as that.
 
8:49 PM
0
Q: Better way to update an object's value [javscript]

invotI am working on some software that reads/writes information in localStorage using a handler. You can find a working example here: http://jsbin.com/wifucugoko/edit?js,console My problem is with the segment of code below: _t.set = function(path, value) { // Update a single value or object ...

 
9:00 PM
0
A: Fix base64 data URI scripts function

sineemoreWatch out! jQuery is full of secrets. html method is not just a simple wrapper around innerHTML property. Possible fail condition: var src = `if ("<x/>" !== "<" + "x" + "/" + ">") { console.log("Math gone wrong."); }`; $("<script>").html(src).appendTo(document.head) <!-- latest jQuery -->

 
@Vogel612 I knew there was an auto-flag for too short, you're telling me there's one for too long as well? After we got our limit raised?
That or you're pulling our leg.
My sarcasm sensor is a bit off.
 
tl;dr jQuery html method is not safe for JavaScript input.
 
@Peilonrayz Well, turns out exactly like that.
@sineemore Nothing about JavaScript is safe.
@pacmaninbw If that turns out to work much better than the junk I currently use, I'll drop mine and polish my C#.
 
@Mast, I'm about XSS vulnerability in the code from the question I linked. The accepted answer is "Awesome, no problem".
 
@sineemore Got a link with that?
I still got a couple of downvotes left today.
 
9:06 PM
Above
 
Oh, konijn.
hides
 
Mm, please explain ^.^
 
Your answer could use a bit more explanation because I currently don't follow.
But looks like you found something interesting.
 
Yep. I am sleepy as hell, but I'll try.
 
@sineemore konijn is one of only 3 JavaCcript gold badge earners :)
 
9:10 PM
@sineemore Top, thanks :)
@Phrancis And kind of a legend around here. He was active here before half of the current regulars.
At least.
 
Guys, I've posted days ago a link to pastebin with question body. There was some broken MathML that rotates small fancy shurikens.
 
@Phrancis Gold badge doesn't mean anything. I've noticed a few who consistently post mediocre answers.
 
How may I find my old posts?
 
@sineemore Check your profile.
Oh hey, SO must be trying to woo me back after my rant. They just gave me a yearling badge.
 
@Hosch250, hm, that post was here in 2nd Monitor..
 
9:15 PM
I know, I was just joking.
That's an automated badge.
 
@sineemore If you're talking about chat messages, there's a search in the top right of your screen.
 
Oh.
^.^
I'd better check surroundings.
Can anyone investigate this?
https://chat.stackexchange.com/transcript/8595?m=45048319#45048319
 
9:30 PM
@Vogel612, can you check the link?
 
TIL that the C++ <random> header is still not foolproof for basic usage -.-
 
@hoffmale How?
 
int get_random(int min, int max)
{
    std::random_device rd;
    std::mt19937 mt(rd());
    std::uniform_int_distribution<int> distribution(min, max);
    return distribution(mt);
}
 
Oh i saw that.
What result are you getting?
 
It's implementation defined, but basically the standard doesn't guarantee that creating a new std::random_device will produce a new sequence
 
9:38 PM
Thats why you should create a static PRNG and seed it once.
 
On some platforms without a true randomness source, this might be equal to int get_random(int min, int max) { srand(0); /* calculate distribution with rand() */ }
(at least conceptually)
 
"I would like to get an objective technical review" - Code Review. — Turing85 49 secs ago
 
@CaptainObvious Got Jenny's (phone) number as the PIN (in the jsbin example)
 
@SamOnela deserves an upvotes just for that.
 
@Mast yes, there is one for "too long". And in general the flags are noise on Code Review
@sineemore seems like
mathjax just works that way.
 
9:49 PM
Ok, thanks.
 
you can of course open a on Code Review Meta
I can poke a dev about it, but AIUI this is just MathJax working not quite as intended
 
@Vogel612, MathJax has a safe mode which is not enabled on SE.
 
now that sounds like a feature request
 
@SamOnela LOL!
Tommy Tutone's Jenny, I assume?
 
@Vogel612, originally I was trying to exploit it to run some JavaScript. Also, it is possible to set own class names to created elements. Like .popup, which will act like a real popup on SE.
 
9:53 PM
Is that like EAV's Rosi?
 
@Hosch250 TTBOMK yes
 
What's that acronym?
 
~AFAIK
(To The Best Of My Knowledge)
 
Oh.
I know of the song, but not a big fan of it, so I don't have the number memorized.
 
867.5309?
Did you know that as a result of that song the U.S. no longer assigns that number for any area codes?
You can buy it, IIRC, but you won't be auto-assigned it.
 
9:58 PM
@202_accepted Yeah, I did.
I've got to buy it and see if I get any calls.
I doubt it now.
 
> In 2013, the number was still ringing up fifty misdialled calls daily for Florida realtor Carrie Routt[35] in area code 850.[36]
"867-5309/Jenny" is a 1981 song written by Alex Call and Jim Keller and performed by Tommy Tutone that was released on the album Tommy Tutone 2, on the Columbia Records label. It peaked at #4 on the Billboard Hot 100 chart and #16 on the Billboard Top Tracks chart in May 1982 (see 1982 in music). The song caused a fad of people dialing 867-5309 and asking for "Jenny". == Creation == Lead guitarist Jim Keller, interviewed by People in 1982, said "Jenny is a regular girl, not a hooker. Friends of mine wrote her name and number on a men's room wall at a bar. I called her on a dare, and we dated for...
 
@202_accepted I heard that and was trying to find a credible source
 
@SamOnela I can't find it anywhere anymore, might not be the case now.
In the 80's and 90's people were literally asking for new numbers because of it.
 
yeah
 
(Same as 776-2323, which was in Bruce Almighty, though not as popular.)
Now-a-days 555-01** is officially reserved in all area codes as "fictitious" in the U.S., and should be preferred.
 
10:03 PM
> According to Tommy Heath, lead singer of Tommy Tutone, "It's ridiculous. If I wanted to get into it, I could probably take the number away from both of them."
LOL.
 
> [...there is a rumor...] that phone number is permanently non-assigned for every area code in North America. That isn’t the case: although 867-5309 is unassigned in many area codes, it is a valid working number in some of them (and such numbers have occasionally been put up for auction on eBay). In late 2004 a member of our site’s message board called 867-5309 in every existing area code and found that about twenty of them were still in service.
 
Nifty
Shows what I know. ;)
 
@CaptainObvious appears to have 2 VTC as Code not implemented or not working as intended - though OP claims it is working and the jsBin seems to illustrate that...
¿ⓧ_ⓧﮌ
 
@sineemore you may want to shoot SE a mail under community-team (at) stackexchange (dot) com
 
1
Q: Grade of Service Probability Function Python

HanzyConsider the following typical probability scenario: I defined this function to handle that scenario, I'm curious if Python has a more efficient method to handle this, or if this is the best way: from scipy.special import binom def grade_of_service(n, p, c): prob = 0 k = c + 1 wh...

 
10:19 PM
@Vogel612, nice option. I'll mail them, but for now there is not that much to worry about.
All my attempts at XSS have failed.
I tend to think that current MathJax config is rather solid.
Except for fancy ninja shurikens (:
 
I don't think there's a better way than to do this manually. I posted a code review here: codereview.stackexchange.com/questions/197017/…TruMan1 1 min ago
 
@CaptainObvious oh, right: "I have a method that works, but it's ugly. And it only works up to a certain point." darn un-emphasized nuance...
 
!gniknoM
 
Monkevening
 
10:37 PM
0
Q: Page and center UICollectionView like App Store

TruMan1I need a collection view to page through cells and center it like the App Store, where a portion of the previous and next cells look like this: The native isPagingEnabled flag would be great if it had an option to center on the cell. However, making the cell the full width of the collection vi...

 
10:50 PM
@Mast I was hoping someone could use it besides me.
 
0
Q: rewriting python algorithm in c++ (no speedup currently)

user18764I am new to c++ and am trying to see if there is anything obvious I am doing wrong in the c++ implementation of: def best_path(transcript, scores, beam_size): transcript = '\t'+transcript prefix_current = [] prefix_current.append(['\t', '\t', 1.0]) seq_length = len(scores) for time in xrange...

 
11:34 PM
0
Q: Scaling decimal numbers up within bounds of limit

rjziiThis code is part of a simulation and inputs will be values less than one. The goal is to scale the inputs up to much larger numbers, although the total sum is bounded. These represent the number of entities in the simulation. For example, if the simulation has a limit of 1000 entities and the us...

 
11:56 PM
Erwin I have tried to put . in String it self its working as well but in code review..I have to remove that — satish 5 secs ago
 
00:00 - 19:0019:00 - 00:00

« first day (1874 days earlier)      last day (2146 days later) »