« first day (376 days earlier)      last day (4555 days later) » 

4:00 PM
It's basically a linked list of pieces.
 
user784668
I thought about ropes, but I'm not sure if the constants hidden in computational complexity won't be too big.
 
well, you're building it out of parts
 
user784668
@RMartinhoFernandes: ropes are a bit more complicated than that, really.
 
fundamentally, that's a node-based operation
so you're going to be paying the cache and such overheads anyway
 
user784668
Have to make my own benchmark, I think.
 
4:03 PM
nah, you just need to know what operations you're performing
reads are much faster with contiguous strings but mutations are much cheaper with large strings when stored as ropes
 
user784668
I'd just like to be sure.
 
so if you're not going to be repeatedly mutating large strings, it's probably better to stick to the standard contiguous array deal
you're over-thinking it, just pick one and come back and benchmark it later
 
user784668
I thought about asking on SO, but then all these "premature optimization" guys would tell me that I should not worry, because it's unlikely to be a bottleneck, yadda yadda yadda.
 
Just phrase your question carefully.
(And make sure it is a bottleneck :P)
 
user784668
I would agree with them if string concatenation wasn't what the program is doing all the time.
 
user784668
4:06 PM
Already made sure :P
 
user784668
@DeadMG: so I would end up benchmarking anyway.
 
You have an existing implementation? If you do, say something like "So I have this app that frobs quxes and it's slow. I came to the conclusion I need to improve this part where I bar some foos together. How can I improve it?"
 
no, you'd end up benchmarking it if and only if it becomes relevant to overall performance
 
user784668
@DeadMG: already made sure, as I said already.
 
oh, I didn't notice that
 
4:12 PM
@Fanael a mutable string. use e.g. std::string::append. don't compute string concatenations separately (you don't want O(n^2), you want O(n)).
 
then I still recommend yokes
uh, ropes
 
Egg-oriented programming.
 
user784668
@AlfPSteinbach: yeah, that's what I'm doing.
 
Hi all
 
4:24 PM
@RMartinhoFernandes - I remember last time you said of finishing your contract. Did you find a new job ?
 
my head :(
 
@Mahesh Not yet. I haven't been looking much though.
 
sleeping is ineffective
 
@DeadMG I thought your problem was your stomach. What's up now?
 
just a bunch of flu
it always goes right to my head
 
4:25 PM
If you are in US, try Bloomberg. They are hiring many C++ developers :)
 
stupid weak immune system
 
@Mahesh Nah, Old World, Portugal.
 
k
 
that's why I've been spending my time watching Futurama
moving my head is rather painful
and it's freezing cold outside and I really don't need to make it worse
 
Right, nice excuse.
 
4:29 PM
humph
you probably have a nice high birth weight#
 
What?
> Some studies have shown a direct link between an increased birth weight and an increased intelligence quotient.
This?
 
not exactly
there are more studies that link it to the strength of all bodily systems
size of vital organs
etc etc
 
Oh, so if you're a fat baby, you're healthier?
 
what surprised me more is that the effect is permanent
it's like a switch in the body that says either "Gosh, food is plentiful, let's pack on lots of muscle, vital organs, and all that good stuff" or "Gosh, food is scarce, let's skip useful tissue and all the rest of it to save energy"
except it never resets
there's a bunch of people in India
they're all subsistence farmers over there
so active lifestyle, healthy diets, lots of vegetables, etc etc
but they have the same rate of diabetes and heart disease as fat Western couch potatoes
and nobody could explain why until they looked at birth weight
 
Solanum tuberosum occidentalis - the Western couch potato.
 
4:35 PM
which was all fine and good until I asked my mother about my birth weight
apparently, I was a nice tall, and slim, baby
been making up for it ever since
 
I have no idea how much I weighed.
 
Started using valgrind. It is just showing that it has leaks in summary. Doesn't it show which part of line has caused it. pastebin.com/9TPXVYR6 is the heap summary.
Which line of the source program has caused it ?
 
uh
first, there's no reason to think whatsoever that any individual line is the cause
 
@Mahesh Did you compile with debug info? (-g on GCC)
 
