core error


What

!important declared after a CSS directive ensures that directive is applied preferred over other styles for the same locator no matter if the former is preceding the later or not.

Why

if you are combining several CSS files in a webpage you may need to have to define two or more different styles for the same locator. For these cases, by using the rule !important you can ensure that style is applied over other conflicting styles for the same element/s.

How

Here is a simple example to ilustrate how to use this rule:

p { color: #ff0000 !important; }
p { color: #000000; }

In this example all the <p> elements affected by this stylesheet will have a red color for the text inside instead of black.

Advertisements

Node.js

Posted on: 06/09/2011


What

Node.js is a programming framework based in Javascript. Node.js runs in the server side and it is events-driven.

Why

It was created to allow developers to build scalable network events-driven applications such as web servers.

How

Here is a ‘Hello world’ example of a web server in Node.js:

var http = require('http');

http.createServer(function (request, response) {
    response.writeHead(200, {'Content-Type': 'text/plain'});
    response.end('Hello World\n');
}).listen(8000);

console.log('Server running at http://127.0.0.1:8000/');

 

 


Cross Site Scripting is a type of computer security vulnerability in web applications which consists in inserting JavaScript code into the attacked page’s html/js code.

For example:


With this setup and if the site is not well protected we could inject some code really easily:

Any website allowing users to send data which is going to be part of the page itself (forums, blogs, forms, etc.) is a potential victim form XSS. To protect our sites from this technique we should server-sid detect any dangerous input coming from the users and escape it or strip it when displaying our html/javascript code.

Google App Engine is a platform for web applications development and hosting in the cloud. If you don’t own a domain you can use the one the platform provides: <mysite>.appspot.com

All applications in Google App Engine must be written in Python, Java or Go. Frameworks (like Django) and modules are supported but developers have the applications have read only access to the file system, so the only possibily of writing files from the app would be through a virtual file system.

The data store is accessed not through SQL but through ‘GQL’, a SQL-like language which doesn’t allow to perform any kind of joins.


Finally Symfony 2.0 was released. This is one of the most popularPHP framworks and now it has been reinvented with this list of new features:

  • It fully follows the PHP standards
  • Extensively uses dependency injection
  • Big improvement in performance
  • Decoupled in 21components all of the separately available in git

For people coming from symfony1 a cookbook has been created showing how the old version differs from the new one.

Steps

In this sample we will create a button to the right of the address bar which will display a fancy popup showing a clock

  1. Create a folder in your hard drive containing two files: manifest.json and popup.html
  2. Add into manifest.json all the information related to your extension. For example: 
    {
      "name": "My First Extension",
      "browser_action": {
        "default_icon": "icon.png",
        "popup": "popup.html"
      }
    }
    
  3. Add the logic of the extension inside the popup.html file. You can use regular HTML, javascript and CSS. For Example:
    <script type="text/javascript">
       //javascript code to display a clock inside the div
    </script>
    
  4. Go to Chrome, click on the    icon, go to Tools > Extensions and load  your unpacked extension from the folder you created
Using Chrome API
Going to this url you can read about all the modules and methods that you can use to enrich your application. For example:
  • chrome.browserAction.setPopup(object details) will let you choose which HTML page to show in the popup (in case you provided more than one)
  • chrome.tabs.executeScript(null, object details) will inject javascript code into the page currently showing in the active tab
  • chrome.tabs.update(null, object updateProperties) will change the properties of the active tab. For example, the url displayed on it

    • Justin Cooney: Great comic, this made me laugh!
    • Justin Cooney: Interesting, I didn't know about the Google App Engine, I'm glad I found your article on it!

    Categories