12,740 karma · joined Feb 17, 2008 (18y ago) · 2,917 submissions
comment 10y ago · link · parent
For a multi-segment setup the length of the entire string would be found by summing the lengths of each segment. This is still "fast" because you would have to, at most, test one byte per segment to find the next length byte, to find the total string length.
comment 10y ago · link · parent
Really, it's unfortunate that null-termination was used at all. The "unlimited length" feature did not have to be implemented in such an expensive way.
As an example, I think it would be possible to use leading bytes to encode strings in one of three ways, using a Pascal-style string as the base case but limited to 253 characters:
[0] [1...253] (short strings)
length data
[0] [1...254] [end+1] (concat. string chains in large contiguous block)
254 len+data start of next
[0] [1...8] [9...255] (concat. string chains in non-contiguous blocks)
255 next ptr. segment len+data
In other words, the values 254 and 255 could act as special values to dictate how to chain together multiple string fragments, and any shorter complete string would degrade to a Pascal-style string.comment 10y ago · link · parent
Even if it were the best thing ever, I know technology and I know that fridges last years longer than any gadget ever has. Any choice of touchscreen, OS or even network connection technology would probably be a "bad idea" in 5-10 years.
comment 10y ago · link · parent
One thing to consider is that the Internet is pretty big, and with a little digging (such as on sites like Reddit) you might find a way to connect with more like-minded people.
It should be possible to slowly climb into a position where you can change things, if you start by running for office or joining the campaign team of someone you respect. I hesitate to recommend this in a world where money and media clearly have a substantial amount of power but, as a candidate, you might get opportunities to bring your message to more people.
There are lots of people in the world who don't have their heads stuck in the sand or playing Candy Crush as you say. Unfortunately, they may not be where you live. I think life is ultimately too short to put up with stuff that you can't stand; if you have to, move to another state/province, or another country, where you'll interact with different people on a regular basis. (And, if you did decide to run for office, you'd have better odds.)
comment 10y ago · link · parent
Very early versions of the Mac Skype client (like 2.x or so) had a completely different UI layout that was multi-window and multitasking, and the program worked absurdly better back then.
Around version 5.x they started making mind-bogglingly stupid UI changes and I stubbornly held onto an old 2.x client just so I could keep the interface that was actually sensible.
So then, what does Microsoft do? They start screwing with the protocol itself and making everything refuse to work at all unless it is running the latest version. Then they introduce more ads and a generally scummier experience from one release to the next.
Even all of that was almost tolerable. Then they made a major "update" to the iOS client that must have removed about 50% of Skype's features for no apparent reason, and added annoyances or random breakages to whatever was left. Fortunately though, the release notes made it clear that they had flattened some buttons so we could all feel good about Skype's usefulness having been mostly obliterated.
Microsoft has, quite simply, ruined Skype. There is no more suitable word than that. It was a very promising protocol and the clients worked well, and Microsoft just completely destroyed it. It's honestly hard to believe the team is being paid to enhance Skype because it really does seem that the team is instead being given instructions to damage Skype in any way possible.
comment 10y ago · link · parent
And that is the real problem with C++: its defaults are downright stupid in many situations and the only real way to produce code without pitfalls is to know all the tricks.
I don't think "auto" is meant to be overused. It makes no sense to use it in place of an "int". It is fantastic for eliminating redundancy in expressions where the type already exists in multiple places and the "auto" serves to eliminate one of the pointless type expressions. It is also good when using objects that you really shouldn't depend on the types of, such as lambdas and possibly magical object types in certain template libraries that exist primarily as a means to an end.
Current compilers appear to generate very confusing error messages for "auto" variables, too. For instance, if you've forgotten to include "Xyz.h" which defines the class "Xyz", and the type of your "auto x = f()" happens to be Xyz, and class Xyz hasn't been used anywhere else in your code, it may take quite awhile to figure out that this is the problem. Therefore, resist the urge to blindly remove all type information from your code; keep as many hints around as you can.
comment 11y ago · link · parent
When I see something as arbitrary as Pocket just show up as one of a handful of toolbar items, my reaction is no longer "oh good, a Firefox update"; it switches to "great, what crap have they auto-installed and enabled-by-default this time!?", to finally "turn off auto-updates".
Same with AMBER Alerts. In theory, a good idea. In practice, every single one of them has occurred at an odd time of day, presenting itself as important but turning out to be the vaguest, most unhelpful text message I could have come up with. Solution? I had to turn them off. A good idea, ruined, by a stupid application of that power.
comment 11y ago · link · parent
As good as Swift is, putting it by default in asinine paths like "/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin" doesn't help anybody (and a ton of stuff in OS X is like this).
A more Unixy way to do this would be /opt/swift-3.0/bin, where /opt/swift is a symlink to /opt/swift-3.0. Even Apple used to limit the path insanity to merely /Developer/usr/bin. Not sure what happened...
comment 11y ago · link · parent
It's silly of them to reject apps entirely over checks that anyone could do in advance, if only they knew what to look for.
comment 11y ago · link · parent
To this day, I click on things and assume my click just didn't "take" because nothing seems to be happening. Sometimes that's true, and other times it's because the Mac decided to display progress in the least obvious places.
Ironically the one thing that doesn't update cleanly through the App Store is the OS itself, even though I suspect that was Apple's main reason for creating all this. When El Capitán came out, at first I thought it wasn't even available because it wasn't structured as an "update" to anything (in direct contrast to the way every other upgrade works, including the minor 10.x.x updates!).
comment 11y ago · link · parent
comment 11y ago · link · parent
I wish that the features of web engines were more compartmentalized. The "convenience" of a Thing That Does Everything will also introduce fragility and bloat (and maybe even security exposures).
For example, I would probably love to call functions to lay out some rectangles for me. I know a web engine can do that really well, and I don't even mind passing in CSS strings to describe what I want. The problem is, I don't want "Internet in a box" to come with it; I just want the layout in that case. It would also be a lot easier to identify problems and contribute solutions if there was a way to "only" do X and focus on that part of the engine to fix.
It would be awesome to be able to take those kinds of low-level details, and start really going cross-platform with them. Make a library that can finally lay out whatever the hell you want consistently across machines, that can be patched into all existing UI libraries or other tools. Make a portable text rendering and text layout system. Make a portable GL viewer. But don't tell me that each of those things only works if I create an InternetInBoxView. Instead, refactor InternetInBoxView to use those separate parts.
comment 11y ago · link · parent
And it's not that OS X hasn't gained some good features since. Once they got the bugs out a lot of the iOS integrations like Messages and even Notes aren't too bad anymore. The problem is, they keep adding half-baked things that don't change, and re-re-re-iterating on things that were perfectly fine to begin with (like Exposé from 10.3).
comment 11y ago · link · parent
https://github.com/kmgrant/macterm
The Python front-end is mostly here: https://github.com/kmgrant/macterm/tree/master/Build/Application/PythonCode
The ".app" bundle layout is constructed as part of the build: https://github.com/kmgrant/macterm/blob/master/Build/GNUmakefile
...but basically it puts Python scripts and a Python-runner into "MacOS", and Python and C++ libraries into "Frameworks". You could also download the built ".app" to see the final layout.This is actually quite a bit simpler than it used to be. In the old days I was able to support both PowerPC and Intel, multiple versions of Python and about 6 different old Mac OS X versions in the same bundle. I still can't quite believe that it worked. :)
comment 11y ago · link · parent
The OS clearly could provide a way to group any number of unrelated windows with tabs, full screen or not, in any tiled arrangement, with more than a lousy 2 splits that are vertical-only. They just don't do it, and they've had decades to add what amounts to some rectangle management.
comment 11y ago · link · parent
comment 11y ago · link · parent
My main project uses a custom-setup ".app" bundle on Mac OS X (combining both a pure Python front-end and C++ bindings) and I've found that it does require a bit of care to see correct behavior.
For instance I found that El Capitán seems to really hate symbolic links now and will consider a code-sign tainted if there is an outside symbolic link (at least, for certain link destinations?).
And I found, at least on older Mac versions, that system calls would sometimes think my application was Python and assume the Python bundle ID instead of my own, if I simply ran Python itself. Whereas, after I included a built binary directly in the MacOS folder that essentially says "int main(int argc, char* argv[]) { return Py_Main(argc, argv); }", it was fine.
I wanted to run the system Python by reference and not bloat my executable; the call-Py_Main() approach worked well for that, too.
comment 11y ago · link · parent
I am against DRM. I don't think it helps anyone to hide content behind buggy technologies, especially when they cause problems that have nothing to do with protection such as security holes. I think you just have to modify the content itself; make it "hard" to cleanse every last mention of the true copyright owner, and stop worrying if some loser actually wants to spend the time and effort it would take to strip all of those mentions out.
comment 11y ago · link · parent
Compare:
for (int x : numbers) {
if (1 == (x % 2)) {
odds.push_back(x);
}
}
auto odds = KeepIf(IsOdd, numbers);
To me, the first case is preferable. The 2nd case uses custom functions that may not be familiar to the maintainer, and semantics are clearly hidden (e.g. does KeepIf() modify the list, return a copy, or return some kind of intelligent generator object that still depends on the lifetime of "numbers"?).Suppose I discover that my application starts crashing with the odd number 15 and I have to work around that case very quickly. The loop version above is trivial to modify, whereas I have no idea how the 2nd version would be modified to filter out one value! And if I want to do several things with the numbers while they're being found (e.g. print them out), the loop is easy to change but the 2nd version basically has to be replaced entirely (and replacing even a concise expression is risky due to the issues above, e.g. unclear semantics).
Now compare approaches for another case:
if (FindWord("I", team)) ...
if (Contains("I", SplitWords(team))) ...
This shows a general problem with a "functional style" at times: it's placing constraints on the implementation that don't need to be there.To me, the first style is preferable because FindWord() could easily walk a raw string and stop as soon as it finds the target word, with a chance for better-than-N average complexity. The second case would mandate: copying strings, visiting all characters in the string every time, and revisiting at least some of the characters in the form of words.
Finally, I think that the C++ standard algorithms, lambdas, and compact-"for" do allow a lot of these tricks to be avoided. Consider algorithms like std::all_of() for instance, which can be combined with lambdas to produce the same results as examples like "AllBy(And(..." but without the downsides I mention at the beginning of my comment.
comment 11y ago · link · parent
The difference between LLVM and GCC is also not purely ideological. By LLVM's own comparison page [1], while licensing is a difference, there are far more significant advantages to LLVM such as the fact that it is easier to integrate with things and build new tools for.
And while it may be unfortunate if two similar, large projects emerge, is this really unique to open software? How many decades of pointless rework have occurred across dozens of projects due to the Microsoft Office file formats, for example? Something like that could have used a lot more GNU ideology in the beginning, frankly, and the world would have been a lot better off with a totally open document platform attached to a "viral" license.
comment 11y ago · link · parent
On the other hand, to the extent that people are more willing to pay ad-blocking companies than the web sites that provide content, I think something needs to change. Ad-blocking companies seem to earn a lot of revenue, disproportionate to their value-add. Compared to all the complex products in the world trying to make a buck, the DOM analyzers and regex lists in ad-blockers are hardly ground-breaking things worthy of massive income. They benefit primarily from having a huge audience.
I've commented before[1] on how protocols might cage data use and scripting in a reasonable way.
comment 11y ago · link · parent
The first example comparing references to copies ignores the fact that you can certainly say "const auto &x = Function();". And really, there's no harm in doing that all the time; if the result is actually returned by value, you'll end up with a stable reference to a temporary object that is only destroyed at scope exit time.
Similarly, I see nothing wrong with consistently saying things like "for (const auto &someObject : someContainer) ..." because it really doesn't help the user to keep typing out all that template garbage each time, and actually introduces unnecessary dependencies on those specifics when the class changes. In fact, ever since lambdas and std::function<> came along, I don't even want APIs that expose things like map types and iterators directly; I much prefer having simple forEach() methods that call whatever function I want, hiding the specifics of the container(s) inside the object.
A case where I really like "auto" is for stuff like "auto x = new ObnoxiouslyLongClassName::ObnoxiouslyLongSubclass();" because it's completely clear and doesn't require repetition of unfortunately-named objects.
comment 11y ago · link · parent
The problem I see is that organizations assume 100% of users must act exactly the same way, and some very user-hostile things are done to ensure that. Each hostile act alienates some percentage of the audience. Sometimes, it's accidental: one day, it's improperly implemented copy-protections that accuse paying customers of being thieves; and here, maybe someone's family member installs an ad-blocker that screws another family member out of E-mail access because the 2nd person doesn't know how to turn off the "ad-blocker" that he's being accused of using.
At some point, enough users of a product are alienated that the remainder is no longer the magic "large" number that is required to keep the product popular, and the product itself starts to fade into obscurity. Businesses have to stop this 100%-our-way-or-the-highway nonsense and just focus on making something really good that people want to use.
comment 11y ago · link · parent
comment 11y ago · link · parent
If you invest billions in surveillance, you will only achieve two things: having spent billions, and making sure that criminals communicate in some other way. You will have stopped no crimes, except the people who are stupid enough that they would have been caught anyway.
comment 11y ago · link · parent
And for something like the Linux kernel, it's not hard at all to find people who are about 236,000 commits behind the master.
I agree that GitHub has some accurate views but they're all mixed and it's very easy for a list to look like something that it isn't.
comment 11y ago · link · parent
Right now, there are accounts that seem to just fork a bunch of repositories and then do nothing with the forks. This makes those people look like massive contributors to open-source because GitHub gives them a nice "Contributions" tab with a list of popular projects under it.
They also get free advertising in reverse because they automatically appear as a "Member" of the parent project's network, despite having done nothing at all in the project!
At the very least, GitHub should require the forking person to have made some pull request that was accepted. If those forks aren't actually contributing, they shouldn't even be mentioned as a sub-network of the original (except perhaps as an option for the project maintainers to see, if they're curious where forks have occurred).
comment 11y ago · link · parent
It gets even worse when absolute age is considered. It's insane that two 17-year-olds can meet and date and want to have sex, yet people come with pitchforks to prosecute the first one unfortunate enough to turn 18!?