and secondly, you should never have memory leaks if you use proper RAII idioms
 
4:37 PM
@DeadMG It usually shows where the allocation occured.
 
and thirdly, that information is definitely not anywhere in the dump, so how the hell are we supposed to know what line?
 
@DeadMG - I am just tweaking with Valgrind.
How it works ?
@RMartinhoFernandes - No
 
The fact that the program is named memLeaks is kind of a give away.
@Mahesh "No" as in "you didn't compile with -g"?
You should.
 
@RMartinhoFernandes I will try it.
 
0
Q: system("pause") won't work with freopen

wsevendaysSee below in comment. int main(){ //freopen("input.txt","r",stdin);//if I uncomment this line the console will appear and disappear immediately int x; cin>>x; cout<<x<<endl; system("pause"); return 0; } How to make it work?

Sigh.
"Using freopen causes a bug in this kludge for my IDE that I've placed in my program."
 
4:41 PM
Grammar G = ({Q, X, Y, Z}, {n, o, s, w}, P, Z}) with productions {Z -> nY, Y -> osX, X -> wsQ, Q -> osZ, Q -> os} generates string (noswsoz)^k, with k >= 1, right?
 
@RMartinhoFernandes Even if I compile with -g flag, I get the same results from Valgrind. But for the one as shown on this tutorial, Valgrind shows line numbers too.
 
Oh, wait, bad link.
 
It had ] at the end.
Proper syntax is [title](url).
 
@CatPlusPlus - Thanks. I did the other way.
 
user784668
uniform_int<> returns <min, max) or <min, max>?
 
4:43 PM
@CatPlusPlus What's the order of the things in the grammar?
I can't recall.
 
Nonterminals, terminals, productions, start symbol.
 
user784668
<min, max> apparently.
 
@Fanael > A uniform_int_distribution random number distribution produces random integers i, a ≤ i ≤ b (...)
@CatPlusPlus It produces noswso (repeatedly), no zs.
 
Oh, right.
I don't know where that came from.
 
@Mahesh Are you using optimizations?
 
4:47 PM
So the minimal one would be G = ({A}, {noswso}, {A -> nowswoA, A -> noswso}, A), right?
 
Hmm, yeah.
 
@RMartinhoFernandes - I amn't sure. How could I check if it is enabled ?
 
Cool.
 
@Mahesh Do you have -O1, -O2, or -O3 in the command-line?
 
I'm not completely theory-resistant.
 
4:48 PM
Compile with -O0 to make sure they're disabled.
 
@RMartinhoFernandes - Ok. Will try it.
Yeah ... Now I see the line number causing it.
But what these optimizations do any way?
 
Well, when the compiler optimizes the code, the result may lose any meaningful relationship to source code lines.
And compilers are rather aggressive these days.
 
user784668
@RMartinhoFernandes: found it, but thanks.
 
@RMartinhoFernandes - Ok. Thank you.
 
@Mahesh I sometimes compile with -O1 and it still retains line numbers nicely. You could try that, if you don't want to be running the slowest possible code.
 
4:54 PM
k
 
Particularly, if you don't want to be running the slowest possible code further slowed down by valgrind. :)
 
I see that Valgrind mounts up the size
 
/me is running under valgrind right now
 
sbi
Wow, Debbie has been quite nasty today.
 
4:58 PM
0
Q: Is there a way to identify the Windows command prompt regardless of file name or location?

adveresI'm writing a program to immediately track and kill when a user runs command prompt (and regedit if that's possible). This is to stop users from running commands I would rather they not have. I've already written code that sees when a process is launched and checks its name using QueryFullProce...

Sigh, again.
 
wow that's "the wrong solution to the wrong problem" in so many ways
 
@sbi That one about the difference between love, true love and showing off is incredibly nasty.
 
@RMartinhoFernandes Lol.
 
anyone know any non-English short, but good jokes that involve accented characters? or a sentence that means something totally different if you accidentally lose the accents?
I want to make a point about "the world isn't just English" in an exercise for 1st year compsci students
 
Reminds me of all those shared web hosts, where you're not given access to SSH for security, but have to a+r(x) all files for the webserver to access them.
The funny things happen with PHP apps that require write access to config files or whatnot, because of the very user friendly installers.
 
