0
votes
0answers
10 views

What is a more efficient way of coding this linq query?

What I'm trying to do is check if I have a row in the database with a matching date and if I do then update the value and if I don't then insert a new row for that date. I'm getting a null object ...
-4
votes
0answers
17 views

check why my code is not working [on hold]

I wrote this simple code that checks if 2 arrays can be re-arranged to be equal to each other, yet it's not working.. can't find the bug.. help please. ...
1
vote
2answers
14 views

Validating a Collection of IPv4s

I have a method within a class that validates all proxy addresses are valid on initialization. I've tried to refactor this a bit, but this seems to be the best I can do. Any suggestions and/or tips as ...
-5
votes
1answer
31 views

Cycles of pointers

I'm really inexperienced with cycles, so I want to make this code shorter. As far as I know, I've made a recursive cycle. ...
3
votes
1answer
13 views
1
vote
0answers
15 views

Switching from functional jQuery code to object-oriented

I've been happily using jQuery, creating vars and binding events in my modules (which have only a little bit of JS). But recently I needed to add an anonymous functions to my code and after ...
3
votes
1answer
25 views

Isprime Android app with kivy

I thought that developing an app in Python should be easier than learning Java. I finally got my isprime app to work but it looks ugly. When I write GUI code I always find myself typing in very long ...
3
votes
1answer
37 views

Event Subscriber with Parallelism

I am trying to exploit asynchronism for parallelism. This is my first attempt at a parallel event subscriber. In your expert opinions, is this a valid approach? ...
11
votes
7answers
119 views

Extracting the classpath entries from a jar file's manifest

Sometimes I need to search for dependencies in the classpath entries in the manifest of jar files. A jar manifest with classpaths looks like this: ...
2
votes
2answers
37 views

Extension method to enumerate a hierarchical object [on hold]

I have a domain object that I have no control over which itself contains a collection of this same type. This is a classical hierarichal representation like in a tree node hierarchy. I would like to ...
7
votes
1answer
38 views

Implement stateless strategy pattern with enum being container

I am implementing a framework for validating orders. User creates a number of orders (Amazon orders for example), before he submits the orders and pays for shipment, whenever he revises anything, I ...
6
votes
0answers
17 views

Trait accessing variables of classes using it

I just tried PHP Traits for the first time, to keep my code DRY : ...
2
votes
0answers
17 views

Slow Javascript code to get Taxonomy terms from Sharepoint

We have the following code which takes about 5 seconds in a modern computer, however the application is also executed on old PCs with Windows XP, and in there it takes 5 minutes to load. I know the ...
0
votes
1answer
38 views

PHP login redirect security? [on hold]

I wish to redirect users to the login page if they attempt to visit a page which requires them to be logged in. After logging in, however, I want to redirect the user back to their original ...
3
votes
5answers
416 views

Shortening boolean with if statement for document version comparison

Can this be shortened to one line? ...
-1
votes
0answers
43 views

Payroll Calculator Homework [on hold]

I have written the code as best that I know how but I am unsure that the questions asked are being fulfilled. Any advice to improve this code would really help me. Question Asked: Create a new ...
2
votes
3answers
90 views

Find the missing number in a array

I'm working on a personal project to practice my programming skills and I came to this problem. I tried to create a program that will find the missing number in a array. I'm looking forward to ...
1
vote
0answers
34 views

Object counting sort in Java

The counting sort for integers counts the amount of each integer, then traverses the count entries in order, and for each entry inserts the integer representing the bucket into the array as many times ...
-6
votes
0answers
17 views

which tools are used for Java code reviewing in Eclipse IDE? [on hold]

Do you have any suggestions of some tools for java code reviewing within Eclipse IDE ? I've tried PMD but the installation keeps failing
-4
votes
1answer
43 views

Declaring the reference of an object within a for loop [on hold]

Please let me know which approach is better case 1 or case 2 and how? Can anybody please explain how it is different if we create the refernce of the object inside the for loop. Case 1: ...
1
vote
1answer
47 views

Class for multithreaded insert into database

Here I have class that supposed to take dictionaries of product objects and their articles (kind of unique identifier) from queue and insert or update them in database table. Received dictionary ...
1
vote
1answer
44 views

Optionally specifying the type when implementing a method for an interface [on hold]

These seem functionally identical: public class Temperature : IComparable<Temperature> { public int CompareTo(Temperature other) { } } as opposed ...
1
vote
0answers
21 views

Idiomatic Scala for nested map/flatmap

Does anybody have an idea on how to make this code more idiomatic? I tried to use scalaz Traverse, but it didn't really help. Given the types and method signatures: ...
0
votes
3answers
36 views

Looping to update article codes on one server based on queries on another server

I've read somewhere on Stack Overflow that doing queries in a loop is very inefficient. It will hammer your SQL server and make your script very slow. Sample code: ...
0
votes
1answer
28 views

Get the condition that does fails in a complex boolean expression [on hold]

