« first day (531 days earlier)      last day (3481 days later) » 

1:00 PM
@Pimgd is connected to Naruto, the anime...
one of the current big long-longrunning shonen anime
(which is gladly about to end)
 
Does anybody want to edit this comment into the question. I'm not comfortable doing it after the mess that just happened.
(2^4 mod 11) = (16 mod 11) = (5 mod 11). – And solving the equation x^n = a mod M for the unknown x in modular arithmetic means to find an integer x such that x^n - a is a multiple of the modulus M. — Martin R 17 mins ago
(Also, a downvote will earn me a badge....)
 
sorry
It's after 3 PM
my brain derped out
there's no way I'm gonna be able to understand mathematical optimizations right now
 
@RubberDuck Sure
 
@RubberDuck here you have a downvote and a thanks,
 
Thanks guys.
 
1:06 PM
because of this comment streak I get the feeling I begin to grasp modulo arithmetics
 
@Vogel612 This is a kind of interesting one I ran across a while back. It took me and another guy quite a while to hash out what the frak was going on.
4
A: Mod with Doubles

ckuhn203According to the VB6/VBA documentation The modulus, or remainder, operator divides number1 by number2 (rounding floating-point numbers to integers) and returns only the remainder as result. For example, in the following expression, A (result) equals 5. A = 19 Mod 6.7 Usually, the data t...

 
eurgh vba... and that when I am in the top users for vba here...
 
@Yann4 @amdube I summon thee
 
5
Q: Modular Exponentiation

JuicyI want to solve the following for \$x\$ (in Python): \$x^{101} = 8765 \ (\mod{9691573})\$ I coded this: n = 8765 power = 101 mod = 9691573 x = 0 while x < mod: if (x ** power) % mod == n: break x += 1 print x This is basically the "brute force" approach. What is the most e...

 
to continue this discussion:
There could be an empty position that's waiting to be filled? Although given that there are no setters, that might not be the case. I tend to like having default constructors, although that is where I have a constructor and an Initialize(). It sets it up in a known state which works well if you might be initializing to different levels. — Yann4 11 mins ago
@rolfl will those users see a notification? or is there another way to invite folks in the chatroom?
 
1:12 PM
Actually, I only have 27" when I'm at the office. At home, I have 30".
2
 
@janos as you're not a mod, they won't..
but...
 
@rolfl Thank you.
 
Hello there.. I just wanted to chime in and remind you that comments are not the place for extended discussion. SE has their own Code Review Chat for this ;) — Vogel612 1 min ago
 
a-ha
 
[chat] is a magic-link
 
1:13 PM
nice
I'm guessing you Santa-ed a little bit there while at it, thanks for that too ;-)
 
@janos I could super-ping them, but that is for more serious things... the comment is the right way.
 
no need
 
This is cool... The third-party library ControlsFX for Java 8 just made it into the JDK
> The nice thing about openjfx-dialogs is that people wanting to use the new JavaFX dialogs API in 8u20 can do so – just download the jar (or set it as a dependency) and you can use the API (and implementation) exactly as it will be in 8u40
@Donald.McLean That makes it even weirder...
 
@Vogel612 It doesn't link to this chatroom
 
I so wish to have this chat at work. on our intranet I mean
 
1:17 PM
@Pimgd correct.. it links to site rooms
by activity that is..
IIRC there's nothing like [chat/rooms/8595]
which would link here...
 
@Vogel612 I was very close to posting another comment to thank you for reminding me about chat, but managed to refrain
 
meta-chat chat.
 
@Yann4 I had some guys on Stackoverflow that were really chatting in comments..
I tried to pull the same trick, but they did, what you managed to refrain from...
 
Argh:
@rolfl by that i mean that my algorithm gives correct result for 3 test cases and incorrect for 7. Code is not broken, algorithm not working in other test cases which i am unable to think of. — amdube 50 secs ago
 
1:26 PM
@rolfl What are you going to do?
 
Paste a link
 
nyan.cat?
 
@skiwi External monitors. I have no idea what you're thinking.
2
 
@Vogel612 my excuse is I'm still new(ish) and trying to be helpful :P all of the privileges that let me help more seem so far away; even further when graduation drops
 
nah [tour] [help/on-topic] and faq should be fine...
@Yann4 we're a loving community, showering chat-participants with upvotes...
It's not that far away, trust me...
 