5:04 PM
@awoodland Some Portuguese verbs have the present and past tense form of for "we" identical, except for an accent. Not exactly a joke.
 
777 all the things!
3
 
@RMartinhoFernandes - can you give me an example? that would be great if it totally changed the meaning even without being funny
 
user784668
@awoodland: does this one count: gizmodo.com/382026/… ?
 
This is what crappy sites like Gizmodo look like on my browser.
@awoodland It changes the tense. I can't come up with a sentence that makes it shocking, though.
"We jump" -> "Nós saltamos ", "We jumped" -> "Nós saltámos".
That kind of thing.
@Fanael OMG.
 
user784668
What?
 
5:10 PM
@RMartinhoFernandes - that'd work well enough I think I like @Fanael's example, except it's probably too offensive
 
user784668
I could come up with a less offensive German or Polish example if you let me think a while.
 
That accent is actually a rule for a certain class of verbs. Despite being one of the few rules in the language that is always valid, lots of people keep writing everything in the present tense.
 
@awoodland Oh boy. I was once reading a page that asserted very strongly that accents are vital for written French, even if it means going out of one's way to write them. There's this very unfortunate condition where French layout keyboards have accented characters but no deadkey for the acute accent, the most common one in French. This means you can't easily write E+acute.
 
user784668
Gah. s/could/can/
 
IIRC it was an academical site. But the example they provided on how confusing it is to not use accents was... interesting.
 
5:12 PM
@LucDanton Wow, that's a bit... braindead of them.
Freaking e-acute is everywhere.
 
It is.
 
I can write French easier on my keyboard layout than on a French one?
How do you type "é" then?
This shows "é" on the "2" key.
 
sbi
@RMartinhoFernandes Actually they have all been nasty today.
 
@Fanael - a German/Polish example would be useful for this exercise
probably German would be better since we have a lot of Polish students who might find it too easy
 
sbi
@awoodland The @Cat should be able to give you a Polish one. I have been raking my mind, but cannot come up with anything German.
 
5:22 PM
@sbi You know, it's funny, I can't come up with anything either.
 
Ha! I'm winning.
(And I can come up with a gazillion more examples! That accent is a rule!)
 
user784668
@awoodland: for example, in German we have "schön" (beautiful) and "schon" (yet, already; also indeed). Not a very striking one, but I'm really unable to come up with anything better.
 
sbi
@Fanael Der ist schon ganz schön. :)
 
user784668
@RMartinhoFernandes: I could come up with a gazillion Polish examples where the minimal pair is e/ę. But these don't change the meaning very much (the verb is just in a different person, usually).
 
sbi
@awoodland Well, in German there's a host of old Maße/Masse jokes: "Masse" means "mass", "Maße" means "measures." I could make up one from that about, uh, maybe drinking en mass or measured, or something like this. But it wouldn't translate anyway.
But you could explain that, while "ß" degenerates to "ss" in some cases, and can be written as "ss" if you're on a system where there is no "ß" available, for some words it does make a difference. Pointing out that drinking in masses or measured makes a noticeable difference might make for a mild joke.
 
5:29 PM
Oh, you had a spelling reform in 1996. How did that go?
 
user784668
I just recalled a quite funny coincidence.
 
user784668
Portuguese "são" and Polish "są" both mean the same ("they are") and they're pronounced the same (/sɔ̃w/).
 
sbi
@RMartinhoFernandes IMO it was just the right compromise between cosmetic changes and a sweeping revolution to be annoying enough without removing some of the real annoyances. I have been mostly ignoring it, but I guess from reading so much (and from how my kids learn writing in school) I might have picked up enough to now be writing neither one nor the other correctly.
 
@sbi We're currently going through a similar process, except it's not a compromise between anything. It's just a sweeping revolution.
 
sbi
5:32 PM
@Fanael You know German and Polish puns, and know how to pronounce Portuguese? What's your native language?
 
Well, I can remember one instance, where ł vs l makes quite a difference, but it's rather slangish.
 
But "são" is pronounced /ˈsãw/!
 
