« first day (496 days earlier)      last day (3523 days later) » 

12:03 AM
night
 
Night!
 
@Mat'sMug RSA - And I second that
And, Monknight!
I need to decide now between mastering a song, or working on my business DB that I need to work on (and post for review)
When in doubt, write code...?
2
 
@Phrancis that
 
@mjolka - congrats on the gold badge! : codereview.stackexchange.com/help/badges/23/…
3
mjolka, Melbourne, Australia
4.1k 1 2 26
 
Well time to start up pgAdmin I guess ;)
 
12:16 AM
@rolfl thank you!
 
Loki is here to destroy my latest C answer ... ;-)
 
:-)
Anybody written a Quine recently.
A quine is a computer program which takes no input and produces a copy of its own source code as its only output. The standard terms for these programs in the computability theory and computer science literature are "self-replicating programs", "self-reproducing programs", and "self-copying programs". A quine is a fixed point of an execution environment, when the execution environment is viewed as a function. Quines are possible in any Turing complete programming language, as a direct consequence of Kleene's recursion theorem. For amusement, programmers sometimes attempt to develop the shortest...
 
@mjolka Addict!
Grats
 
Can't say I have done that since last century
 
thanks @RubberDuck :) finally my addictive personality is good for something
 
12:18 AM
Hold on looking up rolfl last C answer.
 
I was cheating, I only looked at the question because I was short of 1 answer to get a badge
 
I think some Infected Mushroom might make for some excellent coding music
 
And I saw the malloc-without-a-free
 
I saw this question. codereview.stackexchange.com/questions/62691/… Though it would be more interesting to write q Quine
 
How did I miss that question coming through... hmmm
Ahh, it arrived in the middle of a train of thought
 
12:22 AM
@Loki headsplodes
(picturing a C# Quine)
 
@LokiAstari "While misreading the beginning of ..."
 
I believe I wrote one in university, using turbo-pascal.... but I can't find it in my git repo.... ;-)
 
It... wouldn't be possible in .net, would it?
Like, it would output its CIL equivalent, no?
 
@Mat'sMug from a quick google, void Main(){string s="void Main(){{string s={0}{1}{0};System.Console.Write(s,(char)34,s);}}";System.Console.Write(s,(char)‌​34,s);}
 
@200_success you're in Quebec too?
 
12:27 AM
(adapted for LinqPad)
 
@Loki - Why not add to the collection of code0-golf quines: codegolf.stackexchange.com/questions/tagged/quine
 
@mjolka oh.. and here I was, thinking of involving some nasty reflection magic... if the code changes, the string won't...
@Phrancis not according to his profile.. make it a couple of km's west
 
I just heard this fudging awesome tune... enjoy :)
 
bbl
 
Ah... I was curious because he highlighted Quebec in his link. I must be missing context... (goes back to Postgres)
I can't get this damn query to work. Ugh.
 
12:41 AM
Hmm... It's probably a bit late to start working on a new Project Euler problem...
 
@RubberDuck That
 
Great. The TACC login system isn't even accepting my password, the very one that is supposed to apply here.
 
FINALLY
set search_path = test;
drop table if exists test;
create table test(
	id serial,
        word text);

insert into test (word)
values ('Foo');
select currval('test_id_seq');
Apparently, underscores are very important in
 
In fairness, underscores are normally significant in any identifier they are used in
 
@rolfl one thing that's odd (to me) though... look at this slightly different script I modified from last one:
 
12:47 AM
I am boggled to believe you think there is anywhere where you can declare a variable or interface with one name, and call it with another (except case-insensitive calls).
 
set search_path = test;
drop table if exists test_table;
create table test_table (
	id serial,
        word text);

insert into test_table (word)
values ('Foo');
select currval('test_table_id_seq');
Notice the _ in test_table is not differentiated by the way Postgres recognizes the serial test_table_id_seq
This could get really confusing, really quick
 
Well, yes, so don't use confusing names for your serial columns and tables with serial columns
@Phrancis I imagine if you create a table 'test', with a serial column 'table_id', then another table 'test_table' with a serial column 'id', that you may have a problem.
 
