www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Server-Side magazine interview, touches on D

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
http://www.serversidemagazine.com/news/10-questions-with-facebook-research-engineer-andrei-alexandrescu/

Andrei
Jan 29 2012
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 1/29/12 4:34 PM, Andrei Alexandrescu wrote:
 http://www.serversidemagazine.com/news/10-questions-with-facebook-research-engineer-andrei-alexandrescu/

Should have looked first, it's on reddit already. Please vote up :o). http://www.reddit.com/r/programming/comments/p229i/10_questions_with_facebook_research_engineer/ Andrei
Jan 29 2012
parent "George Fekete" <george serversidemagazine.com> writes:
On Sunday, 29 January 2012 at 22:35:32 UTC, Andrei Alexandrescu 
wrote:
 On 1/29/12 4:34 PM, Andrei Alexandrescu wrote:
 http://www.serversidemagazine.com/news/10-questions-with-facebook-research-engineer-andrei-alexandrescu/

Should have looked first, it's on reddit already. Please vote up :o). http://www.reddit.com/r/programming/comments/p229i/10_questions_with_facebook_research_engineer/ Andrei

:)
Jan 29 2012
prev sibling next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Sunday, 29 January 2012 at 22:34:19 UTC, Andrei Alexandrescu 
wrote:
 I wish I’d convince a serious hacker to bring things to the 
 point where
 <?d writeln("Hello, world!"); ?>
 could be inserted in a web page.

That's very easy. About 100 lines of simple string manipulation makes it happen: http://arsdnet.net/dcode/dhp.d $ ./dhp hello <?d writef("%s", "andrei"); ?>! <press control d> hello andrei! $ Set up a shebang or htaccess rule or something like that, and boom, you have it on the web. But, I'd question the utility of it. I wrote that dhp.d script over a year ago, and have never actually used it.
Jan 29 2012
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 1/29/12 4:52 PM, Adam D. Ruppe wrote:
 On Sunday, 29 January 2012 at 22:34:19 UTC, Andrei Alexandrescu wrote:
 I wish I’d convince a serious hacker to bring things to the point where
 <?d writeln("Hello, world!"); ?>
 could be inserted in a web page.

That's very easy. About 100 lines of simple string manipulation makes it happen: http://arsdnet.net/dcode/dhp.d $ ./dhp hello <?d writef("%s", "andrei"); ?>! <press control d> hello andrei! $ Set up a shebang or htaccess rule or something like that, and boom, you have it on the web. But, I'd question the utility of it. I wrote that dhp.d script over a year ago, and have never actually used it.

The difficult part is integrating with Apache. Andrei
Jan 29 2012
prev sibling next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message 
news:jg4hhb$kll$1 digitalmars.com...
 http://www.serversidemagazine.com/news/10-questions-with-facebook-research-engineer-andrei-alexandrescu/

"we tried hard to make off-the-shelf tools work at the scale and quality we need them to, failed, and had to write our own." Yea, I get tired very quickly of defending NiH. Anti-NiH sentiments soudns great in theory, but the rality is that most off-the-shelf software just plain sucks - *especially* off-the-shelf web software. "I wish I'd convince a serious hacker to bring things to the point where <?d writeln("Hello, world!"); ?> could be inserted in a web page." God no. You'll never convince a serious hacker to do that, becuase if you *could* convince them, they wouldn't be a very serious hacker to begin with. Web-front-end people learned a long time ago, from hard experience, that that's a terrible approach to server-side code on the web. No serious web software does that anymore, except maybe when limited to carefully-simplistic uses inside the "HTML templates" waaay off deep into the "view" section of MVC. The whole industry's moved over keeping server-side code out of the HTML, and using plain-old-code to drive an HTML-template presentation system (and that transition started as long as about ten years ago - My first taste of it was the [now old and mediocre] ASP.NET). I'd argue that, even better than that, we should be replacing the "HTML templates" with Adam's brilliant approach of "Server-side HTML DOM" (primarily limited to a presentation module, of course).
Jan 29 2012
next sibling parent reply "Jesse Phillips" <jessekphillips+D gmail.com> writes:
On Sunday, 29 January 2012 at 23:25:36 UTC, Nick Sabalausky wrote:
 The whole industry's moved over keeping server-side code out of 
 the HTML

