Search found 650 matches
- Wed Jun 15, 2016 11:21 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Out of curiosity: What are some use cases of a % b where b is negative? EDIT: What I would expect for b > 0 is that x -> x % q is a homeomorphism from Z to Z_q. If we're assuming % is a mod here (as in Haskell mod or python/ruby % ), then: a -> a % -b maps Z to {-1,...,-b} ... ( for b in Z + ) I do...
- Wed Jun 15, 2016 9:49 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Yeah, like, you've got three equations of which you can only satisfy two: ⋅ a = (a/b)*b + (a%b) ⋅ (-a)/b = a/(-b) = -(a/b) ⋅ a%b is always between 0 and b And I'm also not sure why it's the first equation in particular that must be true. The other two seem way more use...
- Wed Jun 15, 2016 3:28 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
That's the usual div/mod definition... It is, isn't it? Huh... Sorry, I could have sworn it was doing something weird, but I must have been confused. I never really use negative moduli, personally. Negative divisors are fine, but I don't find it natural to think in terms of negative moduli. I tend ...
- Wed Jun 15, 2016 12:31 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Nice choice of modula arithmetic Java. Zero out of ten. Go back and get it right this time... IIRC, Java's integer division is sensible enough, it's just quot-rem division rather than div-mod. The real issue is that most languages don't have both (although I guess div-mod would be preferable if the...
- Tue Jun 14, 2016 10:54 pm UTC
- Forum: Coding
- Topic: Why is my PDF scroll and search so slow?
- Replies: 5
- Views: 6067
Re: Why is my PDF scroll and search so slow?
Zathura is an excellent lightweight PDF viewer if you don't need advanced features. It should be available on MacPorts.
- Wed Nov 25, 2015 10:18 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
I didn't know make would make an executable with no makefile! That's handy. Is that a built-in thing with GCC languages, or does it use some sort of global config/makefile?
- Tue Nov 17, 2015 3:01 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
This makes me want to draft a language where it is syntactically impossible to typo valid code. Or, at the very least, create a syntax checker that can spot the most common typo/errors. I've been tutoring students in Java for some time now, and I can't tell you how many times I've seen the pointles...
- Tue Nov 17, 2015 2:04 am UTC
- Forum: Computer Science
- Topic: Reconstructing a tiling from "is-adjacent-to" data?
- Replies: 10
- Views: 7904
Re: Reconstructing a tiling from "is-adjacent-to" data?
I've bookmarked the site to check out the other games later. (Actually, I'm sure I've come across this site before, a couple of times. I remember the name.)
It's pretty cool that he's compiled the same C code to Java applets, Javascript and native code on 3 platforms.
It's pretty cool that he's compiled the same C code to Java applets, Javascript and native code on 3 platforms.
- Thu Nov 12, 2015 6:39 pm UTC
- Forum: Computer Science
- Topic: Fleeting Thoughts (CS Edition)
- Replies: 99
- Views: 68159
Re: Fleeting Thoughts (CS Edition)
This article claims that fingerprints are unhashable, since you need to accept near misses. That can't be right, can it? You could have a hash function that maps small displacements to small displacements within a certain range, but then reverts to unpredictable "all-over-the-place" behav...
- Thu Nov 12, 2015 5:17 pm UTC
- Forum: Computer Science
- Topic: Reconstructing a tiling from "is-adjacent-to" data?
- Replies: 10
- Views: 7904
Re: Reconstructing a tiling from "is-adjacent-to" data?
Xanthir wrote:It's also an enjoyable puzzle game.
That's actually a lot easier than it looks (I guess that's not surprising if it's a linear time algorithm). There's something oddly satisfying about it, though.
- Tue Jul 07, 2015 12:09 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Packt have been offering a free coding or sysadmin ebook each day. You just need a (free) account. The book is stored in your account, so you can read it in their viewer or download it whenever you want in pdf, epub or mobi format. Some of the titles are quite good. About a week ago, they had the 2n...
- Thu May 28, 2015 8:47 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
0xfdfd is a MSVC stack canary. It is also the http://en.wikipedia.org/wiki/Basmala Unicode code point. They rolled a whole sentence into one code point? Those crazy muslims, what'll they'll do next? I love Arabic calligraphy so much. It really is beautiful as calligraphy. Not so much as an 11-point...
- Tue May 26, 2015 6:28 pm UTC
- Forum: Computer Science
- Topic: Fleeting Thoughts (CS Edition)
- Replies: 99
- Views: 68159
Re: Fleeting Thoughts (CS Edition)
I'm curious, what features make a text editor "decent"? Well... quite a lot, really. I mean, there are hundreds, maybe thousands, of essential functions a text editor requires. It needs an infrastructure for handling text, files, buffers, window management, keymaps, history, registers, ma...
- Mon May 25, 2015 4:29 pm UTC
- Forum: Computer Science
- Topic: Fleeting Thoughts (CS Edition)
- Replies: 99
- Views: 68159
Re: Fleeting Thoughts (CS Edition)
Personally, I can't understand how people tolerate IDEs. I mean, sure, I understand using them for debugging. That's what they're good for. But writing code? You get stuff like prettier autocompletion that's configured out of the box, but in exchange you have to write code without a decent text edit...
- Sat May 23, 2015 8:13 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Yeah... they handle the installation via Windows Update, but if there are no updates waiting, the functionality isn't available. You just have to wait for updates. That's what Windows Help says, anyway. I don't know if there's any way around it. It's hard to believe they know about such a massive, h...
- Sat May 23, 2015 3:01 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Software customization, MS style... Language packs are available through Windows Update as optional updates. They aren't installed automatically. 1. Open Windows Update by clicking the Start button Picture of the Start button. In the search box, type Update, and then, in the list of results, click W...
- Sat May 16, 2015 4:20 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Quot and rem are for integer division. That's pretty useful. AI-controlled ninja frogs can quickly jump distance Y forward or backward. They can also waddle forward or backward at a much slower speed. What is the fastest way for a ninja frog to charge a player without exposing themselves by leaping ...
- Fri May 15, 2015 7:03 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
To be fair, looking at the section expr.mul in the C++14 Draft, they're called "quotient" and "remainder" rather than div and mod, and the behaviour is correct for those operators. Both pairs of operators are useful at different times. FT. Python is the only language that introdu...
- Fri May 15, 2015 2:11 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
The context was some time-series data a colleague was working on that includes what was described as two kinds of null values, one of which means "don't add any data to the time series" and the other of which means "reset the entire time-series to null". That kind of reminded me...
- Fri Apr 10, 2015 12:14 pm UTC
- Forum: The Help Desk
- Topic: Keeping laptop plugged in
- Replies: 3
- Views: 3199
Re: Keeping laptop plugged in
One reason for the contradictory information is probably the different types of batteries that are (or have been) used for laptops. I think older laptops often used NiCad batteries, and after that NiMH batteries. These two types (especially the former) are prone to the "memory effect", whe...
- Sat Apr 04, 2015 6:06 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
OK, I suppose I agree with that, but I think when you get to the point where that becomes the best option, you should probably also take a step back to consider the design choices you made that led to that point. In any case, a few circular imports here and there almost certainly aren't, by themsel...
- Thu Apr 02, 2015 10:54 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
troyp : frankly, if you need code like that, that's probably a sign you're doing it wrong. ;) I don't think that's true at all. Surely you realize static imports are extremely limited. We often don't notice it, since we tend to focus on the solutions that are available given the tools we have, but ...
- Wed Apr 01, 2015 8:47 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Python modules are just objects, so you should be able to do whatever you want with them, dynamically. I'm not sure how portable it would be though. Basically, you can use the imp module to create a module, place members into its __dict__ directly and then and shove it into sys.modules to make it av...
- Fri Mar 27, 2015 9:17 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
I didn't realize UX experts were ever sober... Is anyone familiar with the "separator" characters from ASCII (you know, file separator, group separator, etc)? And the other control codes, for that matter? I was just looking at the Awk manual on multidimensional arrays and it describes the ...
- Wed Mar 25, 2015 10:14 pm UTC
- Forum: Coding
- Topic: IDE for custom syntax highlighting/autocompletion
- Replies: 5
- Views: 2548
Re: IDE for custom syntax highlighting/autocompletion
@YSN: Your link is broken (by a spurious '=' at the end). Fixed:
Vim Wiki: Creating your own syntax files
Vim Wiki: Creating your own syntax files
- Tue Mar 17, 2015 6:48 pm UTC
- Forum: Coding
- Topic: IDE for custom syntax highlighting/autocompletion
- Replies: 5
- Views: 2548
Re: IDE for custom syntax highlighting/autocompletion
You could look at using generic-mode in Emacs*. That's pretty suitable for this sort of thing. There are various completion options like company-mode available (although you might get by with just yasnippet and dabbrev-expand). And there are basically no limits to what you can do in Emacs. * If you ...
- Fri Nov 28, 2014 5:16 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Nine logical connectives implemented with NAND, four combinators, and no named parameters. Simplifications welcome, especially something that gets rid of the 'over' combinator, which I think is a bit of a cheat. The over combination is awesome (did you make up that name or hear it somewhere?). This...
- Tue Nov 25, 2014 11:31 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Basically, it depends on how well I'm used to the relative precedence of the operators involved. Although in 1) I would know the evaluation order without parens too, but I just find it counter-intuitive to have the division first. Also, my preferences are recursive, so if and a/b/c is complex, its ...
- Sat Aug 30, 2014 4:30 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
I can't help but notice that you could have written: !(bool_1a ^ bool_1b ^ bool_2a ^ bool_2b) Without context, it's not actually possible to tell if this is a point for or against XNOR (especially since neither variant is particularly clear). (The XNOR variant would actually be much more clear if y...
- Thu Aug 28, 2014 1:42 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
@ahammel: I think that's a horrible expression (or as horrible as a 3-operation expression can be) , but not because of the compact syntax. It's actually really easy to read (it takes me 1-2 seconds, and I'm not a fast thinker). The issue is the meaning itself is complicated and unintuitive. The nic...
- Thu Aug 28, 2014 12:21 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
In most programming languages != is more "correct" as ^ involves a cast to int and back in most programming languages. I think "most" is a great exaggeration. In C bools are ints, so I can't see any objection. In most other languages I can think of offhand, ^ is either overloade...
- Wed Aug 27, 2014 3:49 pm UTC
- Forum: Coding
- Topic: Poll! What is the value of this constant?
- Replies: 47
- Views: 13244
Re: Poll! What is the value of this constant?
Um? I just answered your question. I'm not sure what religious-warry about that. I expect a certain level of sanity here though. :P Oh, I see. You weren't accusing me of religious-warring... just being insane. Well, I guess that's okay then. But your solution only causes me problems when I want to ...
- Wed Aug 27, 2014 2:56 pm UTC
- Forum: Coding
- Topic: Poll! What is the value of this constant?
- Replies: 47
- Views: 13244
Re: Poll! What is the value of this constant?
It's terrible for any situation. "Just test for it" means that every time you use it, you must test for it or you have introduced a new opportunity for error. Further, in many strongly typed languages, you probably can't use one in place of another. And this is not support for using a wea...
- Wed Aug 27, 2014 6:55 am UTC
- Forum: Coding
- Topic: Poll! What is the value of this constant?
- Replies: 47
- Views: 13244
Re: Poll! What is the value of this constant?
You'd just test it. If it's a string, you convert it to a 1-element array. Then you check input against each element of the array and if it matches any, accept it. That said, I admit it'd be a bit silly to allow either. An interface like that's just a convenience for the user, so they can pass multi...
- Wed Aug 27, 2014 5:06 am UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
( @phlip: hey, your Life-in-Life video's on proggit. ) I don't know why everyone's talking about hard to read code and lots of shit on one line. jaap's code was just return !( hasSomeProperty(X) ^ isRunFooMode ); (and the other example was reducing 3 logical operations to one.) I think it would be h...
- Mon Aug 25, 2014 5:02 pm UTC
- Forum: Coding
- Topic: Poll! What is the value of this constant?
- Replies: 47
- Views: 13244
Re: Poll! What is the value of this constant?
I've seen "extension" used to both include and exclude the dot. Personally, I tend to agree with most people that it should exclude the dot, and use "filetype suffix" to include it. I think it's sensible to have a FILE_EXTENSION_PDF constant to standardize the extension used for ...
- Mon Aug 25, 2014 4:12 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
Maybe it originally used a more baroque scheme involving objects which could be Boolean.TRUE , Boolean.FALSE or null , with an else-clause, and they changed it to primitive booleans and removed the else-clause? They might have used Boolean.TRUE / FALSE because if they just used if(predicate) it woul...
- Mon Aug 25, 2014 3:05 pm UTC
- Forum: Religious Wars
- Topic: The Pronunciation of Sudo
- Replies: 90
- Views: 49128
Re: The Pronunciation of Sudo
They arguing su peruser vs s uper u ser. Oh, okay. I guess that's plausible (although it seems a lot more likely they're just the first two letters). Personally, I don't think it matters what it stands for either way, and even if su did originally mean superuser, it makes more sense as switch user ...
- Sun Aug 24, 2014 10:08 pm UTC
- Forum: Coding
- Topic: Coding: Fleeting Thoughts
- Replies: 9924
- Views: 1882212
Re: Coding: Fleeting Thoughts
I saw the following code construct today if (predicate == Boolean.TRUE) {...} else if (predicate == Boolean.FALSE) {...} This rustled my jimmies. If `predicate` is true, does Java autobox it in that code? (I know it would autounbox a Boolean.TRUE in an if-statement, but I'm not sure if it does the ...
- Sun Aug 24, 2014 9:54 pm UTC
- Forum: Religious Wars
- Topic: The Pronunciation of Sudo
- Replies: 90
- Views: 49128
Re: The Pronunciation of Sudo
I don't have any evidence for the idea that the U in "su" is the first letter of the word "user", as opposed to the letter following the S, but that's my intuition, and that's what I base my beliefs on. If you can find some evidence to the contrary (similar to Steve Wilhite and ...