« first day (1023 days earlier)      last day (2997 days later) » 
00:00 - 18:0018:00 - 00:00

12:00 AM
RELOAD! There are 1877 unanswered questions (94.0708% answered)
 
That was interesting...
 
I'm voting to close this question as off-topic because it is not asking for code to be reviewed. — Phrancis 14 secs ago
From yesterday, must have slipped through from here, saw it in the SQL room
 
12:16 AM
@Jamal Only a programmer would think so ;)
 
I'm about to take a hackerrank test that I was given by an Amazon rep
"DESCRIBE THE RUNTIME AND SPATIAL COMPLEXITY OF YOUR SOLUTIONS." This will screw me over
Well, maybe this too "PROVIDE THE MOST EFFICIENT SOLUTION POSSIBLE."
 
Don't worry, I don't know how to describe the complexity of my programs really.
 
I don't see how that alleviates my worrying
 
LOL.
 
12:25 AM
@JeroenVannevel This in addition to completing the hackerrank test is not always possible... I've done some hackerrank tests related to Python, and I don't like the code it seem to promote.
 
@holroy I guess I'll have to make sure I write perfect code from the get-go then. I have 75 minutes before the exercise is closed
 
A basic loop is O(n). A single statement is O(1). A basic loop can be considered O(?) in certain conditions, if I understood the Knuth at all and the loop is only a small subset of the complete O(1) process.
 
Perfect code and hackerrank tests don't mix very well!
And if you can half the set your operating on in the next run you'll usually get O(log N) performances...
 
o(1) = constant
o(n) = for every element
o(log n) = halving every time, like a binary tree
o(n log n) = once the entire set, then halving every time
o(n²) = two full nested loops
o(n³) = three full nested loops
o(2^n) = lol get fkd
That's how I understood them
 
Then it is just a matter of combining the different operations, and ignoring those which don't count towards the overall timing of the algorithm due to large N's...
Seems like I decent understanding...
 
12:29 AM
@JeroenVannevel You've got them better than me. Better start using your 75 minutes.
 
The trick is knowing when O(n*m) can be reduced to either O(n) or O(m) as one of them is dominating the runtime... But good luck!
 
Well they're not really hard to understand, it's just the reducing and the log ones that are hard
I also have to do spatial complexity which will definitely trip me up
If it means explicit allocations: doable. If it means true complexity I suppose I also have to know all framework allocations
It's a good thing I can use C# so I know quite a bit of what happens underneath but still
 
I posted a question yesterday or the day before on Code Review but it didn't receive any answers or comments, and this meta post doesn't apply to it, as it received 1 upvote and 1 downvote. Is it ok if I post it here and ask for someone to take a look at it? I'm very new to programming and want to follow the best procedures as I work on the large project the question is part of
 
Yeah go ahead
Don't make it a habit but nobody minds every now and then
 
Here it is. Thanks.
 
12:35 AM
If you don't have an answer in 24h, ping me and I'll put a bounty on it
Oneboxed to grab more attention:
0
Q: Drawing art on the coordinate plane with Karel J. Robot

EridanThis question is an extension of this one, which is my implementation of a coordinate system using the Java learning software Karel J. Robot. With the below code, I created a way to automatically make the robot place beepers on spots on the coordinate plane to imitate drawing letters. Here is th...

 
Much appreciated. As this is a project that I am using to learn the fundamentals of Java, I want to make sure I get programming conventions as best as possible in addition to learning the language.
 
@Eridan That looks like really nice code. Isn't there a better way to set the direction rather than using a loop to turn the robot, though?
Like, that should really be an implementation detail in the base class, and you should be able to do setDirection(Direction.North), or something.
 
Unfortunately not. Karel is used to teach aspects of programming, and the first exercise in for loops is making a turnRight() method out of 3 turnLeft()s.
 
OK, cool.
I can't think of anything to improve on any level, really.
 
Wow, thanks. I tried to incorporate the suggestions from my question about the first program (which I linked) into the new code.
 
12:47 AM
Where is the facingNorth() defined? Is that part of the original robot code?
 
facingNorth() is one of the predefined methods for the Robot class.
 
ok...
 
(Which is part of the package that can be downloaded here )
 
1
Q: PHP Basic template engine

Adam TaylorBasic template system for PHP, I wanted to know how I can improove it? mainly I want to look and speed and performance, but if theres any improovements please give a suggestion below, thank you to everyone who helps. <?php defined("SECURE") or exit('Please define SECURE keyword to continue.'); c...

 
1:03 AM
@JeroenVannevel o(n log n) is not correct exactly I'd say.
 
Correct me now before I click 'start'
 
@JeroenVannevel You said "once the entire set, then halving every time" but I'd say "outer loop across the entire set then an inner loop halving every time"
(or an outer loop that is halving every time and an inner that goes through all the elements)
 
yeah okay, that might be a better explanation
 
think about Merge Sort. That's O(n log n) because it both loops over all elements and splits.
 
