@Mathemats This is not a good fit for Code Review, as the code does not seem to work as intended. See: "However I noticed something that bothered me, which was the fact that if i were to enter a number when asked to enter a name, it would assume that number is a name." — Phrancis37 secs ago
This is my first open source release and I'd like to get some feedback on my code styling/organization. Implementation tips are appreciated as well.
The code is for a angularjs select box that allows you to select from a list of values, or enter in free text.
The control can be configured to:
...
I am currently taking a computer science class in high school, and its my first time programming (2 weeks since i started). I have currently finished my program however there were a few details that bothered me. I was supposed to create a program which can calculate average of individual marks an...
emmm... thanks bud. last time your comment on how to catch specific exceptions was really useful and I am using it since. Then your name popped up the first when I googled and didn't find much. @mjolka
@Mehrad if you really don't want to change the code, you could try evaluating some of the expressions in the Immediate window and see if they throw an exception
@mjolka the code work fully. except there is one sheet in Excel which throws the tantrum and I want to catch which line or cell is problematic without going through 1300 lines.
I have created a simple Pseudo "Sieve of Eratosthenes," for a class in Java. I am looking for the most optimized option, or at least an option that is more optimized than current. If there is any other advice that you have to offer, I would be more than happy to hear that as well. My code is as f...
@mjolka good call. was thinking of the same. waiting to see if you would come up with a solution, but I think it's mainly a bad approach and even if it had a solution it would be a workaround.
I am new to javascript, especially the wonders of async and closures and would like some help on the attached code. It is in a Chrome extension and retrieves a list of users albums with the Picasa Web API then gets the items in each album so I can filter out unwanted media and directories. AFAIC...
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in alphabetical order, except for dialects of BASIC and esoteric programming languages.
Note: Dialects of BASIC have been moved to the separate List of BASIC dialects.
Note: This page does not list esoteric programming languages.
== A ==
== B ==
== C ==
== D ==
== E ==
== F ==
== G ==
== H ==
== I ==
== J ==
== K ==
== L ==
== M ==
== N ==
== O ==
== P ==
== Q ==
== R ==
== S ==
== T ==
== U ==
...
There is R and apparently R++ and there is R# add-on for VS known as Resharper (which I don't know why they decided to not to pronounce it R(as are)-Sharp)
I wrote the following implementation of a Vector in Java. I was wondering what you folks thought of it.
package space;
public class SpaceVector {
private final double x;
private final double y;
private final double z;
public SpaceVector(double x, double y, double z){
...
Is makes sense to me, but I'm not convinced with As... Seems like a lot of extra null checking.
I saw let the exception happen and hunt down the bug when it happens.
In most cases at least. There might be some instances where you really don't know what you're being handed. Then it might make sense, but that should be rare.
I'm relatively new at programming in general including Python. But I've tried to create a program in Python that alerts users through a pop up window to perform an action every 2 hours.
import time
import ctypes
count = 0
print "This break message was sent on "+time.ctime()
messageBox = ctypes...
@Legato - FYI, in Java, the bit-size of booleans is not specified. The most common JVM's implement single boolean values in a 4-byte address (the minimum available address pointer), and arrays of boolean are implemented as 1 byte per boolean.
The boolean[] array in the sieve is still a good idea, but, technically, a BitSet is the way to go to get to 1-bit-per-boolean.
boolean[] is good enough and fast enough for all uses in genral educational and 'programming-challenge' situations;
bitset allows you to have about 4 boolean values more than boolean[] because, bizarrely, Java needs some space for an array length, so you cannot ever have quite as many as 2^31 values in an array, but a bitset can go the whole way.
All the bitset saves you is about 7X the memory ;-)
I have implemented the following in order to handle JS XHR requests coming from HTML pages. Is there a better way to do this with OWIN?
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseFileServer(new FileServerOptions
{
FileSystem = n...
If so... yes it takes 1/8th the memory.... but boy, you've got to be storing a lot of bits before that's even remotely significant. Do you need to store one million boolean values? Because that's 1MB of RAM vs 1/8 MB ram.
@RubberDuck I know. However, good practice about exceptions, afaik, is that if you even remotely can guess something is going to happen in your code which you could prevent it from failing, it's advised to make a programmatic check rather than trapping it in the try/except.
and again it depends how you like to program at the end of the day :)
I'm trying to write a function that breaks apart an integer and outputs the count of even, odd, and zero digits. I'm having trouble with the do...while loop. It seems to be an infinite loop. I thought that q would act as a sentinel...not really sure how to stop the loop. Appreciate any help offer...
@rolfl Thank you for clearing that up. I wouldn't want to spread misinformation! Can I still correctly note that booleans are the lightest commonly used data type available?
@Mehrad i know i'm preaching to the choir, and you're doing the right thing using as here. but an easy way to think of it is: cast when you "know" the cast won't fail. use is or as when a cast might fail. use as when you want to use the result of a successful cast
@mjolka exactly. and I guess I have made quite a right choice here since the data in the excel can be tempered with and cast could be failing anytime. Loved the outcome of this conversation. I guess it will improve this chunk of my code to the right level.
I'm trying to make a chat client to swing.
And I need that message in the history of correspondence were formatted in HTML.
The problem I tried to solve with JTextPane, as it supports HTML formatting.
When I did, just text display, in principle everything was normal.
But when I started, add e...
and then in the immediate window, if i type ServiceLocator.Current i get
The type 'Microsoft.Practices.ServiceLocation.ServiceLocator' exists in both 'Microsoft.Practices.ServiceLocation.dll' and 'Microsoft.Practices.ServiceLocation.dll'
@Hosch250 take my advice with a huge grain of salt, i've never had an app in an app store. there should be plenty of articles on strategies for making the most money
I wanted to get some criticism for the below ADT. This is just a basic ADT that will be fed into a TVM calculator. Main purpose is to have it initialized and correct for input errors.
Full disclosure: I am modeling it after Code Complete 2 guidelines. You should notice if statements stating nomi...
I am trying to solve a problem which i think is TSP on a 2-D grid. So, i am trying to get the best result that i can. However, looking ahead 1 step is producing better results than looking ahead 2 steps.
The problem is that i have to clean the dirty blocks on a 2-D grid in minimum number of mov...
I'm looking to optimize a simple sum calculator used in Project Euler+
The premise is simple: Find the sum of all the numbers divisible by 3 or 5 under X.
At first I did it like so:
def main(testCases):
final_answer = []
for x in range(testCases):
answer = 0
test = long...
I have a server which has a permanent state which has to be saved on stable storage. It is composed by three fields:
List<LogEntry> log
int currentTerm
int votedFor
They have to be set during the server setup (in other words, when the server object is created). Every time that I update their...
Objectives Getting Started What Is Computer Science? What Is Programming? Why Study Data Structures and Abstract Data Types? Why Study Algorithms? Review of Basic Python Getting Started with Data Built-in Atomic Data Types Built-in Collection Data Types
I am generating a searchable and sortable data table using bootstrap. all works fine.
I am looking for the best approch to get it. any one can please update/suggest the right way, if you find any one better than the way i do?
here is the demo :
jsfiddle
here is my js:
var tableMaker = functi...
It's been a question since long time. Everytime code goes for review there are different opinion from different senior developers/coders/QA. And every other person fights for its own opinion.
Here are some of "Code review":
There should be single HTML identifier.CSS Selector, id, name, xpath o...
Related
13
Is there any way to script a Google Docs spreadsheet?
2
Is there a way to add a row to a Google Spreadsheet via a script?
2
Enabling script to run as author in a shared Google spreadsheet
I wrote a quick prefix tree implementation. I know it may be far from perfect, but I need to make sure that I got the basics right. I would like to hear back from you. My main concerns are
If I have settled for the correct data structures?
Is this a scalable solution? What sort of problems can...
My task is to write a program to store files in object store. One of the subtasks requires to send json or xml format response to the file uploader/downloader as requested by client. The following rules must be followed:
entry
+---...
I working on a calendar app on android. I am using roomaorama https://github.com/roomorama/Caldroid which is nice.
I am fetching all the events from Events table in Calendar provider once which seems not good performance wise.
The library uses a infinite view pager. It uses 4 adapters to displ...
In reply to previous question I rewrote ColumnReader and would like more suggestions
using System;
namespace R2D.IO
{
public sealed class LineReader
{
public string NewLine { get; set; }
string _buffer = "";
public void Parse(string text)
{
...
Hey @SimonAndréForsberg. I think @Duga might be sleeping. Is she okay?
@200_success I didn't use the real identifier names since they are in german and I didn't want to cause confusion with using an other language. I've now translated them to english and edited the question accordingly. — Thomas Schremser2 mins ago
I Have this JSFiddle That generates a random amount of progress bars. Then Assigns a random number and percent to them.
I am wondering if you know how to better optimize this code to have better run-time.
-Thanks for the help.
/*Creates a random amount of bars*/
function runBars() {
v...
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Collections;
import java.util.Comparator;
/**
* Created by ShrivasA on 1/30/2015.
*/
/* Take an Element and Apply the following conditions:
1. The element should not alrea...
(btw this is about the Hash Code programming contest, I'm looking for teammates, unfortunately eligible countries are limited to France, Belgium, Luxembourg and Switzerland + francophonic)
The competition is open to students (License, Master, Phd, Engineering Schools) and professionals, located in France, Belgium, Luxembourg and Switzerland, as well as in other countries from Francophonie (provided they can travel to Paris). Google employees, temps, vendors and interns cannot participate (but they are welcome to help the organization committee :)
This is a list of the member states of the International Organization of the Francophonie. Currently the Central African Republic and Thailand are suspended from the organization.
== List of member states ==
Participation suspended
=== Associate states ===
=== Observers ===
== Eligible non-member states ==
These are nations that have had some connection to France or its former colonies in the past. If not necessarily eligible for full membership, some of these states are still eligible for either associate membership or observance due to diplomatic, commercial, or cultural tie...
I think it's a question for codereview.stackexchange.com — qarma28 secs ago
@qarma this would not be on topic on Code Review. The code doesn't work. Minimally, code must function as expected to be on topic there. — RubberDuck1 min ago
I'm just feeling my way around here, having had a post recently moved over from another site together with its question. While I like the idea of a place to ask specifically for improvements to working code, I also see the potential for a lazy coder to 'code dump' something like a rat's nest of r...
@Vogel612 I don't see people from here going to study in Germany en masse though, not sure if something is missing from the picture or if nobody really likes studying in Germany for whatever reason
@Heslacher I built this project yesterday and released it to about 150 beta users. No settings have been changed since, and my email inbox isn't flooded with people with broken software.
Got my network drives back after a few restarts/relogs
Btw, Visual Studio claims it is unable to load any assembly... Including the assembly I am trying to add the control to (which is also the assembly that contains the control I want to inherit from)
@Mehrad Yeah. That's bad, and doing something is better than nothing, but I might let it throw and catch the issue farther up the stack. Same old story. It depends.
Hi I'm doing a program in delph writing in all kinds of files either text or executable.
The code I have is this:
var
openfile: TextFile;
begin
AssignFile(openfile, 'test.exe');
Append(openfile);
WriteLn(openfile,'[test]hi world[test]');
CloseFile(openfile);
end;
That...