« first day (1523 days earlier)      last day (2788 days later) » 

00:00
RELOAD! There are 4087 unanswered questions (90.9857% answered)
00:34
monking!
00:59
Question is probably a better fit on codereview.stackexchange.comcharlietfl 49 secs ago
01:13
0
Q: Python 3.x Hexdump

user7340830I posted a small hexdump generator function from a program I've been writing not long ago and applied what a reviewer suggested since then. The goal was to lazily hexdump bytes objects (byte strings, binary files without committing to I/O code). Here is the relevant code (minus docstrings/tests/...

 
1 hour later…
02:20
This sort of question is usually better suited to codereview.stackexchange.comSilvio Mayolo 28 secs ago
 
2 hours later…
04:16
Monking
04:34
from code review i cannot point out the reason. you need debug your self, set breakpoints. — Lei Yang 52 secs ago
 
1 hour later…
05:47
Monking
06:07
0
Q: How shall I call python function/script by MATLAB?

vx2008about c=a+b; Now I want to put in two parameters—’a’ and ‘b’ on matlab , then ‘a’ and ‘b’ are sent to python and python sum them as ‘c’ and return ‘c’ to matlab; how shall I code for this?

06:54
Free Flags: 1, 2
I don't think so...still you can ask this question on codereview.stackexchange.comAkshay 33 secs ago
0
Q: Case statement with array includes?

sschmeckWhat is the best practice to implement case checks using arrays in Ruby? def partition(a) a_values = [1,4,5] b_values = [2,3,7] a.group_by do |n| case n when *a_values then :a when *b_values then :b else :c end end end partition((1..10)) #=> {:a=>[1, 4, 5], :b=>[2, ...

07:14
No, because this is off-topic for Stack Overflow. We will be happy to help you to understand specific problems or errors you are getting, but we are not a code review service (you can find one of those on our sister site). — Joe C just now
07:38
-1
Q: Explode string by length and label

Michelangelohow to explode these kind of string into a labelled array? $string = "1234567890:12345:123"; Fields chars ============== field_a 10 field_b 5 field_c 3 the result will be: array( 'field_a' => 1234567890, 'field_b' => 12345, 'field_c' => 123 ) thanks

Kaz
Kaz
Monking @all
07:57
0
Q: Create Django objects on the fly. Better way to do it? And is the view the best place?

DanielI have a model Sachbearbeiter that has a OneToOneField to the User model in django.contrib.auth. class Sachbearbeiter(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) ... I created a view to enable certain people to create a new Sachbearbeiter. There are three...

-2
Q: Limit digit using try-catch exception

NinjaI want to prompt user to input 10 digits phone number only. And if their input is not that, it will re-prompt user, using try-catch exception. However, it seems my try-catch doesn't work. public static void main(String[] args) { Scanner scanner = new Scanner(System.in); boolean continueL...

08:11
-1
Q: Fast numpy lookup

