Feb 04 2012

CSS background color, opacity and alpha

Classified in: CSS,Internet explorerpaomic at 6:20 pm

If you need to have a background color with a background not fully opaque, i.e. with an alpha layer, here’s the sample CSS taht you need:

 

 

 

 

 

.alpha60 {
/* Fallback for web browsers that doesn't support RGBa */ 
background: rgb(0, 0, 0) transparent; 
/* RGBa with 0.6 opacity */ 
background: rgba(0, 0, 0, 0.6); 
/* For IE 5.5 - 7*/ 
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000); 
/* For IE 8*/ 
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)"; 
} 

the last two lines of the CSS are for older Internet Explorer browser, while Internet explorer 9 and the upcoming IE 10 fully support the alpha channel. The problem is that those browsers will use both the opacity lines, so you will have a double level of opacity, and a different behavor in IE9 and IE10 (strangely, in this case IE6-7 and Firefox Chrome Safari will behave the same!!). The best solution would be to add a conditional css inclusion and put the last two lines in an external browser, like this:

<!--[if lt IE 9]>
 <link rel="stylesheet" type="text/css" media="all" href="css/ie.css" />
<![endif]-->

and add the last two lines above in this file.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • blinkbits
  • BlinkList
  • blogmarks
  • BlogMemes
  • blogtercimlap
  • Blue Dot
  • Book.mark.hu
  • Bumpzee
  • co.mments
  • De.lirio.us
  • Fark
  • feedmelinks
  • Fleck
  • Furl
  • Gwar
  • kick.ie
  • Linkter
  • Ma.gnolia
  • MyShare
  • Netscape
  • NewsVine
  • Scoopeo
  • Simpy
  • Slashdot
  • Smarking
  • Spurl
  • StumbleUpon
  • Taggly
  • Technorati
  • Webride
  • YahooMyWeb
Tags:

Jan 28 2012

Single page authorization in CakePHP

Classified in: CakePHPpaomic at 4:55 pm

If you require the user to login in order to access a single page in cake PHP, and allow free access to the other pages, you could do a very simple thing. Edit you pages_controller.php file (or create one if you don’t have), and add this code to the beforeFilter funcition (create this function if it is not present in the file):

function beforeFilter()
    {
        // deny all pages
        $this->Auth->deny('*');
        // allow the pages you want to be freely accessible
        $this->Auth->deny(array('controller' => 'pages',
              'action' => 'display', 'home'));
        parent::beforeFilter();
    }

In this case you would deny, i.e. require the user to login, every page (with the * line), and allow the pages you want to be accessible. Pretty simple, isn’t it?

 

PS: you have to do this way because of the way Cake works: deny does not explicitely denies one page, but removes an allowed page from the allowed pages list, so doing the other way around (i.e. allowing every page and then denying each page) would not work.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • blinkbits
  • BlinkList
  • blogmarks
  • BlogMemes
  • blogtercimlap
  • Blue Dot
  • Book.mark.hu
  • Bumpzee
  • co.mments
  • De.lirio.us
  • Fark
  • feedmelinks
  • Fleck
  • Furl
  • Gwar
  • kick.ie
  • Linkter
  • Ma.gnolia
  • MyShare
  • Netscape
  • NewsVine
  • Scoopeo
  • Simpy
  • Slashdot
  • Smarking
  • Spurl
  • StumbleUpon
  • Taggly
  • Technorati
  • Webride
  • YahooMyWeb
Tags:

Oct 26 2011

User defined dictionary in Eclipse CDT

Classified in: Programmingpaomic at 1:06 pm

It may happen that you want to add words to a user dictionary while using Eclipse CDT. At first it seems that it does not work, since it keeps saying “A user dictionary is needed to add words. Do you want to configure it now?”, even though you specified a custom dictionary file! The problem is that you need to specify the dictionary both for the C/C++ spelling engine and for the default spelling engine (you can also use the same dictionary!). You can select the spelling engine from the dropdown that you find under General -> Editors -> Text editors -> Spelling menu.

HTH!

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • blinkbits
  • BlinkList
  • blogmarks
  • BlogMemes
  • blogtercimlap
  • Blue Dot
  • Book.mark.hu
  • Bumpzee
  • co.mments
  • De.lirio.us
  • Fark
  • feedmelinks
  • Fleck
  • Furl
  • Gwar
  • kick.ie
  • Linkter
  • Ma.gnolia
  • MyShare
  • Netscape
  • NewsVine
  • Scoopeo
  • Simpy
  • Slashdot
  • Smarking
  • Spurl
  • StumbleUpon
  • Taggly
  • Technorati
  • Webride
  • YahooMyWeb
Tags:

Sep 30 2011

Boost log linking problem with parse_formatter

Classified in: C/C++paomic at 10:27 am

While compiling boost log you may get a linker error like this:

 

undefined reference to `boost::log2_mt_nt5::formatter_types<char>::formatter_type boost::log2_mt_nt5::parse_formatter<char>(char const*, char const*)’

 

This is due to a missing library, specifically boost_log_setup, which you should add to the library list.

 

Happy coding!

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • blinkbits
  • BlinkList
  • blogmarks
  • BlogMemes
  • blogtercimlap
  • Blue Dot
  • Book.mark.hu
  • Bumpzee
  • co.mments
  • De.lirio.us
  • Fark
  • feedmelinks
  • Fleck
  • Furl
  • Gwar
  • kick.ie
  • Linkter
  • Ma.gnolia
  • MyShare
  • Netscape
  • NewsVine
  • Scoopeo
  • Simpy
  • Slashdot
  • Smarking
  • Spurl
  • StumbleUpon
  • Taggly
  • Technorati
  • Webride
  • YahooMyWeb
Tags: ,

May 26 2011

Add navigation arrows to jQuery tabs

Classified in: Javascriptpaomic at 9:56 am

I needed to add navigation arrows to a couple of jQuery tabs, it’s easy to implement by using a few functions:

suppose we have the following HTML:

<div id=”tabs”>
<ul>
<li><img id=”left” src=”left.png” alt=”" /></li>
<li>…</li>
<li><img id=”right” src=”right.png” alt=”" /></li>
</ul>

We can simply add this js code:

$(function() {
$tabs = $("#tabs").tabs();
$("#left").click(function(){ var ind = $tabs.tabs("option", "selected"); if(ind > 0) $tabs.tabs("select", ind-1);});
$("#right").click(function(){var ind = $tabs.tabs("option", "selected"); if(ind < $tabs.tabs("length")) $tabs.tabs("select", ind+1);});
});

The script also check that the selected tab is not outside the tabs limits, but I think this is done internally by the jQeury script itself.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • blinkbits
  • BlinkList
  • blogmarks
  • BlogMemes
  • blogtercimlap
  • Blue Dot
  • Book.mark.hu
  • Bumpzee
  • co.mments
  • De.lirio.us
  • Fark
  • feedmelinks
  • Fleck
  • Furl
  • Gwar
  • kick.ie
  • Linkter
  • Ma.gnolia
  • MyShare
  • Netscape
  • NewsVine
  • Scoopeo
  • Simpy
  • Slashdot
  • Smarking
  • Spurl
  • StumbleUpon
  • Taggly
  • Technorati
  • Webride
  • YahooMyWeb
Tags:

Next Page »