Engadget's review on Nexus S - <AUTHOR> http://www.engadget.com/2010/12/10/nexus-s-review/

<comment><AUTHOR> "To have this many options and discrepancies over something as simple as copy and paste should be embarrassing to Google. What it mostly is, however, is a pain to the end user.

And that's kind of the crux of our problem with Android in its current state. We don't question the power of the OS, but the fit, finish, and ease of use simply is still not there."

I think Joshua Topolsky nailed it right at the heart of the problem for Android, at least from a typical smartphone user's point of view.

<comment><USER2> One of the things that bugs me about the Android UI, which doesn't seem to have been addressed in 2.3, is the lack of any decent UI management for multi- tasking. There's the alt-tab switcher if you hold down your home button which isn't a very obvious solution and it just takes too long. On my phone I have to hold down my home button for several seconds. This is probably a good example of what Topolsky is talking about.

<comment><USER3> 2 seconds is too long?

<comment><USER4> Yes, when someone just wants to switch to another app to get something done, 2 seconds is quite a long time. Compared to the double-click-home in iOS, which is quite snappy, the two-second delay on Android takes the flow out of using the OS.

</comment></comment></comment></comment><comment><USER5> "It seems like every couple of weeks we're saying something along the lines of "x is the best Android smartphone on the market right now." We'd like to tell you differently when it comes to the Nexus S, but the truth is, it really is the best Android device available right now."

THAT is the most annoying thing about Android by far. It's impossible to feel good about buying an Android phone when a newer sexier one always comes out a couple weeks later.

<comment><USER6> Well, unless your mood is not dependent on having the newest sexiest thing all the time.

<comment><USER7> That's why I'm sticking with the IPhone! I always want to be assured that I won't be out-sexied by any other smart phone user, as long as I upgrade once a year.

People will also know that my choice of IPhone as my primary communications device signals that I have the largest number of sex partners, on average, of any smartphone user.

<http://mashable.com/2010/08/10/iphone-sex-okcupid/>

</comment></comment></comment><comment><USER8> I don't understand why people expected so much from Gingerbread in the first place. So they expect Google to only release updates with massive feature additions? Personally I would rather have small incremental updates than nothing at all.

<comment><USER2> Competition. Apple stepped it up in iOS4 and has continued adding user facing features in each point release since -- HDR, Game Center, AirPlay, AirPrint, etc. Then you have WM7 with, at minimum, a very attractive GUI. RIM has some eye-candy stuff on the way with the PlayBook GUI. I think the big disappointment is that Google hasn't been able to spruce up the Android UI. We're starting to drift into this uncomfortable Windows Mobile 6.x territory where the UI is clunky, somewhat difficult to use, and just not all that nice looking. In my opinion at least...

</comment></comment><comment><USER9> Is this thing actually fully-unlocked if you get it with a T-Mobile contract?

The FAQ that Best Buy put out was pretty ambiguous. I called Best Buy's dedicated Nexus S helpline to clarify that, and they were basically useless.

<comment><USER10> Phones in the US have a 30 mandatory day return window by law. Easiest thing to do is just buy one and return it after testing it out on another GSM network's sim.

<comment><USER11> Some states may have a 30-day window, but I don't think the US does as a whole. I only had 14 days to return my Nexus One.

<comment><USER10> Hmmm....Looking further, it looks like you're right...the T-Mobile rep was wrong apparently (and it said so on the receipt).

</comment></comment></comment></comment><comment><USER12> I've said for a long time that it's wrong to compare the iPhone and Android. iPhone is a phone and a brand. Android is an idea, arguably a philosophy. It is _not_ a brand.