1:30 PM
@Vogel612 That sounds vaguely mafia. How do I become a made man?
 
Write answer
Post answer in chat
 
@Yann4 not yet, but you can...
> I will make an offer you can't resist.
 
Will it cost our souls?
 
@TheFailure well it didn't cost mine, but I am not 20k yet, so I wouldn't know.
 
monking
\    /    /\/\   /     /   \
 \o/      \o/    \o/    \o/
  |        |      |      |
 /\       / \     /\    / \
4
 
1:36 PM
what Y...
 
Hey @BenVlodgi
does this look right?
	public Record(string id)
	{
		if (!DoesRecordExist(id)
		{
			CreateNewRecordOnDatabase();
		}
		else
		{
			this = GetRecord(id);
		}
	}
 
reasons
hey @Malachi
 
specifically the else statement
what have you been up to?
 
Hey @Malachi - does this look right: youtube.com/watch?v=kfVsfOSbJY0 ?
 
@Malachi well, if this is C# then... imm not sure what you are doing setting something equal to THIS
also, why do you have a !not in the if statement if you're going to do an else anyway
 
1:38 PM
@rolfl the old Rick Roll
 
hey @Yann4, I wanted to invite you here because maybe others will be interested in this conversation too, about adding a default constructor to an Employee class
Employee()
{
name = QString();
mgrName = QString();
salary = 0;
budget =0;
}
 
@BenVlodgi supposed to be a constructor
 
kicking in the front seat! Fun Fun Fun!!!!
 
but wait
Database -> id -> should be auto increment.....
 
@Malachi I don't think thats corrent syntax
 
1:39 PM
ugh
 
can one even do this =??
 
@janos I think that it's easier to check if name == QString() than have an entire JobPosition class
 
@Vogel612 that's what im saying... I think it just exploads
 
btw.NORMAL nice to see you around Ben ;)
@rolfl I think user actually read the link you posted
 
@Vogel612 I thought it was a good idea, maybe we should suggest it.... JK
 
1:41 PM
So what is two employees have the same name?
 
@Malachi it just wont work
 
@TheFailure a ... normal case??
 
@Yann4 at this point the argument is getting a bit too hypothetical: do we really need to model an empty position waiting to be filled?
 
thanks @Vogel612 :)
 
You shouldn't even use Strings as primary keys..
and enforcing a Unique constraint on names is just plain dumb...
 
1:42 PM
You should have an id or UUID
 
it's overly speculative in the context of this question
 
Thank God that song isn't very long!
 
We had the case in the company where two guys had the same first and lastname
 
@janos Possibly? If someone was just fired? And yeah, I'm with you on that, the question really didn't call for it
@The
 
was interesting with the email and username creation...
 
1:43 PM
I work at IBM .... nuff said.
 
I think it's good to avoid speculation, design for the current problem. You can consider places that are likely to change, but here we don't have a reason to suspect that
 
@rolfl that...
 
@rolfl this was one of the suggestions after the video
 
@TheFailure Yeah, but this was from this question
 
don't worry it's not a miley cyrus video
 
1:43 PM
no way I'm clicking on that
3
 
@janos Fair enough, I guess it was mostly finding a justification for a personal preference. I like default constructors, what can I say?
 
it's the top 10 most hated
 
@Mat'sMug - I don't follow.
 
party in the usa was originally written for Jessie J
 
hmm.. that would be perfect, if I had WTD (week-to-date) instead of LW - the last week figures might not be included in MTD/STD/YTD, depending on the calendar week. Therefore, the factors for LW cannot be hard-coded this way. It's really only LW that's problematic here. — Mat's Mug 1 min ago
 
1:45 PM
no worries @Yann4, good picking on each others' brains
 
LW works fine the way I see it ... ?
 
@Malachi the play icon makes it look like she got braces
 
@Yann4 Why would salary be in doubles?
 
@Pimgd lol it does
ok click this one instead
 
0
Q: Non-concurrent write creates bottleneck

Trond KristiansenI have some efficient methods that recursively creates a tree structure (NSTreeNode) of by looping recursively over a directory structure. The result is displayed in a NSOutlineView. This works well with one exception where I have to non-concurrently update a NSMutableDictionary that holds the st...

 
1:48 PM
@TheFailure I get paid in pounds and pence, I'd be disappointed if someone took my 99p off me and said that I got nearly a pound less a month
 
47
Q: Is a double really unsuitable for money?

doekmanI always tell in c# a variable of type double is not suitable for money. All weird things could happen. But I can't seem to create an example to demonstrate some of these issues. Can anyone provide such an example? (edit; this post was originally tagged C#; some replies refer to specific details...

 
@TheFailure ESPECIALLY if it was because an int shaved it off. That does my nut in on a day to day, I don't want it messing with my money :P
 
@Yann4 as I would be disappointed to find, that when I got a raise of 20 pounds, and just 19 pounds 99 penny and a lot of truncated 9's would come.
 
@TheFailure @Vogel612 huh. The more you know. Is there some equivilant to system.decimal in c++?
 
@Yann4 100 pence in a pound right?
 
1:52 PM
@Yann4 no clue, but I know that you need to use BigDecimal in Java ....
 
Why use Bigdecimal?
 
Just *100 and call it an int? @TheFailure
 
because there's no Decimal.
@Yann4 doesn't work with non-100 based currencies.
 
@Vogel612 Yes it does
 
1:54 PM
Lets say 12 a in a b
 
and now BTW.Work
 
@TheFailure where's the generalization??
 
total = a + 12 * b
 
you can't save 12.52 a in the same "type" as 12.52 € / $ / whatever
because the transformation back is... problematic
 
@Vogel612 Yeah, it would, as it's just getting rid of the decimal. The issue would be if there was, say 1000p in a pound, as there'd still be a decimal that would be shaved
 
1:55 PM
And if you wanted to get a and b back
b = 12 % total
a = total - b
 
@TheFailure the problem is not the transformation in itself, but that you have different transformations depending on currency..
 
Currency class?
 
@Vogel612 Can i have a currency that goes against this
@Vogel612 As you can see I use the magic value 12 every time
 
A non-decimal currency is a currency which has sub-units that are a non-decimal fraction of the main unit, i.e. the number of sub-units in a main unit is not a power of 10. == Contemporary non-decimal currencies == Today only two countries in the world use non-decimal currencies. These are Mauritania (1 ouguiya = 5 khoums) and Madagascar (1 ariary = 5 iraimbilanja). However these are only theoretically non-decimal, as in both cases the value of the main unit is so low that the sub-unit is too small to be of any practical use and coins of the sub-unit are no longer used. The official currency of...
 
Can we just ignore the Khoums and the iraimilanja and sday that madagascar and Mauritanian comanies have to pay extra to have it re-built? @Vogel612
 
2:00 PM
@Yann4 Yes.
 
@Yann4 S! OOS? TS
 
You can print out currency as doubles
 
@Vogel612 I'm so confused. I knew coming to chat was too big a step
 
0
Q: Easy bitset I/O

DanielI'm writing a program that makes heavy use of std::bitset's and occasionally needs to read/write these to file. std::bitset does overload the << & >> operators, but using these will result in an ASCII encoded file (i.e. {0,1} = 1 byte), which is ~8x bigger than it would be if using a bit-for-bit ...

 
ohhh not again...
23
A: What's a Zombie? And what are the many other memes of Code Review?

