-1
votes
0answers
6 views
VBA UDF return calling cell adress as value to that cell [on hold]
I need to have my script find the adress of the cell it is called from and return it to that cell as it's value.
I tried this, but it keeps returning #value.
...
0
votes
0answers
5 views
Shortest path from U to V using at most k nodes
I'm trying to solve a problem that asks for a shortest path between two cities with at most k nodes.
The first line of input has the number of test cases. On the second line 3 integers are given, ...
0
votes
0answers
5 views
Remove and move elements in a WebBrowser Control page
I'm making some changes to a page on a WebBrowser Control. There is some indications in the code. I just want to make sure that I'm not putting any unnecessary lines of code.
...
1
vote
0answers
2 views
Generic toString() for JPA base entity class
In a Java/JPA project I usually define a base class (on which I put the id). The goal is to implement an generic toString() on this base class (named BaseEntity) from which all other entities inherit. ...
1
vote
0answers
7 views
How to encapsulate the following code in a Web API Controller?
I need your help to refactor the following C# code, as you notice the GetDropdownList() function is being called on couple of controllers based on this example and it may be called in many other ...
1
vote
0answers
13 views
Basic contact form - is it reasonably secure?
I've just written my first php file and am wondering if an experienced programmer could have a quick look whether there aren't any obvious security holes.
This code processes a basic contact form ...
0
votes
0answers
21 views
1
vote
2answers
29 views
Implementation of a sparse Markov Chain in C#
I need to create a sparse markov chain. It is supposed to receive text, so the number of rows or columns can easily go up to 20000. Besides, if I want to consider higher orders of the markov chain ...
1
vote
0answers
6 views
Application Configuration in PHP
I'm in a journey to learn php and i know too many ways to configure the application, i use this way :
Folder :
app
config
app.php
db.php
src
class.php
index.php
File :
...
-1
votes
0answers
10 views
Better way to validate user input in cakephp
I'm trying to find a way to make my code easeier to read, so i found that major part of the code is validation trough if, ifelse:
...
1
vote
0answers
20 views
Sunrise calculator
I'm taking a stab at learning Swift, and thought I'd ask for a code review. Basically, can you look at the code and tell me whether where the novice errors are, and what I should be doing instead?
...
-3
votes
0answers
27 views
0
votes
0answers
20 views
Creating a single function which creates clickable listitems with functions to a given list [on hold]
How can I create a single function which creates a generic list item, as I am adding several list items and a lot more in future like 10 - 15, I think following code can be added into a function to ...
2
votes
1answer
22 views
C++ EventHandler Class
I need to have some Thread-Safe Event Handler (like C# EventHandler), so i made one.
Here is my event handler class and sample code (compiled with VS2013)
Could some one please review it? :)
Is ...
3
votes
2answers
34 views
JobTypeLogic and JobType classes in MVC business logic
I am working on an MVC solution. My DAL layer I could solve with Repository classes, everything is working great.
But in my BLL layer I have repetitive code:
My CRUD is the same, my fields and ...
4
votes
1answer
22 views
Text file manipulation with java 8 and guava
I am trying to do some translation of text files. I have a translation csv file, and a file I need to translate (tab delimited). The translation is creating a file ...
1
vote
1answer
26 views
Three ways to read a number for a BitInputStream
I'm trying to learn how to write more readable code without introducing easily avoidable performance killers.
This is part of a BitInputStream Java class I'm ...
1
vote
1answer
36 views
Map all symbols in module to dictionary
The div and add functions are located randomly in my package structure. I have a function with this signature:
...
-3
votes
0answers
13 views
extJWNL synonym relation [on hold]
At the moment I'm trying to write a method which takes two "random" words and checks whether those words are related (synonym). The output should be a probability (0 to 1) how likely "word a" is a ...
-1
votes
0answers
13 views
Flask, Python, MySQL - Query with parameters works locally on dev but not on the production server [on hold]
This issue has stumped me.
Locally I'm using Anaconda and running python 2.7. I serve my Flask app using run.py but connect to my actual database (hosted by dreamhost.com) even in the "dev" ...
1
vote
0answers
21 views
Parallel Merge Sort in Scala
I have been trying to implement parallel merge sort in Scala. But with 8 cores, using .sorted is still about twice as fast.
Input file with 1.2M integers:
...
1
vote
1answer
32 views
Java Rock/Paper/Scissors Game
For my computer science class I am tasked with writing a rock/paper/scissors game. I understand how to write the game, but I was wondering if someone more experienced than I could give me some ...
1
vote
0answers
10 views
Text box intuitive user-interaction using focus listeners
This code aims to replace labels used to explain a text box's container. This is done by adding a default string when the text box is considered empty to explain the purpose of the text box. However, ...
2
votes
0answers
23 views
Dice-rolling Android app
This is just a simple app. All it's suppose to do is move the dice around the screen when the user swipes up or down. It will move 2 dice (image drawables) to a position on the screen depending ...
6
votes
1answer
49 views
Sum of primes in given range in Go
This piece of code calculates the sum of all prime numbers below 1 million.
It stood out to me that the Ruby script is around 20% faster. I know that Go should be faster just for being a compiled ...
2
votes
2answers
293 views
Find the closest number to each given number
I have a program which works but it is a bit too slow with big numbers.
nbBlocs contains the size of the array, it can be up to 20000 and I enter the value inside ...
4
votes
2answers
537 views
Simple FIFO and LIFO ferry simulator
I am trying to make a ferry simulator with one ferry that works like a stack and another like a queue. I have a working class for stacks and queues with pop/push; I am trying to figure out how to ...
4
votes
1answer
21 views
Slicing time spans into calendar months
I have apparently correct code that still runs for weeks on my data (tens of millions of rows). I show the entire code for reference (and maybe other gains to be made), but the key operation is in the ...
3
votes
2answers
35 views
Getting a hash string for a very large file
After reading about large files and memory problems, I'm suspecting that my code below may be inefficient because it reads the entire files into memory before applying the hash algorithm. Is there a ...
6
votes
0answers
21 views
Options, options, options. None for JavaFX?
I was looking through the JavaFX library, and I spotted that JavaFX DOES NOT HAVE A JOptionPane EQUIVALENT. I decided the next step was to write a ...
3
votes
2answers
49 views
Assembling very large files
I have users uploading files sometimes as large as 100+ GB to a local web server. The upload process works well and chunks come in at 50MB. The problem seems to be after the file is uploaded, when ...
3
votes
2answers
55 views
Checking if text is NOT displayed
I'm currently writing unit tests in Selenium (C#). I need to do two things in this particular test:
Check if 2 errors (with html container) are displayed and check if another (given) error is not ...
-1
votes
0answers
10 views
2
votes
0answers
12 views
Bubble sort in Scala
I wanted to implement a bubble sort in Scala following the steps described in: http://www.bbc.co.uk/education/guides/z22wwmn/revision/3
...
2
votes
1answer
54 views
Data Structures C# Dictionary<int,user> and user has a property that is a list<numbers>
1st time posting here. I am about to post a question to StackOverflow about how to do a better job adding a Number to the list inside the User class. But I feel if I refactored this I might solve my ...
-1
votes
0answers
18 views
Checking regex pattern efficiency [on hold]
I have some strings like:
@HELLO) AND @X
@Y1) AND @TEST
I am using this Regex: @[?\w?]\) AND @[?\w?] that detects ...
2
votes
2answers
72 views
Non-Contiguous Substrings
Problem:
A non-contiguous substring of string \$s\$ is a sequence of \$k \geq 0\$ characters in \$s\$, in the order in which they occur in \$s\$. For instance, the set of all non-contiguous ...
-4
votes
0answers
10 views
2
votes
1answer
11 views
Listing Docker Images without registry URI
I have a private container registry behind a firewall that will need some Google registry images. To make sure things are updated sanely, I'm writing a mirror script in Bash. I have one line that ...
3
votes
1answer
23 views
PWM wave generation
This code takes a integer x of range [0,127] as input, returns an array of four 32-bit integers, with x bits set.
I'm trying to ...
2
votes
0answers
32 views
Unit of work with Repository pattern
I am trying to work on a WPF application and decided to go for Unit of Work and Repository pattern, along with MVVM. I am using Entity Framework as my ORM. Could ...
0
votes
1answer
27 views
Null check when enabling Up navigation in Android
This upvoted SO answer and this upvoted SO answer both check for null in a similar way: they call a function in the if or assert ...
4
votes
1answer
36 views
Sieve of Eratosthenes Primes Efficiency
I'm fairly new to Java and was trying to make a program thats generates the primes from 2 - 100. I originally had a design of my own making but it was fairly inefficient so I did some research and ...
5
votes
1answer
34 views
Test whether target string is substring of source string
The code is self-explanatory. It has \$O(n)\$ complexity, and it tells whether a given string is the substring of the source string. Are there any cases where this algorithm fails? Is there anything ...
4
votes
2answers
54 views
Two string comparison
I wrote a function that finds the difference between two strings. This only works given that the difference is continuous.
Beyond doubt this already exists, I am recreating this for educational ...
2
votes
4answers
244 views
Implementing a thread safe log class with simple functionality
I have finally assembled an attempt to create a thread safe logging class and also ensured by file flags that file should not be accessed by different processes at same time. This classed will be ...
2
votes
1answer
32 views
java.sql.Timestamps: There's gotta be an easier way
I have a function that counts how many "assists" a team performs during the course of their day. The way I've written it feels bulky and inefficient using GregorianCalendar.
Basically, the ...
1
vote
1answer
61 views
-4
votes
0answers
28 views
Python Rock, Paper, Scissors. Struggling Newb [on hold]
Struggling Python Newb here. Simple RPS game. Struggling to get it working. Im sure theres alot wrong. Any help would be appreciated. Kinda lost and overwhelmed. The menu loads but then it throws up ...
-2
votes
0answers
28 views
Anti forgery token as header field or as Post value on AJAX? [migrated]
I'm working now on Ring Anti Forgery to prevent the site from CSRF attacks. Now I'm in doubt if I should pass the token as a header field or as a post value on AJAX ...