« first day (607 days earlier)      last day (3409 days later) » 

6:00 PM
Where do I submit a bug report on VS?
I have identified the cause of the bug that keeps making it crash, I think.
 
do I have to delete this @Mat'sMug
oh. well la de da. — Malachi Jan 19 '14 at 23:20
lol
 
@Malachi You could flag it as too chatty and work towards Deputy.
 
lol... I still need a hat yet
 
You already have Deputy anyway.
What about the gold one?
 
@Hosch250 yeah I still need the gold one. but I have a ways to go for that
 
6:04 PM
I wonder if you flagged, then deleted it, would it count towards both?
Oh, can't flag your own comments.
 
I want selfie hat.
 
Then post an answer to your own question.
And wait for an upvote.
 
I already did
and I'm waiting
 
OK. I accidentally got Selfie on SO - I solved my own problem without even thinking of hats.
5
 
lol
My answer:
0
A: Morse Code String

Manny MengUse the ternary operator(?) to simplify this: if(!s.isEmpty()) { this.string = translate(s); } else { this.string = s; } To this: this.string = s.isEmpty() ? s : trnslate(s); It doesn't just improve efficiency, but also reduces typing.

 
6:13 PM
I found it.
 
Thanks, @Hosch250 (was it you?)
 
Now you'll be ahead of me in hats - I can't post with the app.
Yes, it was me.
 
Right now I have 27 not including selfie
 
Me too - 26 on CR.
Kofia I earned on Meta.SE
 
I earned Kofia on Programmers.SE
 
6:15 PM
Quite by accident - I took Phrancis's bounty that was running in overtime and earned like 4 badges and 3 hats, or something.
 
Wow
Hey, @RubberDuck.
 
I earned Kofia, Werewolf Hunter, and Major Award.
 
I gave up gettig anymore hats because they wouldn't be relevant ^^
 
Because I got an upvote, the bounty (200), Yearling badge, and a couple others.
 
6:17 PM
Nice.
 
Hey @MannyMeng how you doing?
 
Good, you?
 
I now have 900 rep on SO and am still 54 edits away from Copy Editor.
 
Congrats
 
0
Q: Playing sounds in Java

Manny MengI wrote a simple sound player to use as part of my MorseString class. I am new to using sounds (in fact, I was helped a lot by Google) and I don't know if this is the correct way to play a sound. The method takes a specific frequency and a duration as parameters, and plays the frequency for the ...

 
6:31 PM
Pretty good. Hungover.
2
Q: CSV reader and parser

Leopold AspergerI have implemented a CSV reader. I think I did pretty well. Since CSV is a loosely defined format to begin with I decided to allow some malformations, like anything but a delimiter after an enclosed value. Maybe someone could point out improvements to this class, I would be happy to know them. ...

Holy comments batman!
 
Found this programming gem from Reddit. http://t.co/tGXaDr1Ddg
 
Oh, a bogosort.
Unbounded worst case performance sort. That's kind of awesome.
 
