Category Archives: web development

[oracle] set default schema

To set default schema for all queries (and avoid prefixing all tables), execute below statement in active db session: Alter session set current_schema = USR where “USR” is schema to use by default

oracle – update rows using joins and select statement

To update rows resulting from join of several tables, use following syntax in oracle: MERGE INTO table_to_update t USING (select field1, field2 from other_table) t2 ON (trim(t.field1 = t2.field1) WHEN MATCHED THEN UPDATE SET t.field3 = t2.field2 where t.field3 = t2.field2 and t.field4 like ‘%DUMMY%’; example: sources

steps to change wordpress db table prefixes after installation

In below tutorial, we will see how to change wordpress db table prefix from ‘wp_’ into ‘wp2_’ without breaking wordpress. Adapt below content to match both your source and target table prefixes. Here are the steps to change wordpress db table prefixes without breaking the websites: backup your current db (=> export it into a file stored somewhere safe and accessible) update all option names starting with old prefix in table named ‘wp_options’. Entries can be identified by running query: select * from wp_options where option_name like ‘wp_%’ Update field ‘option_name’ for all the entries, one by one. update all […]

silence camera sound when taking picture in samsung galaxy s3 4g

Unfortunately there is no menu allowing to turn off sound when takin gpictures with my samsung s3 4g. Even when all sound volumes are set to no-sound levels, camera is still generating noise! Here is how I did to turn it off forever: It is necessary to gain root access: SRSRoot Once Click Root free software worked fine for me (second rooting method) Once rooting is successful, install adb and connect via console to your phone by running adb shell From within the shell, activate root user by running su At this stage, connection is still read-only, it is now […]

javascript: suffle array (one-line script)

Here is a fantastic way to shuffle an array in javascript: myArray.sort(function() {return 0.5 – Math.random()}); So simple yet so efficient, I love it sources

wordpress: prevent direct access to file from outside the workflow

Let’s say you don’t want users to access your script file via typing it’s url in the browser, here is a simple way for instance to make sure wordpress framework has been loaded and section is admin section: if (!defined(‘WP_ADMIN’)) { die(‘direct access not permitted’); }

gmap api: hide street view and hide possibility to change map type (terrain to satelite for instance)

To disable street view and possibility to change map type is pretty easy, when initializing the map, simple set the corresponding variables to false: street view: streetViewControl: false map type: mapTypeControl: false Proof below: var mapOptions = { center: new google.maps.LatLng(46, 2), zoom: 0, mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: false, mapTypeControl: false }; gmap = new google.maps.Map(document.getElementById(“rdw-gmap-canvas”),    mapOptions); sources

wp automatically escaping global vars!

This thing is incredible. Php has been telling people for ages that variables should not be automatically escaped, that it was an error to the extent they even removed this feature altogether starting from php 5.4. Guess what? WordPress has it’s own behavior to escape the global vars on its own! independently from php! And even better, they know it for more than a year and there is no native way to deactivate this! Before wp is loaded: var_dump($_GET[‘var’]); //string ‘st laurent d” (length=13) Single quote at end of string is unescaped. After wp is loaded: var_dump($_GET[‘var’]); //string ‘st laurent […]

wordpress: add css file for your plugin admin page only

If you want to add a css file that is loaded only when your plugin admin page is displayed, here is how to do it: Step 1: attach to appropriate hook: add_action(‘admin_enqueue_scripts’, ‘myplugin_loadAdminCss’); Step 2: inside your hooked function, filter on provided parameter: function myplugin_loadAdminCss($hook) {         if ((‘plugins_page_XXX’) != $hook) { return; } wp_register_style(‘myplugin_admin_css’, plugins_url(‘/css/admin.css’, __FILE__), false, ‘1.0.0); } Key here is to filter on value provided to your function (named $hook here). This value corresponds to the admin page being currently displayed, with a special value when this page is the “plugins.php” page where $hook is ‘plugins_page_XXX’ […]

jquery plugins: popup message

Here are some great jquery plugins for showing up popup messages: