Monthly Archives: March 2014

CSS3 – change image – blur, brightness, saturation, hue, contrast, invert colors, grayscale and sepia

So, if you plan to change some of image properties with CSS filter is your solution.

-webkit-filter: filter(value);
-moz-filter: filter(value);
-o-filter: filter(value);
-ms-filter: filter(value);

You can replace filter with the following values

  • blur
  • brightness
  • saturate,
  • hue-rotate
  • contrast
  • invert
  • grayscale
  • sepia

Example

filter: invert(100%);
// Browser Specific
-webkit-filter: invert(100%);
-moz-filter: invert(100%);
-o-filter: invert(100%);
-ms-filter: invert(100%);

Concat/concatenate then

filter: blur(5px) brightness(0.5);

 

More readings

http://codepen.io/rss/pen/ftnDd
http://www.inserthtml.com/2012/06/css-filters/

Top 5 security flaws within websites and how to prevent them

So we’re now into 2014 and websites are starting to become way more advanced by implementing new technologies such as AJAX, fancy web forms and even web sockets. However, little do webmaster’s realise that they’re opening a space for huge security flaws within their websites / web applications / web services for malicious hackers to take advantage of.

Read more at http://joel-murphy.com/top-5-security-flaws-within-websites-and-how-to-prevent-them/

 

Fatal error: Class ‘DOMDocument’ not found

I was moving a WP from a host to another, and using the WordPress Importer while loading the XML of the export “Fatal error: Class ‘DOMDocument’ not found“.

We have two solutions

  • Install the php-xml package on your server.
  • Replace in file parsers.php in plugin wordpress-importer at class WXR_Parser_SimpleXML

Replace in file parsers.php in plugin wordpress-importer at Class WXR_Parser_SimpleXML

Change

$dom = new DOMDocument;
$old_value = null;
if ( function_exists( 'libxml_disable_entity_loader' ) ) {
$old_value = libxml_disable_entity_loader( true );
}
$success = $dom->loadXML( file_get_contents( $file ) );
if ( ! is_null( $old_value ) ) {
libxml_disable_entity_loader( $old_value );
}if ( ! $success || isset( $dom->doctype ) ) {
return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
}$xml = simplexml_import_dom( $dom );
unset( $dom );

For:

$xml = simplexml_load_file($file);

Displaying charts in tabs

I have two amcharts on different tabs. A stock chart to be place on #chartdiv and a pie chart to be placed on #chartdivpie. This is how I solved my problem.

My custom css – to overwrite bootstrap –

#chartdivpie { width: 1138px; height: 500px; }
.tab-content .tab-pane {
   position: absolute;
   top: -9999px;
   left: -9999px;
   display: inline;
}
.tab-content .tab-pane.active {
    position: inherit !important;
}

JQuery call

$('#myTab a').click(function (e) {
      e.preventDefault()
        $(this).tab('show');
        chart.invalidateSize();
        chart.write('chartdiv');
    })

 

See the discussion here http://stackoverflow.com/questions/10013408/amcharts-doesnt-display-chart-for-initially-hidden-divs/22289182#22289182