user784668
@sbi: theoretically German, but I haven't used it for years so ich habe fast alles vergessen ("so I have forgotten almost everything"), in practice it'd be Polish.
 
user784668
@CatPlusPlus: which one?
 
user784668
@RMartinhoFernandes: /sɐ̃w̃/ to be pedantic :)
 
5:36 PM
"zrób mi łaskę" (do me a favour) vs "zrób mi laskę" (blow me). Other diacritics aren't as critical.
 
sbi
@RMartinhoFernandes See, if they would have weeded out the rules for placing the comma, cut down all the exceptions in the rules of when to concat words and when not, set up one set of rules about how to adapt foreign words, and had done some other sweeping changes, I would have been fine with it. Heck, I might have ranted, but in the end it would have been Ok if they had just removed capitalization altogether. But they skipped over all those issues and semi-fixed a lot of the smaller ones. Annoying.
 
@CatPlusPlus It is similar... ;)
 
sbi
@RMartinhoFernandes Only that the Polish "ł" isn't pronounced like an "l" at all.
 
user784668
@CatPlusPlus: I have thought about this one too, but awoodland wanted something not offensive.
 
sbi
@Fanael Oh. That sounds like a very interesting history.
 
5:38 PM
It's pronounced like "w" in "word". Me no know IPA.
 
@CatPlusPlus (Me neither, I checked a dictionary.)
 
user784668
I'm a conlanger, so I do know IPA. Poor me.
 
And to be honest, "são" is not pronounced the same if I drive 50 km in any direction.
 
sbi
@RMartinhoFernandes Because you're then out of breath? :b
 
5:40 PM
There be dragons.
 
user784668
@RMartinhoFernandes: at least it's still the same "são", Germans aren't so lucky.
 
I forgot I'm supposed to be doing those grammars.
 
So probably any IPA that looks similar to /saw/ with crazy diacritics or upside down letters is correct somewhere.
@Fanael We have subtitles when Azoreans speak on TV!
 
user784668
Upside down letters sometimes have no relation to normal letters in IPA.
 
G = ({S, A}, {b, c, d}, P, S)
P = {S -> bA, S -> cS, S -> dS, S -> ε, A -> cS}

Is it good for "c after any b"? It's supposed to be regular.
Maybe "after every b, there should be c" is better description.
 
5:42 PM
And they don't speak Azorean. They speak Portuguese, or so they say.
 
user784668
For example, [v] is a consonant, [ʌ] is a vowel.
 
user784668
I've benchmarked that string appending problem I'm having, the results are quite interesting.
 
