Better HN
topnewbestaskshowjobs
Log inSign up

makecheck

12,740 karma · joined Feb 17, 2008 (18y ago) · 2,917 submissions

Submissions

comment 10y ago · link · parent

Actually in cases 2 and 3, since the first byte is "special", the length of the actual string must be the next byte. I've updated it to show that. This is why there is no length-254 string. And in the 3rd case, the maximum segment length is 10 bytes shorter.

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

Great observations.

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

I remember seeing a commercial for those things where they drafted the Top Chef brothers, and even in the commercial it looked extremely awkward to use. "Oh, let's just look up something...(walk over...bend down...glance at screen...slowly punch things in...)."

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

I understand and share all your frustrations.

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

Well, I wholeheartedly agree that the current Skype is in that category. Sadly, that is only because it has become that way. It used to be nearly the opposite, a great example of what chat could be.

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

It's funny, none of his examples point out the simplest problem with "auto": it is not a reference and in fact it strips references out. Therefore, if something non-trivial is being used, most programmers might say "auto var = value" (as his examples do) and incur costs or unexpected behavior that would not be seen with the expression "const auto &var = value".

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

The real problem Mozilla has is eroding trust. They're not the first (Windows 10 practically auto-installing itself is another example, or heck, AMBER Alerts on my phone) but it's the same idea: power has to be used wisely.

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

I suppose, though it doesn't tab-complete. :) There's all kinds of reasons to want short paths. Having said that, I can create my own /opt symlink to a long path too.

comment 11y ago · link · parent

There's one thing I can't understand about Apple's approach, and that is their pathnames.

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

If they're doing that level of scrutiny a million times, they should have released a tool (or even built it into Xcode); something like "Consistency Checker".

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

It's funny, too, that Apple feels there is enough development time to do things like implement completely non-standard UI components but not enough time to fix a growing list of real problems.

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

The sad thing is, they didn't even need an App Store to provide this type of service, and it would have been more useful without a store. Apple already has iCloud; they only needed a variation of the current sync mechanism (something a bit smarter that knows how to find stuff in Applications and related files like Library->Preferences). If they're comfortable giving away free gigabytes of storage to people, they shouldn't care about uploading all of a user's apps — from a store or not — and syncing them anywhere.

comment 11y ago · link · parent

It's funny how Microsoft was once in court over essentially shoving browser components into UI, and now this.

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

I think Snow Leopard was a good spot, as the system was really starting to improve from both the user's and developer's sides. It had the system-wide UI consistency of Leopard but the stability improvements from 10.6.

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

Yep. :) It's "MacTerm":

    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

It actually drives me crazy that any application should feel it necessary to implement its own tabs and window layout.

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

I definitely agree with the tendency of late to have to "shut up" OS X. They need to fire the person at Apple who thinks it's OK to abuse notifications for things like "Try out the new Safari!". And the choices are "Try" or "Later"!?!? It's definitely feeling more spammy. And the only real option for something like that is to shut off all of the application's notifications (and part of me is pretty sure they'll re-enable the crap on the next "10.x.1" update anyway so I grow tired of disabling it). "Growl" by contrast had very flexible preferences, allowing application notifications to be disabled per-notification-type if necessary.

comment 11y ago · link · parent

I use "Window Tidy"; it's about half the price of Divvy and at least as far as I can tell it's just as easy to customize.

comment 11y ago · link · parent

How does this package layout interface with code signing and bundle IDs?

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

Perhaps they need to start periodically saying things like "just a reminder, this video is from <University of XYZ> and is copyright by us" and periodically scribble that on a whiteboard too. It may make the class sound a bit silly at times but we live in a world where plenty of people are just fine with making blatant copies of things.

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

The examples are clearly achieving the goal of "concise". I would counter with a different style though, because I try to imagine how the code would change over time and how it would fare when given constraints on memory and runtime.

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

Software projects can be hard work, sometimes spanning decades. It's perfectly reasonable that a project should want to remain open, and not want companies to be able to make millions after contributing almost nothing to development.

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.

[1] http://clang.llvm.org/comparison.html#gcc

comment 11y ago · link · parent

On the one hand, it's not reasonable to treat "blocking" as the problem that needs a law. Sanity-preservation aside, when ISPs can charge people through the nose for the amount of data being used, some form of blocking software IS REQUIRED. (If sites stop auto-running full-screen video ads with sound, or ISPs stop being complete thugs, then we can talk.)

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.

[1] https://news.ycombinator.com/item?id=10407810

comment 11y ago · link · parent

Well, the examples could probably be better here.

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

A well-known product or service seems to require some "large" number of consumers to become so popular, and also to stay relevant. The question is, do all of the people in that "large" audience need to be paying customers? What percentage of free users is a safe percentage?

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

Posted 730 days ago: https://news.ycombinator.com/item?id=6764014

comment 11y ago · link · parent

If "secure" communication schemes are made insecure, other methods will be used. For example, while it may be inconvenient for two people to drive halfway across town and meet face-to-face in a dark warehouse, they'd have no problem doing that if it was the only way to ensure secret communications. Especially when they're planning events that might take weeks or months to unfold, what's an extra 30 minutes of driving?

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

Yes but if you go to "Members" you see all of them, which is confusing at best. The term makes it sound like this is a list of people who are members of your project, when they're not.

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

There's one part of the GitHub UI that I still wish they'd change: the way "contributions" are displayed.

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

Although laws seem to only consider age, this makes little sense given the wide variety in puberty. Some 19-year-olds look 15, and some 13-year-olds not only look 17 but they have probably matured over their peers to the point of being physically closer to the average 17-year-old than the average 13-year-old. It is certainly possible for a 17-year-old and 13-year-old to seem physically similar and be attracted normally to one another. Society shouldn't be able to auto-condemn a relationship at one point in time, and magically become OK with it 5 years later (when the two people may not even look that different).

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!?

1
555657
98