« first day (1864 days earlier)      last day (3083 days later) » 

user406009
3:00 AM
No warranty implied or guaranteed. No cash back, refunds, etc, etc.
 
Hey, could someone show me how to read data from a USB port in C or C++?
Like just the raw bytes?
 
Why would you ever want to do that
 
user406009
@SuperstarGamer-Trent That's going to heavily depend on the operating system.
 
So, it's about the pthread library. I'm trying to implement a consumer-producer-like solution. When I run, without any warnings, etc., nothing actually is output. It just runs as though in a loop, but it seems to be occurring in main, where the threads are created.
 
@nick I'm wanting to see if I can crack the "Portal of Power" protocol from "Skylanders"
 
3:01 AM
read with file /dev/usb/whatever
 
@Lalaland I'm on Windows 10
 
Does this absence of output sound at all familiar?
 
Ok I'll do that
 
oh windows
good luck
 
Here's what I've got in main: pthread_t loader, extractor;
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&condl, 0);
pthread_cond_init(&conde, 0);
pthread_create(&loader, 0, guest_extractor, NULL);
pthread_create(&extractor, 0, guest_loader, NULL);
pthread_join(loader, 0);
pthread_join(extractor, 0);
 
3:02 AM
Have you tried stackoverflow
 
I have, nothing like it there.
 
@Gregor yes, I have.
 
Oh, nevermind
 
user406009
@AdrianM. If I was you, I would keep on adding printfs.
 
user406009
That usually gets you somewhere.
 
3:03 AM
Yeah, suppose that may have to do.
Thank you.
 
I heard someone cracked the portal code before, maybe if I just convert every byte to a char then convert the array to a String and see if I can find any readable data such as the Skylanders custom name. Then I'll go and try to get things like coins and such. Who knows, maybe I can even WRITE data to them? But I'll want to get a guinea pig for that. I don't want to ruin one of my more rare ones.
 
just use linux and dump the usb data
if you really insist on using windows you might as well throw yourself from a high story building
4
it'll be just as productive
 
that won't solve anything because he will still be using Windows when he lands
 
user406009
@SuperstarGamer-Trent You might want to try asking somewhere else. I don't think anyone here does any fiddling with USB stuff.
 
How did hackers ever survive with crucial Linux tools like cat, or even grep?
 
3:07 AM
Wordpad
 
Notepad++
 
@Lalaland I really wish there was more stuff about this. I really hate how I can't just easily communicate with USB in Java or C/C++ :(
 
its like notepad but with metaprogramming
 
user406009
Now, if you had a super pedantic C++ question about the exact lifetime of certain temporaries, then we might be able to answer that.
 
notepad++ isn't bad
 
3:08 AM
but the compile times suck
 
@nick In fact, Notepad++ is the god of text editors.
 
the default notepad is pretty garbage though
 
user406009
Sublime text > notepad++
 
doesn't even support non windoze line endings
 
;-;
I'm still trying to get rid of my question ban. Funny story I got banned from asking questions when I asked how to run multiple programming languages in Java.
This was what, a year ago? I regret the moment.
 
3:09 AM
everyone regrets their java moment
 
@SuperstarGamer-Trent NOOOOO.
 
i accidentally a java
 
I think I'm like one of the few that still program in Java as their main and not just for Minecraft related things like Bukkit plugins.
 
ST > N++
@nick Aren't you like a Java developer?
 
user406009
@SuperstarGamer-Trent Lots of people use Java.
 
3:10 AM
Most of India is doing Java
 
yeah
 
I'M NOT ALONE YESSSSSSSSSSSS
 
user406009
It's actually a reasonably decent programming language.
 
usually I use the jquery sdk
 
user406009
Most people just hate it to seem "hip".
 
3:10 AM
You don't want to do Java because it puts your job at risk for outsourcing.
 
I started programming at 12 years old then moved onto java at 13. It was hard at first but I'm really glad I did it
BUKKIT PLUGINS ARE SO FUUUUN
 
How old are you?
 
14
I know python, java, and PHP.
 
lol
 
@набиячлэвэлиь You've been beat.
 
user406009
3:11 AM
@Mikhail ? That shouldn't make any difference.
 
And I also know MySQL, I just made a library for it in java recently.
 
we have a new child progidy
 
user406009
Programming languages are not the hard part of software development.
 
@nick That's what they said about you but then you started coding in Java/JavaScript.
 
3:12 AM
Dont you talk crap about Java and JavaScript
 
@Lalaland the jobs for C++ devs are different than the jobs for php
 
