Our Recommendation

Sunday, December 19, 2010

Perfect Xmas gift: Computer Engineer Barbie (Cnet)

This is the period of the year, when you try to calculate how little time you can spend purchases for people trying to shortly that buying things possible things for you.

Online shopping has helped greatly in this respect. You can view your friends and your nearest family how much you love without leaving your bed.

However, there are so many choices that can become addled.

Leave me your burden of lifting and it launch into space. Ideal Christmas gift is here. Yes, Barbie computer engineering.

Perhaps you had assumed that Barbie is, at heart, always a kept woman. It is not cheap to keep blonde locks so perfectly capped. It takes a long time to keep her legs lissome and his belly.

(Credit: screenshot: Chris Matyszczyk/CNET)

And yet, when according to Mattel Barbie managers, famous women can now be stolen in a chic geek version. Yes, the Barbie computer engineer.

Here's his clutches rose natty portable sound and port to dazzling pink glasses framed. It has dishes shoes and a T-shirt with an extreme extraction cause binary code.

Its managers - and no doubt his lawyer - declare also computer engineer Barbie was the first professional after having voted by a jury, Lord Barbie, who knows?

You can consider that only a girl would have inspired Barbie computer engineering. I consider you more nearsighted than a Cyclops with a cataract.

There are certainly quite a few men, deeply involved in the coding and the dream of Zuckerbergian, too busy to meet a girl which would correspond to the height of their ultimate social network for two persons. Computer engineer Barbie would certainly provide a perfect symbol of a life that could be.

For those who love their gifts for Christmas to come with a host of features, could cite the Mattel site? "The source of inspiration set also comes with a special code which unlocks career on the theme of content online for even more digital game (how appropriate)!

Is there a human being with any ambition could resist the notion of digital game even more this Christmas?

24 Hours (daringfireball.net)

You may have heard that Delicious stops (or not?). A person on Twitter suggested that a group of engineers should gather on weekends and build a Delicious clone. In anticipation of this group of mystery people sitting and in doing so, I thought that I would like to make a quick todo list for them.

