Barbra Streisand Concert – Amsterdam – 10/06/2013

I’m REALLY looking forward to the concert this evening of Barbra Streisand.

I have a high addiction to her voice. It’s like smoking: if I haven’t heard some Streisand for some while I get this high urge to run and listen to some songs :) I have all her solo albums, all live albums and I also have a collection of some more rare stuff I picked up in record shops and on the Internet.

  • She is the best singer who ever lived. period.
  • The only singer who got #1 albums for 5 consecutive decades in a row and the most top ten albums of any female recording artist ever (32 since 1962)
  • 150 million records sold (so in the list of best selling music artists ever)

So to actually see here live… wow……………………….

some vids to get-in-the-moment:







Sharepoint lookup add insert field for multi select lookup column

SPservices has this great auto lookup field for single lookup values (well.. great in that it saves time writing it yourself using the Jquery autolookup plugin with a CAML query on the lookup list).

But what if you want to lookup multiple values for a multi lookup situation AND that if you would want to insert items when they do not exist? I see that he has added a `link` option SPLookupAddNew  but I do not like a link since I dont want to confuse readers to get lost and besides that it resets all selected values in their lookup.

So I wrote a little code that uses the spautocomplete box and adds and insert or add button after it, depending on what the user is entering in the textbox. If the user then presses `add` (or selects it from the autocomplete box) it is added to the multi select box and if the user presses “insert” it is inserted in the lookup list + added to the selection also so it works seamlessly for the end-user.