user406009
@nick Yep, definitely a "progidy". Didn't you notice the PHP in that list? /s
 
I used to laugh at C++ devs until I realized I might become one soon
 
@SuperstarGamer-Trent They're like the same thing.
@nick So you're saying you're going to get hired as one?
 
3:13 AM
@Lalaland I only use joomla
 
user406009
@Mikhail Yeah, but when you get down to Java vs C++, the choice is arbitrary in many cases.
 
@Nooble perhaps
 
@nick Why can't I get hired.
 
cuz
 
user406009
@Nooble Nah, Java > JavaScript.
 
3:13 AM
patriot act
kids have no rights
 
fartriot fart
 
true
 
When the government invades our privacy its the patriot act. When we invade theirs we go to jail
 
@Lalaland C++ > JavaScript.
I think.
 
3:14 AM
@Lalaland Often the caliber of the projects is different
 
@GregorMcGregor /r/im14andthisisdeep
 
In my opinion for languages its C++ > Java > C > PHP > Python
 
es6 jabbascript is pretty sweet though
 
user406009
@Nooble Well, it really depends on the use case.
 
I use PHP for client side and sometimes web, mostly client though.
 
3:15 AM
@Lalaland C++ is great for web.
 
user406009
I guess even JavaScript can be a good choice for prototype like things.
 
JavaScript is great for things like real-time rendering.
 
P.S. I also made some programming tutorials on how to make PocketMine plugins and I was going through puberty when making them
 
user406009
@Mikhail That just seems like elitism to me.
 
It's so noticable
 
3:15 AM
@Lalaland lol
and yet
 
I sound like a squeaker then this really old kid later on
 
@SuperstarGamer-Trent According to the people I mumbled with, my voice really changed.
@nick Did it really.
@SuperstarGamer-Trent Like nabijaczleweli
 
@Lalaland you're right, there's no production javascript code
 
@Nooble go to my youtube channel (youtube.com/SuperstarGamer101) and look at my first video and compare it to my last.
 
@Nooble it really
 
user406009
3:17 AM
@nick I guess I have to admit that you can overcome most of JavaScript's deficiencies through coding style.
 
user406009
Don't use undefined, ==, or !=, etc.
 
@Lalaland Its a practical matter, most other languages are glue for native code
 
The last video I spoke in was "spleef.mov" the other ones were things like "Y U DO DIS VOLVO" where I got mad when I got my first proffesional killstreak kit fabricator in Tf2 and it was for the pyros lollipop.
Good times.
 
@SuperstarGamer-Trent :p
 
3:18 AM
One day you'll have a voice like Nick.
Imperial voice.
 
So, back to USB and how they deserve more recognition in programming language interal API's!
 
> programming language internal API
 
here let me rephrase that
Oh god I said it so wrong I can't rephrase it
 
I'm co-teaching a class on HDL, and USB devices often don't meet the specs. The amount of hacking it takes to get a keyboard to work is terrible. Nobody should be exposed to that.
 
@Lalaland pretty much, and you should be using strict mode
 
3:20 AM
@SuperstarGamer-Trent Huh.
Why don't you get an Arduino and log the electrical signals.
 
user406009
@Nooble Most of the changes are just syntactical sugar, but they help standardize things.
 
@Mikhail dealing with USB is annoying (for hardware engineers too)
 
But if I got one my parents would be saying "I'm wasting my money"
 
user406009
@SuperstarGamer-Trent That doesn't make any sense.
 
3:21 AM
@SuperstarGamer-Trent It's $30.
 
user406009
They are dirt cheap.
 
Like when I told them about the rasperry pi and said "It's a pocket computer" my parents said "Thats what your phone is for"
 
user406009
Just don't eat out for like a month and you will more than make that money back.
 
It Will Be So Worth It
 
I have like 300 dollars saved from birthdays, christmas, etc. But I have barely spent any of it.
 
3:22 AM
God I have like $3500 saved up from ever since I was 8.
 
And it's all in a savings account.
 
user406009
I personally am not a fan of Arduinos or Raspberry Pis.
 
And I can access it but I'll feel bad.
 
I just have mine in a wallet in my droor
 
3:22 AM
@Lalaland :C
 
user406009
The issue is that you really can't do much with them without a lot of effort and other equipment.
 
user406009
Motors, sensors, etc, etc.
 
@Nooble spend your money now, most adults can save up 3.5k in a month or two
 
I wish all the money I ever got I could put in a paypal account so I could spend money (My own money, of course) without being guilt tripped or anything before buying it.
 
@Mikhail But I'm not an adult :(
 