sbi
Oh, I just thought of another set of cases, where umlauts are important in German. The grammar thing (whatever that's called) describing the possibility of doing something in German often changes the verbs central vowel into an umlaut. So "I will" => "ich werde", "I would" => "ich würde", "I see" => "ich sehe", "I would see" => "ich sähe" etc. I guess one could construct funny situations from those.
 
user784668
Surprisingly, a linked list of substrings is over twice as fast as std::string::append.
 
@Fanael Surprisingly?
Appending to a linked list is O(1).
 
5:45 PM
Damn, another sale on Steam.
 
sbi
@Fanael How about std::string::reserve()?
 
@CatPlusPlus Go work on those grammars! Close that tab!
 
user784668
...assuming I'm using my own allocator.
 
But they need to take my money!
 
@CatPlusPlus I can take your money too.
 
user784668
5:47 PM
@sbi: it's still two times faster if std::string reuses its space.
 
You don't have games.
 
user784668
Apparently memcpying the characters is the culprit.
 
user784668
I gotta go, goodbye.
 
5:50 PM
I just wished we spelled things in ways that made more sense.
 
So I just accidentally git rm'd a bunch of source files that weren't yet committed to my local branch... am I totally screwed? :/
 
pizza is peetza
 
carolina is care-ole-lyna
 
How the fuck do you "accidentally" git rm stuff?
 
5:51 PM
@RMartinhoFernandes shit.
Misplaced wildcard
 
@robjb Do you backup your network drives?
 
@Xaade Yes, but silly me, these particular files weren't on a network drive.
 
do you guys know of any tools to help detect stack corruption in programs? Valgrind doesn't seem to be finding anything
 
@robjb You can $ git reset HEAD now, but it won't bring the uncommitted stuff back from the dead.
 
@robjb So you're the reason I get 50 message boxes when I go to close Microsoft word without saving.
 
5:53 PM
@Xaade: Eh?
 
@codemaker listen for the guard page exception
 
They've never been on a network drive, they were new files -- no one else would have had them open
 
You never use destructive commands with uncommited changes.
 
Well, in that case yeah, they're not in the repo.
 
Especially with wildcards. Wildcards are evil.
 
5:55 PM
@robjb poof
 
Thought so.
 
You can try local fs undelete.
 
The tough part is that git rm even removes stuff from the index (Why the fuck is that called index?).
 
Feel free to donate your paycheck to the paper shredder.
 
@Xaade what is that?
 
5:56 PM
Guard pages are pages marked to raise an alert when they're accessed.
 
Oh wait, git rm does not remove stuff if it's got updates in the index.
 
@codemaker I'm not sure how you'd do it, but I know that the stack is protected by a guard page exception. There's a memory area allocated after the stack that's invalid to write or read. The first time it's triggered, it throws the guard page exception, which tells the stack to allocate more memory. If something else triggers the guard page exception, the stack will get a memory access violation instead.
 
That's confusing.
 
git does something you'd never expect it would? Well I never.
 
@Xaade But that detects stack overflows, right? Not corruption.
 
5:59 PM
If you C-export methods so their names aren't mangled, you can actually call the method with less than the appropriate amount of arguments. And if you happen to be at the end of allocated stack memory, when the callee accesses the argument you didn't send, it triggers the guard page and the next time the stack tries to expand, it crashes.
@RMartinhoFernandes if someone other than the stack touches the guard page, it corrupts the stack, because the stack fails to expand with a read/write access violation.
 
sbi
@robjb You could use one of those tools that salvage deleted files on the file system level.
 
What if such a tool gets installed over the contents of the dead files?
:)
 
@RMartinhoFernandes stack overflow is when the max available memory the stack has decided it will ever hold, is overrun.
@RMartinhoFernandes remove harddrive now, bring to 2nd computer with tool, insert harddrive in 2nd computer, profit.
 
You missed the ?-step.
 
Train monkeys to joust.
 
6:05 PM
@codemaker You wouldn't happen to be using IsBadXxxPtr would you?
 
sbi
@RMartinhoFernandes To be sure you mustn't download and install the file on the machine where you blew it, but download it someplace else and carry it over on a removable drive. In fact, to be sure you would need to turn of the computer immediately, without even shutting it down. In practice I have found this working well enough with a HD filled 50% when I had such a problem a few years ago: Downloaded a program, ran it, rescued my files, and never needed the program again, because I had learned my lesson.
 
"But what should I do, then, if somebody passes me a bad pointer?"

You should crash.
Blasphemy!
The program should continue working!
 
@sbi Thank you for translating my post.
 
sbi
@Xaade Huh?
 
@RMartinhoFernandes This is mostly a hack when people want to test if a caller sent in all arguments to their exported method.
7 mins ago, by Xaade
@RMartinhoFernandes remove harddrive now, bring to 2nd computer with tool, insert harddrive in 2nd computer, profit.
 
6:12 PM
CorruptMemoryIfPossible() sounds cool.
 
Curious why guard page exception triggers only once?
Prevent lockups
 
@RMartinhoFernandes That's basically what most libc functions do.
 
@MrAnubis "My wife". Nice try.
 
6:27 PM
>Yes I know it is much but I have just kept writing code and dont exactly know how to "break up this code" in parts. For example. I have one design "Mainpage.xaml" wih all its controls everywhere.

>If I have a buttoncontrol that executes code, I have put them in Mainpage.xaml.cs.

>How will I put that code in another file for example. Let us say ex: Mainpage2.xaml.cs ? Because Mainpage.xaml and Mainpage.xaml.cs are conntected to eachother or is it possible to have differenct .xaml.cs files connected to the same .xaml file?
Splitting up your code by creating a new file named "Mainpage2.xaml.cs" seems like solid solution.
 