System account - you will need to adopt the standard model that are typical of a web application: accounts.Register hold and installing an SSL cert to appease the security database-oriented. Also: where you host it? What database? MySQL? Good. InnoDB? If you are deploying with another engineer, the typical conversation 30 minutes on the deployment of databases have all two hours.Decide on the ORM or simply write some lightweight classes that are tedious shit. We hope that you have selected a frame has some support for all otherwise… vérificationMéthodes to check email, length and force password user account template options, a good idea of the names of account that you want to hold back so that you can still do as /admin /static on.Lost password flow paths later. You want to generate a key and store the defeat for when someone asks to reset their password. This is another email which must go out.Sign flow.Sign flows. (Be sure and use POST method to sign.) See why here<- signs="" you="" out="" of="" delicious)sign="" up,="" display="" errors.update="" your="" settings,="" name,="" password,="" email—doh!="" you'll="" have="" to="" verify="" the="" email="" again.="" an="" account="" verification="" system="" done="" through="" email="" so="" you="" can="" verify="" people="" have="" given="" the="" correct="" information.scheduled="" backups="" of="" your="" database="" being="" pushed="" to="" a="" separate="" location.="" binlogs?="" mysqldump?="" you'll="" have="" to="" write="" a="" script="" or="" configure="" your="" off-site="" db="" slave.="" you="" might="" also="" want="" to="" test="" that="" it="" works.oh="" hey,="" you="" can="" delete="" your="" account="" on="" delicious?="" what="" does="" this="" mean="" for="" the="" bookmarks,="" favorites,="" and="" friend="" relationship="" interfaces="" you="" haven't="" even="" written="" yet?="" save="" that="" one="" for="" later="" i="" guess.following="" and="" being="" followed="" flow.="" this="" includes:="" a="" database="" for="" holding="" friend="" relationships.="" an="" interface="" for="" looking="" at="" everyone="" you="" follow.an="" interface="" for="" looking="" at="" everyone="" who="" follows="" you.ability="" on="" each="" of="" the="" above="" pages="" to="" follow="" (or="" unfollow),="" probably="" using="" ajax="" because="" people="" don't="" want="" to="" leave="" the="" page.="" also="" you're="" going="" to="" want="" to="" paginate="" that,="" some="" people="" are="" popular.blocking="" followers="" and="" the="" processes="" that="" recognize="" a="" follower="" has="" been="" blocked="" when="" displaying="" content.the="" required="" database="" indexes="" for="" extracting="" and="" displaying="" follower="" counts.so="" before="" we="" get="" to="" bookmarks,="" what="" about="" import="" tools?="" why="" would="" anyone="" move="" to="" your="" system="" without="" import="" tools?="" you="" will="" need:="" a="" task="" queue.="" hopefully="" distributed="" so="" you="" can="" pass="" importing="" off="" to="" your="" workers="" on="" other="" boxes="" when="" things="" get="" overloaded.some="" sense="" of="" the="" different="" formats="" you'll="" need="" to="" process.="" delicious="" being="" the="" big="" one,="" but="" there's="" google's="" product,="" diigo,="" xmarks="" and="" pinboard.="" also="" people="" are="" going="" to="" want="" to="" import="" from="" their="" browsers.="" i'm="" not="" even="" talking="" about="" actually="" processing="" these="" things,="" just="" understanding="" and="" researching="" the="" formats="" and="" pitfalls="" is="" going="" to="" take="" some="" time.actually="" doing="" the="" processing.="" what="" happens="" when="" something="" fails?="" do="" you="" offer="" a="" report?="" there's="" a="" new="" page.="" can="" they="" retry="" without="" duplicating="" inserts?="" i'm="" really="" only="" scratching="" the="" surface="" here,="" this="" is="" tedious="" shit.tags.="" related="" tags.="" searching="" tags.="" recent="" tags.="" explore="" tags.="" you="" gotta="" use="" that="" task="" queue="" for="" offloading="" a="" lot="" of="" this.="" when="" does="" it="" run?="" what="" happens="" when="" it="" fails?="" seriously,="" i="" don't="" even="" want="" to="" think="" about="" tags="" right="" now.="" there="" has="" to="" be="" a="" module="" out="" there="" that="" will="" do="" it.="" go="" read="" the="" docs="" to="" that.three="" letters:="" a="" p="" &="" i.you="" are="" going="" to="" write="" unit="" tests="" for="" all="" this,="">

You still do not fully inspected all your problems XSS, implemented research content, thinking about the design and UI, documentation and errors, different methods for storing links as bookmarklets (tested in all browsers) or, you know, actually record in a database for the presentation to you and other bookmarks.

