I'm having a bit of a problem trying to solve this one,
Currently i've got a php script that scrapes data from a MySQL db, on one part of it the DB has a timestamp which has date and time in it.
What i'm wanting to do is use the date in this timestamp to sort the table im displaying it in.
...
Here's my code and I want to know if there's a better method for doing so. While the question has stated two stacks I wonder if we could do only with one as well?
/**
* Created by mona on 5/26/16.
*/
import java.util.Stack;
//Implement queue using two stacks
public class QueueViaStacks {
...
I am getting a 50% overall mark (75% correctness and 25% performance) on the Codility Fish problem and my solution seems to be O(N) but I am only getting 25% performance. The results can be seen here and my solution is as follows
// you can also use imports, for example:
import java.util.*;
//...
I have implemented an algorithm which computes a maximum clique via a heuristic. The pseudo-code can be found in this Paper (see Algorithm 2).
Maximum Clique Problem
Given an undirected, simple Graph \$G=(V,E)\$, a clique \$C \subseteq V\$ is a subset of vertices such that all vertices in \$C\$...
It is an application I wrote that allows multiple TCP clients to share a single TCP connection to a remote server (hosted project, and a demo). Traffic generated by the server is forwarded to all clients. Traffic generated from any client is forwarded to the server. I don't concern the case where...
I'm voting to close this question as off-topic because it is asking for a review of working code. This question may be on topic on codereview.stackexchange.com. — Colonel Thirty Two26 secs ago
I would like to hear feedback about my code both in term of improving efficiency if possible or using other data structures. Also go ahead and let me know about code styles/patterns.
/**
* Created by mona on 5/26/16.
*/
import java.util.Arrays;
import java.util.Stack;
import java.util.HashSet;...
Having some confusion over the for loop in my solution to this Project Euler problem. The code must find the largest palindromic product of two three-digit numbers. So I did an outer an inner loop both starting at 999, and >99, and just multiplied until I got a product that was equal to its rever...
So I have written the following code and it works for various same length isomorphic strings I have tried. However I am not sure what are some time complexity improvements and coding tweaks that could be applied to the code:
/**
* Created by mona on 5/26/16.
*/
import java.util.List;
import ja...
Pretty new to this hence taking it as challenge. I have a master sheet in which Column A have all the file names( complete file name with .xls extensions). I need to copy data of column b in this sheet and paste it in all the files in a particular folder in a particular tab. There can be multiple...
So I was asked this in an interview, and I had to write this code on a white board. Sadly I couldn't complete the code :( .
I've realized that writing code on white board is completely different from typing it on an editor. Firstly because, I type way faster than I write and secondly I can't ke...
Write PHP script that can accept user entries of student's name and marks. Append the information of the 1st test, 2nd test and UE in the results.txt file of the assignment two. The user should be able to specify the name of the subject so that the system can calculate the cumulative GPA of the ...
I am currently working on a small internal rating system for clients to be able to prioritise my work based on what client pays best. The input data is the hourly rate they are paying and based on that they should be divided into categories in are the range from A-D. The first setup looks like th...
i am trying to make a very simple keylogger using the GetAsyncKeystate
and i am adding the sleep function to reduce cpu usage ,however when i add
Sleep (1); it doesnt seem to pick up the keystrokes properly
for example , if i run the exe and type "yahoo.com"
the .txt file will only have recor...
There's too much code missing to tell (we'd need a real repro with working code), but even then I'm afraid you're asking for a code review / opinions. (Which could make a fine question, but would be off-topic on SO I think.) — Jeroen45 secs ago
I've written the following code for to print the nth Fibonacci term,
import java.io.*;
public class Main {
public static void main (String[] args) throws IOException {
File file = new File(args[0]);
BufferedReader buffer = new BufferedReader(new FileReader(file));
String line;
while ((line = bu...
I'm trying to use a different method to calculate a blob area from contourArea, I'm using countNonZero function. I want to see if there is significant approximation introduced by contourArea function, and also be able to calculate area of contour with auto-intersection.
I'm using this code:
cv::...
@Mast It's going up to Geo-Stationary orbit and then they're going to try to land it in the ocean. There's a good chance the landing will fail as GS orbit requires a lot more speed/fuel. On the other hand, if they manage to land it anyway, that will be awesome.
i recently wrote my first custom config section. I have a collection of index files, each has a path and a savetime:
internal class searchConfigSection : ConfigurationSection
{
static ConfigurationProperty s_indexCollection;
static ConfigurationPropertyCollection s_propertyCollection;
...
It sounds like it would be on-topic for Code Review. Make sure you include your code in the question itself. Your Stack Overflow question can be removed afterwards. — Mast20 secs ago
I am relatively new in MATLAB and my major problem is optimization. My code seems to run very slow and I can't think of any way to make it faster. All my arrays have been preallocated. S is a large number of element (say 1500 element, for example). i know my code runs slow because of the "for k=1...
@Quill Meh, if he's learning, it's fine :P though fetch and standard javascript would be nicer there
that said fetch isn't widespread and classList doesn't work in <IE10
I've said it before; while i hate jQuery, it is not because jQuery is bad, it's because people who use jQuery often have no idea what it is (and is not) doing for them and use it such that it leads to memory leaks
4
But if jQuery helps people get into learning JavaScript better, whatever
@DanPantry This is what I think when people hate on VBA. The language has *limitations*, sure, but most of the things people hate it for are due to who's using it, not because it's an inherently bad language.
I've written a naive shortcode parser in JS that parses shortcodes akin to those found in Wordpress. The intention is for this to be used in realtime on the client in order to preview edits on the fly.
Excusing the strictness of the regular expressions I'd be interested to find about my impleme...
When I said GUI, I probably should meant operations that rely on accessing something external, if that makes sense
Like, I can't rely on an external program returning in any amount of time compared to how fast it wuld be if I did the operations of that program in memory
I come from lands afar, also known as Hardware Recommendations Stack Exchange. Over there, we have a serious problem with first-time Stack Exchange users coming along and asking off-topic questions - to the extent that 50% of incoming questions are closed. We've had a few attempts at solving this...
What I think is cool in Rust is that you when you create a project using the package manager Crate then it automatically initializes a Git repository for your project
My goal is to implement a simple pomodoro timer using golang: channels, goroutines. I'm newbie in go world and have some misunderstanding about name convention. I read a lot of Docker's code on github and there I saw that people sometimes use very short names. These names are not clear for me (a ...
meh, considering they explicity said "sign, scan and email it back to us" I'll just do it the physical way. The recruiter said he'll fix things with HR
I think that match is better, you just do not know how to cook it ;)
fn main() {
for i in 1..102 {
match (i%3, i%5) {
(0, 0) => println!("FizzBuzz"),
(0, _) => println!("Fizz"),
(_, 0) => println!("Buzz"),
(_, _) => println!("{}", i)
...
My team at Apple is looking for #postgres expert in Shanghai. Your work will have a huge impact at . Please RT! https://jobs.apple.com/us/search#location&ss=48219674&t=1&so=&lo=0*CHN&pN=0&openJobId=48219674
I'm taking a Google Firebase course on Udacity and on one of the videos, the teacher creates a Constants class which acts as a namespace for holding constant strings and integers that are useful throughout the app.
The class doesn't include anything else, it just holds constants.
My question is...
@JoeWallis I think it's fine to go with the reason that it cannot be pseudocode, etc. etc. as this looks like it should be on Programmers, though it would probably also be off-topic there
I don't get how people keep doing this... So in my house we have two doors next to each other, one is an (obviously closed) door for the toilet, the other is a door with glass to go outside... People still manage to open the wrong door to go outside
The code below is a simple coding exercise I got from a book that asks to remove the duplicates from a single-linked list (using a simple struct; this is part 2, see part 1 here). My question: is there a better way to delete a Node than by creating a temporary variable temp and deleting that. I a...
@skiwi If I need that excuse, I'll just crap some VHDL together. Takes forever to simulate.
I don't see any code and the question isn't about code you wrote or maintain. That makes it off-topic for a lot of reasons. Please take a look at the help center. — Mast19 secs ago
On an unrelated note, it's Friday.
Tonight there will be beer and destroyed universes.
I made my own class that inherits from button and has a OnHold event. It seems to work ok but I'm wondering if I can improve it or if you can spot any glaring mistakes that I made. Here is the code :
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.Event...
My program, page_reporter, attempts to port scan a network and identify servers hosting web pages. From here it will create an HTML report using iframes to give you a snapshot of what the page looks like. This is meant to be an internal penetration testing tool to identify information disclosure ...
i created an automatic upload tool, working great (most of the time). As i want to improve the code i have several questions:
1)Is it possible to make the iexplorer progress some kind of smoother? I don't like it that people can see the "sendkeys" actions. Is there a possibilty running the progre...
I have written a custom method to use StringBuilder in java. My Requirement is to create a method which accepts any number of arguments of any type and return String by concatenating the arguments.
eg. msgBuilder("Hello ",0," how"," are"," you ",2.5) return "Hello 0 how are you 2.5"
Here is my ...
I have seen the Writings on the wall...
Retro Rocket ASCII Art
Nested for-loop art
Print the Retro Rocket
Maybe a golfed C# answer from me
But I took this relatively serious and created a VerticalRocket class that I would like reviewed, kind of like a little "am I getting better at writing c...
it would not be too hard, you simply have two lists/arrays/whatever one with the hangman and one without and then print out the hanged man to whatever integer and then the unhanged man the rest of the way
I have a switch statement used to handle options that a user selected (stored in an array). The array is iterated through, and for each element (enum object) in the array, an appropriate action is performed. However, the enum has over 50 items, so the switch statement is very long.
The items are...
Question might be better suited for codereview.stackexchange.com, but +1 for " 0 down vote favorite I tinkered with some dependency injection frameworks for Typescript but didn't like the magic & complexity they add. Thus I decided to give DIY DI a try." I don't like DI frameworks either :) — jrahhali31 secs ago
It's possible to optimize these queries:
UPDATE PEOPLE
SET ID_STATE = CASE
WHEN ID_STATE = 2 THEN 9
WHEN ID_STATE = 3 THEN 9
WHEN ID_STATE = 7 THEN 8
WHEN ID_STATE = 8 THEN 9
...
Hi I'm trying to find a way to handle decimals in mongodb. Is there any good way and/or should I handle it with a class like this:
using System;
public class MongoDecimal
{
public long Value { get; set; }
public long SubValue { get; set; }
public long SubValueToValue { get; set; }
...
@N3buchadnezzar Just use string.format. '{:^30}'.format('centered') is something you'd much rather do. I'd use something like: '{1:^{0}}{2}'.format(5, '/|\\', '|').
Should I check Count before Linq Single() call if I excpecte only one elemet?
if (objects.Count != 1)
{
throw new
InvalidOperationException(
"%Collection% should contain one %element%, but now it's: "
+ objects.Count);
}
return objects.Single();
...
Hello! This post has now been asked on Code Review, where it properly belongs. If you could point future questions like this over there in the future, that would be much appreciated. Thanks! — syb0rg14 secs ago
Hello! This post has now been asked on Code Review, where it properly belongs. If you could point future questions like this over there in the future, that would be much appreciated. Thanks! — syb0rg51 secs ago
Could use some upvotes on this comment to show people support it's idea:
Hello! This post has now been asked on Code Review, where it properly belongs. If you could point future questions like this over there (and refrain from answering them on SO in the future) that would be much appreciated. Thanks! — syb0rg8 mins ago
I have this code:
def sortFirst(data: List[FirstClass], desc: Boolean, by: String): List[FirstClass] =
desc match {
case true =>
by match {
case "good" => data.sortWith(_.good > _.good)
case "bad" => data.sortWith(_.bad > _.bad)
...
What @syb0rg meant was "dude, it would be nice if you would come over to Code Review and contribute more fleshed up answers in a more "relaxed" context, and rise to the top of the scala reviewer community! — Mat's Mugjust now
Cross-posting is fine, mistakes happen, keep the link to the SO post in there, it can be helpful to reviewers. Welcome to CR! This is a fine question indeed, but I agree with @Marc-Andre, a little bit of description of what it does and why, would make it a great one. Cheers! — Mat's Mug ♦39 secs ago
@jrahhali Thanks! Did not know about codereview.stackexchange.com. Will try it there but keep the question active here as well, just in case... — Marc Dix25 secs ago
@jrahhali please take a minute to read a guide to CR for SO users; Code Review requires the code to be reviewed, embedded in the post, not as a link to a github repository. — Mat's Mug55 secs ago
@JoeWallis I need to put PE on hold for a while. I miss easy implementations, and basic programming ideas.. Just focus on my exams for a while I guess.