« first day (568 days earlier)      last day (3451 days later) » 

12:03 AM
speaking of command-line...
 
12:20 AM
O! Hai @CaptainObvious!
 
 
1 hour later…
1:37 AM
@RubberDuck Yeah, we were talking about Mac's Terminal.
0
A: Swift complexities with Dictionary

nhgrifWe're really doing two different things here. First, we're building a dictionary of character counts, and second, we're building a string representation of that dictionary. As such, this should be two separate functions. The first takes a string and returns a [Character:Int] dictionary, and th...

> sysdiagnose can be triggered upon pressing a special key chord; this is cur-rently currently Control-Option-Command-Shift-Period.
Wow, what a key-combo.
 
0
Q: Inheritance after instantiation?

A TProblem When writing context-aware class wrappers, I found that regular inheritance wasn't usable. Leaving me with very light wrappers over the "parent" class wrapper: class Foo(object): def __init__(self): pass def create_remote_resource(self, name): return {'created':...

 
2:08 AM
0
Q: Creating a fixed calculator in Python v3.

ChrisFI am new to Python and I am trying to create a calculator to do a complex calculation. I need it to take input from a user and do deductions and multiplication based on that input. The scenario would be inputting an amount (A), deducting 1% of another amount (B) taken from a user from amount (A...

 
2:36 AM
god
this is horrible code
I shouldn't be looking at this at 03:36
private String ControllAllValidation()
{
	String returnValue = "";

	returnValue += ControllDoublePassword();

	return returnValue;
}
Just a tiny snippet of that single page
Methodnames have typos, stuff is abbreviated to rrnr, god forbid any sort of naming convention, ControllDoublePassword checks whether the two passwords are equal and returning a validation message, controls on the page that aren't used (you know, in case you have two postal codes)
Calling .ToString() on the textblocks and passwordboxes instead of .Text and .Password
I can keep going
A single page!
It doesn't even do anything aside from a bunch of controls and this awesome validation
 
3:10 AM
0
Q: Ruby return last element of list

drew578I was doing of one of codewars.com exercises and was asked to return the last element of the list. Here is my answer def last a,*x x.size >= 1 ? x[-1] : a[-1] end Here are sample test last( [1,2,3,4] ) # => 4 last( "xyz" ) # => z last( 1,2,3,4 ) # => 4 Test.assert_equals(last([1,2,3,4,5]...

0
Q: School which registers students by preferred courses

Vince EmighThe point of the application is to create a school, create courses for that school, create students and register them to the school, assigning them courses based off the courses the prefer. There are quite a few things I find messy, and hope to get some seasoned advice on it. I put comments wher...

 
3:29 AM
I just finished my speech.
I did a backup of my files to keep it safe, and look at some of the data on my HDD:
And when I went to delete some of the old backups:
 
1
Q: Custom Memory Allocator in C

xiver77I made this because I need to make a program that creates and destroys huge trees in gigabytes for hours or time. The default malloc/free in MinGW/GCC is too slow. I wrote two equivalent test programs, in C and in Java, which does a large amount of small frequent dynamic memory allocation. The C...

 
As to that .gif pinned by @skiwi, I've used that feature when golfing Python. (For those of you who don't know, you need to use indentation to define what code goes in what function/class/etc. in Python.
 
4:04 AM
37
A: If this were an answer, what would be the question?

DarwinWhat kind of pointer do you use to refer to the current object in C++? http://en.wikipedia.org/wiki/This_(computer_programming)#C.2B.2B

 
4:34 AM
0
Q: PHP application configuration

rink.attendant.6I've started looking at Heroku for application hosting and deployment and it appears that my configuration constants need to be stored in environment variables. I can do this in Heroku, but my application might also be deployed to shared servers and it may not be secure according to https://secur...

0
Q: Lua program to clean up phone numbers

gitarchieHow idiomatic is my code? Since Lua does not have classical inheritance such as in OO languages. local PhoneNumber = {} function PhoneNumber:new(no_as_string) self.__index = self local n = "0000000000" n = no_as_string:gsub("[^0-9]", "") if (n:len() == 11 and n:sub(1, 1) == "1") then ...

0
Q: PHP Usersystem basic class

JasI've recently picked up OOP in Java and I'm trying to use it for my PHP usersystem. I've come up with the following generic.class. On my main site, I'll simply put a include('generic.class.php'); before my content. <?php include_once('connect.class.php'); class User { private $id; pri...

 
 
1 hour later…
5:50 AM
0
Q: Simple One Way IPC Implementation for pcntl_fork

robbmjIt is a common task for me to need to run many nearly identical child processes. Not often but sometimes I need those child processes to communicate their results back to the parent process. I have created the following implementation to avoid boiler plate pcntl_fork() calls, and standardize the...

 
6:24 AM
0
Q: Making a spread sheet using linked list in c++

AdiI am wondering how to make a spread sheet using linked list, the size should be given by user as an input and i have to find out min of the spreadsheet row wise. Can any one please help me in this.

 
monking
 
6:42 AM
@nhgrif about your discussion about command line / terminal vs gui....
1. Functionality. On the command line, you have access to an immense range of programs available in your system. Using features like piping, redirection, loops, you can combine the available commands in a million ways
Take some data file you want to inspect. Wanna know how many lines it has? How many unique lines? Which line is duplicated the most? Wanna use each line as a parameter to do something else? -> you can do all these things, right now
A GUI will give you access to some of the functionality, not all of it. A GUI limits you. Which of course can be used well as a form of control, so it has its uses. But if you want access to the full power of your system, command line gives you that
2. Robustness. A GUI using commands is an additional layer of software, and inevitably an additional set of things that can break
When something is not working as you expect, you have 2 things to question: is the underlying command working correctly? + is the GUI working correctly?
3. Openness. I would prefer "run this script" any day over "run this GUI". A script is open / readable by design, whereas I'll never know what you're GUI really does.
You could share its source code, but then I'd have to read through a lot of code I don't care about when I could be focusing on the code that actually matter: the commands that will get executed. And I would have to build the executable from the source myself, otherwise I wouldn't really know it does only what it says it does.
4. Speed. Debugging. Actually these come inevitably from the lack of the additional layer of GUI. When you know the commands, running them in the terminal will be faster than using a GUI. You can certainly execute many more Git operations on the command line during the same time that you would click with the mouse in Source Tree. GUIs also typically have a lot of embellishments to slow them down.
Sure, I said "when you know the commands". The thing is, if you're a programmer, you should know the commands. Period.
// end of rant
 
7:31 AM
I'm using vim to do python development, I did not realize that not having auto complete can make me faster (not using omnicomplete). Not boasting. But I still have lot to learn about it though.
 
how does not having auto complete make you faster?
@JaDogg ^^^
 
reading the manual before guessing
 
or you can just read the manual and enjoy all the sweet benefits of auto complete
I recommend PyCharm
 
7:52 AM
0
Q: Merge Sort Variant: Using array link

user3598251I was looking for the variants of Merge Sort. So my textbook says, A variant of function Merge in which No records need to be moved at all, can be implemented by use of an auxiliary array links. Firstly, I would like to state the code. Algo MergeSort(low,high) { // a is the array to be sorted...

 
PyCharm would be better, but I do not have access to it.
 
what do you mean, no access?
maybe you mean license? you can use the community edition
 
8:10 AM
hmm
Downloading ...
 
8:21 AM
time to get breakfast
 
0
Q: C# in Visual Studio

Chiz TiuC# Program Determining if a number is either a multiple of ten or within a particular set of ranges I have a few loops that I need in my program. I can also write out the c# code but I'm not entirely sure how to write them logically. I need Program that will enter 10 numbers and display the count...

 
 
1 hour later…
9:38 AM
0
Q: Fastest way of calculating mean values for each indices

simenI have two 2d arrays of equal shapes: given_array and reference_array. I have to write a file for each unique value of the reference_array computing mean values where the unique value are in the given array. import numpy as np given_array = np.array([[2,4,5,8,9,11,15],[1,2,3,4,5,6,7]]) referen...

 
 
2 hours later…
11:26 AM
0
Q: Whats a more concise way to include references in onResume Lifecycle?

sirvonWay to verbose for my taste..... @Override protected void onResume() { super.onResume(); Thread.currentThread().setPriority(Thread.MAX_PRIORITY - 1); TinyDB tinydb = new TinyDB(this); Log.v(TAG + "BaseStartup.onResume", "onResume"); IntentFilter intentFilter = new...

 
11:56 AM
0
Q: tictactoe in C++11 2nd

MORTALbase on my tictactoe game which is available in here:http://codereview.stackexchange.com/questions/70593/tic-tac-toe-game-in-c11/70645#70645 i have come up with different game logic for my game. i would like to know which one is more reliable and effective and how to improve the whole game. #in...

 
12:10 PM
hey
 
After midnight/reset only Jamal vote? ;)
 
the reality is better: I also voted, hours ago, but I guess the cache is not refreshed too often
but still. very few votes these days
 
@janos consider a few things... I'm not try to write one piece of software that completely eliminates the need for terminal, nor am I trying to write software that is even inherently for personal use or even necessarily use by other programmers.
Although, you can compile a build source code from command line, but how many programmers do that versus using a GUI IDE?
0
A: Swift complexities with Dictionary

nhgrifWe're really doing two different things here. First, we're building a dictionary of character counts, and second, we're building a string representation of that dictionary. As such, this should be two separate functions. The first takes a string and returns a [Character:Int] dictionary, and th...

 
shameless pimping ;)
 
12:25 PM
You can move folders from location a to location b via terminal, but who does this versus drag and dropping?
 
that's fine @nhgrif, I was just very puzzled by your loathing of the terminal, I was compelled to say something already
 
Moreover how does the efficiency of a terminal script compare versus compiled source code?
For various tasks
If I need something on terminal, and it's trivially easy, and I need it once, I'll use terminal.
But I don't see myself keeping a collection of complex scripts around, especially if they are things for non-programmers
On the autocomplete discussion, I had to turn intellisense off in SQL Management Studio
 
time to go for lunch, catch you guys later
 
12:48 PM
@janos that is an excellent point. That is one reason for why I don't like to use Sourcetree for some git commands.
@janos when it comes to that voting page, you need to have at least 11 votes to even show up.
 
1:43 PM
This question is still unanswered, perhaps it's time someone put a bounty on it?
16
Q: FizzBuzz in Forth

EdwardThere are quite a large number of existing implementatons of FizzBuzz but I awoke this morning in a cold sweat with the terrible revelation that Code Review had no FizzBuzz implementation in Forth! To redress this terrible oversight, I wrote this while sipping my first cup of coffee. : FIZZBUZZ...

 
1:55 PM
private bool IsValidModel(out List<ErrorInfo> errors)
{
  errors = new List<ErrorInfo>();
  var properties = GetType().GetRuntimeProperties();
  foreach (var property in properties)
  {
      var attributes = property.CustomAttributes.Where(x => x.AttributeType.GetRuntimeMethod("Validate", new []{typeof(Object)}) != null);
      foreach (var attribute in attributes)
      {
          var fullyQualifiedName = attribute.AttributeType.AssemblyQualifiedName;
          var instance = Activator.CreateInstance(Type.GetType(fullyQualifiedName)) as IValidationAttribute;
Custom validation combined with the limitations of WinRT
fun for the entire family
 
Does anyone actually know Forth? I haven't messed with it in years.
 
@RubberDuck put a bounty on it and we will find out!
 
Lol. If someone puts a bounty on it, I'll dig the docs out and review it...
Otherwise, I'm working on a release. =)
How goes the card game by the way?
 
2:11 PM
@RubberDuck guess why I want someone else to put a bounty on it ;)
 
Lol. Nice.
 
@RubberDuck there hasn't been much progress on it recently. Me and @bazola are experimenting with LibGDX, and I released a LibGDX app for Android about two weeks ago. It took me just two weeks to make that app.
I hope to make some stuff for Cardshifter the coming week though
 
If you put it like this, guys..
Then I'll put a bounty on it to make you write two reviews!
 
@Vogel612 do it!
 
2:27 PM
AAAAAND IT'S ON!
Hunting season started!
 
Duck season or rabbit season?
 
Forth season
> Anyone who shoots this Zombie in an acceptable way, will get an honorary reward!
 
Thanks @Vogel612 :)
0
A: FizzBuzz in Forth

Simon André ForsbergAre you using two or three spaces of indentation? Yes. Are you using two and three spaces of indentation? Yes. Are you using two xor three spaces of indentation? No. I don't know the coding conventions of forth, but I'd personally prefer to see using four spaces (one tab) of indentation. Most ...

 
: FIZZBU ( -- )
izzat planned ^?
 
It's obviously rabbit season.
2
 
2:36 PM
Transistor season..
Let's see what happens in this week ;)
 
@Vogel612 fixed. thanks. I did that because I had both my own version and the original in the same code at once
 
I know that problem..
 
1
A: How to change uiview's height using auto layout?

nhgrifStart by clearing all your constraints from everything so we have a fresh slate. Step 1: Build your view hierarchy. In this example, we want something like this: The view controller's view, which we'll call parentView has a subview, which we'll call redView. That redView has a child, a Text...

 
3:01 PM
@RubberDuck Duck doesn't want to be hunted, huh?
 
@nhgrif so much spaaaace!
 
3:23 PM
Hmm?
That's a strange way of saying "What an excellently thorough answer!"
 
4:08 PM
-2
Q: New Install Server

cityHave just installed ubuntu server software, entered username and password, now shows city@ubuntu:~$ ...what must i do now? Install is ok, all begins properly, I need to know what to do next please.

 
Way off topic.
 
4:41 PM
0
Q: Base64 DECODER optimization

Carrybubbles Fedin #include <stdlib.h> #include <stdio.h> void enblock( int len, char *in, char *base64, FILE *outputFILE) { fprintf(outputFILE, "%c", base64[in[0] >> 2]); fprintf(outputFILE, "%c", base64[((in[0] & 3) << 4) | ((in[1] & 240) >> 4)]); if (len > 1) { fprintf(outputFILE,"%...

 
4:56 PM
0
Q: base64 decoder need OPTIMIZATION

Carrybubbles Fedin #include <stdio.h> #include <stdlib.h> void deblock(char *in, char *base64, FILE * OutputFile, int len) { if (base64[(int)in[0]] < 64 && base64[(int)in[1]] < 64) fprintf(OutputFile, "%c",(base64[(int)in[0]] << 2 | base64[(int)in[1]] >> 4)); if (base64[(int)in[1]] < 64 && base64[(i...

 
@CaptainObvious Seems to be off-topic, but why exactly?
 
IMO Unclear what you're asking.
 
0
Q: Java Calculator using stacks do not perform calculations

PedroItHello everyone I have to do a java calculator using stacks and when i try to do the calculations it does not work. Example if my stack contains 5 and the user enters -2 stack should change to 3. Here is my approach /* * To change this template, choose Tools | Templates * and open the template...

 
5:35 PM
0
Q: toBase64 Encoder

MaZaHaKaMy code convert text to Base64. I used the algorithm without bit operations. What do you think about my code ? #include <stdio.h> #include <stdlib.h> #define CRT_SECURE_NO_WARNINGS #define BIN 2 #define MEMORYSIZE 10 void FromSixBitNumbToDec(char *number1, FILE *result){ char table[] = "AB...

 
5:54 PM
is it just me or is Base64 the current university stuff?
 
6:05 PM
0
Q: JOIN and sprintf rather than two queries and echo

TaylorsukI am using the following code... It works fine - however its a little messy, I understand it would be better for performance to use JOIN and have been advised before to use sprintf however its pretty confusing I cannot understand the PHP tutorials on it. <?php $exerciseID = ge...

 
@Vogel612 could very well be
 
@CaptainObvious he knows what he should do and he's asking us to do it for him
Welcome to Code Review! Give us your crap, hint what needs to be done, and we'll do it for your for free!
 
6:20 PM
@janos that sounds just like SO in minimal effort.
 
7:10 PM
0
Q: Loading the jdbc driver jar dynamically from external location. Any memory issues and performance issues?

BRSI have a small project in which I get the url, username, password, driver from a text file and I have to fire a query on the database by dynamically reading the jar file in a predefined directory, register the jar, get a connection object. Possibly de-register it. Each query may talk to a differe...

 
7:58 PM
0
Q: Why is the Frame property null in a pivot item?

Jeroen VannevelI have a pivot page defined like this: <Grid x:Name="LayoutRoot" Background="Transparent" > <Pivot Title="JOETZ"> <PivotItem Header="kampen" Name="PvOne"> <views:CampsPage/> </PivotItem> <PivotItem Header="kalender" Name="PvTwo"> <views:Calend...

WP8.1 experts wanted
 
8:10 PM
@JeroenVannevel You found a weird bug again?
 
@skiwi I doubt it
I probably just don't know enough about it
But it's not something easy to research
going through some channel9 videos now
 
Ah, it's one of those things that are not like in the standard library, and where you actually have to search for it?
I hate those pesky features/"bugs"
Where all hope you have left is in an old email archive, dating from 2005
 
8:23 PM
0
Q: optimal string literal tokenizing algorithm (C#)

Imam IsaI have a tokenizer, where one of the token types happens to be a C# string type. It takes a TextReader as its input, which is created from a StringReader, and it needs to support the basic stuff C# strings supports, such as "jo dude", "joe \"dudes\"", "this is a backslash \\ token" and of course ...

 
8:49 PM
0
Q: Brainfuck interpreter in Haskell [40 lines]

John SmithOkay, so I just started learning Haskell around a week ago and this is my first real program that I worked on all of yesterday with a lot of help from IRC. I know that using indicies and arrays is not very "Haskellish" but I found constantly manipulating lists and traversing them was extremely sl...

 
What's with all the | pipes in Haskell?
 
9:38 PM
@Phrancis Haskell makes heavy use of pattern matching. A pipe starts another pattern, so it looks kinda like BNF or regexes. This is a syntax directly inherited from ML. Think of it as a supercharged switch/case, where the switch keyword can be left out in function definitions.
 
5
Q: Is it normal for a programmer to not have 100% clarity over their own code at times?

83457I'm not an expert programmer so this may be why, but I've come to notice that whenever I create complex code (like a Chess game I recently made), I am able to write the correct code to get the program working, although I find that later on- or even a few seconds after!- I often have to pause, and...

 
10:29 PM
@amon I see, I don't know much about patterns but sounds interesting
 
0
Q: Drawing sets of boxes to display contents of arrays

MunkybunkyThis code draws two sets of 9 boxes on the screen to display the contents of two arrays. How can I speed up, shorten and make the code more efficient? for (int x=0;x<3;x++){ for (int y=0;y<3;y++){ if (pattern[x][y]==1){ g.setColor(colorrange.colb()); ...

 

« first day (568 days earlier)      last day (3451 days later) »