No doubt this has written already by someone out there but I could not find it that quickly via Google so it was quicker to write it myself.

	/**
	 * Event Handler for key/mouse on add/insert buttons on singlelookupfield
	 *
	 * @since 0.1
	 * @param obj @event the event passed
	 * @param obj @objLookup the static lookup object
	 */
	function SingleLookupEventHandler(event, objLookup) {
		var singleValueEntered = $(objLookup.singleLookupSelector).val();
		if (event.type === 'click') {addChoice(singleValueEntered,objLookup);} else {
			var valueExists = false;
			$(objLookup.singleAutoLookupSelector + " LI").each(
				function () {if ($(this).text() === singleValueEntered) {valueExists = true;}					
			});
			if (singleValueEntered.length > objLookup.singleLookupColumnNameTrigger) {			
				if (valueExists == false) {InsertButton(singleValueEntered, objLookup);}
				else {AddButton(singleValueEntered, objLookup);}
			} else {resetFields(objLookup,false);}		
		}	
	}
	
	/**
	 * Inserts one new list item in  a list + updates the multilookup column + hides the insert button
	 *
	 * @since 0.1
	 * @param string @text 
	 * @param string @columnName the multilookup column
	 * @param string @listName the list to insert into
	 */
	function insertOne(singleValueEntered, objLookup) {
		 $().SPServices({
       	 	operation: "UpdateListItems",
	        async: false,
	        batchCmd: "New",
	        listName: objLookup.sourceList,
	        valuepairs: [[objLookup.sourceColumnName, singleValueEntered],["Title", objLookup.insertListAnnotation]],
	        completefunc: function(xData, Status) {
	        	var newId = $(xData.responseXML).SPFilterNode("z:row").attr("ows_ID");
          		insertChoice(newId, singleValueEntered, objLookup)
          		addChoice(singleValueEntered, objLookup)
          		resetFields(objLookup,false);
	        }
    	});
	}
	
	/**
	* Inits an "Insert/Add Button"
	*
	* @since 0.1
	* @param object @objLookup the static lookup object
	*/		
	function initButon(objLookup) {
		var addButton = '<button type="button" id="'+objLookup.buttonId+'">Add ></button>';
		$(objLookup.singleLookupSelector).after(addButton);
		$(objLookup.buttonSelector).addClass('ms-input');	
		resetFields(objLookup,false);	
	}
	
	/**
	* Resets fields: removes button, empties textfield + autocomplete pulldown
	*
	* @since 0.1
	* @param object @objLookup the static lookup object
	*/	
	function resetFields(objLookup,complete) {
		$("#"+objLookup.buttonId).hide();
		if (complete) {
			$(objLookup.singleLookupSelector).val('');
			$(objLookup.singleAutoLookupSelector).hide();
		}	
	}
		
	/**
	* Adds an "Insert Button"
	*
	* @since 0.1
	* @param string @singleValueEntered the value entered in the textbox
	* @param object @objLookup the static lookup object
	*/		
	function InsertButton(singleValueEntered, objLookup) {
		$(objLookup.buttonSelector).text(objLookup.insertAnnotation);
		$(objLookup.buttonSelector).css('background-color', 'red');
		$(objLookup.buttonSelector).show();
		$(objLookup.buttonSelector).unbind('click');
		$(objLookup.buttonSelector).click(function() {insertOne(singleValueEntered, objLookup);})
	}
	
	/**
	* Adds an "Add Button"
	*
	* @since 0.1
	* @param string @singleValueEntered the value entered in the textbox
	* @param object @objLookup the static lookup object
	*/
	function AddButton(singleValueEntered, objLookup) {
		$(objLookup.buttonSelector).text(objLookup.addAnnotation);
		$(objLookup.buttonSelector).css('background-color', '#ccc');
		$(objLookup.buttonSelector).show();
		$(objLookup.buttonSelector).unbind('click');
		$(objLookup.buttonSelector).click(function() {addChoice(singleValueEntered,objLookup);})
		selectValue(singleValueEntered, objLookup);
	}

	/**
	* Selects a value in the multilookup OOTB field
	*
	* @since 0.1
	* @param obj @objLookup the static lookup object
	*/
	function selectValue(singleValueEntered, objLookup) {
		$(objLookup.multiLookupPossibleSelector + " option").each(function () {        
			if ($(this).text() == singleValueEntered) {    
				$(this).val(1);      
				$(this).select();
			}    
		});
	}
	
	/**
	* Inserts a new value to the multilookup OOTB field
	*
	* @since 0.1
	* @param number @id the id of the inserted list item
	* @param string @singleValueEntered the value of the column of the inserted list item
	* @param object @objLookup the static lookup object
	*/
	function insertChoice(id, singleValueEntered, objLookup) {
		$(objLookup.multiLookupPossibleSelector).append($('<option>', {
			value : id,
			text  : singleValueEntered
		}));
	}
	
	/**
	* Adds a selected value to the multilookup OOTB field
	*
	* @since 0.1
	* @param string @singleValueEntered the value entered in the textbox
	* @param object @objLookup the static lookup object
	*/
	function addChoice(singleValueEntered, objLookup) {    
		$(objLookup.multiLookupPossibleSelector+ " option").each(function () {        
			if ($(this).text() == singleValueEntered) {            
				$(this).appendTo($(objLookup.multiLookupSelectedSelector));            
				var multilookupPickerVal = $(objLookup.multiLookupselector).val();            
				if ($(objLookup.multiLookupselector).val() == undefined 
					|| $(objLookup.multiLookupselector).val().length == 0) {
					$(objLookup.multiLookupselector).val($(this).val() + "|t" + $(this).text());            
				}            
				else {                
					$(objLookup.multiLookupselector).val(multilookupPickerVal 
						+ "|t" + $(this).val() + "|t" + $(this).text());            
				}        
			}    
		});
		resetFields(objLookup,true);
	} 
	
	/**
	* Removes a selected value from the multilookup OOTB field
	*
	* @since 0.1
	* @param string @singleValueEntered the value entered in the textbox
	* @param object @objLookup the static lookup object
	*/
	function removeChoice(singleValueEntered, objLookup) {    
		$(objLookup.multiLookupSelectedSelector + " option").each(function () {        
			if ($(this).text() == singleValueEntered) {            
				$(this).appendTo($(objLookup.multiLookupPossibleSelector));            
				var multilookupPickerVal = $(objLookup.multiLookupselector).val();            
				var valToRemove = $(this).val() + "|t" + $(this).text();            
				var newValue = multilookupPickerVal.replace(valToRemove, "");            
				$(objLookup.multiLookupselector).val(newValue);        
			}    
		});
	}
	
	/**
	* Hides a field from a form
	*
	* @since 0.1
	* @param string @fieldId the Id of the field
	*/
	function hideField(fieldId) {
		$(":input[id$='" + fieldId + "']").parents('tr').first().hide();
	}
	
	/**
	 * Jquery Init / Start
	 *
	 */
	$(document).ready(function() { 		
		if (is_transportcontract()) {
			
			// init
			var dirNameColumnId = 'onetidIOFile';
			var objLookup = new Object();
			objLookup.singleLookupColumnName = 'SingleItemLookup';
			objLookup.singleLookupColumnNameTrigger = 3;
			objLookup.singleLookupSelector = ":input[title$='" + objLookup.singleLookupColumnName+"']";
			objLookup.singleAutoLookupSelector = "#SPAutocomplete_" + objLookup.singleLookupColumnName;
			objLookup.multiLookupColumnName = 'ItemLookup';
			objLookup.multiLookupColumnId = 'MultiLookupPicker';
			objLookup.multiLookupselector = "[id$='" + objLookup.multiLookupColumnId + "']";
			objLookup.multiLookupSelectedSelector =	"[title='" + objLookup.multiLookupColumnName + " selected values']";
			objLookup.multiLookupPossibleSelector = "[title='" + objLookup.multiLookupColumnName + " possible values']";		
			objLookup.sourceColumnName = 'ItemNr';
			objLookup.sourceList = 'ItemList';
			objLookup.buttonId = 'ButtonId';
			objLookup.buttonSelector = "#"+objLookup.buttonId;
			objLookup.addAnnotation = 'Add >';
			objLookup.insertAnnotation = 'Insert >';
			objLookup.insertListAnnotation  = 'Inserted by me!';
			
			// hide the foldername
			hideField(dirNameColumnId);
			
			// init the autocomplete lookup column using spservices
			$().SPServices.SPAutocomplete({	
				sourceList: objLookup.sourceList,
				sourceColumn: objLookup.sourceColumnName,
				columnName: objLookup.singleLookupColumnName,
				ignoreCase: true,
				numChars: objLookup.singleLookupColumnNameTrigger,
				highlightClass: "ms-bold",
				slideDownSpeed: 1000,
				debug: false
			});
						
			// init add/hide button			
			initButon(objLookup);
												
			// add eventhandler on keyup on single lookup
			$(objLookup.singleLookupSelector).keyup(function(event) {					
				SingleLookupEventHandler(event,objLookup);
			});
			
			// add eventhandler on mouseclick on spautocomplete box single lookup
			$(objLookup.singleAutoLookupSelector).click(function() {
				SingleLookupEventHandler(event,objLookup);
			})	
		}	
	});