That seems like a bit of an obstacle since Postgres silently converts all schema, table, column, etc. names to lowercase. snake_case seems like the logical choice then... but if it itself uses snake_case internally... ugh.
I would have preferred to use PascalCase but then I would have to use double quotes on everything :(
I do agree on your last message
So, I at least got it working... on to the meaty stuff, after I smoke an underscore a cigarette!
 
A recent highly-voted-up question on Programmers asked what’s wrong with comments that explain complex code? I think quite a bit about how I comment my code but rather than posting an answer on Programmers I thought I’d blog about it a bit here.
Comment commentary

http://ericlippert.com/2014/09/08/comment-commentary/
Interesting read^
 
0
Q: Developing an alert notification in AngularJS: There's a better way do code it?

CodeWarriorI'm studying Angular and want to develop my own notification alert. This is what I done, I like it and it's working like a charm but I think that it can be improved: Do I need to use it in conduction with a service? If yes, how? It will be better if it become an E (element)? I needed to put sty...

0
Q: Dynamically-sized stack follow-up

gues532Follow up of - Dynamically-sized stack - follow up I've took the tips given to me and what I did now is changing the function names to have a prefix, making the pop function only popping and not returning the value as well, checking for OOM exception / scenario that 0 is passed to capacityIncrem...

 
1:14 AM
0
Q: Memory text based game

KrzysztofWould anyone be so kind as to review my code for memory, the card game? Any advice would help me out a bunch! import java.util.*; public class Cards { public boolean gameInProgress = true; public void shuffleCards() { Scanner userInput = new Scanner(System.in); List cardList = new Li...

 
YES. Done.
Time to... write question :)
 
0
A: Merge sorting linked lists

200_successPreliminaries Your compiler should have warned you that in main(), you never use list2. You do compile with warnings turned on, I hope? Usually, the first node of a linked list is called the head. "Root" usually refers to the top of a tree. mergeList() and findMid() are helper functions, whi...

 
1:32 AM
Well, yeah, that's how it should have been done.
 
0
Q: Fizz buzz in JS

jastuccioA simple javascript 'fizz buzz' solution based on a codecademy exercise. I refactored it down a few lines after seeing these: http://rosettacode.org/wiki/FizzBuzz#Alternative_version_.28one-liner.29 I wanted to post here and see what else I can learn from this basic exercise. Thank You. for ...

 
@CaptainObvious No, I'm not editing this now. ;-)
 
So, I've wasted time trying to get my password to work, only to learn that my class' allocation on the supercomputer hasn't even become active. This was never mentioned in class...
Your solution is a duplicate of Trevor Dixon's answer in stackoverflow.com/questions/16620665/…. You might find some other good ideas on that page as well. — shivsky 4 mins ago
It'd be nice if we could actually close this as a dup, though.
 
1:50 AM
UGH. pgAdmin crashed just as I was trying to test a semi-long query I had just written... guess I better start over... -.-
 
Did you by any chance have the slow query log turned on?
 
I honestly don't know
How might I retrive a query from the log @200_success?
 
"FizzBuzz was presented as the lowest level of comprehension required to illustrate adequacy. There's no glory to be had in writing code that establishes a minimum level of competency. Even if you can write it in five different languages or in under 50 bytes of code." -- blog.codinghorror.com/…
2
 
Do you have full access to the server?
 
It's a local instance, so yes
 
1:57 AM
It may be in the data directory. On some Linux distributions, it's inside /var/log.
131
Q: How to log Postgres SQL queries?

PaulCan anyone tell me how to enable logging of all SQL executed by Postgres (8.3)? Thanks! Edited (more info) I changed these lines : log_directory = 'pg_log' log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' log_statement = 'all' And restart postgres service... But no log was created... ...

I don't believe that logging is enabled by default.
 
Can't see anything ... lesson learned, I guess '~'
 
@200_success and that was the 50th question
 
@mjolka No glory in FizzBuzz… unless it's in Brainfuck.
 
@200_success to the masochist goes the glory :)
 
Yet, still no solution in and .
 
2:05 AM
Is that a challenge?
2
 
Yes, yes it is. :-)
 
isn't 50 fizzbuzz posts enough?
 
Nope, not until it has been done in every programming language in existence.
 
right
and I wrote .. so who am I to say?
 
