« first day (548 days earlier)      last day (4391 days later) » 

12:00 AM
@CatPlusPlus Does this push back automatically convert a char to a string?
 
I don't know. Don't remember the exact overloads of string's ctor.
 
No
 
Try it. If it doesn't, then use std::string(x, 1).
 
std::string only has string(char c, size_t count)
 
Instead of x.
Also, in CPython you can create a string from char with PyString_FromFormat("%c", c)
 
12:03 AM
@CatPlusPlus What does std::string(x, 1) do?
 
Creates std::string from 1 char.
 
Well, a char repeated once.
 
@StackedCrooked Close enough.
 
char x = 'c'; std::string xs(1, x);
 
12:04 AM
@CatPlusPlus Ok, so that would be step 2 after having the character array?
 
Yay, I got VIM up on my 24" screen.
 
Well, it's step only if you want std::string from the char.
 
Hooray for productivity.
 
@CatPlusPlus Right
 
@DeadMG Yeah, except that the compiler sometimes fails to warn you about it leading to a runtime crash :/
 
12:05 AM
Sometimes?
 
it would only lead to incorrect data to have, say, 'c' counts of (char)1
 
Sometimes.
 
Implicit conversions and promotions are evil.
This would never happen in Haskell!
 
I require sleep
good night, everybody
 
good night
 
12:08 AM
night
 
I'm off too. Thanks for the help.
 
 
1 hour later…
1:09 AM
-5
Q: Unlimited compress,what do u think?

user1335289I studied on a program I want it compress any file(video,film.. etc) How much I want size? İs it possible? Example:2gb film file compress to 1 mb? Please write your idea and don't write me just "no,impossible"? İf I do it ? what can u say about it

This is next big thing after iterating over GUIDs.
 
Your comments are making less and less sense, almost as if you're applying lossy compression to each one to get the next. — Michael Petrotta 2 mins ago
haha
 
> I know,but I've been studied on this program for 9 mounths.And I get some surprise
 
aww.... 2 delete votes already....
:(
 
It's not Friday.
Yet.
 
1:26 AM
Netbeans has a template for singletons. How not surprising.
 
1:43 AM
Who wants read a really unclear assignment?
The gray box at the bottom of this page.
 
These code samples are so wrong.
 
Well, I have to write nine wrong programs then.
 
if (count > maxElements) {
cerr << "Array is too small; please resize, recompile, and re-execute" << endl;
exit(1);
}
dafuq?
 
@CatPlusPlus I just noticed that the top two negatively voted questions of the day are from the same OP in the Python tag... lolz...
 
Advanced Programming Techniques
Data Input Patterns
I think we need to talk to this professor
 
1:59 AM
Ah, it's the school's fault.
They cut funding to CS and expect great results.
Pffft.
 
@Moshe Did they fire all the teachers and just grab some dudes off the street while they were at it?
 
@Collin No, teachers haven't updated much since they changed from teaching C to C++.
 
@Moshe That's unfortunate
 
@Collin Well, the teachers are all nice. And I know Objective-C from a coupla years and a coupla apps, so I'm not in the dark.
 
@Moshe Good to have some outside projects.. how do you like Objective-C? I keep trying it and giving up in like 20 minutes
 
2:04 AM
@Collin Why are you trying to learn it? iDev?
 
@Pubby No, I just occasionally decide I should know some objective C and read some stuff
 
@Collin Love it, but that's extremely subjective.
 
I've never had a particular project in mind
 
It's a weird language to just know without doing Mac or iOS Development though.
 
Subjective C?
3
 
2:06 AM
I had a professor tells us "Objective-C is a disgusting language, I wish it was never invented" Then proceeded to go on a rant about why you would use smalltalk object-orientation concepts when you could be using something better like C++
 
Mwahaha.
I love Objective-C as a language.
 
That's disgusting
 
@Pubby You're disgusting. Go read my blog.
 
Gimme link
 
I have some stuff about hacking Draw Something.
 
2:09 AM
Hipster hacking or cracking hacking?
 
@Pubby A little bit of both. I tried the cracking bit, but it's well designed.
Read it. ;-)
 
2:43 AM
@Pubby Well, what do you think? Hipster or cracking?
 
Smalltalk concepts aren't bad. Obj-C as realisation of them is bad.
@Moshe So many words. What are you doing with it, exactly?
 
@CatPlusPlus Trying to see what cool stuff I can do that the devs didn't intend. Read part 3 for a brief synopsis.
Mostly some minor FB info leaking and cheating. No unlockables though.
 
