« first day (319 days earlier)      last day (3698 days later) » 

12:00 AM
RELOAD!
2
 
@syb0rg: Did I get any C-specific things wrong?
0
A: Does my reversal program in C follow the common practices?

Jamal Prefer to have one variable per line, which helps improve readability and allows you to add comments for variables if necessary. For instance, this: int count_1=0,count_2=0,i,j; would look like this: int count_1=0; int count_2=0; int i; int j; Prefer to add whitespace as needed, primarily ...

 
wow. just realized I rep-capped two days in a row.
 
This sort of looks okay for Programmers, but I'm not too sure. Definitely should be closed here.
0
Q: Global user reference

rr1g0I have to communicate to an API, and I have to authenticate every time, I am connecting to the API through one single static class. My question is, which is the best practice to handle the user info so I can get it when needed to authenticate? (there's an object user info) The options I see as ...

 
Welcome to CR! Please take a look at our help center to see what we're all about. You build something, and then you post it here to see what other people see that you haven't seen, you see? Cheers! ;) — Mat's Mug 10 secs ago
Or is that too... cheerful?
 
@Jamal Mention this with your first point:
From *Code Complete, 2d Edition*, p. 759:

> With statements on their own lines, the code reads from top to bottom,
> instead of top to bottom and left to right. When you’re looking for a
> specific line of code, your eye should be able to follow the left
> margin of the code. It shouldn’t have to dip into each and every line
> just because a single line might contain two statements.
 
12:15 AM
Alright
 
Other than that, looks good. If you want, I can tell you some other stuff I would recommend.
 
You could, or you may provide an answer yourself. There's one C++ zombie I've found.
 
@Jamal Since I couldn't get the OP's code to work, I don't think I'm going to post an answer. Plus, there isn't too much else to cover.
 
That's fine. I'll add the book excerpt in a bit.
 
Another point to add: Initialize the counter variables within the for loops.
Macro name could be more specific.
do-while loop instead of while loop.
 
12:19 AM
@syb0rg - have you used GPIO on the RPi?
 
@rolfl Not much, why?
 
Why is it not easy to map the GPIO pins on the DPi header back to what they are called in the kernel?
There is no table on the net that I can find (easily).
I want to track GPIO11 which is on pin P1-23 of the Pi header.
 
@rolfl I think I used a library to make it easier for me. But I don't remember what library I used.
 
there are a few libraries, but... well, all I need i bash.
I think I found it....
hehe, @Mat'sMug - s/i/I/ or s/i/is/ both work.
 
hey look, 590 unanswered questions!
 
12:27 AM
@Mat'sMug You are lovin' to kill unicorns tonight!
 
yeah hadn't done that in a while... way overdue!
...
@rolfl you have a particular question in mind for a 100pts bounty? a ?
 
English is such as pointless class to me.
 
@class English
 
there are 6 unanswered questions??
 
@Mat'sMug 5
This one had an answer, but no upvote:
1
A: Working with list in Java

rolflGeneral Your code style is neat. I like that you are using System.out.printf instead of concatenating strings. You should consider using %n instead of \nin the format because it is platform independent. Math.abs() - Math.abs() is a core function that you should use instead of doing it yourself....

 
12:41 AM
not credible.. or very, very funny timing ;)
5
unanswered questions tagged
java
how did this one exist all this time without a review?
3
Q: Is it Best way to use HibernateCompositeUser type for handling localized contents

Umesh AwasthiI am trying to use HibernateCompositeUser type to handle i18n specific data in my application. I am trying to use the below approach. I have a table named master table which contains all locale independent data while I have created another table master_translation which contains all locale sensi...

the tag <property name="master_i18n" type="masteri18n"> is never closed in his xml configuration... Hibernate can parse invalid XML? Besides the XML doesn't even come close to the detailed table structure... should it be closed?
 
Zombie down:
0
A: reading input from keyboard

Jamal With this much code, you definitely should avoid using using namespace std. More info about that can be found here. You have a lot of global variables, and you shouldn't have any. They're generally discouraged as they can be modified anywhere within the program. This can introduce bugs, and i...