ERROR:  relation "person" does not exist
LINE 33: insert into person (
                     ^

********** Error **********

ERROR: relation "person" does not exist
... annoying
 
2:10 AM
@Mat'sMug Well, we are still missing .
 
It worked before you crashed, pgAdmin...
 
@Phrancis that's a very existential error message
 
No kidding
 
@Jamal No until someone writes a compiler. XD
 
There. Fixed it. Again.
Query returned successfully with no result in 55 ms.
 
2:29 AM
0
Q: Undefined variable outside a foreach loop

Danny EnglanderI've written code that grabs google fonts and adds them as an HTML body class. The code works fine but in my IDE, I am getting an undefined variable message. I can see why as the variable is outside the foreach loop. $fontstring = implode(' ', $families); foreach ($families as $fontstring)...

 
@Jamal no kidding
;)
I am not creating a tag on the main site. enough flames with already.. although the meta debate that ensued was quite constructive.
 
hey all
 
hi!
 
I should post this python code for review
it feels kind of ugly :(
 
post! post! post!
 
2:37 AM
I need to make sure it works first :P
 
good point
 
@Mat'sMug I'll have something for you to review shortly :)
I'm debating on how much I should describe FKs on a function/proc to insert data
I'm thinking either (1) describe all values using comments (PITA) or (2) describe nothing. This stuff will eventually be handled by an application, but for right now it's straight SQL into the DB's veins
 
@RubberDuck Fraction implementation in process ;)
@Phrancis great! I'll take a look! :)
 
Ohhhh. Nice @Mat.
I think I'm going to start working on a connect four clone for the kids.
 
and then rewrite it in with !
 
2:49 AM
Lol. Maybe. We'll see.
Hmmm... This guy just liked my blog. I feel like I should be concerned.
https://humanity777.wordpress.com/
 
aye
 
I can only hope it's a troll and not an actual psychopath.
 
lol
 
Fortran incomming.
@Jamal hehehe challenge accepted!
 
Seriously? Fortran? That's kind of awesome.
 
3:00 AM
fort ran
 
It comes back fast, actually
Last time I wrote a fortran program was last century
I had to install the compiler on my linux host.
 
monking
 
I can only pity the poor bastards that are maintaining legacy programs. Cuz you know some sorry soul is neck deep in 40 year old code right now.
 
monking janos
Well, I am debating installing COBOL now too
 
didn't know ideone.com, it's nice
 
3:04 AM
Go full out @rofl. Install INTERCAL.
Please Do
 
Well, I have opencobol, but that's a bit of a cheat too
 
Some day I'll break down and learn something ancient. Ya know, like C
3
 
1
Q: Hexadecimal to string without C++ standard library functions

user52953For the purposes of this code review, I will use the standard library, but pretend that <cstddef> is <stddef.h>, that I didn't use std::cout, that new and delete[] are overloaded and call custom malloc functions, etc. So this is -std=c++11 -ffreestanding. Here are my questions: Currently my toh...

3
Q: FizzBuzz vs. FortRan

rolflIn keeping with using FizzBuzz as an introduction to a language, I present FizzBuzz with a Fortran95 twist: For multiples of 3, print Fort, and for 5's multiples print Ran. For multiples of both, print FortRan. Looking especially for style and common practice criticisms. A hint on how to left-j...

 
My jokes are getting worse. Time for this duck to make like a tree and split.
Night @all.
 
'night!
 
3:08 AM
night duck
 
quack off
4
 
> Besides SELECT queries, the commands can include data modification queries (INSERT, UPDATE, and DELETE), as well as other SQL commands. (The only exception is that you cannot put BEGIN, COMMIT, ROLLBACK, or SAVEPOINT commands into a SQL function.)
WHY NOT?
 
Uhm, because that would make no sense
Functions are supposed to be usable from within other queries.
 
0
Q: Test if two nodes in binary search tree are cousins

japreissCousins are nodes at the same level of the tree, with different parents. They don't have to share the same grandparent. My solution depends on having a binary search tree with unique elements. This code is faster than writing a special find(Node *) that returns the node's level and parent, beca...

 
As a result, the query will always be an implicit transaction, or part of an explicit transaction.
 
3:21 AM
To create a function (procedure) that you pass values to using select, in order to insert data into a table, and commit?
 
Why do you need to do begin/commit/rollbacks for that?
(or the commit?).
 
For context, it took my create function statement all good. I only get an error when I call/select it with data to insert
 
Well, yes, because the data is from a select, and is inside an existing implicit transaction, I assume.
Functions can be used in the from clause, right?
Why put the commit inside the function?
Or, why don't you check the transaction-level and only start a transaction if there is not one already?
(and commit if you started it).
 