2:59 AM
 
3:49 AM
Stupid JavaME assignment uses something that's not in the lecture slides, and forces me to go through crappy docs.
Bah.
 
4:05 AM
okay, this is weird. Software Engineering gives you a BE engineering degree. Computer Science gives you a BSc. plain-science degree. But the f*cking courses for both of them in most universities are the same? I don't get it.
 
Hai.
 
hai
 
where do i need to look to edit a program or clone a program to customize the look and feel. ?
what program reads .dll files
 
So before I left for work, I implemented Bogo sort and left it running. It's currently trying to sort a list of 15 integers, probably has been for a few hours. Expected time is 20 hours.
 
and why are Professional Ethics and English Literature Compulsory 3 hour courses?
Why would a CS guy need to learn English Literature ?
 
4:10 AM
@Riley That totally depends on the application, if it's even possible. Some programs simply don't support that.
 
i trying to convert a standalone simple program into a web app in an online verison so need to work with databases
 
@IntermediateHacker Because your ability to think is holistic.
 
@GManNickG 15! is a big number - not counting overhead :)
 
@Riley Ask a question on the site proper, give as much detail as possible and describe your goals.
 
it is called masterwriter 2.0
 
4:13 AM
@Mysticial Ya, I estimated a constant for the average case O(k * n * n!) based off the time for 14 items, constant was quite tiny (as expected, its not expensive at all to check if a list is sorted or to shuffle it).
 
basically trying to export the feature and possibly make a more usable and redesign it
do i need to work in the setup.exe
 
@Riley Be sure to give credit, too, if you're basing it off someone's work. That said, "take it and redesign it" generally means redoing it from scratch, it's almost certainly harder trying to hack the original program.
 
lol, before I went to bed last night I started a run to decompress and re-compress 10 trillion digits of Pi into a new format... new code...
that ran overnight...
 
@Riley Again, ask on the main site. This is the C++ room. Also, avoid describing steps like "should I do X or Y" and simply state what your goal is, and what steps you've thought of.
@Mysticial How far is it now?
 
@GManNickG It's done, now I'm verifying through a separate interface.
 
4:17 AM
can u send me a link to programs i need to look into that would be able to edit dll files exe files
 
The compression basically crams 19 digits into 64-bit words.
However, decompressing it (64-bit integer to 19-chars) is REALLY slow...
CPU-bound even when streaming from disk...
I initially implemented it as an iterator where I call next() and it gives me the next digit... but the overhead of the function call combined with the divisions made it go at like 10 million digits/sec decompression rate... lol
think about how long that would take...
 
@Riley That's too broad of a question to answer. Editing exe's and dll's isn't a beginner task.
@Mysticial Eek, haha. Is that for the DigitViewer?
 
@GManNickG shit... even I can't do that...
@GManNickG Yeah, the DigitViewer source code on my site has exactly that problem.
The one I have now does some pretty nasty things to make it a lot faster.
Once it's done and fully tested I'll be open-sourcing it.
 
@Mysticial Yeah exactly, you have to know the format inside and out.
@Mysticial Yay!
 
@GManNickG It's nasty... basically, I have to do a buffering system that will load 64 million digits at a time and convert them together.
 
4:26 AM
@Mysticial I can see the advantage, though, but that's probably hard to keep track of.
 
@GManNickG There wasn't much of a choice. You can either do a 64-bit division every time you call next(). Or you buffer and convert entire words at a time. The 64 million sized buffer is just to reduce the # of I/O reads.
Yeah, that Digit Viewer - is one of those things that I really didn't not care about...
until the performance was sooooooooo bad that I HAD to do something about it...
It ended up having to write the whole thing from scratch - since the iterator design (although simple to use) just doesn't cut it.
I remember it taking longer to decompress digits that it took to compute some of the trivial constants... lol
 
Ha, that's definitely not too good.
 