So the whole industry has moved away from php? Sure templating is used so mixing php and html is as common, but if I'm not mistaken <? is still ?> used a lot, I don't know how to use PHP without it.
Jan 30 2012
next sibling parent "Nick Sabalausky" <a a.a> writes:
"Jesse Phillips" <jessekphillips+D gmail.com> wrote in message 
news:ictwgryawpavhnrnqawa dfeed.kimsufi.thecybershadow.net...
 On Sunday, 29 January 2012 at 23:25:36 UTC, Nick Sabalausky wrote:
 The whole industry's moved over keeping server-side code out of the HTML

So the whole industry has moved away from php?

I wish! No, it's moved away from using PHP in an ASP-classic-style. Ie, scattering a bunch of <?php ... ?> throughout an HTML document.
 Sure templating is used so mixing php and html is as common, but if I'm 
 not mistaken <? is still ?> used a lot, I don't know how to use PHP 
 without it.

Typically now, a PHP file will start with "<?php" to turn on "PHP-mode", and then it'll just leave PHP-mode on for the rest of the file. It won't even be closed with "?>" - this ensures no stray whitespace is printed, which can screw things up (for instance, if you're expecting that HTTP headers are not to have been sent yet.)
Jan 30 2012
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2012-01-30 23:51, Jesse Phillips wrote:
 On Sunday, 29 January 2012 at 23:25:36 UTC, Nick Sabalausky wrote:
 The whole industry's moved over keeping server-side code out of the HTML

So the whole industry has moved away from php? Sure templating is used so mixing php and html is as common, but if I'm not mistaken <? is still ?> used a lot, I don't know how to use PHP without it.

This is used in Rails as well. I mean, you need a way to get a value from the controller into the view. -- /Jacob Carlborg
Jan 30 2012
next sibling parent "Nick Sabalausky" <a a.a> writes:
"Jacob Carlborg" <doob me.com> wrote in message 
news:jg84d8$1ea5$1 digitalmars.com...
 On 2012-01-30 23:51, Jesse Phillips wrote:
 On Sunday, 29 January 2012 at 23:25:36 UTC, Nick Sabalausky wrote:
 The whole industry's moved over keeping server-side code out of the HTML

So the whole industry has moved away from php? Sure templating is used so mixing php and html is as common, but if I'm not mistaken <? is still ?> used a lot, I don't know how to use PHP without it.

This is used in Rails as well. I mean, you need a way to get a value from the controller into the view.

Right, but that's the extent of it. It's used for the HTML templates and not much else.
Jan 30 2012
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-01-31 16:51, Adam D. Ruppe wrote:
 On Tuesday, 31 January 2012 at 07:14:48 UTC, Jacob Carlborg wrote:
 This is used in Rails as well. I mean, you need a way to get a value
 from the controller into the view.

Interestingly, a lot of PHP devs don't even use PHP for this! There's stuff like smarty in fairly wide use: http://www.smarty.net/why_use Though, of course, many PHP devs *do* use php for their templates too. (including me when I do php w/o D. I like the {$foo.bar} syntax in smarty but not the rest of it.)

It seems like Smarty is used mostly because of PHP being quite verbose. This is not the case with Ruby and specially not with the help of the many view helpers the Rails framework provides out of the box. Note also that Rails provides many different template languages as plugins. There could well be a smarty plugin. Looking at the syntax comparisons: http://www.smarty.net/syntax_comparison Late's make a comparison with two Rails template languages, Erb (the default) and HAML. smarty: {$foo} erb: <%= foo > haml: = foo php: <?=$foo['bar']?> smarty: {$foo.bar} In Rails you would most likely pass an object instead of an array/hash. erb: <%= foo.bar > haml: = foo.bar If you actually do pass a hash it will like this: haml: = foo[:bar] Or you can implement "method_missing" (like opDispatch) in the Hash class and get this syntax: haml: = foo.bar smarty: {foreach $foo as $bar} {/foreach} erb: <% foo.each do |bar| %> <% end %> or <% for bar in foo %> <% end %> haml: - foo.each do |bar| # indent smarty: {for $x = 1 to 20 step 2} {$x} {/for} haml: - (1 .. 20).step 2 do |x| = x {$foo|lower|escape} haml: =h foo.downcase To me it looks like HAML wins in every example. Don't know if Smarty has this feature but this is so cool in Rails: = render posts What happens is posts is an array of model objects of the type Post. Rails will look in the directory containing all view files for a directory called "posts". Then it will look for a partial named "_post.html.haml". It will render that partial passing in the element in the current iteration to the partial as "post". In Rails you are free to do whatever you want in the views (not sure if you can access everything you need). But you are encouraged to keep the Ruby code to a minimum. -- /Jacob Carlborg
Jan 31 2012
prev sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Tuesday, 31 January 2012 at 07:14:48 UTC, Jacob Carlborg wrote:
 This is used in Rails as well. I mean, you need a way to get a 
 value from the controller into the view.

Interestingly, a lot of PHP devs don't even use PHP for this! There's stuff like smarty in fairly wide use: http://www.smarty.net/why_use Though, of course, many PHP devs *do* use php for their templates too. (including me when I do php w/o D. I like the {$foo.bar} syntax in smarty but not the rest of it.)
Jan 31 2012
prev sibling next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 1/29/2012 2:34 PM, Andrei Alexandrescu wrote:
 http://www.serversidemagazine.com/news/10-questions-with-facebook-research-engineer-andrei-alexandrescu/

Nice, I enjoyed reading it.
Jan 29 2012
prev sibling next sibling parent reply Caligo <iteronvexor gmail.com> writes:
2012/1/29 Andrei Alexandrescu <SeeWebsiteForEmail erdani.org>:
 http://www.serversidemagazine.com/news/10-questions-with-facebook-research-engineer-andrei-alexandrescu/

 Andrei

Learn how to learn? Could you elaborate, please? How did you learn how to learn?
Jan 29 2012
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 1/29/2012 6:16 PM, Caligo wrote:
 Learn how to learn?  Could you elaborate, please?  How did you learn
 how to learn?

I can't speak for Andrei, but I discovered after 4 years of university that I had become much better at learning new things. I attribute it to becoming more efficient at what kinds of effort I needed to make to master new material - I knew what worked for me and what didn't. One also cannot help but get better at anticipating what kinds of things will be on the examinations, so that's what you focus on.
Jan 29 2012
parent reply bearophile <bearophileHUGS lycos.com> writes:
Walter:

 On 1/29/2012 6:16 PM, Caligo wrote:
 Learn how to learn?  Could you elaborate, please?  How did you learn
 how to learn?

I can't speak for Andrei, but I discovered after 4 years of university that I had become much better at learning new things.

It's meta-learning (second order learning). There is a page on Wikipedia, but it's too much short and its quality is too much low: http://en.wikipedia.org/wiki/Meta_learning I believe that learning how to learn better is probably the most important thing to learn at the University. If you get good enough at learning, then many other things in life become possible. There are situations were people change (learn) how they learn to learn (third order learning), but this is a bit psychologically painful (I have not found stuff on Wikipedia about this, so you need to search in primary sources, like books by Seymour Papert). Bye, bearophile
Jan 29 2012
parent "Nick Sabalausky" <a a.a> writes:
 I can't speak for Andrei, but I discovered after 4 years of university 
 that I
 had become much better at learning new things.


 I believe that learning how to learn better is probably the most important 
 thing to learn at the University.

Bullshit, bullshit, bullshit. All you need to learn how to learn is a library, not a $100k debt payable to useless pompous windbags. The biggest thing colleges teach is that their existence is actually needed for anything. And even *that* much is pure grade-A bullcrap. Yea, you *can* learn such things at college: just like how I can sell you a $5k device to help you convert ice into water.
Jan 29 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Monday, 30 January 2012 at 05:17:21 UTC, Andrei Alexandrescu 
wrote:
 The difficult part is integrating with Apache.

Eh, it's not so bad. Make a .htaccess file: .htaccess: === Action dhp-script /cgi-bin/dhp AddHandler dhp-script .dhp === Drop in your files. hello.dhp === <?d cgi.write("Hello, world!"); ?> === NOTE: that is cgi.write, not writefln. This version uses my cgi library so you have all those awesomesauce functions. And in your cgi-bin folder, build dhp out of this file: http://arsdnet.net/dcode/dhp_cgi.d And drop my cgi.d into your /tmp directory. http://arsdnet.net/dcode/cgi.d End result? http://arsdnet.net/dhp/hello.dhp works. Of course, you'll see this is slow because it runs the compiler every time. If it used rdmd instead of dmd though, we'd get cache and it'd probably work pretty decently. (My computer doesn't have rdmd set up currently though.)
Jan 29 2012
prev sibling parent reply Bill Baxter <wbaxter gmail.com> writes:
--20cf3071ce304a643c04b7c63a27
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Jan 29, 2012 at 10:35 PM, Nick Sabalausky <a a.a> wrote:

 I can't speak for Andrei, but I discovered after 4 years of university
 that I
 had become much better at learning new things.


 I believe that learning how to learn better is probably the most

 thing to learn at the University.

Bullshit, bullshit, bullshit. All you need to learn how to learn is a library, not a $100k debt payable to useless pompous windbags. The biggest thing colleges teach is that their existence is actually needed for anything. And even *that* much is pure grade-A bullcrap. Yea, you *can* learn such things at college: just like how I can sell you a $5k device to help you convert ice into water. Libraries don't give you deadlines (except for when to return your books)

Some people need that. --bb --20cf3071ce304a643c04b7c63a27 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On Sun, Jan 29, 2012 at 10:35 PM, Nick Sabalausk= y <span dir=3D"ltr">&lt;a a.a&gt;</span> wrote:<br><blockquote class=3D"gma= il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef= t:1ex"> <div class=3D"im">&gt;&gt;<br> &gt;&gt; I can&#39;t speak for Andrei, but I discovered after 4 years of un= iversity<br> &gt;&gt; that I<br> &gt;&gt; had become much better at learning new things.<br> <br> &gt;<br> </div><div class=3D"im">&gt; I believe that learning how to learn better is= probably the most important<br> &gt; thing to learn at the University.<br> <br> </div>Bullshit, bullshit, bullshit. All you need to learn how to learn is a= <br> library, not a $100k debt payable to useless pompous windbags. The biggest<= br> thing colleges teach is that their existence is actually needed for<br> anything. And even *that* much is pure grade-A bullcrap.<br> <br> Yea, you *can* learn such things at college: just like how I can sell you a= <br> $5k device to help you convert ice into water.<br> <br><br></blockquote><div>Libraries don&#39;t give you deadlines (except fo= r when to return your books) or feedback on how well you are doing.</div><d= iv>Some people need that.</div><div><br></div><div>--bb=A0</div></div> --20cf3071ce304a643c04b7c63a27--
Jan 30 2012
parent "Nick Sabalausky" <a a.a> writes:
"Bill Baxter" <wbaxter gmail.com> wrote in message 
news:mailman.202.1327961928.25230.digitalmars-d-announce puremagic.com...
 On Sun, Jan 29, 2012 at 10:35 PM, Nick Sabalausky <a a.a> wrote:

 I can't speak for Andrei, but I discovered after 4 years of university
 that I
 had become much better at learning new things.


 I believe that learning how to learn better is probably the most

 thing to learn at the University.

Bullshit, bullshit, bullshit. All you need to learn how to learn is a library, not a $100k debt payable to useless pompous windbags. The biggest thing colleges teach is that their existence is actually needed for anything. And even *that* much is pure grade-A bullcrap. Yea, you *can* learn such things at college: just like how I can sell you a $5k device to help you convert ice into water.


Having deadlines doesn't need to cost $100k.
 or feedback on how well you are doing.

If you're relying on the tests to tell you how well you're doing, then you've already failed. *You* are by far the best person to know whether *you* understand something or not. A school's evaluation is *NOT* for the student's sake - it's purely for the school's/teacher's own accountability. It's inherently innacurate, but needed anyway simply because they can't read your mind for an "I understand" or "I don't get it" - but you *can* read your own mind, so for the student, test results are extra time, extra money and *less* accurate, all for no benefit.
 Some people need that.
 

Jan 30 2012