And that's just scratching the surface, it seems.
 
12:57 AM
still nice, +1
 
@Jamal The question wasn't Jamalized before it was answered? Whoa...
 
I'm... actually doing that now... :-P
 
This question has an open bounty worth +100 reputation from Mat's Mug ending in 7 days.

This question has not received enough attention.

The [Java] tag has 5 unanswered questions remaining, and this one is the oldest of all - the elder of Java [zombies](http://meta.codereview.stackexchange.com/a/1511/23788). 100pts to the best review!
OP is somewhat active on SO:
with a little luck this bounty could turn into a new avid user, and a rep-cap-immune 15pts...
wow 5 active bounties :)
 
1:16 AM
My (rep) is on the monkey getting that bounty. :P
 
C++ FTW!
 
> The big problem is that programming languages really need to get simpler and increase the level of abstraction not reduce it.

There will always be a need for low level code, but a majority of the code that we write today is at a much higher level.
> I held out for a long time trying to believe that all the investment I had made in C++ was not lost, but it turned out that C# simplified things to such a great degree that the extra power C++ gave me was not worth the extra responsibility.
^^ not my emphasis... lol
that's quite an intense paper
one of the comments is calling C# and Java "script kiddie" languages!
 
Bot is back online
 
Ah, no wonder rob0t missed my zombie.
 
1:29 AM
yay!
 
Yeah, the internet to my Raspberry Pi got cut... so I had to diagnose that.
 
One reason for C++ is that a lot of 'legacy' code is written in C++. For example I assume that all web browsers are written in C++.
 
The reason for C++ is because it provides a higher abstraction level than C, while being one of very few non-GC languages around
 
@Mat'sMug Wow .... there is a reason I have not tackled that question.... but, I think I may have to do some learning quickly ... ;-)
 
The OP is still around on SO, so he may be in for a nice surprise.
 
1:50 AM
@syb0rg - works
#!/bin/bash

GPIOSYS=/sys/class/gpio
GPIOPIN=11
GPIODIR=${GPIOSYS}/gpio${GPIOPIN}/direction
GPIOVAL=${GPIOSYS}/gpio${GPIOPIN}/value

echo "$GPIOPIN" > ${GPIOSYS}/export
sleep 1
if [[ -f $GPIODIR && -f $GPIOVAL ]] ; then

    while grep -q 0 $GPIOVAL ; do
        sleep 1
    done

    echo Shutting Down
    /sbin/poweroff
    exit 0

fi

echo "Devices were not created"
exit 1
 
@rolfl Nice. No library either.
 
Nope
 
Next step?
 
Well, that makes the button I installed do something... so, at least I can shut down without pulling the plug when it is installed in the server room
Now I have to get a whole bunch of stuff restored.
 
@rolfl I like that ;)
 
2:05 AM
@syb0rg Here are the guts:
I marked the new header I put on the board, and also the new button, and bracket
 
What is that USB device connected, out of interest?
 
It is the logitech C310 web cam.
I pulled the cam from inside it's casing, and you can see I mounted it in the middle....
Held on with that rectangular block of wood in the middle with the non-slip rubber as protetion.
s/wood/MDF/
I needed 12V to drive the LED's that power the 'eye', so I powered the whole system with a 12V power-brick, and then, at the top, you can see the guts of a car-cigarette-lighter-to-USB charger that brings it down to 5V for the Pi
The board in the middle is a 'power bus', with 12V on the bottom set of headers and 5V on the upper set
 
@rolfl what is that?
 
That is the back end of:
... damn-it, can't find the link.
 
@rolfl so what is it? a glorified webcam?
 
2:16 AM
It is a mock-up of HAL9000, which is closely related to the department I work in.
 
is that an arduino?
 
and it is normally installed in the heavy-lab at IBM.
And it 'does things', and 'looks cool'.
 
HAL 9000 is a fictional character in Arthur C. Clarke's Space Odyssey series. The primary antagonist of ', HAL (Heuristically programmed ALgorithmic computer) is a sentient computer (or artificial intelligence) that controls the systems of the Discovery One spacecraft and interacts with the ship's astronaut crew. HAL's physical form is not depicted, though it is visually represented as a red television camera eye located on equipment panels throughout the ship. HAL 9000 is voiced by Douglas Rain in the two film adaptations of the Space Odyssey series. HAL speaks in a soft, calm voice...
 