Let me put it another way: when people buy an iPhone, they're buying an iPhone. When people are buying an Android phone, they're buying a phone (or, in some cases, they're _not_ buying an iPhone).

I've now had the opportunity to use a HTC Desire, an iPhone 4 and a DroidX (in that order).

Inconsistency of UI/UX (as well as hardware) is a huge problem for Android. Even Microsoft abandoned the handset manufacturer and carrier customization model with Windows Phone 7.

You are seeing what carriers are doing: the Samsung Fascinate from Verizon is just the most recent example.

You also see people _still_ releasing 1.5/1.6 devices when there really is no technical reason to do so (carriers/manufacturers like product differentiation, no matter how illogical or how much it hurts the UX long term).

That being said, from Google's perspective, Android is a huge success. Google is successfully commoditizing the mobile OS, lowering costs and driving adoption of smart phones, which drives mobile Internet usage.

The carriers and manufacturers are simply being complicity in their own execution in this race to the bottom. It reminds me of net books actually (almost no profit, commodity hardware, very cheap).

One error made with Android (IMHO) is the proliferation of buttons. It's confusing, inconsistent and (with the possible exception of the back button) unnecessary (beyond the one home button).

Well see just how much pent up demand there is for the iPhone when it spreads to other carriers. My guess is a lot.</comment>


Google Calendar failing to send email alerts? - <AUTHOR>

I've missed a few appointments now because of that. Is this happening to anyone else?<p>I wonder if it's related to the # of mins prior to the event, which sometimes I'll set to 1-2 mins. <comment><USER2> It isn't just you. I've missed daily reminders.</comment>


Wisconsinite caught making thousands of counterfeit THC vape cartridges a day - <AUTHOR> https://www.jsonline.com/story/news/local/wisconsin/2019/09/10/wisconsin-man-accused-making-illegal-vaping-cartridges/2278325001/ <comment><AUTHOR> Kenosha is the same location as one of Amazons large, regional distribution hubs, to give you an idea of the geographical location in which he was caught.

</comment><comment><AUTHOR> 3-5k cartridges per day, over two years: up to 3.5 million potentially contaminated THC cartridges pumped out in the last two years.</comment>


Taking Baby Steps Toward Software That Reasons Like Humans - <AUTHOR> http://www.nytimes.com/2016/03/07/technology/taking-baby-steps-toward-software-that-reasons-like-humans.html?_r=0 <comment><USER2> I thought that it is still largely unknown, how human reasoning actually works...</comment>


Gitlab Director of Compliance resigns in disagreement with new hiring practice - <AUTHOR> https://gitlab.com/gitlab-com/www-gitlab-com/issues/5555#note_241769592 <comment><USER2> Comments moved to [https://news.ycombinator.com/item?id=21482975](https://news.ycombinator.com/item?id=21482975). That one was posted later, but got a lot more comments and is still on the front page, so I guess we'll treat it as the main thread. It seems like the Reddit post adds more information, too, though I can't tell for sure.

</comment><comment><USER3> That's the most comment emoji reactions I've ever seen. I digress.</comment>


Post-mortem: the one where we accidentally DDOS'd ourselves - <AUTHOR> https://keen.io/blog/101427090951/post-mortem-the-one-where-we-accidentally-ddosed

<comment><USER2> ...Is 0.8 Kafka any better?</comment>


The Rest Of The Details On That Monster Groupon Financing - <AUTHOR> http://techcrunch.com/2010/04/15/the-rest-of-the-details-on-that-monster-groupon-financing/ <comment><USER2> A $1.35 billion valuation compared to $1 million / week in profit is a P/E ratio of 26. For a consumer web company that's still growing, that is a very cheap price. For contrast, Google lists over a thousand public companies that have higher market caps and higher P/E ratios--300+ grow at less than 10% per year.</comment>


Show HN: Idea Market – Bringing Together, Talent Money and Ideas - <AUTHOR> http://www.ideamarket.com

<comment><USER2> Invest in an "idea" through a website? Don't do this.

I thought it was a database of problems and ideas matching themselves to help entrepreneurs get insights somehow.</comment>


How Sabeer Bhatia started Hotmail on $300,000 and sold it two years later for $400 million - <AUTHOR> http://www.wired.com/wired/archive/6.12/hotmale.html

<comment><USER2> Interesting to read this in the historical context (1998). e.g. _... and with Microsoft's financial muscle, Hotmail's juggernaut appears unstoppable._

<comment><USER3> Thanks for that.

I was wondering when this was written specifically because of that sentence. Yahoo mail is so far ahead everyone else today that I knew this had to have been written long ago.

Does anyone know how Yahoo mail caught up to and surpassed Hotmail?

<comment><USER4> For the most part, Yahoo started out as "personalized start page," like Excite and a few others. They had, and still might have, far more people using any one Yahoo service than Microsoft had using whatever it is they had back then (I'm not even sure they had MSN).

Anyway, all Yahoo had to do was make mail, then their millions of users would automatically get e-mail accounts. From there, it probably spread just the same way as Hotmail.. firstname.lastname@example.com, and a little message at the bottom of each e-mail: "get your own email at yahoomail.com"

What's amazing is that it took 6 months for a competitor to come in.

<comment><USER5> Yahoo Mail was the result of acquiring Four11 and rebranding their RocketMail product. It was one of Yahoo's better acquisitions. For $65M they got a product that now earns $6.5B/year.

<comment><USER6> Yahoo's total revenue for last year was around 7 billion, and their net income was 400 million. The company has a total market cap of 17 billion, so Yahoo Mail earning 6.5 billion a year by itself seems inaccurate.

<comment><USER5> So says Wikipedia:

      http://en.wikipedia.org/wiki/Yahoo!_Mail

but you're right, it can't be that much.

</comment></comment></comment></comment></comment></comment><comment><USER7> See _Founders_At_Work_ pp. 17-29, if you're interested in a longer version.

</comment><comment><USER8> Nudist On The Lateshift is a great book by Po Bronson about the making and selling of Hotmail. It was pretty inspirational for me.

<comment><USER9> The book is not exclusively about the making and selling of Hotmail. It's a collection of short vignettes about Silicon valley in the 90s.

</comment></comment><comment><USER10> Po Bronson's "What to do with your life" is a great read.

This article though seems to be full of fluff and about reading too much based on post-facto news. Sabeer is definitely smart, but he also definitely got incredibly lucky, and a lot more than everyone else who is as smart or smarter.

</comment><comment><USER11> Nice article, even though I think that too much emphasis was on "having the right idea" rather than on execution and timing. [http://titocosta.tumblr.com/post/81087622/ideas-are- overrate...](http://titocosta.tumblr.com/post/81087622/ideas-are-overrated)

</comment><comment><USER12> I wonder what it is valued at today?

<comment><USER4> If you were to buy it now, you'd not be purchasing the nearly exclusively rights to "e-mail" as it was back then. People would actually say: "Send me a Hotmail." What made it valuable to Microsoft was they they got to capitalize off of the leverage over the largest user-base of any online product of that time. With it they kickstarted MSN.

Today, Hotmail probably pulls in quite a bit of revenue from advertisements, but most of it's value was "spent" by herding the massive group of users into other products, which may or may not have made MS more money.

I think Twitter is today's version of Hotmail, in terms of the concept... except Twitter seems to have gotten much luckier.

What this ingrains into my head is: _give access to known technology in easy ways_. Hotmail, Blogger, Wordpress, Twitter, Facebook -- they allow people to publish/share information where previously they'd need expertise in IT to do it.

<comment><USER13> in other words, it would probably be worth the same 400 millions from 10 years ago? :-)</comment></comment></comment>


Github cofounder says his company doesn't just 'sprinkle Internet on top' - <AUTHOR> http://venturebeat.com/2013/11/12/github-cofounder-says-his-company-doesnt-just-sprinkle-internet-on-top/

<comment><USER2> Was that comment about internet available in more places than electricity meant to be factual?</comment>


Basics Of Function Pointers In C - <AUTHOR> http://denniskubes.com/2013/03/22/basics-of-function-pointers-in-c/ <comment><USER2> The article is missing at least one useful thing: how to declare a typedef for a function pointer. This can be used both to avoid error-prone duplication of declarations and to simplify excessively complex declarations.

Here's a simple example:

[http://en.wikipedia.org/wiki/Typedef#Using_typedef_with_func...](http://en.wikipedia.org/wiki/Typedef#Using_typedef_with_function_pointers)

Here's a more complex example:

[http://www.devx.com/tips/Tip/13829](http://www.devx.com/tips/Tip/13829)

Here's a tutorial on how to interpret the complex declarations like the one at the top of the previous example:

[http://www.codeproject.com/Articles/7042/How-to-interpret- co...](http://www.codeproject.com/Articles/7042/How-to-interpret-complex-C-C- declarations)

Here's a discussion about using typedefs for function pointers on StackOverflow:

[http://stackoverflow.com/questions/1591361/understanding- typ...](http://stackoverflow.com/questions/1591361/understanding-typedefs-for- function-pointers-in-c-examples-hints-and-tips-ple)

See also: The Linux command "cdecl":

[http://linux.die.net/man/1/cdecl](http://linux.die.net/man/1/cdecl)

Plus, there's an on-line version:

[http://www.lemoda.net/c/cdecl](http://www.lemoda.net/c/cdecl)

<comment><USER3> The most useful education I got on reading function pointers is the spiral rule:

[http://c-faq.com/decl/spiral.anderson.html](http://c-faq.com/decl/spiral.anderson.html)

(I accidentally deleted my reply)

</comment></comment><comment><USER4> Good examples and great 'blow by blow' breakdown. This is a really tough concept to learn, and the C syntax gets a little complicated. This was well laid out, readable, and had a good progression of concepts. Well done!

<comment><USER5> This was one of the toughest things for me to learn in C. I think I had to learn it 3 times before it stuck. As more schools depart from teaching C, it's worthwhile to have simple explanations.

</comment></comment><comment><USER6> But why that whole mess with function pointers? Where do they have the key advantage compared to directly calling the function?

<comment><USER7> Function pointers are useful anywhere you don't know what function you're going to call until runtime (and yet more useful still when the number of functions you could be calling is unlimited or extensible.)

Sure, you _can_ get away with, say, implementing a parser with a big switch statement that calls various parse_this() or parse_that() functions, depending on what kind of token you hit. On the other hand, you could instead keep a hash table with token-type keys and function-pointer values. Then instead of O(n) cmp/jnz operations (as a switch statement boils down to), you get O(1) for the hash function, and no processor branch-prediction penalty.

Where it really gains advantage is callbacks: where you write a function for a library (low-level code; mechanism) which can call a user-provided function (high-level code; policy) to do something. The low-level isn't supposed to be aware of the high-level; you shouldn't have to recompile the library every time you have a new callback to pass to it. So function pointers are ideal for this. You call the function, pass it the address of _your_ function, and then it jumps to it to get some answer whenever it needs it.

Think on this for a little bit, and you might be able to invent the traditional _higher-order functions_ : things like map, filter, and fold, which let you do things (adding one to each element; making a new list with just the elements that are even; summing the elements together) by just specifying the _policy_ of what you want to do with each item, without worrying about the _mechanism_ of how it's iterating through the list, keeping temporary values, etc.

Thinking further, you might realize that if you can read a file into _executable_ memory at runtime using some OS function, then you could put native machine code in that file, along with a table specifying function names and the offsets where those functions start in the file. You could read this table in, add the pointer representing where the file starts in memory, to the offset from the table representing where the machine-code is in the file... and bam, you've got a function pointer! Now you can call it. That's a plugin system! (These files containing symbol tables and machine code are called "Shared Object-code" or ".so" files--or Dynamically-Linked Libraries (".dll"s) in Windows--and the function to load them is dlopen(). You don't have to do the math yourself; it's abstracted away by the mechanism--but that's what's really going on there. It's just a plain-old file, mapped into memory, and then you get an address into that memory and call it.)

I would say that the ultimate use of function pointers, though, is a _tracing JIT_ (the JIT being short for "Just In Time".)

In some languages (themselves implemented on top of C), the language's compiler is built into the language's runtime; you can take code specified in source form, or as bytecode, and pass it as a regular old string to a function, which will turn it into native machine code, load it into (an executable range of) memory, and then return you a function pointer to it.

Given this, the language can be based around an _interpreter_ that normally just reads source- or byte-code directly. Interpreters are great, for the most part--they're easy to program; shorter and cleaner than compilers in source form; they frequently fit entirely in processor-cache in compiled form, whereas globs of native code don't; and they don't tend to branch much. If you've never implemented one, they tend to just be a short little "read instruction, parse it into an _op_ and arguments, look up what function that op translates to (via the hash-table-of-function-pointers method above), pass that function the arguments, repeat" loop.

The only thing is, if you have to do that over and over for the same 1000 instructions, the "read, interpret, jump, return" loop _does_ add overhead-- especially since each of these operations has to execute separately and serially, where native instructions might get optimized together into a single clever instruction like x86's "lea" (fused multiply-add followed by load-from- memory, all in a single CPU cycle!)

So, if you want that performance boost for your tight inner-loop code, you _could_ write a separately-compiled module in a lower-level language, and hook it into your code through the C ABI (as above--plugin system = dlopen = more function pointers!) But that's a big jump in complexity. Instead, if you just hook a JIT to your interpreter, the result is only slightly more complex than a plain interpreter.

A JITing interpreter does the same loop, but it also keeps _statistics_ on how often it executes each piece of your code. When it notices that some piece of code is getting interpreted over and over a lot, it'll pass it into the JIT; get back a function pointer to real, native, optimized code; and then _patch_ its in-memory representation of the code you fed it, so instead of saying "A, B, [C, D, E], F", where [C, D, E] is the block that's getting executed all the time, it'll say "A, B, jump to [this native address] and run what's there, F".

That single instruction will transfer control from the interpreter to the code compiled by the JIT, through the function pointer. When the compiled function is done, control comes back, and the interpreter steps to the next instruction like normal. Still easy, still simple, but way faster where and when you need it. Neat, huh?

<comment><USER6> With the help of half an litre Monster Energy, I even managed to understand most of what you explained! (I am an no skilled script-kiddo, that's trying to increase...)

Good explanation and thanks for the work done, that shall help me a lot later on!

</comment></comment></comment><comment> adam-f Psha, try pointer-to-member-functions in C++.

I wrote a fluent reflection/serialization engine a while back which made heavy use of them.

[https://github.com/sparecycles/reflect/blob/master/include/r...](https://github.com/sparecycles/reflect/blob/master/include/reflect/property/AccessorAccessProperty.hpp#L63)

<comment><USER8> This is C, not C++.

</comment></comment><comment><USER9> A good basic article.

An advanced article would talk about arrays of function pointers, pointers to function pointers, returning function pointers and so on. It can get pretty crazy looking.

</comment><comment><USER10> Nice summary. However, the comment about first example is slightly inaccurate. Saying the `sayHello` function does not take arguments is wrong. It does, it just does not care about them. You could still call it with arguments like sayHello("world", 15) and there would be no compiler warning nor error.

If you want to declare a function with no arguments, just do it as `sayHello(void)`. Then, the previous example would result in compile-time error.

<comment><USER11> Updated with that info from the comments already

</comment></comment><comment><USER12> Function pointers are a great tool for untangling balls of code and level- izing different components based upon dependencies in a large project. Rather than having to wait until all code is logically refactored, you can poke function pointers to higher-level functionality down into lower-level libraries to remove the physical link-time dependency and/or circular dependency loops.

There are other tricks you can use if your higher-level code is written in C++. You can take advantage of static initializers to do your function pointer poking for you instead of having to manually do it all in main() or some other point of initialization, potentially creating other physical dependencies. (As long as no other static initializers depend on the function pointers being in place, because order of execution is not guaranteed.) e.g.:

        extern "C" {
        static void higher_level_function_pointer(void) { ... }
        }

        namespace {
          class CallbackLoader {
            CallbackLoader() {
              lower_level_library_set_callback(&higher_level_function_pointer);
            }
          };
          static const CallbackLoader loader;
        }

</comment><comment><USER13> Understanding function pointers in C unlocks the ability to write clean, object-oriented code with inheritance (kinda, sorta, shhhh).

With great power, etc. etc.

<comment> dorian-graph > Understanding function pointers in C unlocks the ability to write clean, > object-oriented code with inheritance (kinda, sorta, shhhh).

People often say this in regards to pointers, or something similar like in the article too, "When understood, function pointers become a powerful tool in the C toolbox.", but often don't explain how/why. In the article the author says that at some indefinite point of time in future they may write about that.

Do you, or anyone, have a link to somewhere not simply explaining the technical side of pointers, but their usage in idealistic and primarily real world examples? Bonus points if it includes indirection, function pointers and other things.

Update: User derefr gave a seemingly great answer below to a similar question like mine.

<comment><USER13> Elaborating on the OO bit, as derefr did an excellent job of talking about the usefulness of function pointers in a VM.

So, let's say I have a structure which I will use to represent objects in my game:

      typedef void (*thinkfunc_t)(void* self, unsigned int dt);

      typedef struct BaseFoo {
        float x,y,z;
        thinkfunc_t doThink;
      } BaseFoo;

      void null_think(void* self, unsigned int dt) { return 0; } /* empty think function */

      BaseFoo* Foo_new() {
        BaseFoo* ret;
        ret = calloc(1,sizeof(BaseFoo));
        ret->doThink = null_think;
        return ret;
      }

      BaseFoo* Foo_clone( BaseFoo* foo) {
        BaseFoo* ret;
        ret = Foo_new();
        memmove( ret, foo, sizeof(BaseFoo) );
        return ret;
      }

So, if I want to create a new BaseFoo, I just call Foo_new() and I'm off to the races; I get back a Foo object that, during my update loop, I can fiddle with:

      /* update loop snipped for brevity */
      BaseFoo* currentFoo;
      currentFoo = get_my_foo_from_my_big_foo_list();
      currentFoo->doThink(currentFoo, getFrameTimeInMilliseconds());

So, that's kind of cool, but what if I want to create a new, better foo, that actually moves? I do this:

      void move_think(void* self, unsigned int dt) {
        BaseFoo* foo = (BaseFoo*) self;
        foo->x += dt;
        foo->y += dt;
        foo->z += dt;
        return 0;
      }

      typedef BaseFoo MovingFoo;

      MovingFoo* MovingFoo_new() {
        MovingFoo* ret;
        ret = Foo_new();
        ret->doThink = move_think;
        return ret;
      }

So, this is very bland, but it gets across the idea that function pointers let me easily override member methods on class instances. You can imagine that, with a little cleverness, you can store arbitrary data into the struct, along with a table of function pointers to instance methods (a virtual function table).

This is a very fun, very deep rabbit hole.

In a lot of ways, you basically fake the type of prototypical inheritance you'd expect from, say, JavaScript.

EDIT:

Elaborating on another point--it's very common to use function pointers in a struct that then gets filled out by a dll or shared library.

For example, let's say that I've got a renderer that draws 3D stuff and conforms to an API. At runtime, I check what driver the user wants to use (software renderer, Direct3D, or OpenGL), and then I fill out the function pointers of that structure to point at the architecture and driver-specific methods I'd like to use.

The rest of my code doesn't change, because it only ever calls the interface exposed by the structure--the actual addresses pointed to by the function pointers are irrelevant.

<comment><USER14> I don't see the need to do the "ret->doThink = null_think;" since you always pass ret to the function. Just call null_think( ret... )

<comment><USER13> Ah, but what if the object is handed over to some other deep end of the code? We want to bake the null behavior into it so that any Foo knows how to think itself--calling code just needs to be aware that any Foo object will always have a valid think callback defined.

This is basically the null-object pattern.

</comment></comment></comment></comment></comment><comment><USER15> Very well written article, clearly explaining what is usually a rather complex topic for new programmers to understand, bookmarked for future use.

The other resource I use for similar situations is [http://c-faq.com/decl/spiral.anderson.html](http://c-faq.com/decl/spiral.anderson.html) [EDIT]: someone beat me to it

FWIW: The explanation by Dave G in the comments isn't quite right (I couldn't reply there, comments appear closed):

> void something(); // prototype of function that takes undetermined number of > arguments

> void something(void); // prototype of function that takes no arguments

> void something() { return; } // function that takes no arguments

isn't quite right as `void something(){ return; }` is still a function that takes an undetermined number of arguments, it just cannot access them; calling `something(1,2,3)` is still valid.

> void unknown(){ return ;}

> int main(void){ something(1,2,3);}

is valid.

</comment><comment><USER16> The C syntax really makes this simple feature look terribly complicated.

It's a while since I watched them, but in the SICP video lectures, as I recall, the notion of storing functions in variables - as introduced in, like, lecture 1 or 2 - took about 0.1% of the time - if indeed that. And that's because while the principles are actually more complicated than the C example (due to the lexically-scoped variable capture), the syntax is simplicity itself.

Consider the issue of making a variable, which goes something like this:

        (let ((x 1))
          (set! x (1+ x)))

You have your "let", then the list of names and values, and then the stuff that makes use of them.

Now consider the issue of making a function:

        (let ((x (lambda ()
                   (message "stuff"))))
          (x))

(Well... maybe they called it define. I don't remember.)

The parallels are obvious, and indeed I suppose they deliberately chose this notation to emphasise the similarity between one type of value (e.g., an int) and any other (e.g., a closure). And so once you've got the hang of making a function that takes one type of value (e.g., an int), it's a small step from there to making a function that takes another type of value (e.g., a closure).

This is a dig at C and its ilk rather than the article. It's ridiculous that such a fundamental, basic primitive is given such a baroque syntax. But then C strikes me as designed for people who already know how to program so maybe the assumption is that most users will already know what function pointers are when they come to it, probably from being familiar with indirect jumps in assembly language.

This post is apropos of very little, I guess. I was just moved to comment after seeing six pages of stuff that still never got to the meat of the matter. So I suppose I should finish it like this: "</rant>"

<comment> qu4z-2 I think the only complicated-looking thing in C is the syntax for declaring function pointer types. If you use typedefs you end up with

      typedef int (*math_op)(int, int);

      math_op ops[] = {
        add,
        subtract
      };

      int a = ops[0](3, 5);
      int b = ops[1](9, 2);

... maybe I've just used them too much, but I find them quite simple (except, as mentioned, setting up the initial typedefs which is a bit "odd").

One of my favourite uses of function pointers is for key-mappings, like in: [https://github.com/muennich/sxiv/blob/master/config.def.h](https://github.com/muennich/sxiv/blob/master/config.def.h)

</comment></comment><comment><USER17> Now it just needs the matching tutorial on initializing pointers in the data section :-)

<comment><USER18> Could you please elaborate?

<comment><USER13> (fitting user name, sir or madam!)

I'm guessing he's referring to declaring a global structure or collection of function pointers, and then using #ifdef's and compiler flags to actually assign those function pointers to things that make optimal sense for the architecture.

Or, at runtime (but hopefully before usage!) setting those global function pointers to point at routines optimal for the situation the program is running under--say, setting them to point at an optimized SSE3 vector routine if the CPU supports it.

Maybe that's it?

</comment></comment></comment><comment><USER19> Thanks for the link. I will pass this onto other developers I know who have trouble understanding this topic.

I recently read this book and it's the best book I've ever read about pointers in C:

Understanding and Using C Pointers Core techniques for memory management By Richard Reese Publisher: O'Reilly Media Released: May 2013 Pages: 226

[http://shop.oreilly.com/product/0636920028000.do](http://shop.oreilly.com/product/0636920028000.do)

</comment><comment><USER18> I remember fondly the time when I learned to use C function pointers. They really stepped up my code design :-)

</comment><comment><USER20> For decoding types, particularly with function pointers, I recommend learning the right left rule. [http://ieng9.ucsd.edu/~cs30x/rt_lt.rule.html](http://ieng9.ucsd.edu/~cs30x/rt_lt.rule.html)

</comment><comment><USER21> I've always liked the presentation of the "spiral rule" at this page: [http://www.unixwiz.net/techtips/reading- cdecl.html](http://www.unixwiz.net/techtips/reading-cdecl.html)

</comment><comment><USER22> On a related note, a teaching aid I wrote out for my classmates in high school: [http://artagnon.github.io/authored/cs- pointers.pdf](http://artagnon.github.io/authored/cs-pointers.pdf)

</comment><comment><USER23> If the name of a function is already the memory address of the function, what extra information does the pointer store? Couldn't you just assign the name of the function to, say, an int?

<comment><USER24> You _can_ coerce it to an int with a cast, with some caveats: It is implementation defined whether or not the size of an int is sufficient to store a pointer, and the type lets the compiler know what you want to happen when you operate one it.

If "foo" is an integer variable, then "foo + 1" returns the integer value of foo + 1, but if "foo" is a pointer, "foo + 1" returns the value of foo + the size of a pointer, for example.

So the pointer does not store any extra information, but the _compiler_ stores and makes use of extra information _about_ the pointer variable (not about the value itself) during compilation.

<comment><USER23> That makes a lot of sense, thanks!

</comment></comment></comment><comment><USER25> This is a simple explanation of the basics of pointers to function.</comment>


Physically Based Camera Rendering - <AUTHOR> http://extremeistan.wordpress.com/2014/09/24/physically-based-camera-rendering/

<comment><USER2> The best video game camera simulation that I've seen described is the GDC 2009 talk "STAR OCEAN 4 : Flexible Shader Management and Post-processing" from [http://research.tri-ace.com/](http://research.tri-ace.com/) It's unfortunate that applying such realistic methods to such anime-like characters produces such a creepy effect (reminiscent of "real dolls" IMHO)

I'm not sure if the researchers at Tri-Ace are related to those at [http://www.siliconstudio.co.jp/nex- gen/en/](http://www.siliconstudio.co.jp/nex-gen/en/) but, I wouldn't be surprised.

<comment><USER3> Thanks for the links!

</comment></comment><comment><USER4> I would love to see something that's more like "Physically Based Eye Rendering" \- rendering what your eyes would see and transmitting it through the monitor at the best quality possible, rather than rendering what a camera would see.

<comment><USER5> how would that work? To start off, eyes have much higher dynamic range than monitors

<comment><USER4> For starters, stop it with the depth-of-field and lens flare and chromatic aberration. At least for motion blur most attempts are at simulating normal motion blur, rather than the staccato motion blur you get from a shutter.

A cool thing would be to do DoF combined with eye tracking and focus exactly where I'm looking at the scene.

</comment></comment></comment><comment><USER6> I always thought it was amusing to see lens flare, which is axiomatically a camera effect, on first-person-shooters.

<comment><USER7> I think the primary reason is just that when you play an FPS, you are looking at a screen, which is the same as looking at the TV when you watch a movie. In this real world setting, your brain is used to see all those effects.

A FPS for a VR headset however should try to mimic the eye instead, because I think it'll be more apparent that those effects shouldn't be there.

</comment></comment><comment><USER8> Why simulate all the flaws of real cameras? This doesn't add anything to realism imo.

</comment><comment><USER9> This is great, too bad the demo was too intensive for my laptop.</comment>


Putin: Russia will help Syria in case of foreign military assault - <AUTHOR> http://topinfopost.com/2013/09/07/breaking-news-putin-russia-will-help-syria-in-case-of-foreign-military-assault

<comment><USER2> Seems like something we don't want to be doing, we wish it never even came to it, promised we would do, and now some big boys are lining up against it.

It's important news. Not really hacker news, I think. Although, you would have to be a hacker to find the right way out of this one...</comment>


Court Reporters vs. Digital Recording and Voice Recognition - <AUTHOR> https://clereporting.com/court-reporters-v-digital-recording-and-voice-recognition-a-comprehensive-breakdown/ <comment><AUTHOR> Bit of an interesting inside perspective on an industry often said to soon be victim to AI/ML advances.

Not sure if the intent behind this is to placate current professionals or attract new ones, but in any case the author seems to mis-understand the current state of the art and appeal of this kind of research[1].

(1) [https://speech-to-text-demo.ng.bluemix.net/](https://speech-to-text- demo.ng.bluemix.net/)

</comment><comment><USER2> I was shocked by the line in the article that mentioned years, plural, of schooling to become a stenographer.

Apparently, although many states do not require a license to be a court reporter, if you want professional licensure, you need an associate's degree. As far as I can find, it's 60 credit-hours of legal jargon, "phonetic theory", and practice typing.

Two years of school in order to become a stenographer. Jeez.</comment>


Which career would make for an easier transition into devops? (poll) - <AUTHOR> https://www.strawpoll.me/18777641 <comment><USER2> I'm confused. Why do you need to select one career, so that you can then switch to another career?</comment>


Ask HN: Securing a server - Balance between being paranoid and wasting time? - <AUTHOR> So.. I'm currently working in a two person startup and I was lucky to get the sysadmin hat. I set up our linux server about two years ago when I had more time on hands, so I was a little over-thinking the whole stuff.
It runs:
- Apache with phpMyAdmin - MySQL - Glassfish
To secure this stuff, I installed a squid proxy which routes requests from the outside to localhost. In addition, all the services (MySQL, phpMyAdmin, Glassfish admin console) are only bound to localhost, so that you cannot access them from the outside (only throug the password secured squid). The only thing exposed is the application running on the Glassfish.
As we plan to move from dedicated server to Amazon hosting (for scaling etc), I was wondering if that stuff was a good idea in the first place. What are your experiences on this, was I wasting time?
Thanks! <comment><USER2> Greetings,

         Basically I would advise to follow some simple guidelines (back to basics):

     -> Don't run stuff with more permissions than needed (ergo, create a user for the services, lock them down, etc)
     -> Make sure you can check the logs to monitor for weird stuff (really, this is important, if you can react quickly you can mitigate many issues before they become serious)
     -> Don't run unnecessary services (do a cleanup on the host)
     -> As best as possible use repository stuff; much easier to be up-to-date (security patches and so on)
     -> Prepare an "emergency lockdown" script. Imagine something you can run that will lock nearly everything and put a nice page for the users, stating "We are performing some super-duper maintenance, blah, blah", don't scare the hell out of them, but allow yourself to carefully check what is happening without worrying with extra leakage. This can allow you to change passwords, block some suspicious IPs, etc (bonus points if you prepare a script to block IPs)
     -> Encrypt passwords and salt them. Really. This is a must, respect your customers.
     -> Extra bonus for a system that emails you as soon as there is a login in the system.

Just common sense I would say.

Oh, and _DO_ change passwords every 90 days, at least.

PS: There is a script for MySQL that does some security check-ups. Google for mysql_secure_installation

Best regards and best of lucks.

<comment><USER3> >>"Oh, and DO change passwords every 90 days, at least." eh. That _might_ help, but my thinking is if someone got in they've already done something so they no longer need that account or that password, so changing passwords is _probably_ not going to help things. That being said, as long as you can keep passwords managed (like using LastPass) then it's fine, and could help.

Everything else miaumiua lists is great. I'd throw in a few random things I think of off the top of my head... mod_security, csf, mount tmp as noexec, LYNIS, phpsuexec, linux maldet.

<comment><USER4> Random addition: disable root SSH login, disallow password-based SSH login (switch to private key), maybe also add two-factor SSH authentication e.g. with a hardware key, or Google Authenticator or whatever.

<comment><AUTHOR> Thanks to all, I guess I'll stick to these basics first!

</comment></comment></comment></comment><comment><USER5> The basic idea is good; I'm not convinced Squid buys you any security, though. If everyone can operate that way, consider allowing access via SSH only.

Oh, and don't forget chroot (or something more modern, like jails or even SElinux).

Having said all of the above, for the typical startup, the main threat is not an attack on the server but some shoddy application code committed under yet another tight deadline.

<comment><AUTHOR> Thanks :) I'll see if the SSH solution is feasible.. The good thing is, that we have very little server code at the moment (as much is done on client- side), I hope we are not that bad at application code right now ;)</comment></comment>


Presence of spouse alters how parents' brains respond to stimuli from children - <AUTHOR> https://medicalxpress.com/news/2020-05-physical-presence-spouse-parents-brains.html <comment> a-priori Of course. This kind of converging brain activity is an important part of how empathy works: by inferring what another person's brain is doing and replicating that in our own brain, we feel what they feel, and this 'synchrony' lets us understand and respond to them. It's basically the closest thing we have to telepathy.

In a co-parenting situation, the activity you see is each parents' brains emulating both the child's brain and their own. That results in a higher degree of similarity than each co-parent on their own, because in that case they're only empathizing with one other person (the child).

You would see the same result in other highly emotional three-party situations; a co-parenting situation would just be a good way to trigger it.

<comment><USER2> I think it's actually the fact that 'roles' have generally been established once a couple has been together for a while, and when the couple is together in this case they are in execute-the-plan mode.

When it's just one half of the couple, theres a realization that they have to fill both roles. The mental scavenging required to prioritize/sequence/execute a blend of familiar and unfamiliar actions is going to perturb brain activity.

<comment><USER3> It is actually other way round. I was more often without other person, so the only me situation was easier to execute and "plan". Other person presence inference sometimes requires more thinking or complications due to acting unpredictably.

Other person makes it easier in a sense that there are two hands and you can split kids. So you don't change diapers while watching other kid. But in terms of how usual situation is, how much cooperation and negotiation it requires, it requires more.

<comment><USER4> > Other person presence inference sometimes requires more thinking or > complications due to acting unpredictably.

It's like solving a constraint satisfaction program where your spouse is an additional variable.

I wonder to what extent the problem solving facilities are more activated with the presence of the spouse.

</comment></comment></comment></comment><comment><USER5> My wife is much less anxious when I am around here. She's a kind of person who easily gets tensed and helpless when she comes across some stressful situation.

To change his all I've to do is just listen to her and offer her my view and usually she is able to fix all problems on her own.

I am one of the lucky people to have great wife who loves me so much.

</comment><comment><USER6> Working from home definitely has its benefits. My wife and I can now, more often than not, look at each other and subtly grin when we are confronted with an absurd tantrum.

Usually these interactions with children raise the blood pressure throughout the day, but having both of us around definitely helps.

</comment><comment><USER7> Might this just be the parents responding to the stimuli of each others presence? E.g let me think about whether or not he/she will pick them up or should I do it. It makes sense that _both_ parents would think this. In the situation where they are alone, such a computation does not need to be done by the brain.

There is no way to actually characterize the thought processes using these imaging methods. No where does this implicate that the actual actions or thoughts _specifically relating to the child_ are any different. This makes the conclusion much less interesting.

</comment><comment><USER8> Well... yeah? Duh?

I definitely have different responses to my kids when my wife is around. I would be very surprised if the same was not true for her. Does anyone _not_?

<comment><USER9> The reverse is true too. Kids have different responses depending on which parent is present and if both are present.

<comment><USER10> Indeed, I find it fascinating seeing how differently our child will be with me, vs. when he's with his mother.

Of course there are differences because he speaks a different language to each of us, but even so his playing-behaviour is different, and I guess he's used to doing different things with us both.

(For example painting is something he associates with his mother, so he rarely wants to do that with me. While I'm the one who lets him choose music to listen to. As you'd expect for a three-year old he likes anything loud, Rammstein being a favourite, with The Prodigy being a good runner-up.)

<comment><USER11> Let him try some dramatic classical music sometime!

<comment><USER10> He's heard Holst's planets, Wagner's "ride of the valkyries", and other pieces. Some of them likes, but usually the kind of music he wants to hear has loud/regular drums and lots of guitar.

His reactions do amuse me though, I let him watch the video to Thriller before bedtime recently, and he thought that was awesome. But the Amy Winehouse video "Back To Black" was scary and he made me stop it!

<comment><USER11> Try Bolero

</comment></comment></comment></comment></comment></comment><comment><USER12> What's extremely different is how a toddler act when both parents are there vs. alone with one parent.

They often act out, try all the things, push the boundaries and run amok. One on one they're lovely.

<comment><USER13> depends on parenting style

if you have typical good cop, bad cop parents there will be obviously differences when each of them is alone and now when suddenly these styles get mixed,

I don't see that much reason for changes, if both parents are good cops or bad cops, of course they are never exactly same,

anyway the child will obviously try to push boundaries towards relaxed good cop standards when mixed since it gives child clearly more opportunities to play and child thinks it's under good cop protection and does things which would never do alone with bad cop

sadly I'm the bad cop mostly

</comment></comment><comment> 08-15 The actual paper is Open Access and linked at the bottom of the article. After a cursory read (I can't read it thoroughly, there is far too much story telling in both the "introduction" and "discussion" sections), I suspect this is merely an artifact of bad statistics combined with Munchhausens Statistical Grid.

</comment><comment><USER13> Fascinating. Who would expect that if parents are together they both feel under supervision of the other one and behave more similar according agreed rules vs alone without supervision of spouse.

Are all these researchers singles?

I have idea for another study, compare behavior of people supervised by CCTV in room vs unsupervised, results will be truly shocking (for some)!

</comment><comment><USER14> I bet if you put a doctor/cop/peer/teacher/parent/total stranger next to the person it would change the stimuli as well.

We're social creatures and to suggest actions are atomic is simplistic. Even a small child knows to alter their behavior when authority figures or social unknowns are present.

</comment><comment><USER15> The prefrontal cortex is the part of the brain associated with executive functions, choosing to eat or not cheese cake. Choosing or not to do impulsivity or not. Of course being present with a wife you would react as such.

</comment><comment><USER16> I bet you would see he same results with two police officers who have been partners for a while. It's a job and if you've got a partner then baby stimuli is basically the "lets get to work" bell.

<comment><USER13> not that sure about it, if they trust the partner he is less likely to report them for negligence, so I'd assume it's exactly opposite with long time partner vs strange new coworker, obviously with stranger you will more likely play it by the rules than with someone who won't snitch on you unless it happened before with long time partner

i think this applies to pretty much any line of work with internal control and repercussions

</comment></comment><comment><USER17> The surprising conclusion from this is..

Whenever we're in the presence of our significant other, our brains are constantly in a state of readiness to compromise or empathize in order to reach a common ground.

</comment><comment><USER18> I wonder if they tried just having two, unrelated people physically together to establish the significance of parentage. What I mean to say is maybe they're just measuring people perceiving the same thing?

<comment><USER19> Isn't that covered by the 3rd paragraph, or are you asking about something else?

> They found that when spouses were physically together, they showed higher > similarities in brain responses to the stimuli than when they were > separated. This effect was only found in true couples and not in randomly > matched study participants.

</comment></comment><comment><USER20> Wow, interesting. huge implications for understanding family sociology</comment>