Scripting.FileSystemObjectI have numpy 2d array with shape = (14542036, 6) I want to look up the same using: >>>a array([[ 4287053, 6218896, 19801222, 19810901, 19881222, 29], [ 4287053, 6218896, 19801222, 19810901, 19850211, 28], [ 4289713, 6222552, 19810105, 19810915, 19930330, 138], ...

@CaptainObvious broken
08:32
0
Q: Wrapper around db

MaxI'm adding db access to my go program, it looks like this: package db_access import ( "database/sql" "fmt" "my_database" ) type TheType struct { Name string } func LoadTheTypeFromDb(db *sql.DB, id uint) (*TheType, error) { query := fmt.Sprintf( "SELECT %s FROM %s ...

08:46
0
Q: testing arbitrary backend implementations dynamically using py.test parametrized tests

kouktrying to write a bunch of tests for a program that supports loading an arbitrary backend implementation dynamically using py.test parametrized tests, and it was a bit more complicated than I expected. What I'm intending to do (and not completely achieving) is to use the list_backends method belo...

sorry for long explanation. I posted similar question on code review but I failed to explain it correctly. — Scripting.FileSystemObject 46 secs ago
Would this not be a better fit for Code Review? — DaveP 36 secs ago
09:10
1
Q: ServiceLocator for easy and central access to replaceable parts

Mischa BehrendFor a bigger project of mine, I needed a simple and extensible solution for easy access to replaceable Parts. This example will show the usage: Define an Interface, describing the replaceable part Eg: IReportSender Define the concrete EMailReportSender and TelegramReportSender Both will be imp...

0
Q: Use counter for ajax loader

Ziv WeissmanI was using a Boolean var for indication of loading so my code looked like this: (this example is in angularjs but i think it can be relevant for any ajax call handlers) //HTML: <div ng-show="$scope.isLoading">...LOADING...</div> //JS: //Init $scope.isLoading = false; //Executing http request:...

09:23
0
Q: Choose random instants in a day with a low memory footprint

WayToDoorI'm looking for a way to plan a list of X events at the start of the day... What I did before: At 02:00 every day, choose X timestamps from "now" to 01:59 the next day. That worked well but I had to "remember" X timestamps What I did to optimize: Each day, create a counter events_planned = X ...

0
Q: Q:Path Finding using Dynamic Programming

monsterI was trying to implement a dp + graph problem (link given below).After completing the solution I tried to compare it with solution in tutorial to figure out which one was better and to find a way to improve mine if i could. But i was not able to figure out which one is better, so please help. An...

0
Q: Is nesting try-except blocks within python3 a correct way to write code?

mp252I have this function that I have written, that gets passed a row of data from a mysql function. The function then uses a try-except block to get some a list of values depending on a value within the row of data. It then loops through this data and completes another try-except block within the fi...

Monking
09:49
Post is best suited for code review, maybe. Definitely not SO — Daryl Gill 58 secs ago
@Peilonrayz I've just watched through your game on github. When are you going to add some GUI to it ? :D
@DarylGill Not suited for Code Review either. Please take a look at their help centre before making such recommendations. — Mast 58 secs ago
@MrGrj GUI are overrated.
@MrGrj As in Python_RPG_Game? Like that's super dead, and was one of the first things I tried to program, I forgot all about it...
@Peilonrayz Yep :D
@Mast I'd like to see an RPG game w/o GUI ;P
10:00
Oh god, that code's soo bad...
    def NewGame(self):
        import NewGame
        self.player = NewGame.SelectHero()
        del NewGame
@Peilonrayz cringe
Zork is one of the earliest interactive fiction computer games, with roots drawn from the original genre game, Colossal Cave Adventure. The first version of Zork was written between 1977 and 1979 using the MDL programming language on a DEC PDP-10 computer. The authors—Tim Anderson, Marc Blank, Bruce Daniels, and Dave Lebling—were members of the MIT Dynamic Modelling Group. When Zork was published commercially, it was split up into three games: Zork: The Great Underground Empire - Part I (later known as Zork I), Zork II: The Wizard of Frobozz, and Zork III: The Dungeon Master. Zork distinguished...
@Peilonrayz give @skiwi a ping. He'll rewrite all of that in Brainf*ck :D
1
Q: What could be done to improve this Question?

LudisposedA few weeks ago I posted a Question to this site. I thought I was getting low views so I even put up a bounty for this Question. Now after the bounty is almost ended, I still have no comments or answers. Thus my Questions are: Is my question badly formatted/too long? How can I improve this Que...

10:45
Welcome to Stack Overflow! You might want to write up your samples in a more-complete fashion and ask for critique over at Code Review. Be sure to read A guide to Code Review for Stack Overflow users first, as some things are done differently over there! — Toby Speight 11 secs ago
Kaz
Kaz
11:09
@Mast Ooh, interesting
11:25
hrngh... ffs
why the carp is an HTTP Status Code 400 an IOException??
just ... ARGHHTJALKTÖ R
who the heck had that expletive STUPID idea??
a Status 400 is completely valid. I'd just like to examine the darn effing response you PoS inbuilt http implementation
another point on the ever longer growing list of reasons to hate on Java...
I added "exceptions" in general as a reason to hate Java, and .NET.
@Vogel612 I guess all HTTP are considered IO. Not finding the correct response on your request could be an IOException.
0
Q: Find every two vowels inbetween a consonant

whywhywhy Task You are given a string . It consists of alphanumeric characters, spaces and symbols(+,-). Your task is to find all the substrings of that contains or more vowels. Also, these substrings must lie in between consonants and should contain vowels only. Input Format: a sing...

who the heck though it was a good idea to just throw an exception whenever the HTTPStatusCode was geq 400?
@Vogel612 The person that wrote that method. ;)
Kaz
Kaz
11:35
@CaptainObvious VTC. Wants an explanation of why code isn't working.
@Mast the point is, that you're getting a response just fine, and you can access the input stream from that connection just fine ...
the problem I really have with this is, that throwing an exception there means that you have no possible way of accessing the request content
which means that you can't even try to troubleshoot this...
true, but they're not the same kind of error as a "byte-buffer overrun on read"
which is what IOException is for
also handling stuff that way throws away a ton of diagnostic information
I agree that it's not the best idea, and in-fact, I wish that Web-controls wouldn't throw any exceptions on errors like that.
@Vogel612 Wrap them always in a try/catch and act accordingly?
It's Java, one way or another your code will always bloat.
11:39
but that doesn't work...
Because it means a simple var webClient = ...; var response = webClient.DownloadResponse(...); if (response.HttpStatusCode == HttpStatusCode.Success) { /* continue */ } else { /* retry with different URL */ } is not so simple anymore.
because I need to get a 200 out of this...
Now I have to wrap it in a try/catch, still check for HttpStatusCode.Success, and lose a craptonne of performance.
the point is: getResponseCode() throws a fucking IOException instead of returning 400 which is bullshit
argh
sorry for the language
@EBrown no... you can't
because StatusCode will never return correctly for any code beyond 399
it will always blow up in your face
@Vogel612 In .NET I can, not sure about the Java version but on my side it's possible to catch a SomethingException that gives you the status code and what actually happened
11:42
it's an unspecific IOException
Ours is a WebException, which contains some helpful information.
throw new java.io.IOException("Server returned HTTP" + " response code: " + respCode + " for URL: " + url.toString());
^^ that's literally all information I get from this....
Yuck, I thought Java was beyond this kind of crap.
actually it's all information I can get
Well you can parse out the HTTP### pretty easily.
So, in all fairness, you can still get what HTTP error was thrown and evaluate from there.
11:44
because this is happening when I access the InputStream with the data I need
@EBrown no. I can't
becuase I can't access the text of the response
because when I try, I get that exception
I fail to see why not? You don't need the text, you can start with the Server returned HTTP### response code: ### for URL ... string.
but that's not useful
It's more useful than nothing, which is what you currently have. ;)
no. I have that
because it gets logged into my console
@Mast Kinda funny that the EAFP language Python doesn't do this...
11:45
the point is I need actual information
I know what URL that is. I assembled it...
Rebuild the library, you have the source.
sure... I'm of course going to rebuild the whole Java Language API ...
whatevs. .. breakfast .
@Vogel612 It could be worse.
That's a really bad excuse
12:56
Is using another library an option? Http Apache (don't remember the name) could maybe provide better api to resolve your issue ? It's a big changes and it sucks, but maybe it could be worth it?
under the hood that still uses Java HTTP
which means that it cannot provide more information to tackle the issue...
Good morning.
I was under the impression they were doing more, maybe I did not encounter an issue similar to yours so never had that problem. Sorry.
Morning @Legato
2
Q: Printing a calendar for a month based on user input

low kimI have a long piece of code that has many repeating points. I am sure that it doesn't take this amount of code to create a simple calendar, but I do not know how to shorten this piece of code. # Creating a calendar in proportion to the user defined starting date n = int(input('Enter number of d...

13:21
multitasking = screwing up several things at once
12
13:52
@Vogel612 Unfortunately there's no "good" excuse here. Especially when that's something that doesn't need an exception thrown anyway.
exactly...
@Vogel612 I am in the process of writing a help file :-( and need some help regarding the word Button. Would you name it Schaltfläche or Knopf or something else ?
Depends a bit ... usually Button works just fine for technical docs...
User doc
14:02
then probably "Schaltfläche"
ok thanks
14:31
-1
Q: fxml switch one window to another window

Rajeshfrom the image view button is there if button press should open new window and my code from controller is This is code is from main controller to call other fxml/load fxml private Button master_cat_view; @FXML public void view_mast_cat(){ try { System.out.println("In...

15:03
0
Q: Scraper for a lazy-loading webpage

SMth80I've written a script in VBA in combination with selenium which is able to scrape all the 1000 links from a lazy-loading webpage which displays it's content 20 at a time and doesn't display the full content until it reaches the bottom of that page. However, my script can make this webpage scroll ...

15:40
0
Q: Is it good practice to use an sql primary key on the front end?

NinjaStarsIs it good practice to use an Autoicremental, primary key for the API requests? e.g. get=user&id=1 Of course all requests are validated for access privilege but still I don't know if this could assist a blind mysql attack or other types of security holes or in general not a good practice.

15:55
Monking
Monking @skiwi
Anyone doing anything interesting lately?
16:11
Sorry, but this code is rubbish. If you worked for me I'd have you over a barrel for this. First, never use constants, ever (psf). Second, how can you iterate over strategies in this model? Reflection? Silly. You're setting yourself up to create lots of duplicate code. Finally, this isn't a code review site so I've voted to close this -- try it on the code review stack exchange site instead. — Engineer Dollery 36 secs ago
@skiwi writing a REST client by hand... also working on RD...
shamefully ignoring the review of your bf to assembler thing, as well as my half-dozen private pet-projects
0
Q: Javascript Scraper class

user3568719I wrote this scraper class, which gets the name of the players from a popular sport odds site. The problem, that the first names are not present, but they could be extracted from the links I made 3 test for the most important method processPlayers. Unfortunately one of them does not pass yet. h...

Besides trying to teach myself C# bit by bit and creating a personal website not really. @skiwi
@Vogel612 Interesting stuff?
@Legato Learning is always fun :)
16:26
@skiwi not really... I had my share of rant about it just earlier...
I didn't even mention that the people responsible for the endpoint considered it a good idea to name all their fields in YELLCASE and german.
also everything is stringly typed, which makes it even funnier
@Vogel612 SCHMETTERLING
yea something like that
doesn't sound like a whole deal of fun then
to be more correct... they named one thing in german, and everything else in english ...
I was trying to figure out earlier today as side task how to hook into the process that hosts a .NET CLR in C#
It works if you hard-code the executable name, which is a bit ugly if someone decides to rename it
I got a bit triggered because I managed to lock myself out of my own application
16:30
wat?
^^
you might be interested in talking to one of the RD contributors...
I've searched a bit earlier as well and so far nobody has done this
since RD hooks into the VBIDE through COM and does some really weird shit there
This has got to do with the compiler DLL that compiles our proprietary code into .NET bytecode
I think I can get away with modifying the assembly right before it is being loaded... to be more specific, I want to modify some const string then and change it to the name of the executing process
It's a bit... hacky though
And next to that I'm working on integrating websocket support into our whole application/architecture, also a fun task
Not really doing any personal projects anymore now though, I've got some thoughts about automating some things using the Ebay API but not really doing anything
17:01
I've wanted to do some project with people on here for the longest time...
@Legato Help @SimonForsberg with the Monopoly I just never got around to! :D
Monopoly game? Did you guys start or nah?
I'm totally willing, I love personal projects.
He built the server.
I like building servers too, lol.
ic
On Github?
Wish I knew about it beforehand, would've had something to work on over the extended weekend.
@Legato Yeah, it should be under his 'zomis' ID
17:23
♫ Hey Jude, don't make it bad. Take some sad code and make it better. ♫
7
0
Q: Test Driven Development in JS and Sinon Stub

MadPhysicistI am going through some TDD and BDD tutorials which guide one through implementing a simple beverage-ordering system. While I think I understand the material, I am still wondering about some intricacies. In particular, it seems that my sinon.stub() line is not really doing anything. I am solici...

17:50
I don't think you are going to solve this with regex. You either need a full-blown sql parser ( complicated ), or maybe to make it a manual code review process. Good luck! — Derek 42 secs ago
18:01
0
Q: Wordlist substitution generator can't handle double letters?

AlessiaThe purpose of the program is to take a list of words, replace the characters with commonly used substitutions (i.e. @ for a), and then to output all possibilities. The program works fine until a word is input with a double character. For instance, if a word with ss is input, it outputs all var...

18:41
Whoever edited the title of my question, thank you. Making a flashy title is not part of my skillset
Oh yeah, I figured that could help, lol.
Now, that's a heavily edited question ...... 20 edits? But, it is much better than the original.
@Legato It is better than what I came up with
Yeah I self answered it a couple of times since it got low views anyeay, but for now will leave it like this
0
Q: Jquery replace html

Cody G.In a portion of my code to get a "report view" where the element is different (textarea becomes a div or span) and use the same data with newlines I replace the new lines with page breaks. Currently the function I use: $.each($('[id^="mytext-text"]'),(i,e)=>{$(e).html($(e).html().replace(/\n/gm,'

0
Q: Retrieve compilation files of smart contracts asynchronously via Ajax and add to database

Erwin RooijakkersI need to retrieve two files that are labeled :abi and :bin from a server. I then want to add these files to a database in a method with a signature like (q/upsert-contract <abi> <bin>). To do this I used core.async and wrote the following code: (defn fetch-contract-code [contract-key code-type...

0
Q: Game-orientated UDP protocol

nyorainAs part of a small multiplayer game project i designed a generic (and not too complex) protocol (used over udp). The game is 2d, has physics-based elements (e.g. rigid body, smoke) and should be sandboxed, allowing everyone to extend/modify it with scripts (therefore the protocol is kept generic,...

18:55
It seems like a great way to get your question attention is to post about it on Meta, haha.
19:08
1
Q: C++ Data-Oriented Modules using namespaces and extern

stimulateI have been coding in a certain style for some time now, where I try to avoid classes and stick to pure data structures whenever possible. Basically every module of my program has its own namespace in which all the data structures and functions are declared. I started doing this because I wante...

@Legato It worked indeed, but it also helped me understand why it was getting low attention
Code that works, but wants review should go on Code Review. Please define an exact problem set that we can help you with. — zero298 56 secs ago
19:44
0
Q: breacrumb directive for angular-ui-router

Sibi RajI am a little new to angular.js stuff. I wrote a library to create breadcrumbs can someone check this code. because I am not very sure of this one especially (function() { 'use strict'; var app, loaded; loaded = false; app = angular.module('uiBreadcrumbs', ['ui.router', 'ngSanitize']);...

20:38
This kind of question is better suited for Code Review. Please consider posting it there instead. — Andre Terra 18 secs ago
0
Q: Simple task list frontend rewrite

GrumpyCroutonI was recently going through some code that I wrote a while ago as an effort to improve my code. There was one foreach statement that I was especially proud of the rewrite as I believe it is much more readable than it was before, and I believe it will last longer now. This code in particular is...

20:53
0
Q: Sorting algorithms - Bubble sort

Ben SteffanFor pure practice purposes, I started implementing different sorting algorithms in modern C++ in a standard library style way (i.e. using templates on iterators). This is my version of bubble sort. I do not really have any specific criteria I would like to have the code reviewed under, but ins...

21:13
Not sure if this is the right site to post this question. If the code works and you need a review of your code then you should post at CodeReview — Steve 42 secs ago
possible answer invalidation by stimulate on question by stimulate: codereview.stackexchange.com/posts/167416/revisions
21:43
0
Q: Better algorithm for all permutation

Bhavik PatelI have written this Java snippet to generate all permutations of a given array's of a HashMaps. Can this be done in a better way? This algorithm is taking too much time. What I have currently done is : Take the first element of the first array of the first HashMap move to the next HashMap tak...

22:31
@Duga Actual answer invalidation...
22:56
Idea that may be beyond your current goal. Formatted print without the need to specify type --> GPrintf("in:", GP(in), "out:", GP(out), GP_eol);. You will have to write code for printing each structure, etc., but I suspect you anticipate that all ready. — chux 31 secs ago
23:29
0
Q: Creating clearly defined methods with generics and delegates

Brian GeI'm fairly new to OOP and have been working heavily with C# lately. I've come across an issue in which I had a lot of duplicate code with only a query and how to handle the query results changing. I significantly cut down on the code by creating a static class that accepts generics and an actio...

23:46
monking

« first day (1523 days earlier)      last day (2788 days later) »