though I suppose it comes down to the same, it's about what I had in mind
 
1:06 AM
Sorry, I can only read what you write, not what you think :)
 
Well that sounds like your limitation, not mine
Step up your game
2
 
1:17 AM
lol
 
0
Q: Type-Safe Event System

JordanI have recently started writing C# from a strong JavaScript background, and found myself wanting to do something I do all the time in JavaScript: events. Since I have a type system at my disposal, I figured I'd make use of it and make the event system type safe. A quick note on existing options...

 
@Eridan I would recommend looking at this as well:
12
A: Checklist for how to write a good Code Review question

Simon ForsbergSimon's Guide for posting a good question There are a lot of questions that appear on Code Review, and all questions are fighting for reviewer attention. This is a non-exhaustive list of items that I am looking for in a Code Review question when determining whether or not I should review it and ...

 
1:49 AM
i would recommend asking this question at codereview.stackexchange.com which is a site specific to review/code improvement. Your question is very broad, on the virge of off-topic, please use stackoverflow.com for more concrete problems. — epsilonhalbe 36 secs ago
 
There you go @Eridan, one answer is now written... :-)
 
I'll get to reading that right away @holroy. Thanks for the feedback!
You're right about currentDirection; it's wrong after executing turnXxx.
@holroy Unfortunately, the Direction class cannot be used in a switch statement, so I think I'll assign numbers to the four directions and write a way to convert to Directions
 
2:09 AM
I snooped around a little in the original code, but I couldn't see any fields available revealing the current direction... But didn't look for long, so it might be there somewhere.
@Eridan Some of the code would look a little nicer if that were possible
 
I visualize it as the turnLeft() method containing something like directionNumber--; and printRobotInformation having if(directionNumber % 4 == 0) { currentDirection = North; }
Unfortunately, the constructor MUST have a parameter of type direction, or this could be so much simpler by making direction an int.
 
Please do note that Code Review SE is for working code, else it is considered off topic. If uncertain please read a Guide to Code Review for Stack Overflow usersholroy 38 secs ago
 
You could still have a simplistic loop using the facingXxx() to determine current direction, and then move that into currentDirection and your own directionNumber
 
What is the loop the condition the loop would test? I just noticed that directionNumber seems extraneous, as I can just put 4 separate if statements in turnLeft() and the others to determine the direction and set currentDirection.
Is rotating the robot 4 times necessary?
The fact that the above should be replaced with a findCurrentDirection() method notwithstanding
 
@Eridan That's what I think.
Pity there is no getDirection() built in.
 
2:21 AM
 
Rotating shouldn't be necessarry, only the actual test of current direction. But I would definitively move it into a new method, like locateDirection() or getDirection() or findCurrentDirection() (but this last name hides the fact that currentDirection is correctly set after triggering the function
It should also be done in the leftTurns() method...
 
0
Q: XOR 256 Block in C rewriten to Golang

majidarifI am quite new to Go but have found it to be very useful for my use case (game server). I have a routine that encrypts/decrypts the game packets which was written in C++ which can be seen here and here as DecryptDirect. My current Go code: type Crypto struct { nkey [256]byte b...

 
The leftTurns() method is only for use in turnXxxxx(). I was told earlier that it's not good form to have methods of the same name differentiated by the fact that one takes a parameter and the other doesn't.
 
It is still public available, and should be consistent with the other methods. On the same page, if you don't override the original turnLeft() you could end up having a case where someone calls the original method instead of your method. Which again would leave in unknown territory with regards to direction
Hmm... Maybe resetCurrentDirection() could be a good name for the checking direction function?
 
13/17 test scenarios succeeded
That's not all too bad
 
2:29 AM
Oh, if leftTurns has changeCurrentDirection() then the turnXxxxx() methods won't need it
This works in my tester
 
@Eridan Yep, that is true. This is just the point why you would want one general method in the bottom instead of having to duplicate logic all over the place. This is similar to the point I made on faceXxxx() and faceThisDirection().
 
Is anybody familiar with VBA around?
 
It might just me, but findCurrentDirection() is a misleading name as it has the side effect of actually changing currentDirection. But be adviced that we've taking this discussion possibly a little long in this chat room, as we should allow for other code review site related discussion as well. :-)
 
0
Q: Java REST WS with DB

user3275095I want to get the feedback on the below code about the best practice I should follow and if I am using the connection pooling properly. I have classes as follows: DAOConnectionFactory- to fetch pooled connections from the Datasource. WatcherService- the REST WS. WatcherDAO- called by WatcherSe...

 
Ah, I suppose so. I'll figure out the rest of your answer now. Thanks for helping!
 
2:35 AM
No problem... Please do comment at answer, if something is unclear. :-)
 
Will do
 
@Hosch250 I don't think so...
 
I figured as much.
 
Are you suggesting I'm pointing out the obvious?! :-D
Just took a look on nhgrif to see if he had any experience with VBA and has 10 pages of tags he contributed in at SO. That is kind of impressing... Only one post in VBA though... :-)
(Looked at his page since he recently turned active here in the chat room)
HeHe... Jon Skeet has 87 pages of tags he contributed in... But I guess he has got a hand on posts related to most tags... :-)
Have you anytime gotten the feeling that you're talking to yourself, or out into an empty void?
 
I'll contribute
I have 11 pages of tags on SO
So, naturally, I'm smarter and better and sexier than @nhgrif
 
2:46 AM
Monking
 
HeHe! And I'm not even competing with only 3 tag pages at SO (and 4 here at CR)
 
NOOOOOOOOOOOOOOO
I justified my algorithm as n^2
I stink
it was 2N ~= N
 
The last one is correct... Did you state it was n^2 instead?
 
ooh... Feel sorry for you!
 
2:50 AM
Maybe I can send the recruiter an email to thank for the opportunity and casually drop that I messed that up..
 
Hope it doesn't matter too much. Did you explain your reasoning going from 2N to N^2, so that they could see that you did a typo kind of thingy?
 
Yeah, I explained that it was n^2 because first I had to construct a tree of all the employees which is O(N) naturally. Afterwards I had to find the lowest common manager of two employees which is O(N) in the case of one employee being the CEO and the other employee being the lowest-ranked employee in a scenario where every employee has exactly one subordinate
Meaning you would have to look over all employees again
That gives you O(N) + O(N) which is obviously O(2N) and not O(N²)
 
Sending an email doesn't sound to bad though...
 
yeah I suppose it can't hurt
 
A good recruiter shouldn't care that much, because it is common to be thinking about problems after the actual solving and rethinking/reconsidering parts of it. Nobody is perfect at the first go, and it's better to admit the error and suggest the correction, rather than standing firm at the first solution.
A good program(mer) will always have live and evolving code
 
2:56 AM
I agree
Besides, I succeeded for 13/17 test scenarios
they should love me
 
And that is one of the bad parts of Hackerrank, you don't know why you failed on the missing 4 which is most likely due to some intricate misconception related to the problem description.
 
yeah, it sucks that you don't get any explanation about what the scenario is about
I basically looked at it and went "well fuck it, can't mess around with my code with the little time I have left"
 
3:55 AM
Why don't you show us some code? That way we can see exactly what you mean and help you. Also, if you want to improve working code, you should ask on Code Review, not SO — Arc676 13 secs ago
 
4:29 AM
You should at least run this code and try it out. Until you can tell us how it behaves, the only thing we can do is give you a general code review, and there's a site dedicated to that. (Note that they require working code - so you should confirm its behavior before opening a review request there too) — skrrgwasme 57 secs ago
 
5:21 AM
0
Q: Controlling parallel jobs with condition_variable

user11177I'm trying to set up a system where I can have an arbitrary number of parallel tasks, all of which wait for a go signal, do their work, and then stop while a manager collects the results, prepares for the next batch of work, and so on. The easy way I know to do this is to launch a packaged_task ...

0
Q: Random Winner Based on Percentage Weighting

