Feb 20 2016

Dompdf margin on page

Classified in: Softwarepaomic at 3:43 pm

I’m back!

A quick suggestion in case you have problems with setting the page amrgins in DOMPdf! In order to set the margin for the page using CSS you would need to do this:

@page { margin: 10px 20px 30px 40px; }

If it does not work though you may add !importante at the end:

@page { margin: 10px 20px 30px 40px !important; }

Hope this helps!


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" />

and add the last two lines above in this file.


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
        // allow the pages you want to be freely accessible
        $this->Auth->deny(array('controller' => 'pages',
              'action' => 'display', 'home'));

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.


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.



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!

Tags: ,

Next Page »