user406009
3:24 AM
@Nooble Yes, but you will be one eventually.
 
@Nooble yeah so spend it now, because nobody will give up a fuck about 3.5k later
 
user406009
So the future value of that money is less than you think it is.
 
It's a lot for me.
 
@Mikhail o.O where do you live to save that much
 
And I can't spend it all, my parents will see :P
 
3:24 AM
open up an account with an online brokerage, buy ETFs tracking S&P 500, profit
 
@GregorMcGregor Urbana Champaign :-(
 
user406009
@GregorMcGregor Probably in a van on his company's parking lot.
 
trade on margin if you have the balls for it
 
I wonder how developers work with USB, like the guys over at Nintendo and Microsoft and Sony and Activision. WHAT IS THEIR SECRET
I NEED TO KNOW THEIR SECRET
 
user406009
I am actually seriously considering the live in a van strategy.
 
user406009
3:25 AM
Think of all the money you could save.
 
@Lalaland do you live in SF?
 
@SuperstarGamer-Trent They use a high-level API because they're not masochists.
 
@Mikhail ahahahah
 
@Nooble Such as?
 
user406009
@Mikhail No, but I'll probably end up moving there after I graduate.
 
3:26 AM
just FYI, if you live in a van you'll remain a virgin for life
 
@Lalaland "man-francisco"
 
Oh would you look at that.
 
user406009
@nick Some people might consider that a benefit /s
 
sf isn't so bad if you room with someone
 
3:27 AM
@Nooble THANK YOU SO MUCH I NEEDED THIS IN MY LIFE HOW CAN I REPAY YOU?
 
@SuperstarGamer-Trent By not using it! libusb.org <-- Use this instead.
 
user406009
@nick Yes, but that requires social interaction.
 
not much
 
@Nooble :O:O:O:O:O:O:O:O
I must suck at using google omg
 
@SuperstarGamer-Trent It's a C library so be careful. I'd build a wrapper around it to manage the pointers and such.
 
3:28 AM
@Nooble hissssssss
 
either that or pay 3k/month
 
I'll make a JNI with it maybe
 
@nick Je suis Christ. Too bad I'm unemployed.
 
user406009
JNI is actually quite decent.
 
I just suck at using them, I always get the VM to crash on me.
code 0xc000005 is thrown at me
 
3:29 AM
@Nooble your life savings wouldn't be enough to cover the security deposit lol
 
user406009
@Nooble Well, technically you aren't unemployed. You are just not in the workforce.
 
@SuperstarGamer-Trent IIRC that's a race condition.
 
actually it might, depends if they ask for more than 1 month's worth of rent
 
WAIT IT IS
I THOUGHT IT WAS SOMETHING ELSE
 
It's an access violation. I think Windows Explorer had problems with it.
@nick :c
 
3:31 AM
Anybody tried optimizing IO by writing the files in the order that they are expected to be read? Does that strategy work? (obviously on an SSD it doesn't matter)
 
Show us the code.
 
I deleted it, but I can regerenate it real quick
 
pics or it didn't happen
 
@SuperstarGamer-Trent Go
 
@Mikhail hm, never thought about that
 
user406009
3:32 AM
@Mikhail You have two programs communicating via files?
 
I feel like you would have better luck using a single file rather than multiple
cuz your OS is liable to scatter the data around
 
@SuperstarGamer-Trent Inb4 int x[5] = {0, 1, 2, 3, 4}; static_assert(x[5] == 4, ":(");
 
Alright .class and .h file made. Now to create the .cpp
 
depends how fragmented your hard drive is
 
@Lalaland No I'm working on rendering, I need to write 400GB of data that will then be read by another program. I wonder if ordering the writes to try to match the other program will result in some IO boost.
 
3:34 AM
@SuperstarGamer-Trent What the fuck is .class?
 
Thats a compiled java file
 
@Mikhail do you need to save it?
 
I did
You make a java file, fairly simple. Then do "javac <FILENAME>.java"
And you get a .class file! :D
 
@SuperstarGamer-Trent Why is it associated with .h and .cpp I mean.
 
@nick Yeah, it won't fit in RAM
 
user406009
3:34 AM
@Mikhail Have you considered trying to use pipes?
 
@Nooble OH, well I'm making a JNI and thats where Java communicates with C or C++
 
Well, the data must be written to the disk
 
I compiled the java class file, then did "javah <JAVACLASS>" which creates a header with all of the methods specified by the class file
 
Its basically pictures of thousands of nuerons, and I'm trying to figure out how they behave
 
@Nooble specifically, native methods.
 
3:35 AM
hm
 
user406009
@Mikhail It seems like it would probably depend on the caching strategy used by the OS.
 
Indeed, also the PMC controller
IO is a bitch
 
user406009
If the cache always discards the oldest file, you might run into a bad case where the reader is constantly lagging behind. etc, etc
 
Alright, the DLL has been created!
 
eww dynamically linking
@набиячлэвэлиь He's one of you!
 
3:38 AM
Its how java loads native code
Oh and java cant seem to load it because it's evil.
 
user406009
I can only think of two things: 1. Structure the data so that the reader doesn't have to read all of it. Have an index or something. 2. Use a streaming IPC method such as sockets, pipes, etc.
 
UnsatisfiedLinkError
I hate you at times Java, I really do hate you at times Oracle.
 
I think you should stop trying to do interop.
 
But Java is like the only programming language I can make cool stuff in
 
Because interop is evil.
 
user406009
3:39 AM
@Nooble Nah, JNI is fine.
 
Try C++, waste your time fixing dependencies like me.
 
user406009
The only annoying part is shipping the application.
 
@Lalaland how do I make a JNI? I think I got it but I dont got it
I have the header file, the native method, and the c file
 
Oh my god.
 
user406009
Cause then you have to drag along the stupid compiled dependencies.
 
3:40 AM
That's what you meant when you said VM.
God damn it.
 
@NOOBLE I CAN EXPLAIN
 
Why do they insist on calling that a VM.
 
I HAD IT COMPILED BUT I THINK I WAS MISSING A STEP
I WAS SAYING THE VM WAS THROWING AN ERROR AT ME
 
@Nooble because its java bytecode, there is literally a CPU with weird registers that is a Java cpu
 
LIKE THE WHOLE JVM CRASHED TRUST ME ON THIS ONE
 
user406009
3:41 AM
@SuperstarGamer-Trent Did you call System.loadLibrary in your Java code?
 
@Lalaland yes
 
user406009
What was the exact error?
 
Let me pull it back up
 
@Lalaland "Something went wrong :("
 
@Nooble Don't do this too me
@Lalaland ok right now it's throwing an UnsatisfiedLinkError
 
user406009
3:42 AM
@Nooble Also, wasting your time with memory management :(
 
"No JNITest in java.library.path" is the current error.
JNITest is the name of the DLL I compiled.
 
@SuperstarGamer-Trent That's 'cause it can't find a definition for whatever.
 
user406009
Why don't you try setting the java.library.path to where the DLL is?
 
AH
That would be done by System.setProperty, correct?
 
@Lalaland I only really have a hard time with that when writing against C APIs like the evil OpenGL.
I'm telling you man, writing destructors...
 
user406009
3:44 AM
Yes, but you have memory management and ownership issues in C++ that simply don't exist in Java.
 
user406009
You don't need to worry about cycles, etc, etc.
 
user406009
Sure, there are things which cannot be modeled well by a tracing GC, but memory is the most commonly used resource.
 
With native code you have to worry about memory management, while in higher level languages (Such as Java, Python, Ruby, etc.) they handle that for you.
 
user406009
@SuperstarGamer-Trent I think so.
 
user406009
You can also do it manually via command line paramaters.
 
3:46 AM
Ok so I printed out the java.library.path. If I put the JNITest.dll in the jdk bin it huold be able to find it.
 
user406009
java -jar Blah.jar -Djava.library.path=/path/to/libs
 
It still can't find it.
Maybe I'll set it manually.
 
user406009
I believe System.loadLibrary also does some name mangling.
 
user406009
I don't know the details for windows.
 
user406009
3:50 AM
All I know is that for linux it adds a .so at the end and "lib" to the front IIRC.
 
user406009
> The most common cause for this is an incorrect naming of the native library for the name passed to the loadLibrary function. The string passed to the loadLibrary function must not include the file extension name in the string, that is .dll or .so. The string must be name and not libname for all platforms. On Windows the native library must then be called name.dll and on most Unix systems it must be called libname.so.
 
user406009
 
@Lalaland For shared libs yes.
 
user406009
@Nooble Which is what JNI stuff is.
 
user406009
I still find dynamic linking really cool.
 
user406009
3:52 AM
You can just ship code around and it will "magically" work.
 
user406009
(Theoretically, if the stars align)
 
OH GOD I DIDNT PUT THE EXTENSION
 
@SuperstarGamer-Trent You shouldn't have to. I think?
 
No wait nevermind, I misread what Lalaland said
I wasn't putting the exension
Wait I finally got it to load
Oh god the JVM crashed
EXCEPTION_ACCESS_VIOLATION is now the error that I am getting
 
27 mins ago, by Nooble
It's an access violation. I think Windows Explorer had problems with it.
Called it.
 
4:00 AM
:<
I just realized like everyone else has left but the 3 of us
OR HAVE THEY
DUH DUH DUH
duh
 
user406009
Part of that is just due to the time of night.
 
user406009
Most of the people in this chat are European.
 
user406009
And they are either nocturnal or asleep by now.
 
Ah ok
Well I'm still getting that pesky EXCEPTION_ACCESS_VIOLATION
I hate that error so much I want to punch it in the face
But that would ruin my monitor
 
@Lalaland Losers.
@SuperstarGamer-Trent Just go full C++ and you'll have these problems and more!
 
4:08 AM
And this is why I hate native coding
it's just so mean to me :<
WAIT ALL OF IT IS GONE
NOW JUST ONE MORE ERROR
IT'S SAYING IT CAN'T RUN ON A AMD 64 BIT PLATFORM
MAYBE MY JAVA IS 32 BIT IMA CHECK
 
@SuperstarGamer-Trent amd64. Aka x86_64.
 
So you're saying my AMD is 64 bit? Or 32 bit?
 
@SuperstarGamer-Trent No, your processor is either x86 or x86_64.
 
Oh ok
I am on a 64 bit machine
 
Time to start homework!
@SuperstarGamer-Trent 32 bit things work in 64 bit environments.
 
4:16 AM
But that is not what Java is telling me, I must be doing something else wrong.
My JVM is 64-bit. I know it is, I just checked it
 
@SuperstarGamer-Trent Neither, it's 86 bit.
3
 
86 bit?
OH I SEE
Wait no I dont
 
4:34 AM
Too much homework I tell you
Also FF is being stupid.
 
user406009
@Nooble Switch to chrome then :P
 
user406009
Ah, chrome isn't too bad with ram.
 
user406009
The trick is not having a bajillion tabs open.
 
user406009
Or getting crazy with those autoapager plugins.
 
4:42 AM
how to suck RAM
3
 
user406009
@jaggedSpire while(true) malloc(1000000);
 
@Lalaland :P
 
user406009
Or just use Java.
 
@Lalaland ayyyy
 
Macarena!
I'm so fucked.
I have to annotate 6 pages.
And answer so many questions.
 
4:54 AM
...why did you elect to start this at 11:45PM on Sunday?
 
@jaggedSpire Because gdb wasn't cooperating!
 
@Nooble kay
 
user406009
@jaggedSpire Nooble is secretly nocturnal.
 
user406009
He will deny it, but it's true.
 
@Lalaland but I thought koalas were crepuscular?
oooooh
 
5:00 AM
Such a nice morning!
 
@jaggedSpire Koalas don't really sleep. We like to connect our minds into a collective knowledge-bank and upload the information we've gathered to make the koala race smarter as a whole. This, of couse, takes around 15-18 hours because our ears have very low bandwidth.
It's something reminiscent of the movie Avatar (the blue alien one).
 
 
@Nooble kaaaay
 
5:20 AM
I should've started this earlier 0_0.
 
5:51 AM
I haff qwestion
 
Yes?
 
struct R8 { uint8_t r; };
vector<uint8_t> list_ubytes;
vector<R8>& list_r8 = *(reinterpret_cast<vector<R8>*>(&list_ubytes));
 
Agh code.
 
does that do what I think it does... is it safe etc
 
reinterpret_cast is never truly safe.
 
5:53 AM
Use safe_reinterpret_cast instead! It's simply an alias of static_assert(false)
@Mysticial This joke is copyrighted
 
I have data given to me in vector<uint8_t> ... but I need to pass it to something that wants it in vector<R8>. I want to avoid copying if possible
alright, time to be negligent and assume it works everywhere
 
@Prismatic I can't imagine a practical reason that would make it not work
you know you can just reinterpret_cast<std::vector<R8>&>(list_u8); btw
 
coo
 
6:15 AM
Good night.
 
@Morwenn I tried to use clang
but that would be very slow (you effectively have to compile everything to find out what headers are needed) and requires libclang, which makes the app significantly harder to port and only work on projects that compile with clang
I also tried using gcc dumps but it doesn't expose full names
so I went with the current approach
the only real limitation it has is that it can't detect { using namespace std; vector<int> v; }
but it has a couple more limitations, but overall it works pretty well
 

« first day (1864 days earlier)      last day (3083 days later) »