Then there is a pattern in the URL which can be problematic (http://xyz.com/ versus http://www.xyz.com versus https://xyz.com/ versus http://xyz.com/index.html), I never really thought about this problem, I am certain that it will take only a few minutes. We deal with later.

(Thanks to usernameguy and Anil for some inspiration.)


If you are photographing and you know typing your hands (Hackaday.com)

If you've ever tried to take photos of yourself, you'll know that it can be a pain. It is particularly difficult to get this shot perfect your strokes piétés when you're out of breath Sprint across the room. OK, Yes, they have remote controls to do this. But what happens if you have lost your remote control or you simply want to have to wear? [LucidScience] set up a sweet, um, "handsfree" alternative.

Essentially, this hack emulates IR signals sent by a remote, Nikon is to take a picture immediately or to take pictures of time at regular intervals. We have seen a similar time remote using an arduino before and a really thorough to an AVR, but they do not take the same approach as [LucidScience] design in terms of monitoring of microphone to trigger input. The project includes several status LEDs and adjustments of ambient noise and triggering, and it can be mounted to the camera body. We wonder how Nikon features could be controlled using typing code and detail your calendar should have some sort of facts in hand (get it?) pulsetrain syntax.  You will probably need to have the world record of typing skills.

Discover the demo vid after the break.

Santa-pede challenge: conclusion (Hackaday.com)

At the end of October, we announced the purchase, pause, series generate kick off with "Santa-pede challenge."  The objective was to get your hands on one of those annoying dancing santas, it tear, and then use its parts to build something that works. We obtained our hands on some cool and same price received [Phillip Torrone] a judge of the guest. Join us after the break to see what we are up to with and may have a few laughs.

So, as you can see in the video, this competition has been a complete failure. We get a single entry. I've quickly discarded this terribly lame attempt in about 30 minutes. I am going to show some pictures of what I did, just for fun. There really are technically "walking" so far as it strangely scoots across your desk making you think about your life decisions.

Here is the beginning of the disassembly. Nothing surprising here. You can see that its half less is a piece of solid plastic (step joints or motorized).

Here are basic breakdown of what I did. I cut feet, radiation servo that his hat to flip back and forth and fade things leg room. There is a thread that went into the arms of Santa Claus. It was too thin and flexible to be useful for a large part of something that I simply thrown in the dustbin of parts.

I couldn't find the attachment to my flame propane, so I was using some tactics quite dubious. I would not recommend water heater for your flexible plastic for most projects. It do the job well.  After putting this piece, all I had to make a tweak "legs" newly created until he himself pulled forward. Its pretty pathetic, I know. It should be the entrance to joke that everyone else seems to good.

What we would like to have ideas. What ideas competition you? What you would compete in? Can what element you think of that has tons of potential hacking for a variety of skill levels?

NVIDIA: Games on next generation Intel chip (CNet)

Supplier of graphics chip Nvidia said that he would do very well despite claims by Intel's next-generation chip will offer higher octane game experience.

Nvidia discrete graphics chips are in Apple's 15- and 17-inch MacBook Pros.Graphics NVIDIA discrete chips are in Apple's 15 and 17-inch MacBook Pros.(Credit: Apple)

Supposed to debut in the Consumer Electronics Show on 5 January, the second-generation Intel Core - aka "Sandy Bridge" - has improved graphics performance, enabling manufacturers to provide computers portable low-cost are more adept at games and multimedia. In short, no additional graphics chip from Nvidia and Advanced Micro Devices is required in some laptop models.

But Rene Haas, CEO, mobile products, Nvidia, says the need for autonomous GPU or graphics processing units or integrated - to handle games becoming more demanding and fluxes of multimedia data beyond the capacity of its integrated - graphics changes next year. "We get in 2011 and watch the Sandy Bridge our point of view is that the world will not change much to our (autonomous) discrete GPUS,"says Haas.""

Haas has continued. "We spoke to many [the manufacturers] about it." The comments we received is that many of the same questions remain concerning [Intel graphics] performance. If you examine the possibility of playing games next year, what will be the integrated graphical component proofing in the future? For example, Windows 7 DX - 11 (DirectX 11) does not work on integrated graphical Sandy Bridge. And the GPU acceleration comes now to Mariners - IE9, Mozilla (Firefox), chromium (Google). "[Browser acceleration] is not at all there yet, but having the ability to provide it will be quite big," he said.

In support of its assertion that the demand for graphics cards is healthy, quoted Nvidia analyst in a communiqué sent on Thursday. "[Manufacturers] application chart discrete solutions remains strong and above historical levels," in accordance with the statement made by Dean McCarron of mercury, which tracks the graphics chip market. "Mercury Research provides discrete GPU shipments will double between 2009 and 2014."

Haas, explains its technology Optimus, which can switch between Intel and Nvidia - discrete GPU graphics transparent depending on energy savings and performance requirements respectively - will be offered on most of the more than 200 models of laptops equipped with Nvidia coming in 2011. Optimus toggles between Intel and Nvidia silicon based on the application, said Haas system. "Optimus decides, based on the classification of the request, what processor (Intel or Nvidia) to run on." For example, a game is running on the GPU. If video in standard definition, such as DVDs, it runs on the integrated graphics as integrated graphics runs standard definition low power. High-definition video will run on the GPU, "he said, as some salient examples."

NVIDIA, says that he checked WINS Acer, Alienware, Asus, Dell, Fujitsu-Siemens, HP, Lenovo, Samsung, Sony and Toshiba design in 2011.

Saturday, December 18, 2010

PHP 5.2.16 released! (php.net)

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. If you are new to PHP and want to get some idea of how it works, try the introductory tutorial. After that, check out the online manual, and the example archive sites and some of the other resources available in the links section.


Ever wondered how popular PHP is? see the Netcraft Survey.


You can grab our news as an Atom feed.

[16-Dec-2010]

The PHP development team would like to announce the immediate availability of PHP 5.2.16. This release marks the end of support for PHP 5.2. All users of PHP 5.2 are encouraged to upgrade to PHP 5.3.


This release focuses on addressing a regression in open_basedir implementation introduced in 5.2.15 in addition to fixing a crash inside PDO::pgsql on data retrieval when the server is down. All users who have upgraded to 5.2.15 and are utilizing open_basedir are strongly encouraged to upgrade to 5.2.16 or 5.3.4.


To prepare for upgrading to PHP 5.3, now that PHP 5.2's support ended, a migration guide available on www.php.net/migration53, details the changes between PHP 5.2 and PHP 5.3.


For a full list of changes in PHP 5.2.16 see the ChangeLog at www.php.net/ChangeLog-5.php#5.2.16.

[10-Dec-2010]

The PHP development team is proud to announce the immediate release of PHP 5.3.4. This is a maintenance release in the 5.3 series, which includes a large number of bug fixes.


Security Enhancements and Fixes in PHP 5.3.4:

Fixed crash in zip extract method (possible CWE-170).Paths with NULL in them (foo\0bar.txt) are now considered as invalid (CVE-2006-7243).Fixed a possible double free in imap extension (Identified by Mateusz Kocielski). (CVE-2010-4150).Fixed NULL pointer dereference in ZipArchive::getArchiveComment. (CVE-2010-3709).Fixed possible flaw in open_basedir (CVE-2010-3436).Fixed MOPS-2010-24, fix string validation. (CVE-2010-2950).Fixed symbolic resolution support when the target is a DFS share.Fixed bug #52929 (Segfault in filter_var with FILTER_VALIDATE_EMAIL with large amount of data) (CVE-2010-3710).

Key Bug Fixes in PHP 5.3.4 include:

Added stat support for zip stream.Added follow_location (enabled by default) option for the http stream support.Added a 3rd parameter to get_html_translation_table. It now takes a charset hint, like htmlentities et al.Implemented FR #52348, added new constant ZEND_MULTIBYTE to detect zend multibyte at runtime.Multiple improvements to the FPM SAPI.Over 100 other bug fixes.

For users upgrading from PHP 5.2 there is a migration guide available here, detailing the changes between those releases and PHP 5.3.


For a full list of changes in PHP 5.3.4, see the ChangeLog. For source downloads please visit our downloads page, Windows binaries can be found on windows.php.net/download/.

[09-Dec-2010]

The PHP development team would like to announce the immediate availability of PHP 5.2.15. This release marks the end of support for PHP 5.2. All users of PHP 5.2 are encouraged to upgrade to PHP 5.3.


This release focuses on improving the security and stability of the PHP 5.2.x branch with a small number, of predominatly security fixes.


Security Enhancements and Fixes in PHP 5.2.15:

Fixed extract() to do not overwrite $GLOBALS and $this when using EXTR_OVERWRITE.Fixed crash in zip extract method (possible CWE-170).Fixed a possible double free in imap extension.Fixed possible flaw in open_basedir (CVE-2010-3436).Fixed NULL pointer dereference in ZipArchive::getArchiveComment. (CVE-2010-3709).Fixed bug #52929 (Segfault in filter_var with FILTER_VALIDATE_EMAIL with large amount of data).

Key enhancements in PHP 5.2.15 include:

Fixed bug #47643 (array_diff() takes over 3000 times longer than php 5.2.4).Fixed bug #44248 (RFC2616 transgression while HTTPS request through proxy with SoapClient object).

To prepare for upgrading to PHP 5.3, now that PHP 5.2's support ended, a migration guide available on www.php.net/migration53, details the changes between PHP 5.2 and PHP 5.3.


For a full list of changes in PHP 5.2.15 see the ChangeLog at http://www.php.net/ChangeLog-5.php#5.2.15.

[22-Jul-2010]

The PHP development team would like to announce the immediate availability of PHP 5.3.3. This release focuses on improving the stability and security of the PHP 5.3.x branch with over 100 bug fixes, some of which are security related. All users are encouraged to upgrade to this release.


Backwards incompatible change:

Methods with the same name as the last element of a namespaced class name will no longer be treated as constructor. This change doesn't affect non-namespaced classes.

namespace Foo;
class Bar {
public function Bar() {
// treated as constructor in PHP 5.3.0-5.3.2
// treated as regular method in PHP 5.3.3
}
}
?>


There is no impact on migration from 5.2.x because namespaces were only introduced in PHP 5.3.


Security Enhancements and Fixes in PHP 5.3.3:

Rewrote var_export() to use smart_str rather than output buffering, prevents data disclosure if a fatal error occurs (CVE-2010-2531).Fixed a possible resource destruction issues in shm_put_var().Fixed a possible information leak because of interruption of XOR operator.Fixed a possible memory corruption because of unexpected call-time pass by refernce and following memory clobbering through callbacks.Fixed a possible memory corruption in ArrayObject::uasort().Fixed a possible memory corruption in parse_str().Fixed a possible memory corruption in pack().Fixed a possible memory corruption in substr_replace().Fixed a possible memory corruption in addcslashes().Fixed a possible stack exhaustion inside fnmatch().Fixed a possible dechunking filter buffer overflow.Fixed a possible arbitrary memory access inside sqlite extension.Fixed string format validation inside phar extension.Fixed handling of session variable serialization on certain prefix characters.Fixed a NULL pointer dereference when processing invalid XML-RPC requests (Fixes CVE-2010-0397, bug #51288).Fixed SplObjectStorage unserialization problems (CVE-2010-2225).Fixed possible buffer overflows in mysqlnd_list_fields, mysqlnd_change_user.Fixed possible buffer overflows when handling error packets in mysqlnd.

Key enhancements in PHP 5.3.3 include:

Upgraded bundled sqlite to version 3.6.23.1.Upgraded bundled PCRE to version 8.02.Added FastCGI Process Manager (FPM) SAPI.Added stream filter support to mcrypt extension.Added full_special_chars filter to ext/filter.Fixed a possible crash because of recursive GC invocation.Fixed bug #52238 (Crash when an Exception occured in iterator_to_array).Fixed bug #52041 (Memory leak when writing on uninitialized variable returned from function).Fixed bug #52060 (Memory leak when passing a closure to method_exists()).Fixed bug #52001 (Memory allocation problems after using variable variables).Fixed bug #51723 (Content-length header is limited to 32bit integer with Apache2 on Windows).Fixed bug #48930 (__COMPILER_HALT_OFFSET__ incorrect in PHP >= 5.3).

For users upgrading from PHP 5.2 there is a migration guide available on www.php.net/migration53, detailing the changes between those releases and PHP 5.3.


For a full list of changes in PHP 5.3.3, see the ChangeLog.

[22-Jul-2010]

The PHP development team would like to announce the immediate availability of PHP 5.2.14. This release focuses on improving the stability of the PHP 5.2.x branch with over 60 bug fixes, some of which are security related.


This release marks the end of the active support for PHP 5.2. Following this release the PHP 5.2 series will receive no further active bug maintenance. Security fixes for PHP 5.2 might be published on a case by cases basis. All users of PHP 5.2 are encouraged to upgrade to PHP 5.3.


Security Enhancements and Fixes in PHP 5.2.14:

Rewrote var_export() to use smart_str rather than output buffering, prevents data disclosure if a fatal error occurs.Fixed a possible interruption array leak in strrchr().(CVE-2010-2484)Fixed a possible interruption array leak in strchr(), strstr(), substr(), chunk_split(), strtok(), addcslashes(), str_repeat(), trim().Fixed a possible memory corruption in substr_replace().Fixed SplObjectStorage unserialization problems (CVE-2010-2225).Fixed a possible stack exaustion inside fnmatch().Fixed a NULL pointer dereference when processing invalid XML-RPC requests (Fixes CVE-2010-0397, bug #51288).Fixed handling of session variable serialization on certain prefix characters.Fixed a possible arbitrary memory access inside sqlite extension. Reported by Mateusz Kocielski.

Key enhancements in PHP 5.2.14 include:

Upgraded bundled PCRE to version 8.02.Updated timezone database to version 2010.5.Fixed bug #52238 (Crash when an Exception occured in iterator_to_array).Fixed bug #52237 (Crash when passing the reference of the property of a non-object).Fixed bug #52041 (Memory leak when writing on uninitialized variable returned from function).Fixed bug #51822 (Segfault with strange __destruct() for static class variables).Fixed bug #51552 (debug_backtrace() causes segmentation fault and/or memory issues).Fixed bug #49267 (Linking fails for iconv on MacOS: "Undefined symbols: _libiconv").

To prepare for upgrading to PHP 5.3, now that PHP 5.2's support ended, a migration guide available on http://php.net/migration53, details the changes between PHP 5.2 and PHP 5.3.


For a full list of changes in PHP 5.2.14 see the ChangeLog at http://www.php.net/ChangeLog-5.php#5.2.14.

News Archive

ASP.NET MVC 3: code implicit and explicit nuggets with knife (Weblogs @ ASP.NET)

This is another in a series of posts I’m doing that cover some of the new ASP.NET MVC 3 features:


In today’s post I’m going to discuss how Razor enables you to both implicitly and explicitly define code nuggets within your view templates, and walkthrough some code examples of each of them. 


ASP.NET MVC 3 ships with a new view-engine option called “Razor” (in addition to the existing .aspx view engine).  You can learn more about Razor, why we are introducing it, and the syntax it supports from my Introducing Razor blog post.


Razor minimizes the number of characters and keystrokes required when writing a view template, and enables a fast, fluid coding workflow. Unlike most template syntaxes, you do not need to interrupt your coding to explicitly denote the start and end of server blocks within your HTML. The Razor parser is smart enough to infer this from your code. This enables a compact and expressive syntax which is clean, fast and fun to type.


For example, the Razor snippet below can be used to iterate a collection of products and output a

    list of product names that link to their corresponding product pages:


    image


    When run, the above code generates output like below:


    image


    Notice above how we were able to embed two code nuggets within the content of the foreach loop.  One of them outputs the name of the Product, and the other embeds the ProductID within a hyperlink.  Notice that we didn’t have to explicitly wrap these code-nuggets - Razor was instead smart enough to implicitly identify where the code began and ended in both of these situations. 


    Razor does not define its own language.  Instead, the code you write within Razor code nuggets is standard C# or VB.  This allows you to re-use your existing language skills, and avoid having to learn a customized language grammar.


    The Razor parser has smarts built into it so that whenever possible you do not need to explicitly mark the end of C#/VB code nuggets you write.  This makes coding more fluid and productive, and enables a nice, clean, concise template syntax.  Below are a few scenarios that Razor supports where you can avoid having to explicitly mark the beginning/end of a code nugget, and instead have Razor implicitly identify the code nugget scope for you:


    Property Access


    Razor allows you to output a variable value, or a sub-property on a variable that is referenced via “dot” notation:


    image


    You can also use “dot” notation to access sub-properties multiple levels deep:


    image


    Array/Collection Indexing:


    Razor allows you to index into collections or arrays:


    image


    Calling Methods:


    Razor also allows you to invoke methods:


    image


    Notice how for all of the scenarios above how we did not have to explicitly end the code nugget.  Razor was able to implicitly identify the end of the code block for us.


    The below algorithm captures the core parsing logic we use to support “@” expressions within Razor, and to enable the implicit code nugget scenarios above:

    Parse an identifier - As soon as we see a character that isn't valid in a C# or VB identifier, we stop and move to step 2 Check for brackets - If we see "(" or "[", go to step 2.1., otherwise, go to step 3  Parse until the matching ")" or "]" (we track nested "()" and "[]" pairs and ignore "()[]" we see in strings or comments) Go back to step 2 Check for a "." - If we see one, go to step 3.1, otherwise, DO NOT ACCEPT THE "." as code, and go to step 4 If the character AFTER the "." is a valid identifier, accept the "." and go back to step 1, otherwise, go to step 4 Done!

    Differentiating between code and content


    Step 3.1 is a particularly interesting part of the above algorithm, and enables Razor to differentiate between scenarios where an identifier is being used as part of the code statement, and when it should instead be treated as static content:


    image


    Notice how in the snippet above we have ? and ! characters at the end of our code nuggets.  These are both legal C# identifiers – but Razor is able to implicitly identify that they should be treated as static string content as opposed to being part of the code expression because there is whitespace after them.  This is pretty cool and saves us keystrokes.


    Razor is smart enough to implicitly identify a lot of code nugget scenarios.  But there are still times when you want/need to be more explicit in how you scope the code nugget expression.  The @(expression) syntax allows you to do this:


    image


    You can write any C#/VB code statement you want within the @() syntax.  Razor will treat the wrapping () characters as the explicit scope of the code nugget statement.  Below are a few scenarios where we could use the explicit code nugget feature:


    Perform Arithmetic Calculation/Modification:


    You can perform arithmetic calculations within an explicit code nugget:


    image


    Appending Text to a Code Expression Result:


    You can use the explicit expression syntax to append static text at the end of a code nugget without having to worry about it being incorrectly parsed as code:


    image


    Above we have embedded a code nugget within an element’s src attribute.  It allows us to link to images with URLs like “/Images/Beverages.jpg”.  Without the explicit parenthesis, Razor would have looked for a “.jpg” property on the CategoryName (and raised an error).  By being explicit we can clearly denote where the code ends and the text begins.


    Using Generics and Lambdas


    Explicit expressions also allow us to use generic types and generic methods within code expressions – and enable us to avoid the <> characters in generics from being ambiguous with tag elements.


    We have used code nuggets within HTML attributes in several of the examples above.  One nice feature supported by the Razor code editor within Visual Studio is the ability to still get VB/C# intellisense when doing this.


    Below is an example of C# code intellisense when using an implicit code nugget within an href=”” attribute:


    image


    Below is an example of C# code intellisense when using an explicit code nugget embedded in the middle of a src=”” attribute:


    image


    Notice how we are getting full code intellisense for both scenarios – despite the fact that the code expression is embedded within an HTML attribute (something the existing .aspx code editor doesn’t support).  This makes writing code even easier, and ensures that you can take advantage of intellisense everywhere.


    Razor enables a clean and concise templating syntax that enables a very fluid coding workflow.  Razor’s ability to implicitly scope code nuggets reduces the amount of typing you need to perform, and leaves you with really clean code.


    When necessary, you can also explicitly scope code expressions using a @(expression) syntax to provide greater clarity around your intent, as well as to disambiguate code statements from static markup.


    Hope this helps,


    Scott


    P.S. In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu