Here is my insertion method for a doubly linked list. It works, but passing two parameters for the method seems cumbersome. Can anyone suggest a cleaner approach than this?
LinkedList list = new LinkedList();
Link link1 = new Link("A");
list.insert(list.head,link1);
Link link2 = n...
So... this guy emailed & sent me a twitter message because he can't figure out how to use a project I put on github.
I was already annoyed that he contacted me through both methods and didn't make it clear he was the same person (the account names weren't even remotely similar).
He insisted in chatting about it through twitter direct messages though...
I told him it's a conversation that would be better held in a Stack Exchange chatroom or through email.
So... several hours later he sent me a message and said he didn't have enough rep. I didn't reply and haven't heard from him since. I'm not going to help this guy figure this out over Twitter..
There are millions of different methods for him to communicate with me.
I have a subclass of UIScrollView that I need to internally respond to scrolling behaviour. However the viewcontroller will still need to listen to scrolling delegate callbacks so I can't outright steal the delegate within my component. Is there a way to keep the property named "delegate" and jus...
It's a challenge, in general, to debug someone's code problem remotely, especially when a question is vague or ambiguous. But sometimes I have a pretty good idea where the issue lies, and how to ferret out the problem, so I suggest debugging / problem solving steps. These are typically for questi...
haha wow... this guy... in Cities: Skylines... he's got a lake... on one side he placed all of his sewage outflow pipes, on the otherside, all of his water intake pumps... and across the middle, a hydro-electric dam...
I want to have distinct operations of numbers to get a number. For example
If number = 5
The result should show in System.out.println: 2+3, 6-1, 10-4-3-2-1, 1+6-4+5+2, the last one is important i want to have "+" and "-" operands with whatever combination wich equals a number, not only 5 but ver...
I am working on an interview question in which I need to find largest palindrome made from product of two 3-digit numbers. Here is the question. I came up with below example:
public class PalindromeThreeDigits {
public static void main(String[] args) {
int value = 0;
for(int...
I want to have distinct operations of numbers to get a number. For example
If number = 5 The result should show in System.out.println: 2+3, 6-1, 10-4-3-2-1, 1+6-4+5+2, the last one is important i want to have "+" and "-" operands with whatever combination wich equals a number, not only 5 but ver...
@Femtosecond that seems a bit odd... Perhaps post another question regarding this on codereview.stackexchange.com or put the code in at www.pastebin.com — vihan10864 mins ago
Oftentimes, I write small little dialogs or forms without a UI builder. I usually find myself having a lot of "container" panel variables that just float around. I found this leads to time-wasting experiences.
Where did I put that BorderLayout panel?
Oh right, here it is.
Wait, neve...
In order for Rubberduck to be able to "recognize" the built-in VBA functions, procedures and objects, I added yet another constructor parameter to my Declaration class:
public Declaration(QualifiedMemberName qualifiedName, string parentScope,
string identifierName, string asTypeName, bool is...
I have a script to load a range of number. This range of number is only 200 lengths. However, it has a change function. When the start number is change, the the end number will try to find its range again.
The whole of code is working fine. However, it gives me a time lag (sometime get crash) o...
There seem to be several questions floating around Stackexchange regarding how to take a python regular expression list the matching instances. This problem is a bit different because 1) I'm need to start off with a domain-specific regex system, not just the standard python regex, and 2) the pos...
you don't need a StreamReader, you can use StreamReader's base type TextReader
instead of a static field, you can pass the TextReader between the methods
since you're given a string, you can use a StringReader, which is derived from TextReader
i think you should be checking if calls to Peek and Read return -1, which indicates no more characters to read
finally, a big problem with the static field is that if EvaluateExpression is called, and called again before it returns (e.g. from a different thread) the result of the first call will be wrong
Take a look at the problem statement here.
Here is my code.
#include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long int l,d,s,c;
scanf("%lld%lld%lld%lld",&l,&d,&s,&c);
long long int i;
long long int x=s;
for(i=2;i<=d...
I have a Map<String, List<Object>> multiFieldMap and I need to iterate over its value set and add the value to multiFieldsList:
public List<Object> fetchMultiFieldsList() {
List<Object> multiFieldsList = new ArrayList<Object>();
for (Entry<String, List<Object>> entr...
I'm working on a search utility that searches through source files. It's only the beginning of the project. It lacks a lot of features, but a backbone of the project works and it would be great if you can take a look at it.
path, keyword = ARGV if ARGV.length == 2
if ARGV.length != 2
puts "No...
I have written a water cooler example in which the consumer drinks from the water cooler until its empty and when it gets empty the producer fills it up and the consumers wait until its filled up and then start drinking again. Can you please review.
Producer:
package com.par.consumer.producer;
...
public final class DistanceCalculator {
public static void main(String args[]) {
System.out.println("distance="
+ calculateDistance("Khreschatyk Street 1, Kyiv, Kyiv city,
"Peremohy Avenue 22, Kyiv, Kyiv city")); //6266
System.out
.println("dis...
Does it work? Is it bugfixing or code review you're after? If bugfixing, please state the nature of the bugs you can't find. If it's code review, your code is better suited on Code Review. — Lasse V. Karlsen54 secs ago
instead of including [Post Link] results for the posts id, it includes the Ids of the posts.
@YoryeNathan When you do a thing, you should do it correctly, otherwise a code reviewer will ask himself "does he know exactly how Random works and doesn't care, or what" — xanatos50 secs ago
My intention is to store user's last log in date and time when he logs in to the web page. I pass his username and password to the stored procedure to check whether is it correct or not! I believe it'll be fine to store his last login date and time if any record matches.
Below is my code:
USE [...
This is a bunch of questions, all of which are inappropriate for stackexchange. Please provide a minimal example program that reproduces a specific problem. Once the code is working, you can use the "code review" stackexchange site for more general suggestions on improving your code. — TheBlackCat59 secs ago
I wrote the following code below to extract the least significant bit (LSB) of each pixel and store it into byte array. I was wondering if Java has a more efficient way to do this?
Right now, I am looping over every pixel, extracting the LSB, and updating the current byte by shifting it to the l...
I can't really tell whether superuser.com/users/388162/se-sucks is affecting anyone on sites other than Anime/Manga, so is it really right to ask for a network removal or just limit it to area of effect?
@Quill while that concern is true, I think that's for the staff to evaluate... Oftentimes they have a better overview of what is happening where than us users...
they just seem to be somewhat disgruntled about some drama somewhere...
@Quill In general, if you have a concern about anything on the site that is not handled with a downvote, close vote, or so on, then flag it for moderator attention. If you notice a pattern that you are not happy with, then be sure to say that there is a pattern in the mod message, add links to examples of it.
The mods on each site do communicate with other sites too, so be sure to mention any cross-site concerns in the flag as well.
If relevant, flag content on each site for the other mods.
Hmm, I'm torn between using Django views or using AngularJS views + Django REST API or a combination of both
Django views don't seem to be that bad at all, but in my experience all view technologies are difficult to work with, just like JSP pages are a hell to maintain as it seems
"i think its not efficient enough" - on what basis? Is there some performance problem (memory? CPU? Have you profiled it?) Could you expand on your criteria for efficiency? If this is working code that you think could be improved, consider codereview.stackexchange.com, but I suggest you read and follow the style guide as a first port of call. — jonrsharpe32 secs ago
I am working my way through some exercises, using Java, to learn about programming. I have just finished the following Code Golf challenge:
Here is some example input, so I can explain what the problem is:
((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo)))
Think of this line of text...
Recently as part of a job interview I was given the following coding task:
Attached is a gzipped text file of about 100,000 English words. Write a
Python, C or C++ program that finds all the anagrams of the word
"empires" that exist in the words file (just a reminder: an anagram is
the ...
This weekend, I ran into a peculiar problem of handling race conditions in Javascript.
Here is the code that was giving me problem:
function myFunction(requestObj, myArray) {
for(var i=0;i<myArray.length;i++) {
//AJAX call
makeAjaxCall(requestObj, function(data) {
//Callback for the...
Consider I have the following:
FrameworkA, which defines class Foo
FrameworkB, which also defines class Foo
A file in FrameworkA which imports FrameworkB
How can I get Xcode to generate either a warning or error on any line that makes references to Foo without using the namespace qualifier?
...
Hmm, my Probability and Statistics Course has homework exercises: 6 weeks of exercises and for every week 8 exercises, but only 4 will be graded, furthermore only the 5 highest out of 6 weeks count
I wonder if by reasoning with probability I can infer how many exercises I need to make per week :D
Technically speaking, of course, I'll still make them all
Help me optimize the code. Prompt, where it is possible to improve the code or change the way rendering? Consumes a lot of CPU.
Or it is possible to reduce the overhead of calculations? If you are using only 1 point when drawing the load on the CPU is not changed! If you are using only 1 point w...
I have a large word-file with over 240 000 words. I need to know if a specific word exists in this list quite fast. I thought that it would be a good idea to create a Radix Tree for this problem.
The text file excists of 240 000 lines, one word for each. A string contains one word which is then...
causing a cascading short and then overload of all the circuits (note, plural, the primary and backup nes) that manage the switching of power sources for the data center.
It happened in the missle of a batch process updating insurance claims and the data was in the process of being mirrorred between mainframes.....
I just so happened to come across this and wanted to offer a non-SO point of view, as I believe this rightfully belongs on MSE as badges affect the entire Stack Exchange network.
I think this is a wonderful idea and have wondered myself why there isn't a silver and bronze level badge for this. ...
I want to be able to improve the way I am sending these emails because it is currently not testable (via Mocking) and it is hard to maintain.
Main Sender (I also need an Async method on there but I have left it out):
public class MailSender
{
protected bool SendEmail(MailAddress toAddress, ...
so I am working on a program where it is a networked game and either player enters a choice, and I am trying to add an image to the JFrame when the person picks their choice. There are 5 choices and I just simply want the images to appear in the frame (i.e. someone picks rock, then a picture of ...
This would be OK on Code Review as it appears the code works and just looking for improvements. If you do decide to post on CR, make sure to delete it from Stack Overflow so we don't have duplicates. — Phrancis48 secs ago
Working on some documentation lately, I had a need to convert a number of asynchronous serial waveforms into ASCII graphics characters. Rather than draw them by hand, I decided to write a program to do it for me. I'm interested in a code review, and particularly if there are smarter/shorter way...
Let me start off by saying that I have several years of experience in Java, but now I need to learn Python, so I decided to make a calculator as it also is a community challenge.
Please review the code looking for beginner mistakes, though I do intend the code to look professional. This is my fi...
You've got this weirdass verbose naming convention that says packages should be com.mycompany (and another 5 subdirectories). Does net.mycompany also apply if you have a .net domain?
The Go Playground was boring so I decided to make a small application that throws me into the language. It basically queries the chatroom every second for new messages and displays them in the output pane (minus the bots their messages).
It's all new to me so any insight is welcome. One thing I'...
While looking at a question, I saw a list of other related questions that had several meaningless titles:
How can I make this code more elegant
Can I make this C# for-loop more efficient?
How to refactor a verbose datatype?
How can I improve this OOP design? Is it even valid?
How can I make thi...
@JeroenVannevel - yes, the package name traditionally is your domain-name reversed. This allows everyone to create a "Node" class. additionally, after your domain, you then break it down by department/application/etc.
So, things like com.google.commons.util.StringUtils happend (don't know if that exists).
For people without their own domain, the tradition has become to use your github name....
I have been learning C# for a couple years now, and using small projects to help myself learn. My most recent project is a complete rewrite of my first C# project that just got out of hand (the old one).
I would really appreciate it if you could take the time to take a look at it and provide ...
An unhappy SO user just accused me (and all other SO answerers) of being arrogant.
I am arrogant... But I'm not sure how get that from my SO answers.
Wow. I am not so arrogant, you certainly appear to be arrogant enough to believe without proper basis that I do not research or attempt to answer my own questions or solve my own problems. That quote you took from my post perfectly demonstrates this as I meant exactly what you went on to say I should do instead.. The arrogance of question answerers on SO is unbelievable — Josh C26 mins ago
So yea, even one source file is too large for pasting in here. For the help I would like (code review of entire solution), I don't think the setup here is the best way for me to ask it. — Chris Woodward2 mins ago
I have routine tasks which require pulling data from an obsolete SPC package and putting it into Excel. The SPC software will only export into a text file.
I have put pieced together a script to import this into excel, break it into different sheets and do a little bit of cleaning on it. I am s...
FYI, somebody has kindly created a pull request with optimized raw SQL that performs 2-3x better for writes than the original raw SQL: github.com/daj/android-orm-benchmark/pull/2 I plan to merge it once we've finished code review. — Dan J11 secs ago
I have a class I use to sent of request and to receive responses via NetMQ. This class uses a Pub-Sub type structure and works great. I instantiate a broker, use it to run a back test and everything works (requests are recived by my C++ code, and responses from C++ are detected and handled).
Ho...
Can you please give me a feedback about this design implementation ?
Suppose i need to calculate a salary of an Employer, this salary is depending on something called : REGIME, the REGIME is either newRegime or OldRegime.
Suppose the calculation should be as following :
If (newRegime) then ...
I am trying to simulate the Monty Hall problem in Matlab. Find below my code
games = 10000;
playerSwitch = zeros(1,games); %add 1 to last entry if you win else copy
playerDontSwitch = zeros(1,games); %
for p = 1:games
winningDoor = randi([1,3]);
contestantPicks = randi([1,3]);
hostP...
I have been learning C# for a couple years now, and using small projects to help myself learn. My most recent project is a complete rewrite of my first C# project that just got out of hand (the old one).
I would really appreciate it if you could take the time to take a look at it and provide ...
One of the biggest challenges for a Beta SE site is attracting enough people to attain critical mass necessary for keeping the site productive. Whereas cosmetic appearance isn't nearly the most important aspect of a Q&A site, it does affect first impressions - considering the breadth of the Inter...
@ChrisW Well, indeed. I suppose "should" be temporary is more fitting. Code Review is an odd one as it's been borderline popular where just enough posts/people have been there to keep it alive, but not enough to make it a live site. I presume mostly because there's not enough users with high rep to moderate. — James20 hours ago