GTUG STHLM

Yesterday it was a GTUG meeting on Stockholm. GTUG is the acronym for Google Technology User Group and is not affiliated with Google in any more way that that the users are interested in the technology that Google provides.

Yesterday was my first meeting and the only reason I ever knew that there was such a thing as GTUG was that Peter Svensson (@psvensson) was at an earlier GeekMeet and sponsored with some beer. An excellent attitude that ofcourse made me curious, and some googling and linkedining later we were in contact.

This was the third GTUG in stockholm and I believe we where around 40 persons or so, the second meeting was attended by 90 heads and I don’t even want to think of how many of those that had no clue what was going on at the screen because it was rather crowded already at 40 visitors. Not to mention the bad seatings!

The bad seating was compensated by really interesting speakers. We got an in-the-middle-of-dev perspective of a cool app that will make the android device a complete MIDI-controler and some technical implications for that, for example, it’s not possible to set-up an adhoc wifi between computer and phone or that the bluetooth lacked a decent API.

After that presentation we was shown a rather fancy idea regarding augmented reality. This is a topic that is starting to get ahead of the sci-fi scene and I’m soo thrilled to be in the middle of it. Poor our parents that only got the transistor, the TV and the internet. :)

So far there was a total absence of real code so my back started to itching like hell because of the bad chairs, but we got saved by a demonstration of Dojo gfx (or whatever the package is called). Very fancy stuff could be done with pure javascript and if I got it right the Dojo toolkit will use the best way to render the graphic depending on the browser. It even renders as vectors when applicable.

I remember I did a comparison between Ext and Dojo three or four years ago. Ext won because the documentation was better (ie. it existed). According to information I recieved yesterday the Dojo documentation is running up fast these days.

It’s very much mentionable that the GTUG will set of a Android Hackathon in the very near future. It’s on a saturday and I think everyone with an interest in developing on the Android plattform will get a huge jumpstart by visiting.

I wrote a jQuery plugin that could help domino developers: jQuery.plugin.deleteable.js

In my current project we have a few web-pages that contains meta-data around clients, projects or companies. Each page contains different modules and one module that was repeatedly used was a table that lists attachments that was connected to the current page.

When everything was working I could simply do this in a document.ready to get everything in place:

1
$('#docFileTable').deleteable();

I wanted to have a solution that could be implemented all over the site without needing to rebuild every form. I came up with a jQuery plugin that makes the document represented in the table deleteable. I was able to do this with just one modification in the view that generates the markup for the table, I added an attribute to the TR cell: docunid and added an empty TD in the beginning of a row. The latter was due to a performance issue with IE6 when I tried to add this TD dynamically.

The rendered table looks like this (I have removed the anchor links for simplicity):

1
2
3
4
5
6
7
8
9
10
11
<table border="0" width="100%">
<tbody>
<tr>
<td class="rowControl"></td>
<td><a onclick="openPopup('/mydb.nsf/0/9D147753FCFAA1FCC125764C0067CADB/$file/jocke_jordglob.jpg?open');" href="#">jocke_jordglob.jpg</a></td>
</tr>
<tr>
<td class="rowControl"></td>
<td><a onclick="openPopup('/mydb.nsf/0/7A990FCEC0C4A468C125764C0067CAD6/$file/jocke_cigar.jpg?open');" href="#">jocke_cigar.jpg</a></td>
</tr>
</tbody></table>

Before we can delete anything we need to have something in the backend that deletes the document, an AjaxDocDeleter. It can be a simple agent:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Sub Initialize
On Error Goto errHandler
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument

Set db=session.CurrentDatabase
Set curdoc=session.DocumentContext

