Missing “key ports” in Live Messenger on Vista – FIX!

The problem
As of lately, using WLM has been like a game of Russian roulette.
One day you can log in fine, the next day you cannot log in, and WLM is complaining about missing key ports.

Read the rest of this entry »

Adding a reset method to Aeron Glemann’s Calendar

We use Aeron Glemann’s Calendar quite frequently in projects at work, and in a recent project we ran into a case where we needed to reset the calendar with new available dates depending on some other choices in the form (we also reversed the blocked option, so only the “blocked” dates are selectable, but that’s another story).

Read the rest of this entry »

getStyle in percentage for mootools

At #mootools the other day, DiegoMax started talking about how Element.getStyle returns the px values of properties, even if they where set with %.

Because of issues with how you retrieve those styles from different browsers (Computed vs Cascaded Style), there’s little or no way to know if a value is set with % or not. But, returning the value as a percentage of its nearest parent (or any other parent element, when we’re first at it) is highly possible. If you know that you want %..

As I saw it, there where two approaches..
1. Make a new method for Element, like Element.getPercentageStyle()
2. Replace Element.getStyle(), and add new optional parameters..

I went for the easiest solution first, a new method for Element..
But then I decided to write the other solution as well. And it turned out to be a nice demonstration of how to replace an Element method, while still retain and use the original method as well.

Both sourcecodes can be found below.

Read the rest of this entry »

file uploads with iframe and IE 6/7

Yesterday, macsim’work on #mootools asked some questions regarding IE and file uploads.

He tried to send a form with an attachment to an iframe, and it worked without problems in any non-IE browser (Opera, Firefox, Safari, Chrome).
And while file uploads today is no brain science, this error/bug was new to me, and something I’d never run into before.

We sat down and had a thorough look at the issue.. And with some help from ie developer toolbar and google we found a solution.

Read the rest of this entry »

JSON.test() rewritten (for mootools 1.2.1)

I recieved a comment from Philipp on the old Json.test() post the other day.
But since that code was written for mootools 1.11, I thought it would be good to update the code to 1.2.1.
(I’m migrating all my old code snippets to 1.2.1 these days, so expect more posts like this in the days to come..)


Read the rest of this entry »

Element.appendHTML

One of the js challenges that was thrown my way at work today was:
do you know of a good way to append a string with HTML to an element, like Element.appendText() but with HTML beeing parsed? And outperforms the =+ logic based solutions?“..

I didn’t have a solution at hand, but I had some ideas.. Thus Element.appendHTML() was born..


Read the rest of this entry »

Korg nano Kontrol with Deckadance, it sorta works

Beeing the impatient beeing that I am (at least when it’s about learning something new and get my hands on new gadgets), I couldn’t wait untill I got the “new Midi Controller” issue sorted (I want to get my hands on a Vestax VCI-100 or Dj-Tech i-Mix Reload, whichever I can get first)..

So when I visited my local music store today, to get some more info on the VCI-100 (vestax btw has no retailer in Norway, kind of sucks..), I just couldn’t leave empty handed..
At least not when the Korg nano series got my attention.. If you don’t know what the “Korg nano series” is, it’s a “nano sized” set of midi controllers for the pc or mac..

Korg nano series

As I wasn’t very impressed of the finish on the keyboard, and I don’t realy have the need for a drum/pad controller, I went for the nano Kontrol.
It has 9 midi control groups, each containing 1 knob, 1 slider, and two buttons.. in addition to 6 transport buttons (play, stop, pause, rec, loop, rewind, fast forward) and a “scene” button.
And at the price of 560,- NOK that’s not a bad deal at all..

My initial thought was to use this mainly with FL Studio, to control effects, the master mixer, and channels..
but, I was more in a deckadance mood today, and after playing with it for a few hours I got the setup I want..
Inspired by the button setup on the VCI-100, this is what I ended up with (only thing I REALY miss in this setup is a jog-wheel or some sort of searching back and forth in the songs.. have to do that manualy with a mouse for now):
Korg nanoKontrol

No video yet, although I have the mapping done, it’s just not there yet to show in a video…
The midi settings-file for deckadance can be found here: Download Korg nanoKontrol deckadance mapping (VCI-100 inspired) Version 1

Extending mootools selectors (pseudo-selector: containsNoCase)

It’s impressive how easy it is to extend mootools..

Just 8 lines of code, and String.containsNoCase and pseudo-selector: containsNoCase is implemented..

String.implement({
	containsNoCase: function(string, separator){
		return this.toLowerCase().contains(string.toLowerCase(), separator);
	}
});
Selectors.Pseudo.containsNoCase =	function(text){
	return (this.innerText || this.textContent || '').containsNoCase(text);
};

Now I can do case insensitive searchs through an rss feed (titles) with element selectors

xml.getElements('entry title:containsNoCase(query)');

Elements.getTotalSize(), get the total size of an array of elements

While creating a mootools Slider-controled image gallery navigator (fancy huh?) at work, I suddenly had the need for getting the Total size (width in this case) of all the li elements inside a ul.


Read the rest of this entry »

Lesson learned, extending mootools with Array/Element properties

I’ve twisted my brain in all different angles today, trying to get my first custom Array property in mootools to work.
For some reason my code kept returning the content as an array, and not as an object like I’d set up my piece of code to do.

It turned out that there was allready a property with the name I selected for Elements, which Array then had inherited..
thus, it allready existed, returning an array of objects (the same object I was trying to return, actually..).

I ended up adding the property to Elements instead (for another reason), with a new Property name.

Lesson: before you try to add a new property to Array, Elements, or any Class in general, check if it allready exists :p