Mat's MugMeme: TS | RSA Originator: SimonAndréForsberg (TS), rolfl (RSA) Cultural Height: star-power Background: The 2nd Monitor is quite a star-happy chatroom. How many of you know that there's only a number of times you can "star" a chat post - a star cap (like the rep cap and the vote cap, a star ca...

 
2:01 PM
Just don't work with it in double form
Because of floating point inaccuracies
In computing, floating point is a method of representing an approximation of a real number in a way that can support a trade-off between range and precision. A number is, in general, represented approximately to a fixed number of significant digits (the significand) and scaled using an exponent; the base for the scaling is normally two, ten, or sixteen. A number that can be represented exactly is of the following form: For example: The term floating point refers to the fact that a number's radix point (decimal point, or, more commonly in computers, binary point) can "float"; that is, it can be...
 
@rolfl select CalendarDate, 0 as LWFact, 1 as MTDFact, 0 as STDFact, 0 as YTDFact from dbo.CalendarDatesMTD(GetDate()) - LW might be included in MTD/STD/YTD.. or not, depending on whether last week was in the same month/season/year as the current week
 
@TheFailure but what makes your approach any different from:
struct decimal {
   int decimal_part;
   int pre_comma_part;
}
 
but week-to-date would work, because the current week is also in the current month/season/year.
 
I'm still missing something (rather, I think you are ... ;-)
 
And what happens when I +254 onto the decimal part?
Does it automatically roll over onto the whole numbers
 
2:05 PM
@rolfl you're right. I missed the union and then the max and the group by
stupid mug
 
mug-shot
 
@Vogel612
 
@Vogel612 The "OOS" is still tripping me up :P
 
Lets say we use dollars and cents, if we need to add x dollars we just add x * 100 cents
When we need an output of dollars and cents
dollars = total % CENTS_IN_DOLLAR
cents = total - (dollars % CENTS_IN_DOLLAR)
 
0
Q: Binary search tree

dimanistPlease review this code. I try to write a program about binary tree with classes. What can I do better? //ClassTree.h #pragma once class Node{ private: int id; Node *left; Node *right; static int count; public: Node(); Node * first(Node *root); void search(Node *r...

-1
Q: Recommendation for Application that will create HTML & CSS from Text or Word Doc

KieranDI have a software program that outputs HTML and data values for invoices, emails etc. The problem is editing the output is really cumbersome. Can someone recommend an application that would "read" a doc file or rtf and create corresponding HTML and CSS as a jumping off point.

 
2:09 PM
If we need a double Representation we can just do dollars = (double)total / (double)CENTS_IN_DOLLAR
 
@TheFailure @Vogel612 Are there any currencies that have multiple layers? So Pound.Pence.IttyPence? Or was that cleared up in decimalization?
 
@Yann4 Multiple layers would work as well, let me give you an example (Just need to write it first)
Hope you dont mind a little Java
 
@TheFailure I think I'm being conditioned to like Java again, as Java == rep
 
Never noticed.
 
around here, that's mostly true, though...
C# isn't all that much active and after php there's a huge gap until python and SQL only are coming..
 
2:15 PM
> Dinosaurs loving money is the root of all evil
 
@Yann4 Out of Stars...
 
@Vogel612 aahh, I should have realised
 
why else would you call a TS ;)
 
And I'm vaguely considering taking some time learning python, but I'm not sure how much it would be worth it. Also, I spend 5% of my average day "vaguely considering learning X". That's why I know befunge
And yeah, I thought it was implied! @Vogel612
 
Well no reason to not wonder about it..
 
2:19 PM
But there be vidja games to play. Currently my spare time is even-split between making a chess game (and swearing at it), playing dark souls 2 (and swearing at it), and actually interacting with humans.
 
@rolfl 35 rows, 2 seconds
 
Run it again, should be faster ;-)
 
3rd run
 
@Yann4 well I used to have Dark Souls prepare to die on my pc...
 
Also, you should validate the numbers manually for the last week, and compare against yours, to ensure tha tthe behaviour is correct
 
2:20 PM
until I realized, that it didn't actually save my savegames...
so I removed it after lots and lots of cursing..
 
That'll induce rage. @Vogel612 Get the dsfix, it cleared up a lot of problems with the port, and it's a good game, I swear :P
 
@rolfl same results
 
*cough*
 
@Mat'sMug Well, you have to wait for when last week is not part of this year ;-)
 
I can run the report for week 1 :)
oh, but I didn't bother importing a calendar for Fiscal 2013... damn
LW shows up as all 0's, so I'd say it's working correctly
 
2:26 PM
Alright, the loic seems sound to me. Some of the other solutions are iffy, but the nice thing is that the concept is 'expandable' with some small effort.
 
now I might have to, because the next question they'll ask is "how does that look against LY"
 
Of course, year-on-year comparisons, then against last quarter, etc.
 
I like your answer over the others, because it's easier to maintain / change the groupings, or add columns - I might want to drill it down to model and material eventually
and checkmark
 
Thanks, but I want to see what the explain-plan looks like ;-)
Ok, and I never mentioned it, but the CalendarDate functions are nice... really nice.
good idea.
 
@Malachi Wow, that was really annoying.
 