For the add/remove in the OOTB box I used the great trick from Derek Gustaff using the append Jquery function which moves stuff around in the DOM, pretty handy.

Agora

I saw the movie “Agora” tonight at NL 2 VPRO which I really can recommend to you if you have not seen it. It’s both historical, a love story and beautifully worked out. It dragged me from one thought to the other by all  the metaphors used.

It has been worked out to the utterly details: e.g. the visual effects team designed the sky so accurately that it matches the time period of the movie.

image

So uhm… go watch it.

Little Total Commander Tricks

A moment ago I found a neat little trick: if you create a new folder and put pipes in the foldername e.g. “test1|test2|test3|test4|test5” … then it will create 5 directories at once. I then went searching and found some other tricks e.g. test\test\test\test for subdirectories. Little nice thing.

How to Resize and Crop Photo under Picasa under Windows 8

I blogged before on crop an image to a certain aspect ratio. In my example workflow I first resize and then recrop to a certain aspect ratio as I would do in e.g. Irfanview. Seems the most logical to me.

problem 1: Picasa and crop/resize

I had to explain this today to someone with little computer knowledge using Google Picasa…. who needed to resize images for a website. But how can this be performed in Google Picasa?

I found out that In Google Picasa it works the other way around:

  1. Via “Crop” you first crop to a certain aspect ratio. However you then have an image of the  desired aspect ratio but no yet the desired size.
  2. Then you file > export  the photo and choose the resize option to make sure that the width of the image corresponds to your desired width
  3. (and then you do an undo of the crop to have your original image back)

I think this is more confusing then first resize and then recrop? (How the heck would a simple end user conclude that you need to EXPORT to resize ???).

problem 2: Associate JPG in Windows 8 to something else then picture viewer

So… I thought… let’s install Irfanview on this Windows 8 laptop. Note that you may not use “free” Irfanview within companies (see license) but this is a home user installation.

I then wanted to associate jpgs with Irfanview to do this task …. but that seemed to be a problem also: although I associated jpg with irfanview it kept jumping back to Microsoft’s default image viewer no matter what I tried ( e.g. “search on associate” / “associate with program” /”set default program”) OR just associate via Total Commander on the file extension. It just did not pick my Irfanview executable.

?

Donderdagavond: cluster headaches

0:00 hoofdpijn…

vanaf 1:55 tot 2:15 enorme piek. Ik zal je de details besparen. Ik heb toch maar weer een ibroprofen genomen. Maar even boven achter de laptop gaan zitten bijkomen.

Eigenlijk tot toch niet normaal meer. Toch is het interessant. Zag deze via de Facebook groep:

image

 http://www.hindustantimes.com/Entertainment/Hollywood/Radcliffe-suffering-from-cluster-headaches/Article1-875265.aspx#.UZK2ZDPFN0w.facebook

Eens kijken wat de rest van de nacht gaat brengen. Welterusten?