The Raspberry Pi beta site kinda looks a bit pitiful ever since I left
 
2:17 AM
@rolfl I was reading that very link when you posted....lol
 
Well, that's a @Shame
 
hai guys
 
Hey
 
were Mat or 200_Success in here ?
 
@Sham @Mat'sMug is here, but 200 is not.
 
2:29 AM
@rolfl is that movie on Netflix
?
 
Nope, but you can torrent it (well, it is not on Canadian netflix)
You have heard of the movie, right?
 
0
A: Does my reversal program in C follow the common practices?

vaxquis// C99 in Java style! all standards broken have been broken for a reason... #include <stdio.h> const int WORD_MAX = 10, CHAR_MAX = 20; int main() { char words[WORD_MAX][CHAR_MAX]; char ch; int word_idx = 0, char_idx = 0; memset( words, 0, sizeof(char)*WORD_MAX*CHAR_MAX ); ...

^ Fine answer IMO.
I don't agree with its being down-voted, FWIW.
 
@rolfl yes I have, haven't heard much but I have heard of it. plus I just watched this
 
Half-here actually!
 
@ChrisW Though I don't fully agree with their style of though, I don't think it deserved a down-vote. But neither do I think it deserved an upvote.
 
2:35 AM
Hi @Sham!
 
hi mat
mat, we removed switch case in the link and later we removed to make sure ocean class should not be modified if new creature comes in the ocean
 
Still fishing?
 
i did an invention 2-3 months back, that i need to make my career in programming after working 10 years in IT industry, so ya
):
may be i will find out, what best it is and share with u the final code
let us not dicuss right now, if it is boring
 
Implementing that ocean is starting to tickle ;)
 
@Mat'sMug i changes my plan in my preparation again
instead of 3 steps that we discussed the other day, i planned to do something else
would u like to know that?
 
2:43 AM
@Sham I'll ping you when I post my implementation for review :)
 
implementation for what?
@Mat'sMug which implmentation are you talking about?
 
An OOP-twisted implementation of the problem:)
 
but you are C# guy, how you implement in java?
 
almost the same????
PIMP my Answer
13
A: Stored Procedure logically or coding

Malachiyou have a lot of if statements in your SQL, this screams at me that you are doing something in your SQL that should be done in the application, and that this SQL should be separated into two distinct stored procedures. the benefits faster stored procedures use an actual coding language to d...

 
...I'll do it in C#, of course..
 
2:49 AM
was microsoft C# rival for Oracle java in the market ?
when gates thought of C#?
ok, it is office time now here, see you guys later...
 
3:04 AM
@Sham sorry I'm half-here as I said (posting from phone actually), bad timing I guess.. catch you later then!
@Malachi true
 
3:40 AM
TTGTB - 'night @all!
 
@Mat'sMug Ditto, good night all!
 
4:17 AM
0
Q: alp in masm(8086)if the number is present the output should show the numbers that are not present

Meet Sanghvi.model small .Stack 100 .data array db 5, 12, 23, 45, 60, 67, 96, 100 len equ $-array key db 100 msg1 db "found$" msg2 db "not found$" .code mov ax, @data mov ds, ax mov si, 00h ...

 
4:29 AM
@JerryCoffin: For the above question, it's a little hard for me to follow as there are no comments, especially for the registers. That alone probably wouldn't make for a sufficient answer. Any ideas yourself?
 
Let me take a look.
 
4:48 AM
Sorry -- finger slipped and posted well before finished.
 
I was wondering why you've included that last code on there. I'm adding a few things of my own now.
 
@Jamal Using laptop right now. Sometimes the heel of my hand gets too close to the touchpad while typing, and suddenly bad things happen.
 
I hate when that happens. I'm also on a laptop, but I have a mouse.
 
5:04 AM
@Jamal I have a mouse, but Windows doesn't seem to be smart enough to disable the touch pad when the mouse is plugged in.
 