2:30 PM
@Vogel612
private static final int KITS_IN_QUOTS = 25;
	private static final int QUOTS_IN_HETS = 43;
	private static final int KITS_IN_HETS = KITS_IN_QUOTS * QUOTS_IN_HETS;

	private static int amount;

	public static void main(String[] args) {
		// Deposit 3Hets 4Quots and 3Kits (The program wont care if you use something greater)

		amount += 3;
		amount += 4 * KITS_IN_QUOTS;
		amount += 3 * KITS_IN_HETS;
		// 3328

		int temp = amount;

		int hets = temp / KITS_IN_HETS;
		// hets = 3
		temp -= hets * KITS_IN_HETS;
 
@Donald.McLean lol I haven't even finished watching/listening to that video, I wandered off on a bunny trail from there, and some how ended up on what-if.xkcd.com/109????
 
0
Q: Organize module inclusions in Lua

キキジキIn the Lua library I'm developing I was originally exporting everything inside a global variable. Inside the include file (init.lua) I had: lib = {} lib.class = require "class" lib.ClassA = require "class-a" lib.ClassB = require "class-b" -- ... -- inside the other source files (for example, ...

 
@Mat'sMug Experienced Mug
 
@Vogel612 Dare you to break that
 
@rolfl ^
 
2:31 PM
@Malachi There was one song I like on that list, but the other nine - blech!
 
@Yann4
You can put in 30000 kits and it would convert everything up
Made up an odd currency for this
with 3 phases
 
@TheFailure neat. I wish I could say more, but...neat.
 
If you use double there is a chance money will be lost due to limited precision
 
Earned Mortarboard first time
 
Well, congratulations, but you're never going to earn it again... so the first time is also the last ;-)
(well, you can earn it on other sites).
 
Why cant you earn it again?
 
it's a one-timer badge
 
0
Q: DB Model for Small requiremnt

VIckybI have created below DB model. Could you please validate if this is proper. This is restaurant app where waiter takes order and gives it to chef.Before placing order she does have information of menus.The chefs prepares the dishes and is delivered to customer.Once customer is done an invoice is...

0
Q: Trim a certain amount of characters in a string

Edeniavoid strdev (char *str, long from, long to) { char *part1 = malloc(strlen(str) - strlen(&str[from])); long i; part1[from] = '\0'; for(i=0; i<from; i++) part1[i] = str[i]; sprintf(str, "%s%s", part1, &str[to+1]); free(part1); } Any other more exotic way ..or that one is...

 
2:38 PM
I am not even on that list.
 
Nice number
 
Monking
 
Monking @Phrancis
 
@Heslacher That is now 68 badges in the past year, and 20 in the 3 years before that.
 
@rolfl BTW I love that it's still 2 seconds when I add Model and Material to the groupby - 699 rows in 2 seconds :)
 
2:40 PM
@Mat'sMug you talking about your query from yesterday?
 
yep
 
Only 49 days like today to get epic ;-)
 
Race you ... ?
 
No
 
Me to legendary, you to epic ?
 
2:42 PM
I'm still "racing" konijn to 20K, and I'm actually in the lead so far.
 
I can get legendary before Christmas, if I try
 
Still need to get my (never ending) work done.
 
I'm so glad you guys still monk
 
I will have to pimp some answers though.
 
0
A: Small password generator app with GUI

Nate KerkhofsA minor detail: A good random character also contains non-alphanumeric characters. On my default azerty keyboard, I can see between 40 and 45 other characters that you haven't included that can be used, not even including any combinations. Fortunately, after you made the changes recommended by Th...

I wanna flag this with not-an-answer
... maybe it is an answer, but not for that question.
 
2:48 PM
I need to get to work
but T really want one of these wickedlasers.com/arctic
 
@Pimgd I would consider it an answer. It raises an important point, but just not particularly well.
There's a difference between not-an-answer, a bad answer, a decent answer, and a great answer
 
@Malachi xkcd can do that to you.
 
> A shoebox full of pure LSD would be worth about $2.5 billion.
Shoot for the Moon. If you miss, you'll end up co-orbiting the Sun alongside Earth, living out your days alone in the void within sight of the lush, welcoming home you left behind.
2
 
This answer would be much more useful if you included the 2 lines of code which you mentioned would be trivial to add. — Phrancis 19 secs ago
 
@Malachi XKCD violating gun safety laws
 
2:55 PM
Gun Safety laws?
 
@janos that is a violation of Gun Safety
 
Yeah... you shoot up...
guess what happens to the bullet
 
I'm sure Malachi has an xkcd quote for that....
 