Good thing I fixed that. Though the use of massive loop unrolling and some ridiculous SSE4 abuse, I got it fast enough to be disk bound... Now the hard part (which I'm doing now) is to build a user-friendly interface.
WTF at that flag...
lol
 
How do you control unrolling?
Compiler flag? PP tricks?
 
-1
Q: I want to make a function in python that lets me use colors from that function in any program that i make

derek hoytI've been learning python for about a week so far but i've learned a lot about it and i want to make a function that has a list of colors so when i use the function in a different program i can just pick on of those colors and use it through the function but i'm having trouble learning how to mak...

 
4:34 AM
manually
 
That's one sentence.
 
Manual loop unrolling? Ouch
 
You can unroll with template recursion, too.
 
what software would you use to edit exe and dll ? anyone know of any they used or use?
 
@Pubby Here's my non-SSE implementation of 64-bit integer to 19-digit char looks like:
#define ymi_CVN_u64d19_to_strd_u0_Default(T,A){ \
    ym_u64 _r0 = ((const ym_u64*)(A))[0];   \
    \
    ((char*)(T))[18] = (char)(_r0 % 10) + '0';  \
    _r0 /= 10;  \
    ((char*)(T))[17] = (char)(_r0 % 10) + '0';  \
    _r0 /= 10;  \
    ((char*)(T))[16] = (char)(_r0 % 10) + '0';  \
    _r0 /= 10;  \
    ((char*)(T))[15] = (char)(_r0 % 10) + '0';  \
    _r0 /= 10;  \
    ((char*)(T))[14] = (char)(_r0 % 10) + '0';  \
    _r0 /= 10;  \
    ((char*)(T))[13] = (char)(_r0 % 10) + '0';  \
    _r0 /= 10;  \
 
4:36 AM
That definitely could be unrolled with template recursion.
 
You're not gonna wanna see the SSE4.1 optimized version... You'll die and you'll probably want to take me down with you.
 
Boost PP toooo
 
@CatPlusPlus It's C, not C++.
 
@Mysticial That's why it sucks.
Zing.
Boost.PP should work fine in C, though.
 
@Riley A hex editor.
 
4:37 AM
Oh screw it. Since the one-boxing will shrink it, I'll show you the SSE4.1 version. Templates won't help here...
@GManNickG You're gonna love this... hehe
 
:D
 
#define ymi_CVN_u64d19_to_strd_u1_SSE41(T,A){   \
    const __m128d _SCALE0 = _mm_set1_pd(0.000004096);   \
    /* const __m128d _SCALE1 = _mm_set1_pd(4096.); */   \
    const __m128d _SCALE2 = _mm_set1_pd(0.000000001);   \
    const __m128d _SCALE3 = _mm_set1_pd(0.00000001);    \
    const __m128d _TEN = _mm_set1_pd(10.);  \
    const __m128d _ADD = _mm_set1_pd(0.00000000000001); \
    const __m128d _MASK0 = _mm_set1_pd(4503599627370496.);  \
    const __m128d _MASK1 = _mm_castsi128_pd(_mm_set_epi32(0x000fffff,0xffffffff,0x000fffff,0xffffffff));    \
3
 
This is a macro.
 
This SSE4.1 version does the equivalent of two calls to the first version I posted.
 
Trying to find that missing \ must be fun.
 
4:39 AM
@CatPlusPlus Syntax highlighting?
 
Wouldn't it be better to put it in a X file?
 
X file? For aliens?
 
And believe it or not, it's around 2 - 4x faster than that straight forward unrolled division version.
 
#define T whatever
#define A whatever
#include "this_scary_thing.x"
Idiom is called X-macros, generally.
 
Oh, that thing
Yeah, that's much better
 
4:41 AM
@CatPlusPlus That's pretty close. That macro is in it's own file.
 
Except with that you don't have \ at the end of every friggin' line.
 
Figuring out the algorithm and a proof of why it works will be left as an exercise to the reader. :P
 
I wish the PP didn't suck so much
 
@Pubby PP?
 
Obligatory Template Haskell praise.
Noooo, don't star thaaat.
 
4:43 AM
@Mysticial Preprocesser
 
It'll haunt us forever.
 
@Mysticial That is so freakin cool. (Just finished reading through it.)
@Pubby language*.
 
is it offensive to post picture of cat-eating person?
 
4:46 AM
Cat eating aliens?
 
@CheersandhthAlf I just said I'm not sure. It's not real or graphic, but meh.
 
@GManNickG That's about as bad as it gets. I think there's only 1 or 2 macros in the y-cruncher code itself that are worse. The one in my BBP code (the verification algorithm for Pi) is almost as bad.
 
@Mysticial You've done a good job of making it readable/traceable though, so it's not too shabby.
 
> java.lang.IllegalArgumentException:
> at javax.microedition.lcdui.Graphics.drawImage(), bci=40
Well, thanks for nothing.
Stupid crap.
Exceptions are supposed to carry more information than error codes, not less, you dumbasses.
shakes fist
Everything related to Java makes me angry.
 
4:54 AM
@GManNickG Yeah, it took me a few hours to write that. My attention span is much less. So if I didn't comment as I went, I'd forget where I was at. :)
@GManNickG Oh and, when I open-source the digit viewer, you'll be able to see how it's used. The main loop uses it for the body and switches to the non-SSE version to finish up the last iteration if the # of iterations isn't divisible by 2.
 