That sucks.
Anyway, I've posted my answer now.
 
I suspect yours is more what he's probably looking for. Mine is really more a tutorial about how to write this sort of operation in assembly language, where yours is more about the how the existing code is expressed.
 
To be fair, he didn't specify what he wants from a review. :P But I still appreciate your answer as it provides more insight into the language. Mine is mainly about cleanliness, also from my little knowledge of assembly.
And since he's unregistered... who knows if he'll be back to read this feedback. It's not every day that a new unregistered user posts something good.
 
@Jamal We'll see what happens. I guess we can hope that one of the two (or ideally even both) provides him with something sufficiently useful to return.
 
I think so. Not a whole lot to this code, it seems.
Ah, that note about clearing the register. I would've noticed that had I been reading more closely. Is there an actual difference in the way registers are cleared? All I know is that, in MIPS, the $zero register is preferred as it's faster (I believe).
 
5:25 AM
@Mat'sMug I'd call it (mostly) nonsense. His claim to love C++ is a lot like when I was a kid and was sure I was in love with Christie Brinkley (shows something about my age). Yeah, she may have been (was!) gorgeous, but I didn't actually love here because I didn't know or and had never even met her. Contrary to his claims, it seems pretty apparent to me that I knew her at least as well as this joker knew C++ though.
@Jamal xor (or sub) sets the Z flag in addition to clearing the register. It is generally faster and more compact though (mov reg, 0 needs to include the value 0 in the instruction).
 
@JerryCoffin I see. So the difference with mov here is the use of an immediate?
 
@Jamal Right. Makes it larger. On quite a few processors, that also restricts it to being decoded on only one of the (three or four) decoders. As long as you don't use immediates very often, that's all right, but using them too often can restrict the rate at which they're decoded as well.
 
Good to know. I am aware that registers are the fastest to use, and there are times when you must use them (such as arithmetic operations).
 
0
Q: Optimizing "simplifier"

ambigram_makerBasically, I'm trying to make a Simplifier that can take inputs in the form of a String and print out the solution step-by-step. Now that I've got it working, I think it has some cleanliness issues. public static void test(String eqn) { char[] order = { '^', '*', '/', '+'}; //order of prec...

 
@Jamal There are a few operations (e.g., movs) that operate memory-to-memory, but most operations need at least one operand in a register. e.g., you can do a mov reg, mem, or mov mem, reg, or mov reg, reg, but not mov mem, mem.
 
5:40 AM
Right. I also sort of forget when to use [mem]. Is it when, for instance, you're displaying the value at that address?
 
@Jamal Displaying, or just using in general -- i.e., [whatever] translates roughly as "indirectly via whatever" (but be careful--depends a little on the assembler you use).
 
I've only used NASM so far. I suppose I can use [mem] when it seems appropriate, and make should correct me if I'm wrong.
 
Most of these aren't very funny, but for some reason, this one really is (or at least appeals to my juvenile sense of humor):
@Jamal Probably. NASM and MASM do use [] subtly differently. MASM uses it to mean indirection. NASM means something more like "referring to memory"--but (if memory serves) can use it even in a direct reference, as long as it's to memory.
 
lol
2
 
That made me laugh a bit more than it should have.
 
5:50 AM
I also remember that it has to do with accessing an array index via offset, like this:
`add EAX, [EDX+ESI*4]` (taken from my real code)
@Corbin I'm going to refrain from making a "stay X my friends" joke here. :-P
2
 
Hahahahahahahahahaha. Oh my god. That made me laugh more than the image.
 
If only Sex & Intimacy SE was still online... then this may be on-topic in that chatroom... :P
 
Never knew there was a sex and intimacy SE. I bet that had some interesting questions.
 
20
Sex and Intimacy

Proposed Q&A site for consenting adults who engage, or want to, in intimate and/or sexual activity.

Currently in definition.

I was mistaken... it's still online. :-)
 
@Jamal That's probably more properly thought of as "at the memory address defined by..."
 
5:59 AM
0
Q: Fare Chart in HTML

UtkarshI am a beginner and I have made a Fare Chart in HTML. I'm pretty sure it will look horrible to any developer out there, but hey, that's why I've posted it. I'd like a general review of this. I'm especially concerned about the quality and enhancements of this form. What should I do to add attract...

 
Something like that. I always struggled with arrays in assembly. Luckily that was not greatly tested on.
 
@Jamal Not too surprising, I guess. The assembler can make it easier, but since assembly language (much like C and C++) is often taught more as an introduction to low-level logic (and such) rather than with an intent of helping you write code as easily as possible, they often make it quite a bit more difficult than really needed.
 
Yeah, we never really learned how to write it cleanly. But there were some fun programs, such as using 16-bit assembly (via DOSBox) to display the system time and date using interrupts. Unfortunately, even the professor had some trouble with it, and my code appears to be broken somewhere...
 
Hmm...I don't have a DOS box installed to even try to run such stuff any more. But if you want a challenge, I still have a few....interesting old DOS programs you can attempt to decipher if you feel like it.
 
I could give it a try sometime. I still have to get my make utility reinstalled, and so I still cannot assemble assembly programs.
 
6:14 AM
Here's one to try to figure out when/if you're feeling a bit masochistic:
.model tiny,c
.286
.code
.startup
main proc
mov si,offset count
inc byte ptr [si]
mov al, [si]
mov bx,4090h
shr al, 4
call convert
lodsb
and al,0fh
mov byte ptr end_convert, 08bh
convert:
add al,bl
daa
adc al,bh
daa
int 29h
end_convert:
ret
db 0d6h
; mov dx, si
mov ah,3ch
xor cx, cx
int 21h
xchg bx, ax
mov dx,offset main
mov cx,offset the_end - offset main
int 21h
ret
main endp

count:
db 0
name:
db 'c.com', 0
the_end:
 
I'll copy/paste this for later.
 
Once you've figured out what it does, the next step is a bit of code golf--try to write something shorter that does the same (but in assembly, code golf is always based on the size of the executable file, not the source code).
 
This should be fun. :-)
 