6:50 PM
@rolfl I'll check that out later! I won't forget
Oh, this gem
private static int getIndexInTags(final String element, final List<String> tags) {
    for (int i = 0; i < tags.size(); i++) {
        if (tags.contains(element)) {
            return i;
        }
    }
    return -1;
}
Was wondering why it always returned the same index
And now I'm even wondering what I'm doing
It needed to be this
if (Arrays.asList(tags.get(i).split(" ")).contains(element)) {
 
@skiwi i don't know much java but this makes no sense to me :D
@skiwi this is much better xD
 
7:04 PM
0
Q: Handling errors when using PDO to connect to a database instead of mysqli

zia grosvenorI am wondering what would be the preferred method for handling errors when using the PDO to connect to a MySQL database? I was using mysqli_error($this->pdo), but I heard this was bad practice. Any feedback would be much appreciated. class Database { /* * Database properties */ ...

 
I'm on a boat!
 
^ This is a hat! It should be on your head :o
 
7:19 PM
Only at SE is a waffle considered a hat...
3
 
7:47 PM
Jamal?
 
8:03 PM
Yes?
 
@Jamal In regards to the comment chain on your answer in codereview.stackexchange.com/questions/75361/….... How do you write an assembly program without using any interrupts?
 
Monking Monkernoon
 
@Phrancis I passed up PPCG
2
 
Well done!
 
@SirPython I may be wrong about that, which is why I removed it entirely from my answer. You can talk to @Edward, who is much more experienced with assembly.
 
8:08 PM
@Phrancis It's always morning in our second monitor.
 
@Jamal Okay, thanks. My thought on it was that, at least in your 16-bit FizzBuzz code, you used an external file called "macros.s", which might've had hidden interrupts in the macros(for example, "PutStr").
 
0
Q: Challenge: Finding the length of the largest run

LegatoNote: A run is a series of adjacent chars that are the same. I just want to answer a few questions: Is this readable? Does it need commenting or is it self-descriptive enough? Are there any efficiency tweaks this could have? Which is the preferred/conventional syntax? int maxCheck = 0, ...

 
@SirPython That file actually doesn't have any ints in it.
 
@Jamal Is the source for this macros.s file some where on the web? Or, was it provided to by a class?
 
It appears that they call various C functions.
It was provided by a class.
 
8:13 PM
Ah, that makes sense. Thanks for clearing that up.
 
I do feel that it has hurt my understanding of assembly, but I believe it was provided to help focus on the assignment tasks themselves.
 
1
Q: Writing better AngularJS Translation Filter

BurakI'm very new to AngularJS. I'm using a directive for translation of category objects like: { "id":17, "order":2, "published":false, "createdAt":"2014-12-29T16:22:43.000Z", "updatedAt":"2014-12-29T16:23:22.000Z", "CategoryTranslations":[ { "id":13, "name":"Fishes", "descripti...

0
Q: Conversion from 32 bit binary string to int Java

CodeWriterWhy does this code public static void main(String[] args){ int N = (int)Long.parseLong("10110011001100111111001111111100", 2); System.out.println(Integer.toBinaryString(N)); N = (int)Long.parseLong("-0110011001100111111001111111100", 2); System.out.println(Integer.toBinaryString...

 
@Jamal I'm not sure if this helps the hurt, but I'm pretty sure that the C standard library for Assembly(I'm not sure if that is what is really called) uses interrupts.
 
@CaptainObvious There's not even an accurate way to label this as off-topic... suggestions @anyone?
 
Probably the someone else's code one.
 
8:21 PM
And... deleted by owner.
Must've RTFM and figured it out ;)
 
You rang, master?
@SirPython Just for the record, there isn't really any standard library for assembly.
One could implement the C standard library in assembly, but that's not often done.
 
@Edward My terminology was poor, as I do not have knowledge on the interaction between C and Assembly.
 
@SirPython No problem. I think most of us are here to learn things.
I have some experience with assembly if I can help you with anything.
 
8:37 PM
@Edward Nothing pops to my mind right now, but I'll know to find you if I need anything.
 
No problemo.
Also, reading the earlier chat comments, about interrupts.
In x86, a "software interrupt" is essentially just an alternative method for a subroutine call.
 
So basically an interrupt is just a jmp to a label?
 
So when one does "BIOS interrupts" or "DOS interrupts" or "Linux interrupts" they're just calling various services.
 
From the kernel, right?
 
Not quite a jump. More like a call, but with additional state stored.
In some cases it's the kernel, but when booting, for example, the services are directly from the BIOS.
 
8:40 PM
Then something confuses me - If I were to be programming a kernel for a computer, how would I be able to make Kernel calls if I'm making the Kernel?
 
In the same way that if you're writing a regular C program, you can call routines that you've written within that program.
 
So if I were making a kernel, would(for example) 80h be a routine that I've made?
 
Yes. Typically you'd have some kind of a handler that would be the Int 80h code, examine registers and figure out which routine to call.
 
Ah, that makes so much sense.
 
Also, the choice of Int 80h is entirely arbitrary. DOS uses int 21h for example.
 
8:44 PM
One more question: If I were to be programming an embedded device with Assembly, how would the Assembly differ? I'm assuming you don't put a whole kernel or BIOS system in a tiny device.
 
Actually, you might.
 
But don't kernels take up a huge amount of space? Or am I thinking of operating systems?
 
A kernel is part of an operating system, but there are large ones and small ones. Linux is fairly large, but uCOS for example, can be made very small.
 
Speaking of kernels, how is a kernel different than a device driver? Can a kernel be thought of as a driver for the processor?
 
So if you think of an embedded system, it might be something more computer-like (e.g. a set-top box like a Roku) or something with almost no user interface like an engine control unit for a car.
@SirPython A kernel is just that -- the central thing around which all of the other parts of the OS are organized.
 
8:48 PM
0
Q: Code Optimzation javascript

MattI feel like (plus notice lagg) when I run this code it must create memory leaks. I'm just goofing off to learn a little and use my free time, but I would prefer if this ran more smooth. I am not sure how to detect memory leaks well, but if someone can point mine out I should be able to understand...

 
By organized, you mean...?
 
Even for Linux there are both loadable module device drivers and ones that are built-in.
 
Oh. I see.
So kind of like a secretary for the device?
 
The very most elementary thing that an operating system does is to manage shared resources such as memory and I/O. So it's more like a librarian than a secretary.
If I have the book, you have to wait until I return it before you can borrow it.
The librarian (OS) keeps track of all of that.
Who has it, who wants it and prioritization on more advanced kernels.
 
My head hurts...
 
8:51 PM
Mission accomplished!
:)
 
Do you have a reference you go to for all this information(assembly, machine level interactions)? I've been using a resource called TutorialsPoint that I find very inconsistent, and rather annoying.
 
I've been doing assembly language programming for various platforms since the late 1970s, so I have a lot of reference material accumulated.
For example, I have a databook in front of me at the moment for an ARM processor.
 
Wow.
 
My own web site is a modest collection of resources for x86: www.beroset.com
 
Do you update this commonly?
 
8:55 PM
Unfortunately not. It's rather stale at the moment.
It's got some Windows stuff, some DOS stuff, and a little bit of Linux stuff.
Mostly, though, the code examples there are intended to show how one might do various things which tend not to be OS-specific.
 
In regards to the bad TutorialsPoint site, here is a link to some code that is REALLY bothering me: tutorialspoint.com/assembly_programming/…. Scroll down to the part about the ADD/SUB instructions. It looks like this bit of code was written by two different people who wanted to name the variables two different things.
At the part in the code where the ascii numbers are turned to their numerical forms, they use "number1" and "number2" instead of "num1" and "num2"
 
It's also not very good code, but perhaps it suits it purpose anyway.
I typically rely on the Intel databooks.
 
Intel Databooks?
 
You had that link in a Jiffy...
 
8:59 PM
I was looking it up before you asked. :)
 
So you know both ARM and Intel assembly?
 
Yes, and probably about a dozen others.
Embedded system work very often involves learning a new processor and instruction set.
 
I've been recently looking into OS development on the Raspberry Pi(I'm not sure if you've heard of them). I believe the RPi(it's an abbreviation) uses an ARM processor. Are the registers for ARM r0, r1, r2, etc?
 
It's funny, but one of the oldest ones is still widely used -- the 8051.
Yeah, I have a Pi here on my desk.
And a Beagle bone and a couple of other toys.
 
:D
 
9:02 PM
0
Q: Adding HTML DOM template

Aleksandr K.I'm new to JS and jQuery. I wrote this function which just do what I want, but it seems very unreadable and because of my experience I don't know better way to handle it. Could you please give me advice how to refactor it? function new_section(id, name, order) { return $('<tbody>') ...

 
But those are pretty high end stuff compared to what I usually work with for embedded system stuff.
 
High end = easier to work with/less complicated?
 
Typical is something like the Renesas M16C or the venerable 8051.
High end = more complicated but maybe easier to work with depending on tools and OS
So for example, the link to the Intel site I mentioned has a 7-volume set just for the processor.
 
7-volume?
 
If you add video, sound, keyboard, Ethernet, GPIO, etc. it's even more.
Yes, 7 volumes, but most of it is reference material that you probably wouldn't need. For example, unless you're designing your own board, you probably don't need the electrical volume.
You will probably want to refer to the instruction set volumes.
And volume 1 is a really good overview.
 
9:06 PM
Oh - sorry, I'm still getting used to this terminology.
 
If you're interested in embedded system stuff or just curious about how low-level programming works, I can suggest some resources.
 
That would be great
 
Here's one about x86 stuff that's in some ways even more detailed than the intel manuals: sandpile.org
 
My "Assembly" bookmarks bar is overflowing....
 
We'll break it for sure: here is an older book about a simple open-source OS: micrium.com/books/older-books
 
9:12 PM
This is that uCOS thing you mentioned.
 
Phil Koopman (author of that last one) also has a good web site: users.ece.cmu.edu/~koopman
But I probably should have asked first what your experience level is so far.
Are you a student?
 
Yes, but I'm not learning in a class room
 
In that sense, I'm a student too, although I earned my degree a long time ago!
 
A student, as in, you are still learning? Or, you still go to a university?
Nevermind
That's too personal.
 
Still learning. I'd love to take more classes at U but haven't the time at the moment.
 
9:16 PM
I just started Assembly programming about a week ago, I believe
 
Ah, OK. Are you following a tutorial online or have you got a book?
 
Following a tutorial online(from that TutorialsPoint site). I also have the book, "The Art of Assembly Language 2nd edition" and "Write Great Code", both by Randall Hyde. I don't look much into these though - I only use them when I get confused with bytes and bits, or when I'm looking for opcode.
 
I'm not a big fan of Hyde's stuff. I think his "high level assembly" is not a good way to learn.
 
I agree - that's why I don't look into them much.
I especially hated his HLA book because when I had first heard of assembly, my head was clogged up with questions and the book was just making things worse.
 
I just try to stay way from Assembly :)
 
9:21 PM
Kip Irvine wrote a book some years ago... amazon.com/exec/obidos/ASIN/0136603904/assemblylangua03
You can probably find a used copy cheap
 
What do you think about Deitel and Deitel?
 
That's better: a $5 book compared to the other $75 book.
 
Free is even more appealing then. Paul Carter's book is here: drpaulcarter.com/pcasm
 
0
Q: Java - Drawing own windows with AWT

SiracI am trying to simulate a window system with java. I don't know much about java graphic-api's, so i began with AWT (I am using Graphics2D here, so far I don't need it, but I think it will come in handy at some point). So far I just have two functions: Each window can draw it's own individual cont...

 
Sorry about that.
 
9:26 PM
I've done some teaching but my main gig is as a manager of programmers.
I don't mind. I'll tell you if you're being too nosy. :)
 
Okay, thanks ;)
 
One of the things I really enjoy about my job is mentoring less experienced programmers.
I enjoy doing that here, too.
 
I can see.
You're pretty good :)
 
I had a lot of people help me over many years; I like to pay it forward when I can.
 
My "manager of programmers", do you mean a project manager, like on GitHub?
 
9:28 PM
No, I work for a large company that makes industrial products.
Before that I was writing BIOS for Compaq
And before that, writing antivirus software
And before that ... well, I'll have to check my resume. It's been a while!
 
You seem to have done it all
 
Not all, but I'm working on it.
 
I just finished watching that video of you racing around a track.
 
I also hope to have seen a lot of the world by the time I'm 52 ;)
Imagine what one can do in 31 years
 
That car sounds pretty bad.
 
9:30 PM
That's an old video, but I still have the car and a few newer toys.
 
This is kind of an odd question, but do you prefer *.asm or *.s for your Assembly files?
 
I usually use .asm everywhere except Linux, where I use .s to be consistent with what the tools expect.
 
Dum dum dum..... Hi all.
 
Hi, Rolfl!
 
Hola.
 
9:32 PM
oh hi there @rolfl!
your solution to the problem seems elegant
 
@Edward On your site, you mention that NASM doesn't really have the features of a normal assembler - what kind of features?
 
Why thanks ;-)
 
I still think it's too complicated, but the problem statement itself is also complicated, so perhaps it deserves complicated code
 
What's complicated? I run a regex on a string ;-)
 
@SirPython Named parameter for macros.
 
9:34 PM
@skiwi And, can you simplify it?
 
@rolfl Exactly. I probably cannot
 
@Edward Oh, like you have to use $1, $2, $3(etc) instead of a names you apply to them?
 
Yes, exactly. There used to be a couple of other features missing from NASM but I have contributed code over the years to address a few of them.
 
My definition of easy to understand code often actually means that I'm using a bunch of complicated stream operations anyway
 
@Edward Do you prefer Intel or GAS syntax?
 
9:36 PM
I prefer Intel syntax, but it's mostly because that's what I started with.
They are, of course, equivalent.
 
@Edward In Assembly, do you believe it is best to comment EVERY line, or do that but leave out some lines that don't really matter(like setting up a buffer for outputting a message to STDOUT)?
 
@SirPython In any programming language, the purpose of comments is to explain to the reader what the code is doing. So it depends on both the code complexity and the reader as to how much is sufficient.
For code I have posted on my web site, the comments tend to be quite verbose.
 
I see that - that's why I asked.
 
So you don't exactly need a comment like i++; // Increment i by 1
 
Right.
You might need a comment saying why you're incrementing by one.
But not to simply repeat what the code says.
 
9:39 PM
Or even worse: i = i + 1; // i equals i + 1
 
Yes, so only comment when it is not blatantly obvious what you are doing/why you are doing it?
 
Yes, exactly.
 
i++; //decrement i by 1
2
 
Hah! :D
 
@skiwi I've seen that in production code.
 
9:40 PM
@SirPython Exactly, like this code here:
 
@rolfl Was there any excuse they came up with?
 
When the code is not the same as the comment, both are usually wrong, or so I've read.
 
@skiwi "We forgot to update the comments when we changed the code"
My other favorite:
 
@skiwi I'm lost, excuse for what?
 
9:42 PM
i=5;
i=5;   // i REALLY needs to be 5
2
 
You've seen that before?
 
@SirPython - when I comment, I mean it:
    // THIS IS CRITICAL
    /*
     * Sort the 'tags' in reverse order alphabetically. The reason is as follows:
     * If one tag is a prefix of another, like "bobby" and "bobby tables", then we
     * want our regex to match "bobby tables" if it exists, and not just "bobby".
     * Add another tag "tables", and we have three: "bobby", "bobby tables" and
     * "tables". If we were to match the text:
     *     I am bobby tables
     * we want the match to be "bobby tables", and not "bobby" and "tables"
That is a huge amount of logic contained in a single line of code:
sources.sort(Comparator.reverseOrder());
 
Yeesh! That's a lot for one line. I only use that much when I write in Java and I explain what the program is for at the top.
I should learn to comment more.
 
It is pretty much also the only comment in the code.
 
And an amusing reference to this:
 
9:45 PM
Is this a MySQL joke, or am I missing something?
 
It's a general SQL joke.
 
Don't worry, I didn't get it for a while, and I still don't know SQL.
It had to be explained to me.
 
@rolfl Oh... that was intended at @Edward up there
 
0
Q: Numeric center in Java

Ner0ckI got a proposed exercise from a Java2 book. This one wants me to find out the numeric centers. A numeric center splits two list of numbers that make the same result when you add the numbers in each list. For example, 6 is the first numeric center because 1+2+3+4+5=15 and 7+8=15 too. The second ...

0
Q: UnitTesting: Is this TestCase overkill?

GiamPyIs this Test Case overkill? I am new to Unit Testing so I am learning and I'd love to hear your opinion about it. use Application\Tests\TestCase as TestCase; class RoutesSubmissionsTest extends TestCase { public function setUp() { parent::setUp(); $this->app['router']->...

 
And now I was lost to figure out why you were lost, as @Edward responded to my ping, so I could surely not have pinged wrongfully! (right)
 
9:46 PM
Right. The favorite comment I have ever seen is:
// This code was hard to write, it should be hard to read ....
Man, the code was a maze of complciated logic.
 
@Edward There is an online tutorial called Baking Pi that covers OS development in the Raspberry Pi. cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html - scroll down to part 6; there, it talks about labels, but it says that they only cover one line - the next line. Is this something to do with ARM assembly?
 
What about the // This code was automatically generated. Do not touch.
 
@Edward That's like presing Ctrl+C ten times?
@rolfl I was confused there for a bit whether you were really correct, then I found out that the String comparator is implemented on the lexographical ordering and that that one also orders consistently and as intended on the length of the string if the first x characters are the same
 
@SirPython I hadn't seen that but it looks interesting and well written.
 
@Edward It is very well written, and has long paragraphs after code segments to explain everything.
 
9:50 PM
@skiwi Good thing there was a comment, right?
 
I just can't use any of it because I don't have the right version of the RPi.
 
@rolfl Yeah
 
@SirPython I'll bet it could be applied anyway.
 
Some of it, anyway.
 
@Edward So, do you know why it says that the labels cover only the next line?
 
9:52 PM
@SirPython Sure. It just means that in assembly language, a label refers to the next instruction.
 
@Edward All this label stuff is kind of confusing me... What is the difference between a local label and a global label? How are they used differently?
 
A global label can be referred to from anywhere with the file, while a local label only has meaning within the context of that individual subroutine.
 
Basically scope?
 
Exactly that.
 
So do the general rules about keeping as tight as possible apply?
 
9:55 PM
They should -- otherwise why bother writing in assembly?
 
I thought so, but I was just wondering.
 
Are global variables defined with the global keyword at the top of section .text?(this might be NASM specific)
 
One generally uses assembly for speed, size or to access things that are difficult in higher level languages (like the carry bit).
@SirPython That's common to several assemblers, including NASM.
 
So how would I compile any Assembly I wrote?
And are there any really good online resources to learn about it?
 
I have about 30, if you are willing to wait ;)
I'm not sure if they are good, though.
 
9:58 PM
I have an Intel x64 processor, if that is of importance.
 
It's been a long while since I learned, so @SirPython is probably a better resource than I am on that.
There are a number of books and tutorials, though. I just mentioned drpaulcarter.com/pcasm a minute ago.
 
I do have one good resource, however. Here is the link: chat.stackexchange.com/users/104512
 

« first day (607 days earlier)      last day (3409 days later) »