'Print "
"
docunid=Strleft(Strright(curdoc.query_string(0)+"
&amp;","docunid="),"&amp;")
Set doc=db.GetDocumentByUNID(docunid)
Call doc.Remove(True)

Print "
Content-Type:text/javascript"
Print "
result : 'OK';"
Exit Sub
End Sub

So, now we have a nice table and a back-end solution, let’s do a jQuery plugin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
jQuery.fn.deleteable = function() {
this.each(function(){
$('TR', this).each(function() {
var o ={
element : $(this)
,docUnid : $(this).attr('docunid')
};
td = $(':first',$(this));
link = $('<a href="#"> </a>').attr({'class':'deleteLinkNoACL', title:'Delete document...'}).click(function(){
elm = $(this);
if(confirm('Are you really sure?')) {
elm.addClass('loadAjax');
elm.removeClass('deleteAble');
ajaxParams = {
url : '/'+dbpath+'/DeleteDoc?OpenAgent&amp;docunid='+o.docUnid
,success: function(data) {
// if there's an error in data something went wrong
elm.removeClass('loadAjax');
elm.removeClass('deleteAble');

if(data.indexOf('ERROR')&gt;-1) {
elm.removeClass('deleteLinkNoACL').unbind('click');
elm.css({'padding-left':'20px','background':'url(../famfamfam/error.gif) no-repeat'});
alert('Something went bad, unfortunately we at the development team didn't put enough effort to solve this problem');

} else {
elm.removeClass('
loadAjax');

o.element.hide();
}
}
}
$.ajax(ajaxParams);
}
return false;
});
td.prepend(link);
});
});
}

As we can see there’s a piece of CSS involved with this, and a few icons from the famfamfam library, the CSS used are these classes:

1
2
3
4
5
6
7
8
9
10
11
12
13
TD.deleteAble {

padding-left: 20px;
background: url('../famfamfam/delete.gif') no-repeat;
}
.deleteLinkNoACL {

background: url(../famfamfam/delete.gif) no-repeat;
padding-left:20px;
}
.loadAjax {
background: url(../ajax-loader-small.gif) no-repeat;
}

I haven’t assembled down this in a public package yet, but if enough people are interested I will do that. Just let know.

I downgraded to iphone OS 3.0

Sometimes my eager to run the latest of everything makes me bite my own tail (or shooting my pants of as some friends would have expressed it).

Latest iPhone 3.1 beta disables the tethering trick so I tried to downgrade to 3.0 which was not a walk in the park until I found this nice tutorial.

UPDATE: In addition to that trick it’s noteworthy that if your phone loops in recovery mode everytime you start it you can:

1) Start iRecovery in Terminal / Console with 

1
iRecovery -s

2) Execute the following commands:

	setenv auto-boot true
	saveenv
	/exit

Two regexps for swedish circumstances

All persons and organisations in Sweden has an identification number, the syntax is nnnnnn-nnnn, here’s a regexp for validating that:
/^\d{6}[./-]\d{4}$/

And here’s another one for validating Swedish zipcodes (nnn nn):
/^\d{3} \d{2}$/

Keyboard speed test

Swedish

37 words

Speedtest

English

51 words

Speed test

I have an iPhone application at the appstore

Swedish Regents since Gustav Vasa is approved and published on Apple Appstore. Check out the Swedish Regents page.

 

Screenshot Swedish Regents

One charger suits all cell phones?

Dreams can come through. Today it was announced that a rather impressive list of cellphone manufactures has a agreed on standardizing the cell charger.
“The initial group of companies who have joined the GSMA’s UCS initiative include 3 Group, AT&T, KTF, LG, mobilkom austria, Motorola, Nokia, Orange, Qualcomm, Samsung, Sony Ericsson, Telecom Italia, Telefonica, Telenor, Telstra, T-Mobile and Vodafone.

As a mac-taliban it’s hard to see that Apple is not in the list and I wont put my money on them, but good things can happen!

Source: GSM World

I have an iPhone so this chart wont apply

ActiveSynch between your iPhone and Google account.

Breaking News!

I was just told that you can synch your iPhone with your google account using activesynch now!!!!

http://www.google.com/sync/iphone.html

How i blog during the lotusphere (Swedish)

Jag tänkte berätta om arbetsflodet jag följer när jag bloggar från lotusphere.

Först startar jag min iPhone wordpress applikation och skapar ett nytt blog entry.

Jag sparar det lokalt på telefonen eftersom när det väl hamnar på servern måste jag ha wifikontak för att kunna fortsätta redigerat.

I telefonen skriver jag rubriken, taggar och kategorier sedan försöker jag skriva brödtext om jag hinner annars blir det mest stolpar. Jag bryr mig inte om stavning. När jag får några minuter över så ändrar jag status på inlägget och det sparas som draft på servern där jag tar upp det och putsar samt fyller på mer text. Sen publicerar jag det.