@Jamal I'll warn you: it may (easily) be beatable, but this code is already golfed to a thoroughly unreasonable degree.
 
I haven't attempted any golfing at all, so I may just focus on the deciphering for now.
 
6:25 AM
@Jamal Install an assembler and run it a few times. That'll make the basic intent obvious fairly quickly.
 
I'm still gonna need MinGW for this. I have a makefile, though.
 
you should really set up a linux VM at some point :)
 
I have access to my school's Linux account, but it appears they don't use NASM.
 
This code requires MS-DOS (or a close facsimile thereof) in any case.
 
Yes, so I can use DOSBox for this.
 
6:33 AM
I think I'm far too lazy these days to even attempt to deal with raw assembly
 
@Yuushi If anything, this particular assembly is at bit overcooked. :-)
 
I believe I still need to assemble the code before running it in DOSBox. I only have the .txt file with the code and a makefile.
 
@Jamal Yup--need to assemble and produce a .com file (important--a .exe file will not work).
 
I'll attempt this some other time. It'll take me a while to get this working again.
 
@Jamal Probably. I'm pretty sure it'd take me a while anyway.
 
6:42 AM
I once wrote a GCF/LCM calculator on my own. :-) It was one of my first CR questions, too.
 
6:57 AM
Well, it's about midnight here. I think I'd better go to sleep. G'night all.
 
night @JerryCoffin
 
7:43 AM
0
Q: Constants organization in Java. Quiz inzide