Java Y U NO INHERIT CONSTRUCTOR.
 
@Mysticial Nice. And I'm going to compile then, make sure it works, then proceed to completely ruin it while messing around.
 
Why are you taking a Java class if you hate Java so much? Are you a masochist? :D
lol. Two things. `T` is pointer to two 64-bit integers. Must be aligned to 16 bytes.
`A` is a pointer to 19 `char`s. Does not need to be aligned to anything.
 
I don't have a choice.
 
Both of the 64-bit integers need to be less than 10^19. (otherwise it'll have an extra digit which will make the code go weird...)
 
5:07 AM
@Mysticial Ya, makes sense. Is the alignment built into the typedef?
 
Also it's "embedded systems", mkay.
 
@GManNickG what typedef?
@GManNickG *correction, not 19 chars. It's 38 chars.
 
@Mysticial Sorry, not a typedef, but I mean everywhere where you have that requirement, do you 'manually' align it at that declaration?
 
And it will convert the two 64-bit integers into an ascii string of 38 chars (but without the NULL terminator)
@GManNickG It's only called on an internally allocated buffer - which I can force to any alignment. It's never called on user-provided buffers.
Oh wait, I completely switched T and A... lol A is the 64-bit integers. T is the chars...
You can tell I haven't looked at that code for a while... lol
 
@Mysticial Haha, derp.
 
5:18 AM
ym_u16 and ym_u32 and unsigned 16-bit and 32-bit integers.
 
sbi
@GManNickG Hey, I just woke up, which is a reminder that you should go to bed soon. :)
 
@sbi You're obviously early!
@Mysticial Yeah guessed that. :)
 
sbi
@GManNickG Actually I was late the other day. But the other day was Sunday. Now it's Monday, and for Monday, I am late even now.
 
@sbi Bleh, the sad part is you're right, if I had any self-control whatsoever I'd be in bed getting my recommended amount of sleep.
 
5:32 AM
It's been more than a year since I wrote that SSE4.1 macro. I don't remember exactly made me think that it was actually going to be faster than 19 divisions.
I have it dated 1/20/2011 - which is a thursday... I must have been done with class early that day...
And was REALLY bored or something. I don't normally optimize things this far.
Oh hey... I see a lot of potential for this question to make it big... If someone is able to answer it...
27
Q: Algorithm improvement for Coca-Cola can shape recognition

linkerOne of the most interesting projects I've worked in the past couple years as I was still a student, was a final project about image processing. The goal was to develop a system to be able to recognize Coca-Cola cans (note that I'm stressing the word cans, you'll see why in a minute). You can see ...

 
@Mysticial Somehow I don't believe that. :P
 
@GManNickG Which sentence?
 
sbi
@GManNickG Ah, that. I remember it. Were you even born? :)
 
@Mysticial That you don't optimize that deeply that often.
"This video contains content from WMG, who has blocked it in your country on copyright grounds. "
I'M AMERICAN AND WHAT IS THIS?
 
sbi
@GManNickG What? There's a video on YouTube I can watch in Germany, that is banned elsewhere? I thought it's only us here?!
 
5:42 AM
@GManNickG Not everything I write needs to be optimized.
@GManNickG lolwat?!?
 
@sbi Guess not. :o Though searching for the title obviously returns a million watchable things, so meh. But no, I wasn't born for the original release. :( Though I was for the German remix.
 
sbi
@GManNickG Well, it's not like I'm out of options.
Ah. "Very popular song amongst GTA Vice City players." That explains why there's so many on YouTube.
 
@sbi Only the second and third of those worked. :o
 
sbi
@GManNickG That's why I not only posted one of them, after all.
And in the best tradition of this room, a message where someone is publicly slapping their forehead saying they're stupid gets immediately starred until that's the second-highest starred message on the board.
3
Oh, BTW. Hi, @JohnSmith. Welcome to the room. Sorry for your message drowning while we bathed in bad music from the 80s. :-/
Why did you just delete that, @Ethan?
Oh damn, while I make light conversation here, I am running out of time and options for the day. I need to get going, folks. Good night @GMan! See you later, everybody!
 
@sbi: See ya!
 
5:55 AM
cya
 
6:08 AM
@Mysticial: subidiom.com/pi
 
@GManNickG They probably keep it all in memory. :)
 