(eyes glaze over)
I have no idea if functions/sprocs can be used in from clause... why does it matter?
 
Because, every time a query or other statement starts, it has it's own transaction
rolling back that transaction, in the middle of a running query, would be odd.
 
3:28 AM
I put commit inside the function because I want to be able to pass a set of values to it, inserting in multiple tables, and commit (or fail)
I may be mistaken in this, first time trying this
 
Meh, there's likely stuff I am missing, but, having a restriction on creating new transactions inside a function that can be used in a query (as opposed to a procedure that is free-standing), makes sense
 
Where would you start transactions, instead of inside a function/sproc?
 
ok, question posted
 
@rolfl for context, this is my create script, which executes:
set search_path = PsychoProductions;
create or replace function fcn_insert_person(
        -- person table
        prm_role_id text,
        prm_first_name text,
        prm_last_name text,
        prm_organization text,
        prm_website text,
        prm_default_billing_method_id text,
        prm_active boolean,
        -- address table
        prm_address_type_id text,
        prm_address text,
        prm_city text,
        prm_state text,
        prm_zip_code text,
        -- email table
 
0
Q: String to (Multidimensional) List Conversion

YuushiSome background: I'm writing a number of classes that ensure user input is properly validated, and is rejected if it does not conform to expected types (there's also some extra options such as setting bounds and finite sets that the values can come from). There are a number of basic types (Integ...

 
3:35 AM
And the calling script giving me the error...
set search_path = PsychoProductions;
select fcn_insert_person (
-- NOTE: DO NOT REMOVE QUOTATION MARKS
        -- person table
        '3',                      -- customer
        'firstname',
        'lastname',
        'organization',
        'website',
        '2',                      -- net 30
        True,                   -- active
        -- address table
        '1',                      -- unique
        'address',
        'city',
        'state',
        'zip',
        -- email table
That seems sound to me, but... I'm not very experienced
I'm mostly concerned... if BEGIN is not allowed in a SQL function ... then why did it allow me to create a function as such using BEGIN?
 
-1
Q: writing code for an image to spawn when x hits 900

connorHow would I go about spawning in enemies once the current enemies hit an x location of 900? it would have to be like if(enemy.x<=900){ //spawn enemies } i need the current enemies to stay on the board while these are spawned aswell, and just have it so that there are multiple groups of en...

0
Q: Is this IRC bot utility library Racket-y enough?

Jake KingTo help myself learn Racket, I ported a simple JavaScript ircbot module I wrote for Node.js to Racket. The Racket version is built atop the Racket irc package, so the low-level code is handled by that. My module simply provides some utility functions to make it easier to implement IRC bots. My c...

 
3:52 AM
@Phrancis This is what I suspect s the problem (that you are calling the function from inside a select).
immediately before the select starts, it creates an implicit transaction.
that transaction will be the owner of any locks that are created, and if the select fails, it will release the locks, etc.
Select statements hold read-locks on data.
So, you are creating a transaction before the select, and then creating a second one inside the select.
commit-transactions commit to the outer-most begin.. .... right?
 
Is there something weird/hidden in Postgres, where select ad_hoc_some_query clashes with select myFunction(foo)?
 
Can't help with that question.
 
Probably a bad question... disregard
 
but, the postgres transactions are different to ones I have experience with.
For SQLServer, you can nest transactions....: msdn.microsoft.com/en-us/library/ms190295.aspx
nested transactions increment the transaction count, and commits decrement the count.
when a commit decrements the count to 0, the transaction is actually committed.
For Postgres, it is different: postgresql.org/docs/9.1/static/sql-commit.html
See, in the begin, it says:
> Issuing BEGIN when already inside a transaction block will provoke a warning message. The state of the transaction is not affected.
It also says:
> By default (without BEGIN), PostgreSQL executes transactions in "autocommit" mode, that is, each statement is executed in its own transaction and a commit is implicitly performed at the end of the statement
So, your SELECT function(...) creates an implicit transaction, and your function then nests a second transaction (creating the warning).
 
@Phrancis what's the error message?
 
4:01 AM
ERROR:  BEGIN is not allowed in a SQL function
CONTEXT:  SQL function "fcn_insert_person" during startup

********** Error **********

ERROR: BEGIN is not allowed in a SQL function
SQL state: 0A000
Context: SQL function "fcn_insert_person" during startup
 
The commit inside your function will try to commit the outside-select transaction, which will create havok, so I presume that Postgres identifies the conflict at compile time, or run time, and then aborts.
A trick I have used many times in the past, is to partner up non-transactional procedures with a transactional wrapper.
When you have an outer transaction already, call the non-transactional inner call.
 
@Phrancis so remove begin; commit; end;?
 
Note, that in your use case, there is no need for the transaction in the function... you know that, right?
 
Do I? I guess I don't...
 
Well, there is an implicit begin/commit for the outer select, and if there's a problem in the insert, the rollback will happen automatically
 
4:04 AM
0
Q: Yep, a split fraction

Mat's MugA recent question inspired me to implement a Fraction class. The OP's code was written in vb.net, and I had already implemented it in c#, so I decided to write this one in vba, because I like writing tools for the poor souls that still have to deal with that language myself. I really wanted to b...

Feel free to edit the title, I'm not sure about it
"split" because I ended up coding it in two files/types
but kinda lame
 
kinda lame because of .... ;-)
 
@Mat'sMug: how about "VBA: the lowest common denominator"
3
 
Unlike my cool !!!
 
1
Q: Yep, a split fraction

Mat's MugA recent question inspired me to implement a Fraction class. The OP's code was written in vb.net, and I had already implemented it in c#, so I decided to write this one in vba, because I like writing tools for the poor souls that still have to deal with that language myself. I really wanted to b...

 
@mjolka is that proper usage of a tag-in-title? ;)
 
4:06 AM
I removed the begin, start and commit commands... but same error :\
 
Somehow I don't believe you.... you sure you calling the right procedure now, and that it is compiled again?
(it is past midnight here... ;-)
 
^^^
 
It does accept the create function it just doesn't execute when I call it
 
@Phrancis if you removed the "begin" and it's complaining about a "begin"... then we have no hope
 
-.-
set search_path = PsychoProductions;
create or replace function fcn_insert_person(
        -- person table
        prm_role_id text,
        prm_first_name text,
        prm_last_name text,
        prm_organization text,
        prm_website text,
        prm_default_billing_method_id text,
        prm_active boolean,
        -- address table
        prm_address_type_id text,
        prm_address text,
        prm_city text,
        prm_state text,
        prm_zip_code text,
        -- email table
Query returned successfully with no result in 16 ms.
 
4:08 AM
TTGTB - good luck @Phrancis!
 
Yeah thanks, Mug
set search_path = PsychoProductions;
select fcn_insert_person (
-- NOTE: DO NOT REMOVE QUOTATION MARKS
        -- person table
        '3',                      -- customer
        'firstname',
        'lastname',
        'organization',
        'website',
        '2',                      -- net 30
        True,                   -- active
        -- address table
        '1',                      -- unique
        'address',
        'city',
        'state',
        'zip',
        -- email table
ERROR:  COMMIT is not allowed in a SQL function
CONTEXT:  SQL function "fcn_insert_person" during startup

********** Error **********

ERROR: COMMIT is not allowed in a SQL function
SQL state: 0A000
Context: SQL function "fcn_insert_person" during startup
 
Are you calling it from a prepared statement?
 
What's "it"?
 
the select....
 
No it's ad hoc
 
4:11 AM
Drop the function, and run the select with the function dropped.
 
0
Q: Stack Implementation using Linked List in Java

Arun PrakashTo understand the concept, I implemented the stack operations using linked list. Please review the code and tell me your suggestions. Time complexity of push O(n) Time complexity of Pop O(n) Node . java public class Node { public int data; public Node next; public Node(int data) { this.d...

 
ERROR:  function fcn_insert_person(unknown, unknown, unknown, unknown, unknown, unknown, boolean, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown) does not exist
LINE 2: select fcn_insert_person (
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

********** Error **********

ERROR: function fcn_insert_person(unknown, unknown, unknown, unknown, unknown, unknown, boolean, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown) does not exist
(that's after dropping the function)
 
Good, OK, that gives us a baseline, now it may also have cleared out the caches of the function.... (I have known DB's in the past to not honour the create-or-replace as nicely as you would expect).
So, go ahead and create it again (16ms I hope).
(with the commented-out begin/commit)
 
For some reason I'm getting a syntax error on the create now... looks deeper
Hm. It just needed for me to introduce a different syntax error, so it would ignore that one... then Query returned successfully with no result in 32 ms.
Postgres engine seems to run a bit funny
 
WhooHoo, Success!!!! And another reason to do the explicit drop&create... I wonder if the previous replace failed for the syntax error, without reporting the problem?
leaving the previous version intact.
Well, that must have been frustrating for you ... ;-)
 
4:23 AM
It seems not to have done such. Maybe I run a bit funny, rather than the engine
Separate select "function" function statement still getting same error, but I'm sure I will figure it out soon...
 
@Mat'sMug why did you change your CompareTo from what you had in this q? codereview.stackexchange.com/questions/56968/…
 
@janos ... FGITW !!!
 
@mjolka had to, no framework to handle NaN for me!
 
@Mat'sMug what about this bit
long left = _numerator * other.Denominator;
long right = _denominator * other.Numerator;

return left.CompareTo(right);
that was good
 
Very. But Integer doesn't have methods in VBA...
 
4:31 AM
omg
ok
 
Visual Basic for Amateurs.
 
what about delta = left - right; if delta == 0 then ... or some such
you have longs don't you? (please say yes)
 
doubt it.
 
Yes
 
ORly... OK.
 
4:33 AM
But they're Int32's
 
hahaha wat
 
Ahh, that's more like it.
 
Hey it's called Long!
 
conforms to the C mindset, where int was 16 bits ;-)
and long is 32, and long long is 64
 
i.e. old stuff
 
4:34 AM
Which is probably why Exel is limited to 16K columns.
 
kids these days, spending bytes like it's going out of fashion
 
@mjolka - I picked up the PIC microcontroller as a hobby....
look at the specs for my favourite, the PIC10F
 
'Night!
 
Program Memory (KB)	0.375
CPU Speed (MIPS)	1
RAM Bytes	16
Yes, 16 bytes of RAM
and programs that can be 256 instructions long....
(the instructions are 12-bit).
 
16 bytes should be enough for anybody
 
4:37 AM
There is a single register.
 
-- bill gates
 
And yet I built an infrared remote control for a digital DSLR.....
with multiple signals, and complicated timing.
in assembler.
and used only 4 bytes of RAM
It was overkill
 
:)
 
I used almost all the program memory only because I encoded my name and e-mail address in the last bytes of program space.
2
 
@rolfl I actually want to ask if you wanted it, but I saw you were in the middle of a discussion, so I thought you probably don't intend to do it...
rolfl you don't want this one?
1
Q: Memory text based game

KrzysztofWould anyone be so kind as to review my code for memory? import java.util.*; public class Cards { public boolean gameInProgress = true; public void shuffleCards() { Scanner userInput = new Scanner(System.in); List cardList = new LinkedList(); List matchedCards...

 
4:45 AM
Nope, i have to be off to bed....
I can normally multitask OK.
 
and I have to go make breakfast :)
humans don't multitask well
but maybe monkeys do ;)
 
@janos - I've deleted my post. Your answer covers the significant bits as well.
Feel free to scan through it and if there's some odd bits in mine that can be added to yours, well I am sure you would have thought of them too... so add that to your answer ;-)
 
easier for me if you just leave yours ;)
 
OK, then
 
hrm, still somewhat ugly, but a bit better :/
 
4:51 AM
What, my face?
 
my code
 
read it, but yeah, I'd rather not steal your lines
 
TTGTB, behave @all
 
who could call that cute monkey face ugly?
 
see ya!
 
4:53 AM
user image
2
 
@Yuushi I'll take another closer look, gimme a sec, though unlikely I'll find more
 
@janos Oh, I didn't edit the question
I left it as is
I just edited my actual code :)
 
I know. that's good. if I look harder I might find more points in the original
in any case, leave it open, Friday is usually a competitive day
 
yeah, I was going to
 
maybe jonrsharpe or mleyfman will see it and comment, and of course @200_success
 
5:02 AM
0
Q: Converting seconds to hours, minutes and seconds

Oompa LoompaThe following question was taken from Absolute Java 5th ed. by Walter Savitch: Write a program that outputs the number of hours, minutes, and seconds that corresponds to 50,391 total seconds. The output should be 13 hours, 59 minutes, and 51 seconds. Test your program with a different number...

 
@Yuushi I didn't say earlier, but there should be a blank line before the @value.setter
also, how is .strip(string.whitespace) different from simply .strip() ?
 
@janos am i missing something obvious? pop looks like it's O(n) codereview.stackexchange.com/questions/62710/…
public void pop() {
    while(!li.isEmpty()){
    li.deleteFirst();
    }
}
oh, the loop was added in revision 2
 
@janos That'll teach me to actually read the docstring for strip...
 
@mjolka yeah, that wasn't there when I reviewed. Now it's O(n), but that's not a normal pop, that wipes out the entire stack
so it doesn't make sense
 
agreed
i sort of wish there were more hurdles to editing a question
 
5:17 AM
@Yuushi well that's all I got, added to my post as well
 
@janos thanks for going through it
 
no worries
time to go to work, see you all!
 
@janos later
 
One more answer, and I'll have 300 (non-deleted) answers. :D
 
5:33 AM
morning @all
 
Morning
 
@Jamal, news over a possible graduation?
or still stuck at beta..
 
0
Q: Effectively calculate the result of geometric series

MichaelGiven f(n) = 1+x+x^2+x^3+……+x^n and we know that computer cost more time when multiply than add two numbers, how can we work out the result with greater efficiency? Blow is my solution, is there any good ideas? #include <iostream> using namespace std; double powerWithIntExponent(double base, i...

 
We can neither confirm nor deny any possible rumors of graduation.
 
5:49 AM
@200_success I didn't mention rumours, I was asking if there was any new news over it
so no new news mean still same situation
 
0
Q: Registering multiple objects with same interface

Arnab ChoudhuriI'm calling the below code in XYZManager class's constructor and the application is working. var handlers = new ITableType[] { new AbcHandler(new Logger(), new Repository()), new OtherHandler(new Logger(), new Repository()) /*etc...*/ }; XYZManager, Logger and Repository are regist...

0
Q: Sharing the common code across two .c files

Anguse1.c #include<stdio.h> #include "common.h" int main(){ printf("The add is : %d ",add(2,2,1)); return 0; } e2.c #include<stdio.h> #include "common.h" int main(){ printf("The add is : %d ",add(2,2,2)); return 0; } common.h #ifndef COMMON_HEADER #define COMMON_HEADER int add(...

 
6:13 AM
I didn't say that there were rumors, nor did I say that there was no news. =)
 
6:47 AM
@200_success Ever considered working at the governement for communication? I think you are a competent guy for that ;)
 
Monking
 
7:05 AM
Maybe I do work for the government. You don't know that.
 
Appointing an NSA agent as a mod? Well played, SE.
4
 
7:17 AM
Does anyone know if in Windows (8) it is possible to create some kind of own workspace for certain actions? Say I want to have a "workspace" for a specific course, with easy access to the studyguide, exercises, book-pdf and such?
Folders are surely a possibility, but is there something even better?
Folders become more problematic as you also need some tools, which you cannot really put in that folder
 
@RubberDuck got the pingback at midnight and read it AT midnight. who needs sleep
 
@skiwi it's windows... Don't expect anything...
 
7:45 AM
0
Q: Will Use GPL: A Simple Example of Recursion

Carl SmithA toy function meant to illustrate that there are simple things can only be described recursively. willUseGPL = (party) -> return no if party.hatesFreedom for party in party.downstream return no unless willUseGPL party yes

 
8:08 AM
0
Q: Refactoring the Iffy Tractor task

DymytryThere is a test of OO knowledge called Iffy Tractor. The task is to refactor the code and make it as much flexible as possible for the future modifications. I have placed the code here: http://pastebin.com/s3ABaBqh It was taken from here: http://www.benstopford.com/2011/05/11/the-iffy-tractor-c...

 
8:31 AM
-1
Q: model designing and fluent api confiration for forums in entity framework

aarush shahi am working on online forum project in MVC where user can ask question and expert can give solution to the question same like stack overflow but here only specific expert can give ans to that question. for eg:if question asked is of category say java or mvc or android etc..then expert belonging...

 
@CaptainObvious mod-hammered
 
 
1 hour later…
9:47 AM
0
Q: Performance of removing dictionary keys which are substrings of other keys

mattkaeoI am curious why removing a line in my code results in a significant increase in performance. The function itself takes a dictionary and removes all keys which are substrings of other keys. The line which slows my code down is: if sub in reduced_dict and sub2 in reduced_dict: Here's my funct...

 

« first day (496 days earlier)      last day (3523 days later) »