Frank59I and my collegue have different opinions about constant organization in Java. So we need feedback from the community about our ways. Please write into comments or answers what variant is better for you and why. 1) classic variant public class MyClass{ //constants defenition private s...

 
7:57 AM
Morning
 
Morning.
 
wee 30 free rep on SO, from yesterday's stuff
 
free rep on SO??
 
0
Q: can i use this as credit card number validation

user2894732<?php $array = $_POST['array']; //array holding numbers $array = array_reverse($array); // reversing the array echo "<br> Credit card Before :- "; for($i=0;$i<sizeof($array);$i++) echo $array[$i]; echo "<br>"; echo "<br> Credit card after applaying mod 10 Algorthim :- ";...

 
@Vogel612 From answers I posted yesterday
 
8:04 AM
@skiwi how many? ?
 
30 of the 30
 
naaah..
how many answers,..
 
ah you mean the amount of answers
I think just one
The amount of accepted answers looks depressing like this
 
8:22 AM
@skiwi don't try to compete with the unsung hero
 
That's quite a load of accepted answers
 
@skiwi but a quarter of them is 0-scored.
like... wat
 
oh indeed, I didn't look that far down
I even got 3 -1 answers
 
lol ;)
1
Q: Is there a reason why objects should be set to null after use?

Ewald StiegerI see a lot of code where the objects are set to null in the finally section or at the end of a method, for example: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public void buildUpdates(int batchId, string mkt) { aplUpdate oDU; ...

look at that post and tell me my answer deserves more than 1 Upvote..
 
I guess yes
hmm
illegal forward reference, That's not good.
self-reference in initializer is neither good
 
8:52 AM
I broke Java or myself
0
Q: Enum RPS-implementation gives self-reference in initializer and illegal forward reference

skiwiI have the following code and I believe I see why I get the errors: The errors are, for example: Self-reference in initializer in the constructor of ROCK at RPSGesture.ROCK. Illegal forward reference in the constructor of ROCK at RPSGesture.PAPER. public interface Gesture { public List<...

 
9:08 AM
0
Q: DTD file needs validation

user3436586I have a short dtd file and it has about 15 errors. I have to find and describe them. Maybe someone could check my tryings and validate them? Thanks a lot. Here is the code: <!ENTITY % note "(tip | warning | remark)"> // there are needles brackets and spaces between "|" <!ENTITY % content "(#P...

 
Does this seem legit?
0
A: Enum RPS-implementation gives self-reference in initializer and illegal forward reference

skiwiI found a proper way to do it myself, using Java 8: public interface Gesture { public List<? extends Gesture> winsFrom(); public List<? extends Gesture> tiesTo(); public List<? extends Gesture> losesTo(); } public enum RPSGesture implements Gesture, Action, RuleGestureFPSFactor...

Netbeans, what the hell did you do?!
2
    abstract public class RPSPlayer extends AbstractPlayer<RPSGesture> {
        private final static LiRPSGestureure> RPS_GESTURES = Arrays.asList(
          RPSGestureesture.ROCK,
       RPSGesture  Gesture.PAPER,
    RPSGesture     Gesture.SCISSORS
        );

        public RPSPlayer() {
            super(RPS_GESTURES);
        }

        @OverrRPSGesture public Gesture doActionBackup() {
            return getRandomAction();
        }
    }
People are always stunned by how easy Java 8 is :D
 
9:37 AM
@skiwi You are forcing losesTo in Gesture, it's the root of the problem.
I would expect something like Rules.losesTo(gesture1, gesture2)
 
@abuzittingillifirca Well there's no problem anymore now though
 
@JerryCoffin You used to (perhaps still can?) run assembler including int21 intructions from the command prompt of Windows/NT.
 
Morning / Almost noon
 
morning @SimonAndréForsberg
What do you think about this?
abstract public class AbstractGame<A extends Action, P extends Player<A>> implements Game<A, P> {
I think I simplified it to this though:
abstract public class AbstractGame<P extends Player<? extends Action>> implements Game<P> {
 
@skiwi Ah, generics! I also tend to have some classes like that. I think the last one there works... unless the game class needs to know the Action class? (Does it?)
 
9:50 AM
I don't know yet
:D
 
Haha, yeah, I know that feeling :)
I guess you just have to code it and see if those generics will work.
I've been trying to implement some generics into one of my projects but ended up reverting back to non-generics because I just couldn't figure out the correct generics to use, if there was any.
 
It seems hard to handle both genericity and inheritance/polymorphism at once :p
2
 
Also @SimonAndréForsberg I made something evil
0
A: Enum RPS-implementation gives self-reference in initializer and illegal forward reference

skiwiI found a proper way to do it myself, using Java 8: public interface Gesture { public List<? extends Gesture> winsFrom(); public List<? extends Gesture> tiesTo(); public List<? extends Gesture> losesTo(); } public enum RPSGesture implements Gesture, Action, RuleGestureFPSFactor...

 
10:15 AM
0
Q: get and post in one action do different stuff - is it OK?

MaximusI'm using Kohana's routing with the route being defined as domain/controller/action. To demonstrate my question let's consider sign-in flow. Currently, if I want to sign-in user I need to return form first and then proceed with data sent by user. Do I need to have two actions, each for the corres...

 
hmmm
03-19 09:58:26.140      880-895/system_process E/AndroidRuntime﹕ Error reporting WTF
    java.lang.NullPointerException
            at com.android.internal.os.RuntimeInit.wtf(RuntimeInit.java:345)
            at android.util.Log$1.onTerribleFailure(Log.java:103)
            at android.util.Log.wtf(Log.java:278)
 
WAT
 
@skiwi I would do that win/lose/tie approach in another way. I especially like the Mug's RPSLS code for that. And I'm quite happy with my own approach as well (which is also a bit different). Take a look at our RPSLS questions here on CR and you might get a few ideas :)
@skiwi WTF = What a Terrible Failure.
It's actually documented in the Android documentation :)
Log.wtf(TAG, message);
 
5
Q: Reservation Form in HTML

UtkarshI am a beginner and I have made a Reservation Form in HTML. I'm pretty sure it will look horrible to any developer out there, but hey, that's why I've posted it. I'd like a general review of this. I'm especially concerned about the quality and enhancements of this form. What should I do to add a...

 
@SimonAndréForsberg - aaai.org/Magazine/Watson/watson.php
 
10:23 AM
@SimonAndréForsberg A terrible failure sounds bad
 
@rolfl Oh, Watson info! I'll look into it later. Anything you suggest I should take a look at specifically?
 
You were interested..... and I have not read it yet ;-)
 
10:42 AM
That has a lot of technical detail that I thought was somewhat proprietary.... interesting read
Not sure why I never came across that in previous searches. Should have asked Watson
3
 
0
Q: Optimise Javacript Code

Niraj paulMy Javascript is fairly new and want to learn new ways to create clean, fast code. Can you have a look at this code and guide me on how to optimise this code to improve my skills. Much appreciated. I can not provide html but shouldn't be too much of a problem I think. Thanks in advance! function...

 
11:28 AM
0
Q: Raw JS AJAX method

Alex GarrettI built this as a simple example of using raw JS to perform a simple GET request with a data callback. Suggestions on how this could be improved in any way, while keeping it simple, would be much appreciated. JS: /*jslint unparam: true, white: true */ var app = (function() { "use strict";...

0
Q: My first model RSpec

atomAlteraThis is my first model RSpec test: require 'spec_helper' describe CashFlow do context 'DB Fields' do it { should have_db_column :amount_cents } it { should have_db_column :amount_currency } it { should have_db_column :user_id } it { should have_db_column :target_date } it...

 
everyone's gone...
 
11:47 AM
0
Q: Node exports, architecutre

ValeryMy project written in node js + express have the following architecture: routes(e.g controllers), models (stateless functional modules) and app. Models objects only doing sql queries like this: exports.setPassword = function (id, password, callback) { pg.connect(conString, function (err, clien...

 
@skiwi No, but @Nobody is.
 
wb @SimonAndréForsberg
 
Early morning in America (and Canada)
 
I'm trying to figure out exactly how to let my code die after a set amount of time
Trying wit a CompletionService currently
I don't know if this code makes any sense even...
default public A doActionWithTimeout(final Executor executor, final int period, final TimeUnit unit) {
    CompletionService<A> completionService = new ExecutorCompletionService<>(executor);
    completionService.submit(this::doAction);
    Future<A> future;
    try {
        future = completionService.poll(period, unit);
        return (future.get() == null) ? doActionBackup() : future.get();
    } catch (InterruptedException ex) {
        Thread.interrupted();
        return doActionBackup();
 
11:50 AM
I hate Guava >.> as it's 3rd party extra thingie
So unless I really really must...
 
I love Guava. I find it very useful for most things :)
 
If that CompletionService would only make sense
It's probably easy when you understand it
 
Surprising...
 
Doesn't look too bad
default public A doActionWithTimeout(final Executor executor, final int period, final TimeUnit unit) {
    FutureTask<A> futureTask = new FutureTask<>(this::doAction);
    executor.execute(futureTask);
    try {
        return futureTask.get(period, unit);
    } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
        return doActionBackup();
    } catch (ExecutionException | TimeoutException ex) {
        return doActionBackup();
    }
}
 
I was refactoring a 630 line monster controller all morning and it's less than 100 messages here..
 
12:02 PM
it's been quiet
 
yea.
This looks like Interrupted exception is derived from Execution Exception... why not put em together??ß
 
I don't know yet... I think the regular interruptedexception needs to interrupt the current thread for sure
also i like the behaviour of my RPS now
It asks me once for my gesture, waits two seconds, then asks again, waits two seconds again, and then starts spamming the hell out of my by asking it forever.
 
well it's not like I knew... just giving the rubber duck here ;)
gotta love it
 
This doesn't even make sense.
 
@skiwi it does..
rubber duck programming: explain every single line of code to the rubber duck
 
12:06 PM
Ah interesting, it was working
Of course... When I enter something, then the AI does his job
And then it asks me again
 
like... no result??
 
Only real issue is that I do not have time anymore to enter anything from the 3rd round onwards
No it works fine, it just all happens so fast.
Please enter your gesture:
rock
Key: players.RPSSimpleAIPlayer@816f27d / Value: ROCK
Key: players.RPSHumanPlayer@548c4f57 / Value: ROCK
Please enter your gesture:
Key: players.RPSSimpleAIPlayer@816f27d / Value: PAPER
Key: players.RPSHumanPlayer@548c4f57 / Value: SCISSORS
 
bye
 
And if I do not have enough time to enter anything, it will just take something random :D
But after one timeout it just goes mad.
 
did you reset the timeout on reprompt?
 
12:10 PM
It shouldn't keep running I think...
I create a new FutureTask every time, this does not even make sense.
Maybe I should read up upon the documentation
3
Hmm, if I have a Scanner(System.in) inside a FutureTask, can it then be interrupted when it's in the scanner.next() method?
 
IOException
Read Error
 
maybe
I should print a stacktrace
stupid me
Very stupid me
Interesting.. java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: end
of course if it is an ExecutionException it is hard error, I should not multicatch that
g2g, have class
 
12:35 PM
0
Q: Is recursion like this safe with a task queue on GAE?

909 NiklasI've written a function to call with the deferred library to generate a large task queue, and at first without the recursion it timed out (deadlineexceeded) so now I'm trying with a recursion but it is safe? def do_blobs_delete(msg=None, b=None, c=None): logging.info(msg) edge = datetime...

 
@SimonAndréForsberg: You seem to have acquired a habit in referencing me, do you? :)
@Vogel612 @skiwi: do you two talk about the same thing?
 
@Nobody I'm not referencing you, I'm referencing nobody.
 
@Nobody probably not..
 
12:52 PM
@SimonAndréForsberg: I am sure you do ;)
@Vogel612: It was a bit confusing to follow until I realized that
 
morning everyone
 
moin @BenVlodgi
 
1:24 PM
0
Q: innerclass runnable calling outer method

holapI created a console program that tests report results from JasperReport. It retrieves the list of reports, splits the list and pass any peace to a new thread. Every thread execute its own reports and compares the results with reference files. My college says multithreading is wrong, but as usual ...

 
1:41 PM
yay, my first rollback
 
1:52 PM
hi!
 
which company is large enough to justify rooms with four digit numbers?
 
it's actually quite easy..
Building 8, level 2, room 24
take any campus
 
@Nobody any company renting ..^^ that
 
hm did not think about Identifying the building with a number ^^
 
@Mat'sMug returning that about the links...
 
1:56 PM
oh, I broke the hover text! ... It's taken me 20 years to get over skyline tetris ...lol
 

« first day (319 days earlier)      last day (3698 days later) »