It comes down and can hit people.
 
2:57 PM
Yay, i was mentioned in the answer ;)
 
0
A: Binary search tree

Yann4I'll try and review this file-by-file, but things might crop up across multiple files. However, first, I'd like to mention that my initial thought on looking at this was that I'd have a Node struct, and then have the class manage that struct, and keep track of the head, but that is just my way of...

Thoughts?
 
Weekend!
and out of stars already
 
0
Q: Dessing Pattern Repository GetById

Guillermo Ayran Torres LoresI'm using Dessing Pattern Repository for example like explain Remondo Developer's Brain Repository in Plain C#, I have a Dessig of Data base where I have primary key of type DateTime, nchar(2) and int, as you can see I use different types for primary key in my Tables. The question is that when I ...

 
@Yann4 As I don't know enough c++, will the output of search(Node *root, int digit) (if the digit is found) be "Found..." and "not found.." ?
 
Toodles!
 
3:11 PM
@Heslacher Good point, I missed that.
@Heslacher I've edited into my answer, ta
But sweet jesus, code reviews take time. AND I missed stuff. How do you guys get rep?!
 
You need to make it more prominent in your answer. This should be seen as a bug as it doesn't create the expected behaviour/output.
 
0
Q: Spit out duplicate words

RA SALBONERcan you please help me with this problem below. please i really need your help. I’ll be glad if you response. Thank you very much :) Problem: you are about to write a program that reads in a while bunch of words and will spit out the duplicate words. for our purposes, words are to be separated b...

Hmmmmm
Homework much
And no code to review
@Pimgd
 
@Yann4 By doing lots of them ;)
 
@TheFailure You don't know. Their boss might want to know how much wood a woodchuck can chuck.
2
 
Hmmmmm
 
3:18 PM
And Yay, can cast close votes!
3
 
With great power.. and all that...
 
-2
Q: Spit out duplicate words

RA SALBONERcan you please help me with this problem below. please i really need your help. I’ll be glad if you response. Thank you very much :) Problem: you are about to write a program that reads in a while bunch of words and will spit out the duplicate words. for our purposes, words are to be separated b...

 
@rolfl Yeah, yeah, now who do I hit with the great power </humour>
 
3:38 PM
@Yann4 now quick, get to 3K before the privs thresholds are changed! ;)
2
(congrats btw)
 
@Mat'sMug Too bad you don't keep them
The privileges, that is
 
@skiwi oh I will :)
 
@skiwi I'd be okay if a workaround were proposed where in order to keep my privileges, my rep got bumped to the point where I'd have them :P
 
uh.. except the 40K
 
@Mat'sMug What's the 40K?
 
3:44 PM
oh, nevermind
I somehow thought "Trusted User" was 40K
 
So much for you keeping on top of your rights and responsibilities.^^^
 
brain's been farting quite a lot lately
 
@Mat'sMug And here was me thinking that there was a super-secret-special level that you only saw when you got to 40k, that ninjas descended if you told the plebs about.
 
lol
4
 
