The code is working but slow. Is there a way to speed it up or make it more compact but still easy to read?
Private Sub CommandButton2_Click()
GetBook = ActiveWorkbook.Name
Application.ScreenUpdating = False
Call OpenFile
Call ReadOnly
Call FindLastRow
Set rng = Worksheets("PHASE").Range("N13:...
Because exceptions messages are localized and I prefer some kind of error codes. Besides my code reviewer will not accept that. Im pretty sure :P — Sarrus21 secs ago
The code is working but slow. Is there a way to speed it up or make it more compact but still easy to read?
There are 35 different jobs to be done. They are made in a worksheet with merged cells to enter, who did the job, when, how long, workorder, nr, etc. Next to the layout is a command button...
I made a slide show using array values. it woks. But i strongly relive that the way i did is too length. there should be a easy and compact approach.
any one give your suggestion to get the compact version of this function.
here is my js and html :
$(document).ready(function () {
var num = ...
I am using the following code to try and only allow letters, numbers, backspace, space, dashes, slashes, and ampersands. I also want all other keys including the function keys to be disallowed. I feel like this code can be optimized to make it more streamlined.
This function is part of a live se...
I have some code to handle integer, double, Boolean, and string settings. Right now, each setting variant extends an abstract class, where the setting value is stored as an object.
Is there any way to avoid this? What I'd like to do is have IntSetting objects return their Value as an integer, D...
There are other methods in this class for executing queries, getting and setting data but I excluded them from post for clarity. Do you still think this class has too broad name? Do you have any suggestion of better one? — Piotr Nawrot6 mins ago
@SimonAndréForsberg The first three seasons were above average and the last three, leading up to the mid season episode of s7 were absolutely amazing, alot of scheming and logic
I have made a game in java that involves two players to fight each other with spaceships. For one player mode, I have programmed a simple AI to avoid allies and asteroids and go straight towards the player. Unfortunately, the game lags quite a bit when there are 3 AIs at once. I think this is bec...
I've written a very short program that is intended to run the program specified in its arguments (argv) as the user named "restrict" (which exists). I want to make sure that there are no subtle bugs in the program, and that the program is as simple as possible.
Is this program doing what I inte...
People say that the code in my implementation is generally obscure.
Can you point me what looks bad here?
The file is too long to include it here, I think.
Please review my custom Arraylist class I constructed from scratch and add any suggestions or constructive criticisms. The point of this template class is give the user a lightweight arraylist with optimal control over how it operates.
It is automatically created on the heap with an optional see...
A question is flagged: Please delete this question - my boss has seen it and says it contains confidential code - he's freaking out and wants me to remove it, but I can't delete it. The question was asked 3 days before, it has 2 answers, one is accepted. How do you respond?
Determining the c...
I need to find the common elements present in all the given arrays.
All the arrays are present in another array
I have come up with this solution and its working
I tried to remove the usage of indexOf, but I could not.
Could someone guide me in optimizing this?
Thanks in advance?
var findCo...
I recently started to learn python for the purpose of making my life as a network engineer easier when performing repetitive tasks.
The script below does parse a huge inventory.xml file I get from a reporting tool to find the ID of ports I want it to and then writes back to the xml file a struct...
I'm new to both C++ and Code Review, I'm hoping for someone to help me use the best practices and further make my code better that I used to accomplish the DailyProgrammer Challenge "Balancing Words." Thanks and please let me know if I need to change this post at all.
#include <iostream>
#include <
I usually review peoples coding style (or lack thereof) on [c]. I've been answering some questions over at [python] today – what a virtue PEP 8 for a reviewer.
I keep looking at this trying to figure if there's a better way. All three functions work, but I wanted to get some insights and ideas from others.
IsLoadDay determines if the date parameter is a "Load Day". Load Days are Tuesday through Saturday, but we skip holidays and designated No Load Da...
I want to create a function that prints a url in Java. I was wonder if my code can be improved:
public void printUrl(String urlStr) throws IOException {
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
try (
InputStreamReader isr ...
on a related note, you should definitely stop using URL. the results of .equals() are dependent on whether you're connected to the network or not... — Vogel6121 min ago
> Note, the URI class does perform escaping of its component fields in certain circumstances. The recommended way to manage the encoding and decoding of URLs is to use URI, and to convert between these two classes using toURI() and URI.toURL().
I've recently finished implementing a ring queue based on std::array in C++11. I tried to write the code as if I were going to submit it to the C++ Standard committee to have a RingQueue as part of the standard while keeping the implementation as simple and fast as possible. The code is below. Pl...
I'm writing this C++ code and compiling with GCC 4.9
This code returns true in case of only one char difference in two words
and false in other cases
bool one_char_difference(const std::wstring& w1, const std::wstring& w2) {
if (w1.size() != w2.size())
return false;
std::size_t d...
I actually don't have too much against simple JavaScript used for scripting, it gets a pain once you use vanilla JavaScript for building full applications
@rolfl Only today did I realise that your name is probably a first name + last initial kind of thing. I thought, for the longest time, that it was something like "rolling on le floor laughing" (and I pronounced it the same as rofl). ;-)
I have a script for a countdown function, which is using massive amounts of CPU power on my MBP.
The script is updating the countdown display every second and basically updating all piecharts aswell.
JS:
var options = {
scaleColor: false,
trackColor: 'rgba(255,255,255,0.3)'...
See Set-uid root program that runs a program as the user "restrict" for context.
I've written a very short program that is intended to run the program specified in its arguments (argv) as the user named "restrict" (which exists). I want to make sure that there are no subtle bugs in the program, ...
Iam doing this exercise where i have to draw a pyramid like below:
**
***
****
*****
Here's the code i have, it does the job but it doesnt work well if user enters strings. it strangely goes on infinite loop. Why is that? I thought that scanf ignored strings so it would return 0 ...
I have some system with java code.
public class Utils {
public static final byte PROVIDER_FOO = 0;
public static final byte PROVIDER_MOO = 1;
public static final byte PROVIDER_BAR = 2;
public static final byte PROVIDER_FUR = 3;
public static final byte PROVIDER_BOO = 4;
public stati...
I have a project with lots of ugly code I've written some time ago. Now I'm trying to make it testable and to use TDD for further development. But every time I'm trying to write unit tests for existing code I'm getting stuck. I just don't know how to test my old code. I can't write any little tes...
http://www.commitstrip.com/en/2015/07/07/video-games-trailers/ CommitStrip - Blog relating the daily life of web agencies developers Video games trailers CommitStrip 1436293200
A word is balanced at the index if the sum of the alphabet positions of all the chars multiplied by the distance to the index is zero. (This description is equivalent to the one given by DailyProgrammer in the challange info).
I did not code Input/Output as I found them not as interesting as the...
I am doing this exercise where i have to draw a pyramid like below:
**
***
****
*****
******
*******
********
*********
Here's the code i have, it does the job but it doesnt work well if user enters strings. it strangely goes on infinite loop. Why is that? I thought...
I'm writing a plugin and want it to have no dependencies.
I create a form and append it to the page, but the code is really long, does anyone have any suggestions to clean it up, perhaps shorten it? I feel like there must be a better way!
Thanks in advance for your help.
// Create elements
va...
After a bit of work, I've changed my code a lot from the previous question:
I was recommended by George Mauer and rofl to make a better structural design, so hopefully this new build is a bit sleeker in design. I will note that my main target is optimal performance. But like Mr. Mauer said, it ...
This question could be suitable for Code Review, as long as (a) your code works as intended, (b) your code is real code, rather than example code, and (c) your code is included in the body of the question. If you wish for a peer review to improve all aspects of your code, please post it on Code Review. — Phrancis30 secs ago
I am trying to look at a range of values for samples taken with core drilling. Each drilling has a sample for each specific depth. The range is the depth and for each range there is a property value such as
518.6 thru 517.9 0.3
517.9 thru 516.6 0.6
516.6 thru 514.4 0.9
I have a multitude o...
//I reposted this here because of suggestions
So I stumbled upon this exercise (or whatever you wanna call it), and I am wondering if there is a more efficient way of writing this.. It is written from high school level knowledge.
Basically you need to find the most occuring number of an array o...
@Phrancis once you figure out how CSS works, it doesn't happen so often. you have to remember that CSS stands for Cascading Style Sheets. meaning that each style has a spot in the hierarchy, and can be overwritten by a style applied to the same type of element further down the document.
I don't remember the order that the styles are applied. but I think that the inline styles are applied last?
The code is already working, but I am looking to get advices from everyone on how to make this piece of code better.
https://gist.github.com/edson-junior/38d6989bdcfa4d855d29
Unfortunately there is no URL where you can see the code working. Hope you all can figure out what the code does simply ...
For fun, I have been making a very basic login system in Python. I was going to look up an algorithm or something for user info storage and transfer, but then decided it would be more fun to come up with and implement it myself. What I would like to know is:
1) Is there anyway to make it secure...
Below is my attempt at providing a type-safe way to combine to use enumeration and bitset together. The resulting class is intended to be use as a set of flags, where each flag is a member of the "user-defined enumeration".
The user must not define any explicit value to the enumeration member.
...
@BSeven: You may have other design options that keep your main goal to have native Ruby config but that don't paint you into this corner. But they cannot be discussed without the code, and probably better discussed at codereview.stackexchange.com — Neil Slater12 secs ago
The standard way to open a file in Python is to use a with ... as ... context manager. By using a with ... as ... context manager, you can ensure that the file is properly closed, and there aren't any memory issues. Here's how you'd do that:
with open("path/to/myfile.txt", "r") as my_file:
....
This is from a coding challenge I attempted for an interview. I will post the question and the solution I came up with. I didn't get through the interview and they could not offer feedback so hoping to get some feedback on how this can be improved:
Question:
We've taken some strings and chopped...