now I need to create the funny tetris shaped blocks, I currently have just squares, I was thinking of connecting the squares into a tetris shape, like an L shape for example. Can anyone give some input on the best way to do it? I was thinking of making a shape class, but then I'm not sure how to define the shape in terms of squares? Like as in, how to stick the squares together on the screen?
 
Chrome Web Store drastically changed it's page design a few days ago. Since that moment the user count of my app is on the decline. Before the redesign it was on the rise. :(
 
@TonyTheLion Standard Tetris has only tetrominoes.
 
people are still getting used to it
 
That makes it easier.
 
6:32 PM
@TonyTheLion It's called "vertexes" :P
 
@RMartinhoFernandes and where do I find those tetrominoes?
 
There are only seven possible ones.
 
@TonyTheLion You can define a Tetris piece in a 4x4 grid. You could paint the piece grid on top of the gamestate grid.
 
A tetromino, also called a tetramino or tetrimino, is a geometric shape composed of four squares, connected orthogonally. This, like dominoes and pentominoes, is a particular type of polyomino. The corresponding polycube, called a tetracube, is a geometric shape composed of four cubes connected orthogonally. A popular use of tetrominoes is in the video game Tetris. The seven tetrominoes Ordinarily, polyominoes are discussed in their free forms, which treat rotations and reflections in two dimensions as congruent. In that case, there are five unique tetrominoes. However, due to the ov...
 
6:36 PM
That's just one way to do it. Feel free to invent you own system.
 
Remember you're going to be removing parts of those pieces.
 
Once the piece is solidified into the game state it's no longer an entity in itself.
 
It's easy to implement Tetris ...for the second time :)
 
You should be playing Heptis.
 
6:43 PM
ideone.com/GNAi5 Does this make sense (except 4, I have no ideas presently)?
 
Looks fine.
 
Cool.
 
You can represent an arbitrarily rotated tetromino with two bytes! I wonder if that makes it easy to rotate (hint: probably not).
 
@CatPlusPlus What is it?
 
@StackedCrooked I noticed.
 
6:52 PM
but my question is if I should make up my tetromino's of individual squares?
or should I use some image?
 
@RMartinhoFernandes Updated my question.
 
@StackedCrooked Formal grammars, what else.
 
@TonyTheLion It's probably easier to just build them out of squares.
 
Most people seem to use bool[4][4] for the implementation of a Tetromino class. If you're low on memory, you could also use an unsigned short ;)
 
uint16_t, you mean.
Maybe you can work out some bit twiddling trickery to perform the rotation.
I think I got a neat question for Code Golf.
 
6:55 PM
Why do people want to compute rotations at runtime? Just use a precomputed lookup table.
 
That's no fun!
(Unless you metaprogram the table.)
 
How is bool[4][4][4] not fun?
 
I used std::vector<int> to define my grid. When implementing the AI I hit the 2GB ceiling at search depth of 8 and "search width" of 5. Changing int to char made a big difference memory wise. But it didn't last long given the exponential size of the search tree.
 
Or even better, bool[7][4][4][4].
 
WTF is the seven for?
 
6:57 PM
7 shapes
 
Oh, right.
 
const Grid & GetGrid(int inId)
{
    if (inId < 0 || inId >= 28)
    {
        throw std::logic_error("Invalid block identifier.");
    }

    static Grid fBlocks[] =
    {
        Grid(GetIGrid(0)),
        Grid(GetIGrid(1)),
        Grid(GetIGrid(2)),
        Grid(GetIGrid(3)),

        Grid(GetJGrid(0)),
        Grid(GetJGrid(1)),
        Grid(GetJGrid(2)),
        Grid(GetJGrid(3)),

        Grid(GetLGrid(0)),
        Grid(GetLGrid(1)),
        Grid(GetLGrid(2)),
        Grid(GetLGrid(3)),
Somewhat ugly though.
 
ewwcakes
 
You can identify a block by it's type and rotation. This gives you 7x4 combinations. You can store those in a constant array.
 

« first day (376 days earlier)      last day (4555 days later) »