Tag: Niveau intermédiaire

Get color_id from a Google Calendar using API [PHP]

For a project I needed to get the events from a Google Calendar, as well as the colors from it. It’s been a pain, but after a couple of days I’ve been able to create a PHP page to do so. It will use the server-to-server auth mechanism. I’ll try to provide the different steps […]

Play with ribbon on Sharepoint

In Sharepoint 2010 and 2013, there are some existing functions to deal with the ribbon. Below an example of what we can do: // we need the file “sp.ribbon.js” SP.SOD.executeOrDelayUntilScriptLoaded(function () { // use PageManager var pm = SP.Ribbon.PageManager.get_instance(); // define a function to call when the ribbon is loaded var DoSomethingWithRibbon=function(ribbon) { // For […]

How to change the default logon name on Windows 7

On a remote PC it was another logon name that appeared by default… In that case I had to click on “Switch User”, then “Other User”, and finally enter my username and password. Very frustrating. After a few searches I found we can change the default name using the registry and with the below commands […]

Change screen saver timeout [Windows]

Let’s say your network admin blocked the default screensaver timeout to 15 minutes, but you want more…. You can change this timeout by running as an administrator the regedit then use the “Find…” command to look for “ScreenSaveTimeOut”. It should be under Computer\HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop The timeout is defined in seconds. Just change the value and […]

Excel file as an HTML table and Date formatting

If you create an Excel file using an HTML Table, then it exists a way to format the cells based on some CSS rules. Some examples can be found on this blog post. I spent some time trying to figure out how to display correctly the dates, whatever your regional settings are ; for exemple […]

Pure Javascript Drag and Drop cross browser from IE8

I was looking for a simple JavaScript to drag a div element around, and that would work with IE8 and without any third party libraries (like jQuery). It’s been very difficult to find a simple code ! Finally http://news.qooxdoo.org/mouse-capturing saved me with some code… but there was still a problem with IE8 due to the […]

How to expand Sharepoint 2013 calendar by default [JavaScript]

This code has been tested for Sharepoint 2013 only. It permits to expand by default (so as soon as the page is loaded) the events in the Month calendar view. See here a solution for Sharepoint 2010. Tested with IE8 and Firefox 41. You’ll have to add the below JavaScript code into your calendar page: […]

Transform pseudo currency to number in JavaScript

In JavaScript I want to change some formatted numbers to a regular number. The code might be look like that: var aNb=[ 1500, “1,500”, “15,00”, “1,500,000”, “1,500,000.25”, “1000.25”, “1 000 000”]; for (var i=0; i < aNb.length; i++) { var nb = aNb[i] + “”; if (nb.split(“,”).length <= 2) nb = nb.replace(/,(\d{2})$/,”.$1″); nb = nb.replace(/[^\d\.\-]/g, […]

Force CORS headers in Firefox to allow cross domain calls

This guy created a Firefox extension to force the CORS (access-control) headers from a call. This is very useful when you want to do a JavaScript/AJAX query over another website that doesn’t allow the cross domain calls. His code is on github. I’ve the XPI compiled version on my blog (into a ZIP file) found […]

“class-phpmailer out of memory using GuiForm” avec WordPress

Ayant un WordPress sur 1and1 j’ai été confronté à un “out of memory” sur le fichier class-phpmailer.php à cause d’un appel AJAX d’un formulaire créé avec GuiForm. Je ne peux pas faire grand chose côté serveur à cause de l’hébergement partagé… Donc j’ai fouillé comment contourner le problème. Il va s’agir de modifier le fichier […]