I have a complex boolean expression with many conditions. I want, if it is possible, to refactor it so I can get the first boolean condition that is false (will stop parsing boolean conditions as ...
2
votes
0answers
13 views

What's the best approach to achieve two-way communication with TIdTCPServer and TIdTCPClient?

I'm a newbie in Delphi and I'm trying to create a client/server application using INDY. I want to have a server that is capable not only of receiving messages and streaming, but also sending data to ...
1
vote
0answers
10 views

Text formatting with embedded markup for terminal output

I'm learning Rust. I wrote the following library to format text and output it to terminal, so that the formatting markup is embedded with the string itself (looks similar to HTML4). I feel the code ...
6
votes
1answer
60 views

Stable Sort in C#

I wrote a stable sort algorithm in C#. It is just a simple iteration, and is probably not very optimal: ...
2
votes
1answer
34 views

Recursively parsing JSON response using GSON

I have a URL which I am executing it and it is returning the below string as a JSON response. I am using GSON to parse JSON. In the below JSON, "resourceId" ...
5
votes
2answers
87 views

Wiring CollectionView and updating itself without the need for Refresh()

I have been using your expertise developing my application using parts of WPF that I have never touched before. In this stage my View does all I need it to do, however, I am not sure if I've done my ...
-2
votes
0answers
13 views

Recursive function calling another function [on hold]

I'm new to Python and I made this recursive function with a non-recursive function as one of its arguments. I was expecting it to print 4 times but never did. May I know what I'm missing? ...
3
votes
1answer
43 views

Inserting data into database

I started learning PHP and MySQL, was using MySQL_ functions. Then I learned they are deprecated, had to choose between PDO and MySQL. I chose MySQL and started using it. As I learn OOP PHP, I ...
4
votes
1answer
60 views

Strategy Pattern Implementation

I thought I would learn a design pattern today and picked this one. I wrote a simple Android test demo to test the pattern. main.xml ...
17
votes
5answers
1k views

Passing parameters by reference? Let me fix that for you

I've implemented a code inspection that verifies whether a procedure has parameters that are implicitly passed by reference - in VBA a parameter is passed ByRef ...
-1
votes
0answers
18 views

Simple stack-linkedl list calculator in C [on hold]

I'm trying to write a simple postfix calculator that reads the line and performs the calculation using a Stack. I was wondering if somebody coudl check if is struct's and push function are correnctly ...
-5
votes
0answers
28 views

Building a Triangle out of input in a for loop in Java [on hold]

*I need help making a triangle based on the output of the base of the triangle. For example When you put enter the size of the triangle it always prints the same size triangle, Please Help me * ...
18
votes
1answer
103 views

Script to enter text in a box

Here's a little script that enters text into a document when activated. ...
3
votes
2answers
71 views

Rotate image 90 degree clockwise

* Time complexity: O(N) * Memory complexity: \$O(1)\$ Is my calculation of complexity correct for this code? ...
7
votes
7answers
298 views

Create a new Member

I was tasked with member creation on a site that was already developed for Active Directory, so the log in functionality was there and most of the site was all ready to go (after minor major tweaks). ...
4
votes
1answer
57 views

Optimize the Buddhabrot

I am currently working on my own implementation of the Buddhabrot. So far I am using the std::thread-class from C++11 to concurrently work through the following ...
2
votes
1answer
47 views

Code that finds the largest palindrome from two three-digit factors

My code is really ugly, but I don't know how to make it better. ...
0
votes
0answers
33 views

synchronize 2 jobs/processes [on hold]

I am having a continuously running server application which processes 2 jobs (file processing) which are completely different flows. I invoke the client giving either job 1 or job 2 so it could be ...
3
votes
1answer
28 views

Getting rid of extra test during initialization of loop/recursion

I'm reluctant to ask this question. My code below works, it's intelligible, and it seems reasonably efficient. It's just that there's a trivial, nitpicky issue that's driving me crazy. The function ...
3
votes
0answers
25 views

3-way merge sort in Java

All those numerous merge sorts split the range in two halves. This is a modification that splits each range into 3 subranges. My demo suggests that 3-way merge sort is pretty efficient on large ...
6
votes
0answers
48 views

Mapping a textual method name to a function

My program (a daemon hosting a Minecraft server) exposes a D-Bus interface to allow interaction with the server from other processes. To that end, and to avoid a chain of repetitive conditionals in ...
2
votes
0answers
19 views

HLSL Shader Model 4: Is there a way to avoid pixel shader computing all code paths?

I have a pixel shader that needs to output either a plain colored pixel or a texel sampled from one of three textures - selected by a switch statement operating on an index fed in by the vertex ...
1
vote
1answer
26 views

Parallel for loop in Java 8 - follow-up

The previous and initial iteration at Parallel for loop in Java 8. Changes are as follows: ParallelLoopBody removed; ...
2
votes
2answers
35 views

Multiple random falling objects animation in Java

I am new to programming but I tried to make my code as readable as possible! Hopefully you can see what it does before you run the program. I did not implement a ups or fps controller, the animation ...
-3
votes
0answers
19 views

Transposing matrices [on hold]

The idea is to use functions in order to transpose matrices. For some reason, C won't allow me to return the arrays themselves so I tried using pointers. I'm not very good with pointers, so this ...

15 30 50 per page