6:51 AM
> The search engine is currently processing another request - please try again later.
@GManNickG @Mysticial you busy? ^
 
Not really, just motivating myself to lose 8 hours of my day.
 
@sehe nope
 
@GManNickG On that note, I'm off to the office as well.
 
@sehe I meant to sleep. :)
 
When you add a function declaration (by including the header file) at the top of the .c file....is that only for keeping the compiler happy?
While the linker is the thing that actually resolve the address to where it finds the definition?
 
7:07 AM
Correct.
 
are the function declarations included in the header file every used in the code? or is it just for the compiler to be able to not give error when the function definition is not in the same file?
 
@GManNickG So did you end up playing with that mega-macro?
 
@Mysticial Not yet, I'll have to wait for a few more weeks, almost done with school. :|
 
undergrad senior?
 
@Viper: Whenever you use a function (or anything else), the compiler has to know at least it's declaration (so it knows whether the syntax is correct). Later, if the linker can't find a matching definition, it will complain.
 
7:17 AM
@GManNickG Are the function declaration that you include in other files used in the running code, or are they only needed so that the compiler is able to help you? And then the compiler will later find the address etc to the functions not defined in the same file?
 
@Mysticial Yup.
@Viper ereOn answered that well, just above you (bad timing though :P)
 
@ereOn Okey, I think I actually start to understand why we use header files:p Thank you:) So it is just for the compiler to be able to help you from writing wrong function names etc?
 
@Viper: In a sense yes, you could say that. I believe the most important notion is the "translation unit" : for every distinct .cpp file, the preprocessor resolves all the includes and produces one big file : that's why you usually need the headers : they declare things so you can refer to them later in this big file.
Just like a book where the author explains who the characters are then build a story with several of them.
 
Yes, but the reason why you need to declare things first is because the compiler is intended to help you to not call functions etc that doesn't exists? The compiler did not necassary had to require that functions are declared before use?
But if it didn't you probably would have many linker errors because of misspelling etc?
 
Not exactly
It needs to know the types of the function
 
7:31 AM
Do you mean the parameters and return type?
 
Yeah
 
why?
 
@Viper: The translation units have to be consistent
 
Well what if I want to use a function pointer?
 
If you can write anything, even undeclared functions, classes or variables : what uses has the compiler ?
 
7:33 AM
How will the compiler typecheck it?
How will it know what overload to use and when to implicitly cast?
 
morning all
 
if I write : int a = b + c; u = c();
How do you expect the compiler to know whether these instructions are correct ?
You can't guess the types of b, c or u.
@thecoshman: Hi
 
true
It is hard to understand because I am not used to this in Java
Every book I read only talks about that it is good to have header and c file because then you can make a public interface for your class...
 
partly that
 
Anyone who knows about a book where what I asked about here is described? The reason etc?
 
7:40 AM
There's not much to say about them
 
header files are (mostly) just saying 'these functions/class exist'
 
Stuff must be declared before they're used
#include just pastes a file into another
And so headers are just declarations that get pasted into other files so you can use them
 
for trivial projects, it is hard to understand why it is useful
it also helps with reduction in work. if you have a class called foo it will declared in foo.h and defined in foo.cpp and make use of things like iostream and regex when you compile a program that uses foo the file foo.cpp is compiled into an object file (what I believe is a translation unit) foo.o cont...
this object creation process will look at foo.cpp first. it will so the #include foo.h and include the declaration for foo, and also see the include for iostream` and regex it will not compile these two things, it will just include the headers for them. It will check that all your functions in foo.cppare defined in one of included header files. cont...
let say your class foo is also used by bar, the same process will happen, the bar.cpp will compiled, first by include the header bar.h which will include the header foo.h this means that when bar.cpp is compiled, the use of functions can be checked. with in bar, if you use a function that was not declared in foo.cpp you will get a compilation error. so now lets say with have foo.o and bar.o these need to be linked together, it is now cont...
it is now that you will get told that bar used a function declared in foo.h that has not been implemented in bar.cppas up to the point of linking, all bar had to go with, is what foo.h had said it would offer.
@viper I hope that helps explain the 'why', I also hope that I have not made too many mistakes :P I am sure my technical terms are not spot on, but that is the jist of it as I understand it
 
thank you for writing
Not 100% confident that I understand it completly though
 
I had a question about inline function and why they have to be in header files, htat answer explains might help you out, let me look it up
 
7:59 AM
@Viper: On the other hand, do you understand why you shouldn't put a non-inline definition in a header ?
 

« first day (548 days earlier)      last day (4391 days later) »