OwenI have 3 variables and each one has their own percentage to win out of 99.99...%. (The 3 percentages don't act up to 100% perfectly) When button1 is clicked, it will go through 100,000 simulations and afterwards it will output how many times each variable "won" in a MessageBox. I would like som...

 
 
3 hours later…
7:58 AM
0
Q: Adaptive counting sort for integer arrays in Java - follow-up

coderoddeI have refactored this. Once again, the running time can be anything between \$\Omega(n)\$ and \$\mathcal{O}(n^2)\$, yet it adapts to "smoothness" of the input array. AdaptiveCountingSort.java: package net.coderodde.util.sorting; /** * This class implements an adaptive counting sort that adap...

0
Q: Personal Video Aggregator

Daniel SikesI built a simple app that was inspired by this Reddit SMT Post. The purpose of the app is to be a "Save for Later" website for YouTube and Vimeo links. Once you've built up your playlist, you can watch your videos back to back from 2 separate providers, but only be on 1 site. It plays them in ful...

 
8:27 AM
monking
 
1
Q: making dynamic tables with JSON - angular2

CᴀʟʟᴏᴅᴀᴄɪᴛʏOkay, so simple enough task - I'm using Ionic/Angular2 to develop an auditing app. Using angular I can map Objects into the DOM rather easily, so what I need to do is create an object - but I would like some suggestions or advice on how I can do this in a modular way. The app displays a table of...

0
Q: Basic Cryptography

jack1I am using C language as my programming language for basic cryptography. Then I saw this exercise in the book but I don't know how to do this one, it also seems that it is not clear what it is telling about. "Your application should read a four-digit integer entered by the user and encrypt it as...

-1
Q: How to create a boolean method that allows users to type in yes/y or no/n instead of true and false in java

Bob Jenkespublic boolean getYesOrNoAnswer(String yesNoPrompt) is all I got. Also it should be a method that can be called latter on in the code

 
9:00 AM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: TabLayout inside fragment fetch data from web
 
9:43 AM
0
Q: How to secure this line with mysqli_real_escape_string?

Bajwa kapoorI am new to this field.I am using google authentication to pull the data And i am using function check user.This is the line.But when i used mysqli_real_escape_string it simple insert a empty data to database.Ok just wait let me come to the point Is it already safe right when i am pulling data fr...

0
Q: Comparing two integers without logical, relational or bitwise operators

sun qingyaoI answered a question on SO today, however it did't receive any up-votes, so I want to know what's wrong with my code. The requirement is to compare the input numbers(granted to be positive), and insert the corresponding comparison sign between them. For example: input: 4 6 output: 4 < 6 input...

 
9:56 AM
If you used a variable-sized container instead of an array and filled the data with random data, you could set the size on the commandline and it would make sure it's not optimized away. That said, please post your code to codereview.se, your code would benefit a lot. — Ulrich Eckhardt just now
 
10:13 AM
Nice reactions to that flag @janos, is someone more than me using Desktop Notifications perhaps? :)
 
10:31 AM
0
Q: Integer tree sort in Java

coderoddeI have this algorithm for sorting integer arrays. Basically, it's a balanced tree sort which creates a tree node for each distinct integer, and in each tree node it maintains a counter counting how many times the integer key appeared so for in the array being scanned. After the array is scanned, ...

 
@SimonForsberg I think I've said this before, without that user script, I'd be catching very very few flags
so yeah, I have it on 99% of the time
 
Nice :)
 
11:07 AM
0
Q: Optimize OrderBy Generic Method

Sean ThorburnHere is my OrderBy method which includes concatenated column names. Can this be achieved more efficiently? public static IQueryable<T> Sort<T>(this IQueryable<T> query, List<SortationDto> sortations) where T : BaseEntity { sortations.ForEach(s => { Expression value = null; ...

 
If you can copy and paste your Fortran code, it may be worth trying Code Review codereview.stackexchange.com or even Computational Science (probably after simplifying your code) scicomp.stackexchange.comroygvib 1 min ago
 
0
Q: Implementing a String class using reference count

In78 Design a STRING class. Provide support for: Assigning one object for another, Two string can be concatenated using + operator, Two strings can be compared using the relational operators. Modify the STRING class so that assigning/initializing a string by another will not...

 
11:43 AM
0
Q: Matasano cryptopals: Conversion to base 64 (with generic types)

MehowMy main interest is in how I have handled the generics and if it's idiomatic. I want the user to be able to specify what kind of integer type they would like to use for the encoding (u8, u16, u32, u64). I want to keep the hex string -> vector of numbers and vector of numbers -> base 64 string c...

0
Q: I my code is vulnerable to sql injection Its hardly coded?

Bajwa kapoorIs my code is vulnerable to sql Injection.It is hardly coded if (isset($_POST['submit'])) { $content = strip_tags($_POST['cont'],'<h1>,<br>,<h2>,<h3>,<h4>,<strong>,<a>'); $content_date = date('d-m-y'); i...

 
12:00 PM
@CaptainObvious I my title is vulnerable to bad title Its hardly written?
 
12:21 PM
0
Q: Java loops in Map Reduce Mapper

colin.kaneNew to Java and can't get this loops and arraylist working correctly. Working on identifying co-occurences of Actors in a shakespeare play. The map and reduce should produce (Paul, Mary) 25. Indicating they were together 25 times. Below is the map function to identify the cooccurences. What i'...

 
Morning :)
 
Hey @DJanssens!
 
What are you up to on this delightful sunday afternoon @SimonForsberg?
 
in Cardshifter TCG, 2 hours ago, by Duga
[Zomis/Machine-Learning] Zomis pushed commit efa4b27d to develop: Refactor how features are added in GameAI
Doing some work on my Machine Learning project
Currently working on implementing precision/recall and F1 score for logistic regression
 
12:37 PM
Aha :)
You're doing it in Java?
Doesn't the course of Andrew Ng target Octave?
 
0
Q: Using goto with DataReader to get sproc return value

DaiI want to get a second-opinion on my use of goto. SqlCommand and SqlDataReader only read the RETURN-value of a Stored Procedure after the SqlDataReader has been closed. This is a problem if you want to interrogate the return-value to make a decision regarding how you want to read the data. In m...

 
@DJanssens Yes it does, but nearly all the code that I am ever writing is for Java, and it is for that code that I want to apply machine learning.
I could perhaps use a library for all of this, but I feel that it's good to learn how to implement Machine Learning myself (that is what the course was for, wasn't it?)
 
No I totally agree. I should have done that too, since tbh I never use octave. Well, I managed to answer a few SO questions related to it haha. Might be a good idea for me to start working on some ML in Java to refresh my Java knowledge too :)
 
@DJanssens You are more than welcome to help me out on my repository!
 
Just out of curiosity, why is the package called: Machine-Learning/src/main/groovy/net/zomis/ The groovy and net name confuse me :)
I doubt I can be of much help. I just started reading Java in a nutshell again and noticed that I almost forgot every detail about Java. :)
 
12:49 PM
0
Q: Stack having push, pop and return min in o(1)

Mosbius8Here is my approach, class MinStack { Stack<Node> s1 = new Stack<>(); public void push(int x) { if(s1.isEmpty()) { s1.push(new Node(x,x)); } else { s1.push(new Node(x,Math.min(s1.peek().min, x))); } } public void pop() {...

 
@DJanssens src/main is Maven and Gradle standard, it is not part of the package name. groovy is a language (although most my code is written in Java now anyway, Groovy and Java work very well together). The actual package name there is net.zomis which is what I have in all my package names.
see the develop branch instead
in Cardshifter TCG, 2 hours ago, by Duga
[Zomis/Machine-Learning] Zomis pushed commit e51a87a2 to develop: Move classes from src/main/groovy to src/main/java as everything is now Java
 
I see. The net made me wonder if it was .net related ;)
 
Oh hell no! :)
 
hey
 
1:12 PM
Hi @skiwi
 
0
Q: Updates list in haskell to remove duplication

Jackson JacobThe task in question allows a user to re-rate a film such that only the latest rating from the user should remain in the database. Initially I solved this problem in a very basic manor? This was my result: type Rating = (String, Int) type Film = (String, String, Int, [Rating]) --Example ("Blad...

 
Okay @DJanssens here's the results from the first try:
truePositive: 7, falsePositive: 1, trueNegative: 249, falseNegative: 32, precision 0.875000, recall 0.179487, f1 score: 0.297872
 
hey @DJanssens
@SimonForsberg What's that?
 
@skiwi It's the performance of a logistic regression. Currently working on classifying @Duga's comments for Programmers.
I think I need more features, and train my data for more iterations
and implement regularization
and watch the learning curves
and separate the data into training set, cross validation set, and test set
 
One day I'll write a damned plugin to mute all chat.SE tabs... That sound on mention seems to randomly reset every few months, scares the crap out of me
 
1:25 PM
and I need more data...
and I need more unit tests
 
@SimonForsberg Ah cool, so finally someone is doing that :)
 
Yeah, I thought that if anyone was going to do it, it had to be me.
 
Maybe I could be doing it... in an alternate universe
I think I need more motisomething to do it
 
I'm sure that you can do whatever you set your mind fixed on.
The only question is how long it will take.
 
Fixing my mind on things is seemingly a random process, the workings to me are still unknown
 
@SimonForsberg The output seems valid ;) double checked it. What you mean by classifying comments for Programmers?
 
32
Q: New SE Chat Bot feature for identifying when Programmers is mentioned on Stack Overflow

maple_shaftThere are some very creative SE users and contributors to Code Review that have used the Stack API to build an open source SE Chat bot that is currently being used for many things. https://github.com/Zomis/GithubHookSEChatService The top contributors of this project have graciously offered to i...

@DJanssens also see github.com/Zomis/Duga/blob/develop/src/main/groovy/net/zomis/… , which shows how @Duga is currently classifying the comments mentioning Programmers.
 
Let's see
How are you using logistic regression for that matter?
The current classifier seems to just give a score depending on the presence of particular words, right?
 
1:51 PM
-1
Q: Java two arrays of audio, or one array? how to determine the most effective

user3667111Okay so I have some code, I want to play some audio of two byte arrays, I was wondering whether it would be better to play them as two separate arrays both calling the method or to put them into one array and play it from there. Note: The starting from position 4 because the first 4 bytes are sa...

 
@SimonForsberg Like what features are you currently using (for logistic regression)
And how did you end up with those score values in the current version, trial and error?
 
@DJanssens trial and error, yes.
@DJanssens Currently I am using the same strings as shown in CommentClassification.groovy and I am checking if the comment contains that string or not, 1 if it contains it, 0 otherwise.
 
Aha
 
There exists another interesting approach which I've seen applied for sentiment analysis. Might be interesting to try that. Perhaps I can help with that.
Namely, instead of feeding it the features you expect it to be present. You let the classifier figure them out by itself.
You just use every single word as a feature, 1 presence, 0 absence.
You do this with unigrams and bigrams, perhaps trigrams
and then the model 'should' learn which word sets tend to result in a positive instance and which in a negative.
 
2:06 PM
@DJanssens I am planning on doing that as the next step, haven't gotten that far yet :)
 
Aha! ;)
 
If you want to help out with that, feel free :)
I have also seen some features that I should add and some pre-processing that could be done of the data to make it learn better
for example, this comment was a false negative: (should have been marked as 1, but was marked as 0)
> try on <a href="http://programmers.stackexchange.com/help/on-topic">programmers</a>
 
What do you currently use as threshold for the classifier score? 0.49?
 
so if I replace s/stack exchange/stackexchange/ and add programmers.stackexchange as a feature, that should do something
@DJanssens I used >= 0.5, but F1 score was improved if I lowered it to 0.3
truePositive: 24, falsePositive: 8, trueNegative: 242, falseNegative: 15, precision 0.750000, recall 0.615385, f1 score: 0.676056
with threshold 0.3 ^^
However, I still need to implement regularization and stuff...
 
There exists Weka, a ML library & tool in Java that offers all this out of the box. However where is the fun in that ;)
2
 
2:10 PM
exactly ^^ :)
Once I feel more comfortable with my own algorithms, then I will probably switch to a library. When the question is no longer about how well the algorithm performs, but about speed.
 
Let's see if I can pull your repo. Never actually used github before. :)
Smart ;)
 
@DJanssens Then it's about time! :)
Please tell me that you've used git at least...
 
sure ;)
 
 
1 hour later…
3:31 PM
0
Q: Basic JSON Representation in Rust

stefanobaghinoThis week I started reading "The Rust Programming Language". As I reached the chapters on enumerations and pattern matching I felt I had enough material to put together a simple representation of JSON in Rust, just to play around and get a better feeling of the language. This is what I came up w...

 
This question appears to be off-topic because it is a code review request. This is better suited to the Code Review Stack Exchange site. Before posting there be sure to read their FAQ to ensure that your question meets their guidelines. — John Conde 40 secs ago
 
stack can be private final too. And it seems you lost a bunch of semicolons ;-) — janos ♦ 1 hour ago
@janos ^^^^ semicolons have gone with go .... can't believe I forgot them so fast.
 
sweet, I really want to get into that language too
I knew it must have been another language that made you forget those
I wonder if you flag my comment obsolete, will that come up for me, or only the other mods
 
The best/worst part about go is that the format is so well "standardized" that there's a tool that will reformat your code each time you save, so that it's exactly structured like everyone else's.
@janos - go check ;-)
 
3:47 PM
I got it, good to know ;-)
 
I really miss generics in go, though.
The error handling is massively verbose in go too.
For many lines in go there are 3 lines of error handling.
 
there's a guy at work who makes everybody reformat their Java code as IntelliJ/Eclipse would, so they all look the same --> me
do you use Go at work?
 
Yes. We completely retooled everyone just before christmas. I was opposed to go, but have adapted OK.
 
sweet
 
We are building from scratch a massive datacenter automation tool. Go from the ground up. 100 people.
 
3:50 PM
@rolfl At work I am using some Eclipse auto-format thingy. Annoys me every time it formats something in a way that I don't want to.
 
Nobody knew go at all. We all started from fresh.... but, I was one of only a few Java guys, the rest are python, C/C++, scala, and even some javascript people. It levelled the playing field by making everyone a noob.
3
Now I'm the best ;-)
But, in the land of the blind, the 1-eyed man is king.
 
Hmm... I wonder if there's some little coding challenge I could do in Go. Any suggestions, @rolfl?
 
I've heard it's very easy to learn, because it's very opinionated
 
Go has a lot of good introductions and tutorials. It's actually a good language once you get past the fact that it has poor tooling for IDE's and devops.
 
I've heard of "tour of go"
 
3:53 PM
Yes, it's great: tour.golang.org/welcome/1
You can run the code in the browser.
 
it's actually a very good time for me to learn: the #3 Go answerer on SO recently joined our company
 
@rolfl is it me or does Go use inverted type declarations: x int
 
It does use invetred type declarations. They have a reason for it.
@SimonForsberg - my first fizzbuzz: play.golang.org/p/FCJixGY5Xp
 
I'm interested in that reason. :D It contradicts with all other languages I've programmed in.
 
Delphi also uses it
in fact, Delphi uses := as well
 
4:00 PM
@DJanssens looking for the blog post
 
@DJanssens so does Scala
 
it feels more natural for me that way
very often I think of names first, and their types later
 
With go the type can often be inferred, and the type dropped as well.
I feel Java is more expressive and powerful as a higher level language. I find myself rebuiding in go a lot of things that are part of the standard libraries in Java.
But, go has a different level of appeal. I am starting to like some of the simplifications, but other things are a PITA
 
The snippets I've seen so far look promising.
 
4:04 PM
thanks for the blog link @rolfl
 
The single biggest benefit of go is the compile-to-a-single-binary-with-no-dependencies.
Install is as simple as scp myprog user@remotehost:myprog
 
Bye-bye C++.
 
I have to confess that it makes Java look ugly at deploy time.
but, code-time in Java is more pleasant.
 
You said something about the lack of tools available for Go, but I assume there are more drawbacks to consider?
 
@rolfl and yet it is said that Go has "a large standard library."
 
4:09 PM
Yeah, even coding Go in eclipse, I can't do code refactoring - you can't rename a variable or function.
3
 
^^^ ouch
I see that as a huge problem :(
 
Back to Ctrl+F-style refactoring, great.
 
What's with all these languages with no good IDEs?
 
Most go programmers are still with vim and emacs ;-)
 
This sounds more like a code review question than an SO question. codereview.stackexchange.comchris85 18 secs ago
 
4:11 PM
@SimonForsberg - about the large standard library, yes, it's bigger than a raw C install....
but, things like C are always augemented by other libraries, C++ and boost, etc.
 
oh, so "for some values of large", then.
 
What's a good example I ran in to recently, yeah, SCTP - Streaming Control Transmission Protocol - this is a standard that's been there since 2002 or something, and lives next to TCP and UDP. Java has had support for years, but not go.
Another one I ran in to was passwords in zip files - no support.
The logging systems are very primitive.
 
does it have the equivalent of junit ?
 
(unless you get a third party logger).
@janos It does have a good unit-test system, and th eunit tests include cool benchmark and "example" systems too.\
The examples are really interesting. You can write a spectial type of unit test, and the system will copy the test, and the result, in to the HTML documentation as an example (that, when you read the docs, you know the code produced the results you are seeing, and was validated at compile time).
 
wow, that sounds pretty awesome
 
4:16 PM
My biggest beef with the tooling, though, is the open source dependencies ;-)
It's hard to explain, but most Go code is out there in github. The native libraries do not contain a UUID library, so you have to get one from "the wild". Then, there's 100's of people who have implemented their idea of what UUID should look like
It sounds nice, but really, you spend too long trying to figure out which UUID library is the better one, with the best license, and most stable..... and you give up, and write your own.
Then, you store the code in the GitHubEnterprise local system, because you are IBM, and can't easily make the code public on github.com.... so, now your code is not in a public repo.... which means all the standard go tools break.
Normally, if you want to use some code like: (just picking the top google result: github.com/satori/go.uuid )
go get github.com/satori/go.uuid
but, that can't work anymore, and you have to do git clones, etc. and it's a mess, because you have to manually chase library dependencies.... etc.
Ihate maven, but go makes maven look attractive for non-public development.
 
@rolfl Sounds very useful, such a tool would make me more likely to write both tests and documentation :)
 
1
Q: Android unit converter

imotebI am developing an unit converter application for android, the application is working correctly but my problem is with the optimization, is there a way to optimize somehow the code. I have different categories - speed, weight, length and so on, and for each of them I have separate activities. Her...

0
Q: lightweight logging library in C

arcomberI want to get some practice in writing C libraries and so started with something I can use straight away, a logging library. It is very basic and only has two levels: log everything and log only errors. Use logd (log debug) to log any low level thing and if log everything level set, that item w...

 
@rolfl Doesn't sound nice at all. (Which I thought even before read your opinions there)
 
4:31 PM
The word that describes Go is "immature". All the major issues can be addressed in time.
Now is about the right time to get in to it, thought - mature enough that it is useful, and before everyone else jumps on to it - it will be a successful language.
The people who start now, in Go, will be the experts in 2 years when Go is making people $$$$$$
^^^ Monkey Prediction ^^^
7
 
possible answer invalidation by imoteb on question by imoteb: codereview.stackexchange.com/posts/120714/revisions
 
0
Q: Query Optimization

eWizardII// cleaning / sort db.Data.createIndex({"_created_at": -1}); // help : hackhands.com/vibhor var start = new Date(2013, 2, 13, 0, 0, 0); var end = new Date(2013, 2, 13, 23, 0, 0); while (start < end) { var newDate = start.setMinutes(start.getMinutes() + 5); start = new Date(newDate); ...

 
@rolfl As much $$$$$$$ as COBOL?
 
COBOL in 1980, 1999 or 2000?
 
I've tried to like Go, but idk, I just can't bring myself to like it for some reason.
 
4:46 PM
I can understand that ;-). Out of interest, @SimonForsberg
GO: http://www.indeed.com/salary?q1=Go+Developer&l1=
Java: http://www.indeed.com/salary?q1=Java+Developer&l1=
COBOL: http://www.indeed.com/salary?q1=COBOL+Developer&l1=
 
Holy crap, big difference between junior and senior salaries.
@rolfl Well, I guess 2000 was better paid than in 1980?
 
2000 was much worse than 1999 though ;-)
 
Whenever I look at such stats about salaries, I always feel underpaid...
 
4:49 PM
This is better suited for codereview.stackexchange.com — chepner 15 secs ago
 
the highest I can find is Scala
 
Sounds like it's time to learn Scala, then :) Sorry, Go!
 
Hmmm... golang makes an interesting search: indeed.com/salary?q1=Golang&l1=
 
the future is not looking very good for brainfuck: indeed.com/salary?q1=brainfuck&l1=
9
 
4:53 PM
LOL
 
@SimonForsberg - out of interest, jenkins or travis?
 
Hmm... It seems I'm grossly underpaid.
 
@RubberDuck - everyone is. It's the few lucky schmucks who have wangled their way to the top by BS and weaseling... that make the rest of us feel bad.
You don't actually want to be one of those people who skew the numbers for everyone else.
 
@rolfl I'd recommend Jenkins. I feel that it gives you much better control of things
 
Lol. That makes me feel better.
 
4:56 PM
@rolfl You underpaid too?
 
@ chepner I suppose you're right. I will not re-post this in the codereview.stackexchange.com board for fear of the "double poster" reprisal from various members, but if anyone can bump this post, please by all means. — John 58 secs ago
 
@SimonForsberg Thanks, appreciate the feedback. I am content with jenkins, but others like the pretty colours of travis, but I can't see the actual value-add.
@SimonForsberg Of course.
 
I think most developers are under paid.
And more of us perform corporate support than most would have you think.
 
@rolfl You want pretty colors? The most important thing is this: wiki.jenkins-ci.org/display/JENKINS/Green+Balls
 
@SimonForsberg Green Balls is so much better than Blue Balls.... yeah.
Actually, I'll see if I can enable that. I dislike the blue. I have to admit.
 
5:00 PM
I believe the green balls plugin is the most popular plugin for Jenkins.
 
I have it..... just need to enable it, I guess.
One of our execs is colour-blind. I will run it past him first.
 
0
Q: Java: How to cancel a job in ExecutorService?

FinkelsonI wrote a code which demonstrates how to cancel a job in Executor. Here is it: ExecutorService executor = Executors.newFixedThreadPool(4); Future<Void> future = executor.submit(new Callable<Void>() { @Override public Void call() { // // do some long running op ...

 
And making new Jenkins plugins isn't too complicated.
in Cardshifter TCG, Feb 14 at 0:01, by Duga
[Zomis/Duga-jenkins] 7 commits. 657 additions. 164 deletions.
Made that plugin in one day ^^
 
I am building it all in to a really long script as part of the shell-exec build ;-)
 
You might want to investigate in the Groovy DSL for Jenkins
in fact, I should investigate in that too :)
 
5:10 PM
 
0
Q: How do I increase performance speed of my algorithm for segmenting CT brain images(Dicom format)

SantoshHere I am attaching snippet of my code. % Matlab Code for region growing algorithm. th = 20;diff = 10; J = regiongrowing(img,CORD_XY(1),CORD_XY(2),th); value1 = sum(sum(J>0)); if(num>10) th = 55; diff=10; else if (num <=10) while(diff <0.2*value1 && diff ~= 0 && th < 60) val...

 
5:33 PM
0
Q: Array based deque in java

Sanchayan DuttaI wrote a java code for array based deque. Are the conditions which I have included for insertion and deletion from front and rear sufficient and necessary? Have I missed some condition check? Or have I included some redundant condition? import java.io.*; class Dequeue { int arr[]; int lim; int ...

0
Q: How to call a class method correctly with parameters?

user984621I am using axlsx gem and it works beautifully. So far I had the code for generating the code in the controller, it looked like this: respond_to do |format| format.js format.xls do Axlsx::Package.new do |my_axlsx_package| ... send_data my_axlsx_package.to_stream.read, :filena...

0
Q: python lists. greatest common divisor (GCD)

f.pinki want write function named find_gcd that accepts a list of positive integers and returns their greatest common divisor (GCD). Your function should return 1 as the GCD if there are no common factors between the integers. Here are some examples: [12, 24, 6, 18] then my function should return the ...

 
5:51 PM
That totally worked, thanks for the code review, I feel daft now. :-X — Achtel 39 secs ago
 
@rolfl I suppose IBM jumping in on the language is quite helpful ;)
 
In a sense. We're not the first by a long way, though. It came from google, and things like Docker use it extensively too.
 
@rolfl I haven't been able to find the option to run Travis locally since a long time, and that pretty much makes it unusable in a lot of scenarios (if you don't want to put everything in the cloud)
 
It does give it a "good for the enterprise" stamp of approval, though.
 
@rolfl Hmm right, I just can't seem a reason to start using Go, nothing is really attractive, except it has that new thing with fibers instead of threads for multi-threading I believe?
 
5:56 PM
fibers is an interesting name for it. go-routine is the official name. go-routines are useful, and fast, though.
 
I think I'll need to really dive into C++ if I want to get a foot in the game market though, it's still on my todo list
 
Technically goroutines are a concurrency, not multi-threading thing.
It's a subtle difference, but understanding that difference is important in go (and other languages too).
 
I am curious though why Go would be chosen over an existing tool-chain of any currently well-supported language
 
it's new and shiny
and it makes concurrency easy
concurrency is a big thing at the moment
and will probably continue to be
it's also not javascript which is a plus to some
 
00:00 - 18:0018:00 - 00:00

« first day (1023 days earlier)      last day (2997 days later) »