Okay, I'm considering answering this question codereview.stackexchange.com/questions/67018/… to the OPs definition
exotic: Intriguingly unusual or different; excitingly strange
Now it can be argued that that's from the definition that they provided (literally), but providing what is an 'exotic' answer is probably not what they actually want.
If I gave an obfusticated answer (Which I'd consider exotic), would that be wrong?
 
3:53 PM
correct, that would be wrong.
Code Reviews should all be about making better code, not worse code.
3
(FYI, if yo like the games you can play with making code obfuscated, small, etc. then consider Programming Puzzles & Code Golf
 
But equally, if someone came here with code, and was asking for it to be made less clear (there is a place for code obfuscation), and everyone refused and cleaned it up, would that be right?
 
the question would be closed as off-topic:
> Do I want the code to be good code? (i.e. not code-golfing, obfuscation, or similar)
 
and yeah, it's more of a theoretical question, I wasn't planning to just troll.
Oh right, I didn't realize that golfing was off topic.
I was just reasoning that "better" is subjective, and an answer would make it better in the way that the OP wanted.
 
@Yann4 As a 40k-user on SO, I can neither confirm nor deny the existence of secret levels. Also: Jon Skeet is totally not one of those Lizard People.
7
 
4:22 PM
0
Q: Setting up notifications for Android

Kala JHere is Alarm Service for setting up notifications on my phone. Currently, the code works and is functional. However, I noticed my code looks different than a few examples I found online. I was wondering if I should be using Notification Compact builder instead? Also, any advice on how to make ...

 
4:40 PM
"Golfing for Cats Code"
 
1
Q: Bouncing ball simulation

Ethan BierleinI was fooling around with some maths and realized that I could use a parabola to represent a bouncing ball. So, naturally, I decided to make it in code. var Ball = function(r, v, a, y, x) { this.r = r; this.v = v; this.a = a; this.y = y; this.x = x; }; Ball.prototype.draw = ...

 
4:55 PM
So, messing around, I took that strdev question, and tried to run it:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void strdev (char *str, long from, long to)
{
    char *part1 = malloc(strlen(str) - strlen(&str[from]));
    // long i;

    part1[from] = '\0';

    //for(i=0; i<from; i++) part1[i] = str[i]; // Old copying
    memmove(part1, str, from); // New copying
    sprintf(str, "%s%s", part1, &str[to+1]);
    free(part1);
}

int main(void) {
        char* hw = "Hello World!";
        fprintf(stdout, "%s\n", hw);
        strdev(hw, 7, 12);
        fprintf(stdout, "%s\n", hw);
gcc -o substr -Wall substr.c
no errors, no warnings.
when I run, I get:
Hello World!
Segmentation fault (core dumped)
I dislike C.
 
It'll be ok @rolfl
 
I know, right? It's like saying to me: "Bloody Java guy tries to mess with me...? I'll show him what real programmers have to deal with!"
3
 
@rolfl I would star that, if I could
 
RSA :)
 
@Mat'sMug Thanks!
@rolfl You aren't checking if your system calls succeed
 
5:02 PM
@rol
@rolfl - the sprintf is where the segfault is
 
That could well be the case, but does that mean the code in this question is broken? codereview.stackexchange.com/q/67018/31503
or does that mean I did a bad copy/paste?
 
I'm going to side with broken
 
@Vogel612 :)
 
Finally was able to post a C answer:
0
A: Trim a string to a given start and end

syb0rgA few notes: I think the basic concept of what you are trying to do is remove a substring from a string. My confusion comes in as to why we have a function prototype such as yours rather than this: void removeSubstring(char *str, const char *toRemove) This in my opinion is easier to operate...

@rolfl It works, but it's finicky on how to call it from main
@rolfl Your problem is that you have a constant string declared, and then you try to modify it in the method
 
That's sweet of you to be so .... sensitive about it. My problems are much more basic than that ;-)
OK, if I do the strdup, it runs, but gives unexpected results.....
if I call it as:
    char* hw = strdup("Hello World!");
    fprintf(stdout, "%s\n", hw);
    strdev(hw, 7, 12);
    fprintf(stdout, "%s\n", hw);
it prints:
Hello World!
Hello W
 
5:13 PM
Monking!
 
Monking!
 
Sorry @Malachi but today is just too good a Friday to not post this!
 
Slow today, huh?
 
4 hours ago, by rolfl
Hey @Malachi - does this look right: https://www.youtube.com/watch?v=kfVsfOSbJY0 ?
 
5:16 PM
Well, it's worth saying twice today!
 
There's a lot of truth in that .....
There's a lot of truth in that ....
 
user image
3
 
@rolfl I see what you did there
 
@SimonAndréForsberg I see what you did there
 
Simon says he sees what you did there when you said you see what he did there, @monkey.
 
5:24 PM
hi Monking, @SimonAndréForsberg!
 
@Mat'sMug Monking Hi, Mug!
 
5:44 PM
@SimonAndréForsberg It has stopped being funny and is starting to look more like harassment. Especially when you are taunting one individual user. Please stop before it gets there.
 
I guess that applies to me too then :(
 
@SimonAndréForsberg Well, I was in a meeting, opened remote desktop and that was right in front of my screen.. lol
 
0
Q: Concurrently Iterable Poor Array List

maaartinusAs I wrote on SO, I need an ArrayList-like structure allowing just the following operations get(int index) add(E element) set(int index, E element) iterator() while supporting iterations concurrent with modifications. While I'm waiting for something better, I tried it myself. It was a bit har...

 

« first day (531 days earlier)      last day (3481 days later) »