« first day (983 days earlier)      last day (4191 days later) » 

16:00
what is up y'all?
@LuchianGrigore the sky
user142019
@LuchianGrigore I'm going to school. :(
0
Q: C++ Converting const char* to chat*

CookieMonsterI want to create a new class that takes a string, and converts it to a character array,then saves it to its private variable. So, I am trying to convert const char* to char* because I want to be able to modify its content. class MyClass { public: MyClass (const char* input) { // conv...

Edited that title
user142019
Eww non-explicit single-parameter constructor.
16:02
The Abstruction Pattern: when you create a useless APIs that obfuscate functionality and obstruct access to the good features for no reason.
9
user142019
> a useless APIs
The amount of grammar nazis in this lounge is too damn high
i need a bigger frying pan
No wonder we all hate each other
@Borgleader Capital N.
16:04
the current one can't contain the awesomeness I cook
Reminds me of:
May 21 '12 at 15:13, by R. Martinho Fernandes
        DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
        Document doc = docBuilder.newDocument();
Totally the Abstruction pattern right there.
Like this? ^
@R.MartinhoFernandes The hell is that?
user142019
I feel food.
user142019
@Borgleader Java.
@Borgleader True story.
16:06
5
Q: Unsure if I understand TransactionAwarePersistenceManagerFactoryProxy

megazordI am trying to use the org.springframework.orm.jdo.TransactionAwarePersistenceManagerFactoryProxy in my Spring project, but I am not sure how to use it or whether it's exactly what I am looking for. I realize it can help make my DAOs work with a plain JDO PersistenceManagerFactory. Another questi...

2
user142019
Dat answer.
@Borgleader nice stuff
@rightfold zomgzord
@Borgleader Creating a new XML document with Java's builtin API.
@R.MartinhoFernandes My condolences for the braincells transistors that burned out when you wrote that.
user142019
I don't understand why you would have such a factory object.
user142019
16:08
What state does it keep?
user142019
Why is a factory stateful?
@rightfold Because ~~Java~~
It's not a factory. It's a builder factory.
user142019
Why is it stateful?
@R.MartinhoFernandes do you perhaps have a factory that builds builder factories?
16:09
0
Q: Beautiful soup is not a module

Abhishek MitraTrying to run code; but i get the error, Beautiful soup is not a module. import urllib from Beautifulsoup import BeautifulSoup webpage = urlopen('http://en.wikipedia.org/wiki/Mathematics').read patfinderTitle = re.compile('<title>(.#)</title>') if __name__=='__main__': main() I've tried 'fro...

dat name
What does the -mt suggest at the end of shared library file names in boost; for example : libboost_program_options-mt.so
user142019
@not-TonyTheLion Eww uppercase letters in Python module names.
@RitwikG multi-threaded
oh
do they get installed by default ?
my usr/local/lib/libboost* lib files do not have that
they are all non mt !
@BartekBanachewicz You cannot use new to create one: you must use the static factory method.
user142019
16:10
template<typename T, typename... Args>
T create(Args&&... args) {
    return T(std::forward<Args>(args)...);
}
user142019
The only factory you'll ever need.
by they way
@rightfold Cue make_unique.
I just repcapped and passed 7k
COMING SOON, TO A LIFETIME NEAR YOU.
16:11
Naiice
user142019
create<std::unique_ptr<T>>(new T(foo, bar)) LOL
user142019
@not-TonyTheLion Dat username.
Ell
Ell
How do you put progress reporting ability into a function?
@rightfold which one?
Ell
Ell
Actually. I guess return a mutex straight away to a progress object or something
user142019
16:12
@Ell Cällbäck.
@Ell you have to use a factory builder, then build ProgressTaskFactory from it
user142019
@not-TonyTheLion not-Tony The Lion
@rightfold hehe
user142019
@Ell template<typename F> void foo(F f) { do_something(); f(0.1); do_something(); f(0.2); /* etc */ }
Ell
Ell
@rightfold Right
16:13
@rightfold no, each progress tick has to be created by the factory!
user142019
If you want thread-safety I don't know.
private:
    optional() {}
// wonders why not default constructible....
user142019
Use actors and send messages to them.
Ell
Ell
I was thinking return a mutex to a pollable object
or something, idk
@BartekBanachewicz needs more singletons
user142019
16:15
@Ell std::future_with_progress!
user142019
@R.MartinhoFernandes would it default to no object or default to a default-constructed object?
i think that gcc needs new option
--hardcore : prints "OK" if the code has no errors and "Error" otherwise
user142019
It already has that. It's called g++.
so adding --hardcore has no effect, then
@rightfold meh, it gives you line numbers
16:18
Simple to add: if gcc output is empty, write "OK", otherwise "Error"
Xeo
Xeo
@rightfold Would "default-constructed object" really be a sensible default?
It's private.
@BartekBanachewicz Removes the source code on error, prints nothing in either case.
@CatPlusPlus --super-hardcore hexagon
@CatPlusPlus g++ -froguelike
2
16:28
catplusplus, wht did you do to your cat
Oooh. Tests pass.
Important question is: did I write tests for this feature?
Turns out the answer is no.
Xeo
Xeo
@R.MartinhoFernandes And even if you did, that doesn't mean anything.
--hardcore isn't that like compiler porn mode?
Compiler porn is like naked assembler
Xeo
Xeo
@KonradRudolph How the fuck did that question happen? Like, all of it?
user142019
--hardcore is -x c++
user142019
16:32
@CatPlusPlus Sounds like GHC.
Ell
Ell
inb4 fiddling with privates jokes
I started my 3rd attempt at learning haskell today
@KonradRudolph what.
Fuck.
@Ell Cool.
Hopefully you'll become completely obsessed like Xeo.
Ell
Ell
I'm hoping so. But the other times I tried I just couldn't get into it
I left my desk without locking my workstation for the first time in years :(
I need to burn it now, as it's totally compromised.
I'm the last one left at the office, but you never know.
16:41
Ohhh shit
Internal e-mail alias for C++ discussion just started a massive thread on pointers v. references
I want to chime in!
But.... I'm afraid these titans will crush me. :c
> I wanted to add a remark about a file_size or byte_count class. I think that this class should have operator bool() that returns whether the size is valid or not.
@ThePhD why are you afraid of that?
You shouldn't be thinking about winning or losing, but about teaching or learning.
What if I say something and STL comes in and says like "Absolutely not, that's horribly wrong." D:
@ThePhD Then you will learn something?
16:43
Hello, I saw the no-helpdesk tag here. Could someone point me out to a C++ room where I can receive programming related help?
@danijar I think there's a !Real C++ room somewhere
@ThePhD Dead and gone.
0
Q: Why is FILE not recognized even after putting #inlclude <stdio.h>? (c language)

mc8I put this code on a program that I found on the Internet: /*the other variables are declared and defined before this code fragment*/ FILE *pfile; pfile=fopen("textfile.txt","w"); fprintf(pfile, %d, number->var_inp fclose(pfile); After compiling there were arrors such as: "FILE undefined or no...

@ThePhD Thanks, but I can't find it since the room filter doesn't show it. Have an idea where I can get the link?
@danijar Most such questions belong on the main Stack Overflow site. If you want to ask about something that's more of a discussion topic, asking here might make sense -- as long as you realize that if we disagree about its belonging here, we'll probably be quite merciless in ridiculing both you and your question...
16:45
@danijar That room was abandoned some time ago. It's frozen or deleted now.
@danijar It's apparently dead now. D:
@ThePhD ...except that dead would imply it was once "live" it never really was.
I'm pretty sad that my Mystical and Magical World of UB was suddenly and mysteriously deleted off of SO.
I had some great UB tricks in there. :c
Xeo
Xeo
@ThePhD Should we have moved you over there too?
Alright. My question is just how to make an instance accessible at another place in my own architecture. I think it's too special for SO because of my own architecture. Does it belong here?
16:49
@Xeo No. D:
Xeo
Xeo
@danijar Whatever you end up trying, if you see a pattern called "singleton", run.
@Xeo :P
Xeo
Xeo
As I said, run.
dhawjkdwk WHAT
Come on that's not even fair. D:
@R.MartinhoFernandes: I wrote a program to search a directory for files, and attempt to guess the text encoding (including "not text") of each file, and list files that looked like they were "a code page". It flagged each and every wave file as being a code page.
16:52
@MooingDuck Every wave file starts with RIFF. That looks like text, I guess.
@danijar Normally, to make an instance accessible, you pass a reference (or pointer) to it to whatever needs the access. I have a feeling you already know that though, so I'd guess more information is needed to give a meaningful answer.
@Xeo I considered that, but would like to not circumvent my own architecture. There are many header files in my project which contain types, basically structs. In one of this types, I need an instance in the destructor.
Make the constructor take an instance and keep it around.
@ThePhD Also, apperently there wasn't enough characters zero through twenty to look too suspicious, and it clearly wasn't a unicode encoding...
I guess I need to make it more sensitive to the control characters
@MooingDuck Do you really need to do that?
I would avoid it all costs.
16:55
@ThePhD The type is used in many source fields. But the needed instance is only available in one of the source files.
Shrug. Guess you're screwed. :3c
@R.MartinhoFernandes no, but I was hoping to make a list of source/config files that are codepage 1252 instead of UTF-8. Potential bug hazards.
@JerryCoffin The instance is only available in one of the source files at the moment, but destructing the types is needed in many of the source files.
Where can I get a wav file?
Xeo
Xeo
@danijar So why is that type not in some header?
16:57
Anywhere on the internet.
Somewhere within the Windows directory, maybe.
@danijar what?
Ell
Ell
freesounds hmm
@MooingDuck Woah. No way. Your filter sucks.
16:57
It's safe, I've downloaded it before.
Ell
Ell
Dern you have to log in
@ThePhD Got a bunch in \Windows\Media. But thanks anyway
Ah.
@R.MartinhoFernandes oh probably.
@MooingDuck It sounds like you're doing this on Windows. If so, I'd start with Findexecutable to see what executable Windows associates with it. Only if that comes back with something that fits with its being text, I'd start to look at the contents on my own to sort out the encoding.
@R.MartinhoFernandes whoa, my waves don't look like that
o.0
Where's the header info?
@MooingDuck That's C:\Windows\Media\chords.wav
@ThePhD Notice the scrollbar.
Oh.
Seriously, if it has NUL, or SOH, or something => not text.
17:00
waaiit, I lied. it didn't flag all my waves. I simply have lots of wave files, and a few false positives.
Xeo
Xeo
Even the header itself has a SOH NUL
actually, but my math, I only flagged about 0.2% of the total wave files
Xeo
Xeo
Well, for chord.wav anyways.
I don't think any binary file has no 0's [NUL]'s.
We sure do go from topic to topic.
17:01
@R.MartinhoFernandes yeah, I made my thingy accept a small number of errors, but I think I need to make the error limits smaller.
Very, very small.
You could also early-exit once you find a '\0'
Seriously, no text file should ever have a null-terminator.
@Xeo Maybe it's clearer with an example. The type is a collision body and is handled in a global list. It can be created or deleted from many source files. One of those source files is the physics module. It adds bodies to the simulation. But to to delete the bodies, they need to be detached from the simulation. Therefore I need the instance of the simulation world in the body's destructor.
@ThePhD specifically, I deal with some files that are 95% UTF16, and 5% binary data. Thus I desired a small amount of "fuzziness"
Oh.
I wonder what happens if I give boost::filesystem::directory_iterator a path that's a full file...
17:04
@MooingDuck I would make any character in the ranges U+0000..0008 and U+000E..0019 a certain non-text file marker.
@MooingDuck That's not a text file then.
It's a binary file with text components.
@ThePhD Many of them do.
@R.MartinhoFernandes fair enough, but I desire that this filter to detect that it's mostly UTF16 anyway.
@JerryCoffin Yeah, so it should be easy to detect certain binary files when you encounter a 0. :D
@ThePhD Yes, but a UTF-16 encoded text file will also.
@MooingDuck Then make two passes.
@ThePhD He doesn't want to detect binary files.
17:06
Oh.
@JerryCoffin Oh yeah.
He wants to detect text files.
@danijar I wouldn't call that 'an example'.
Well then.
And FWIW, don't make the output be true/false.
@MooingDuck Are you using (or have you at least looked at) IsTextUnicode? It's heuristic, but often fairly accurate.
17:07
@LucDanton Why not? It is my use case...
@JerryCoffin That's what Notepad uses, right?
@R.MartinhoFernandes it returns a table of "probabilities"
@R.MartinhoFernandes I don't know for sure, but it seems like it probably would.
@JerryCoffin this initially started as me attempting to rewrite that
17:08
@MooingDuck Ah, I see.
Bush hid the facts is a common name for a bug present in some Microsoft Windows applications, which causes a file of text encoded in ASCII or its superset (such as in a Windows code page) to be interpreted as if it were UTF-16LE, resulting in mojibake. When "Bush hid the facts" (without newline) is put in a new Notepad document and saved, closed, and reopened, the nonsensical words "" (Liu Benrenmotian Touyingjianmeng) appear instead. While "Bush hid the facts" is the sentence most commonly presented on the Internet to induce the error, the bug can be triggered by many sentences with cha...
Ell
Ell
@R.MartinhoFernandes oh gawd :L
@JerryCoffin except, I wasn't happy with IsTextUnicode's interface
@R.MartinhoFernandes took me three glances to notice
Roflmao.
Big fails are big.
Welp.
17:11
@MooingDuck Hard to blame you there. Its accuracy is probably open to improvement too -- but it sounds like it's still a bit better than you've managed yet.
Time to sac up and rub my face into the Unreal Engine some more.
q_q Game Development.
It's just like I always... dreamed it would be... ;~;
@JerryCoffin given valid text files mine usually does great, except occasionally it says a binary blob is a code page.
@MooingDuck You need frequency tables.
Is FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF a bunch of y-umlauts in cp1252 (ÿ) or a bunch of -1s in a binary file?
@R.MartinhoFernandes I haven't begun to differentiate code pages yet, but I'll need them when I get there
@R.MartinhoFernandes also a good thought
ÿ is quite rare in natural text (it only occurs in some French place names)
FF is, however, not at all uncommon in binary data. A frequency table would sort it out quite well.
Gotta leave.
17:20
@R.MartinhoFernandes One minor detail to infuriate you before you go: was reading through part of the UEFI spec last night. Found that the current version (April 2013) claims to use UCS-2 Unicode...
Ell
Ell
Why is that bad?
As long as there is a specified encoding, isn't all unicode supported?
@Ell UCS2 only supports the basic multilingual plane, not all of unicode
@Ell UCS-2 has been obsolete since Unicode 2.0 came out. That was something like 15 years ago (or more) if I recall correctly.
@milleniumbug Dumb.
Ell
Ell
17:22
@MooingDuck ah :/
@Ell UCS-2 is not a Unicode encoding.
Ell
Ell
Oh o.O I thought it was the encoding winapi & java used for unicode. Or is it just the encoding they use but can't be classified as a unicode encoding?
@Ell winapi and java both use UTF16LE
@DeadMG The site? Usage of UTF-8 as storage? My comment?
you :P
17:24
@milleniumbug Frankly, they're pretty equivalently dumb.
I really wish Windows accepted UTF8 as the current code page for it's API.
there is a UTF8 codepage, I think
Ell
Ell
I don't see why utf8 everywhere is such a bad idea
@DeadMG there is, but you can't set it as the current code page for a thread/process/user/etc
@DeadMG it only works in conversion routines
because firstly, UTF-8 is not the pinnacle of text storage, there are valid reasons to use other encodings
and secondly, because holy shit, all the legacy applications and existing APIs
going "ER MAH GERD UTF-8 EVERYWHERE" is just idiotically ignoring that UTF-8 isn't suitable for being used everywhere for plenty of good reasons.
17:26
@DeadMG msdn.microsoft.com/en-us/library/x99tb11d.aspx "The set of available locale names, languages, country/region codes, and code pages includes all those supported by the Windows NLS API except code pages that require more than two bytes per character, such as UTF-7 and UTF-8. If you provide a code page like UTF-7 or UTF-8, setlocale will fail, returning NULL. "
The problem with UTF8 everywhere is that it asks everybody to use UTF8 no matter their use case. This is full-retarded -- especially for those living in Non-Romantic-Languages (CK JP etc), where every encoded character might be 3 characters instead of 1 or 2 -- because it STILL doesn't solve the problem: my string type (my text type) should never let me know that it's using utf8, utf16, utf32, or codepage1252 unless I do backflips and a dance to find out.
hahaha romantic xD
@Xeo that's... er, interesting?
@Xeo Wow. He looks so happy.
17:28
UTF8 everywhere doesn't create an opaque data type: it creates a type that makes it painfully obvious when I try to work with anything that's not UTF8, or UTF8 friendly.
@ThePhD Aside from the fact that UTF-8 has a number of cases where it's suboptimal, the reality is that there's a bunch of applications that currently uses other encodings and it would entail re-writing all of them.
simple fact is, encodings aren't going anywhere soon
The problem with UTF-8 everywhere is that it concerns itself with implementation details.
@CatPlusPlus Yeah, it's not longer an opaque type.
Xeo
Xeo
@EtiennedeMartel Bet he's not happy anymore.
I shouldn't have to care about encodings.
@Xeo You monster.
17:29
Encoding matters in storage.
And interop. Not internal details of Unicode implementation.
I'm a reaper doomsday device
Factor uses two vectors to represent Unicode strings.
Not UTF-anything, valid for implementation, is point.
What's the second vector for? o.0
Fast one-by-one iteration through the code points?
One is 7-bit, the other one is 16-bit.
17:33
... o.0
Wat.
Highest bit in first indicates extended character, where the rest of bits is stored in the aux vector.
@CatPlusPlus UTF8everywhere speficially says "this should be the default choice of encoding for storing text strings in memory or on disk, [and] for communication..." as the first sentance on the page
... That's actually extremely clever.
@MooingDuck Yeah that "in memory" part is wrong.
@CatPlusPlus I agree that "in memory" is silly, but the rest of the sentance I agree with
17:34
@CatPlusPlus I'm gonna steal that implementation. <3
As for storage, eh. Depends.
Though, actually.
Any Linux gurus online atm?
@CatPlusPlus Anything that starts with "The problem with UTF-8 everywhere" is guaranteed to be wrong. There are many problems with the "UTF-8 everywhere" theory, so anything that states or implies there's only one is automatically wrong. That said, I agree that this is one of the biggest problems.
@JerryCoffin I'm bad with :words:
17:35
My string type is pretty agnostic, It hink...
Ell
Ell
@ThePhD you have a string type?
Though, I do have functions that specifically are appended with Unit to specify it's messing at the code-unit level.
Everyone has a string type.
SubstringUnit
Ell
Ell
But me :'(
17:36
Well, I could separate the implementation out from the string class itself.
Uh, what's the use of substring on codeunit level?
Generating invalid sequences?
@CatPlusPlus Working with plain ASCII as fast as possible. :3c
You're leaking encoding information.
I'm not!
You only get encoding information when you ask for it by-type.
AsciiText t = regularstring;
I do feel I need to prune my string type to behave better, though.
Right now it's templated and stuff.
Or use regularstring.SubstringUnit, which only works when you know how internals look like.
There are no codeunits in Unicode text, drop this.
They exist only in encoded bytestrings.
17:39
Well, it's compile-time templated. typedef StringBase<UTF32Encoding> String; Maybe I should redesign it a little better. :c
See, there it is, internal encoding information.
Yeah, but it's not really visible until you start using .*Unit things. :c
If you want template on something, template on space/speed balance policy.
And pick an internal encoding based on this.
wow, I broke the chat
17:41
@KonradRudolph Jesus fuck. o.0
Though I don't like that anyway, there should be just UnicodeString and that's that.
@KonradRudolph Java: Destroyer of Dreams and Chat Applications
@KonradRudolph No, chat defended itself against the evil Java virus.
Wow, there’s an even longer one
@CatPlusPlus Okay, but inevitably you have to permanently decide on a storage for that.
And that storage will become apparent when you use it with other interfaces -- especially those that ask specifically for a specific type of a specific encoding.
17:44
@ThePhD I agree with you and think the cat is nuts
InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNo‌​tFocusedState – cannot find the link to the documentation though
UnicodeString str = /* Lots of Data */;

FuckingCApiShit( /* What... happens here? */ );
@KonradRudolph what is that monstrosity :O
From the name it sounds like the implementation is probably shorter than the name
(it might be an enum)
@KonradRudolph Java simplifies the language to the point that it's easy to write language aware editors -- then uses names so ridiculous that you absolutely need such an IDE to maintain any productivity at all.
17:46
@ThePhD So?
@ThePhD FuckingCApiShit(str.get_as_utf8(), ...);
Attach an encoding to the encoded string. It's very ephemeral object anyway.
@MooingDuck That's easy, sure, but...
It's also a performance issue. Do you make a copy of your string every time you deal with an outside API? Is there a way to get away from that copy? Let's look at the internal type of the UnicodeString.... oh, it's UTF32. That's fast to iterate and operate on in some cases (when you're not considering Grapheme Clusters), but now I have to send it to this other API that is not templated that expects a specific encoding (UTF8). Looks like I need to perform a copy of my massive string...
auto str = utf8_encoder(unicode_str);
foreign_api(str.c_str());
17:49
I know it's clean and easy to use and encoder, but many people would like to be able to choose the text type that's right for their job. If I'm going to be spending 90% of my application working with UTF8 and not UTF32, UnicodeString becomes useless because it's machine-bolted to being UTF32 internally. So in the end, I roll my own solution, and it just becomes a bigger mess.
I would rather prefer text<MyEncoding, MyOtherEncodingParameters...> because it's the most flexible and I end up choosing what I want, while having an interface that deals in code points and converts to code units internally.
Encodings, meh
As long as the interface to the string is always code-point based, it should be fine.
Interop doesn't happen that often, and you overestimate sizes of strings used for inteorp.
Of course, I'm violating my own law with Unit based things. :c
Guess I'll just remove the API and work naturally with the code points
@KonradRudolph That's 93 characters! Try to fit that in standard terminal line.
17:52
Damnit I keep confusing code points and code units who the fuck names things so closely when they're such different concepts fuck.
Fuck terminals.
I don't know why I join these discussions. Let's talk about something fun.
I was just thinking that
=[
I wish Ogonek didn't use so much using and constexpr.
I'd be able to use it and not my own stuff. It'd be so nice. ;~;
Stop using MSVC.
@not-TonyTheLion Hey, did you steal not-sehe's not-?
17:55
I can't!
I'm at corpoate places for Chrissakes. ;~;
Sure you can.
I'd rather wish VC++ has using and constexpr
Xeo
Xeo
Shouldn't you be able to use their internal build?
Oh wait, using and constexpr were exactly the features it doesn't have. :P
@ThePhD You work at MS?
@Xeo ='(
17:56
@not-TonyTheLion Uh. Maybe a little.
Wait, wait, wait, wait, wait.
That whole Perforce shit.
That happened at Microsoft?
Oh, look at the time.
Xeo
Xeo
@CatPlusPlus Guess why they didn't like the idea of a Linux VM
@ThePhD Hey, I got a friend who works at MS. It's not like it has to be kept secret or something.
Ahahahahahah oh god.
Xeo
Xeo
17:58
@EtiennedeMartel Is he a friend or a "friend"? :P
@Xeo An actual real friend.
ITT MS sucks more than ever before anticipated
well, it's not like I don't understand why Microsoft would want to keep it scecret
Ahahahahahaha

« first day (983 days earlier)      last day (4191 days later) »