home mail me! syndication

overthinkings

of Ruben Daniels

Simple authentication for complex Ajax applications

Can I do this? Who are you? Yes you can do it.

Authentication is always a hard problem for any web application. For an Ajax application it’s even more complex. Imagine you make a request which gives you an access denied, what state should the application be in? And when the user logs in again, how can the request - or requests that happened while not being logged in - be retried?

This is where jpf.auth comes in. It helps you to set up authentication for your entire application in a declarative manner. First, let’s look at how to set-up basic login and logout teleport methods, to which the auth element can connect to.
Read the rest of this entry »

How to add items to a list

This week’s snippet discusses two methods of adding items to a list.

First we create a list with some inline binding rules. For this example we are using a list with mode=”check” and mode=”radio” set. The mode sets the behaviour of the list, “check” to function as a list of checkboxes, “radio” to function as a list of radiobuttons.

<j:list id="lstExample1"
    mode     = "check"
    model    = "mdlData:question1"
    caption  = "text()"
    traverse = "item" />
<j:list id="lstExample2"
    mode     = "radio"
    model    = "mdlData:question2"
    caption  = "text()"
    traverse = "item" />

We can now add the model to our application:
Read the rest of this entry »

How to integrate crappy banner javascript with your neat ajax application

Many banner companies are using dynamic javascript loading to insert their banners in a website. Most of these companies grew big before the Ajax term was coined and recognized as the future technology of the web. So the scripts they are using assume the page is loading while the script is inserted; they use document.write() to add html to the page. As many of you might know, using document.write on an already loaded page will clear all it’s html and leave you with a white page containing only the banner. In this week’s snippet I’ll show you how to work around this.
Read the rest of this entry »

Dynamically loading jml

This weeks snippet shows how you can fetch some jml (Javeline Markup Language) from the server and run it in your jpf application. This is a good way to dynamically load parts of a big webapp or website.

First we set up the basic calls to retrieve the jml. I’ve added some handling for the error and timeout states to make sure we don’t create errors when the user is disconnected from the internet.

function callback(data, state, extra){
    if (state == jpf.ERROR || state == jpf.TIMEOUT)
        return alert("comm error:" + extra.message);

}

new jpf.http().getXml("somejml.xml", callback);

The final step is to parse the loaded jml data. We use the W3C DOM call, document.createElement to instantiate the element. Javeline Platform allows you to pass jml as a string to this function.

var jmlNode = jpf.document.createElement(data);
jpf.document.documentElement.appendChild(jmlNode);

Together it looks like this:

function callback(data, state, extra){
    if (state == jpf.ERROR || state == jpf.TIMEOUT)
        return alert("comm error:" + extra.message);

    var jmlNode = jpf.document.createElement(data);
    jpf.document.documentElement.appendChild(jmlNode);
}

new jpf.http().getXml("somejml.xml", callback);

It’s that simple.

—–

If you are new to Javeline Platform don’t hesitate to try it out. The new ajax.org website contains the downloads and reference guide which will get your started.

How to synchronize states between a window and a button

My colleague Lukasz is working on www.onedayapps.com, which is meant as a demo site for jpf (javeline platform). This site has a button which is selected when a window is shown, and deselected when it isn’t.

In this weeks snippet i’ll explain how to get this done easily. Lets start out with creating a simple two state button and window:

<j:button state="true">test window</j:button>
<j:window title="Test window" icon="application.png">
   Test
</j:window>

One solution is to use events. We can add an onclick event on the button and an onclose event on the window like this:

<j:button id="btnState"
   state   = "true"
   onclick = "winTest.show()">test window</j:button>
<j:window id="winTest"
   onclose = "btnTest.setValue(false)"
   title   = "Test window"
   icon    = "application.png">Test</j:window>

An easier way to do this, is to make use of bidirectional property binding. This means you connect one property to another such that when one changes, the other one changes as well. Let me show you:

<j:button
   value = "[winTest.visible]"
   state = "true">test window</j:button>
<j:window id="winTest"
   title = "Test window"
   icon  = "application.png">Test</j:window>

That’s all. Now you have a button and a window that are synchronized. When you close the window, the button is not pressed anymore.

—–

If you are new to Javeline Platform don’t hesitate to try it out. The new ajax.org website contains the downloads and reference guide which will get your started.

Ondisk and Online connecting to the right service url

This is the first snippet i’m writing. Hopefully I’ll manage to get one up every week. A snippet is a really short post about something useful or interesting.

This time it’s about setting up your JPF (Javeline Platform) application in such a way that it’s easy to double click and open from your disk, but also still work online. Because online can be many places; i.e. the test server, acceptance server or the live server, it’s important that relative paths are used there. But locally an absolute path needs to be used.

Start by specifying everywhere in the application relative paths, in teleport but also using data instructions. Then in the appsettings element you can specify a baseurl for all relative paths used throughout your appliaction. Now the magic comes in when using dynamic properties using the { } syntax.

<j:appsettings baseurl="{jpf.host ? jpf.host + '/' : 'http://test.example.com/'}"/>

The baseurl is set based to jpf.host if it’s set (it’s not set for the file:// protocols), otherwise it uses the url to the test server. That’s all. I hope this will be helpful in your future projects.

—-

If you are new to Javeline Platform don’t hesitate to try it out. The new ajax.org website contains the downloads and reference guide which will get your started.

document.elementFromPoint

A quick note to give some kudos to Mozilla. It seems they implemented document.elementFromPoint in Firefox 3. This makes drag&drop in Firefox very fast. My docking example runs fastest i’ve seen so far, in FF3. Happy, happy, joy joy!

Thanks in advance.

Property Binding


fig 1. Property Bindings.

With property binding you can define the way a property is calculated. This statement is usually based on a javascript expression including one or more properties on other objects. The value of the property will always be kept up to date. This means that when one of the dependent properties changes, the property is recalculated. See fig 1. for a graphical explanation.

Let me give you an example to make it a bit straightforward. This example sets the visibility of the slider based on the state of the checkbox.
Read the rest of this entry »

MVC and Javeline PlatForm


fig 1. Model-view-controller.

I’m not someone that knows the intricate details of design patterns. Whilst trying to tell people how Javeline PlatForm works I’ve often used the MVC design pattern to describe the functions. It’s even in the JumpStart Guide. In writing this article I talked to Arnold Daniels, who friendly explained to me that I was completely wrong. He simply explained to me the basics of MVC, which instantly made it clear to me why it’s nearly impossible, if not impracticle to apply this design pattern to widget based GUI systems. Read the rest of this entry »

Presentation @JTeam, Amsterdam

We had a nice presentation at JTeam’s Tech Meeting today. It wasn’t recorded on video, but I do want to share the slides, and the demo’s. JTeam is a Java oriented company that works a lot with the Spring Framework. They have quite some experience with GWT. For us a challenge to show them the benefits of Javeline PlatForm (JPF). We tried to show in particular how JPF can be used in a real production application.
Read the rest of this entry »

Next entries »


Movies online

movies online, click here
order clomid viagra online review cialis from canada cheap generic viagra compare cialis prices online buy cheap acomplia buy viagra no rx find discount viagra online cheap accutane online lasix pills drug cialis online purchase order discount viagra order viagra from canada cheap lasix online online propecia viagra information accutane prices cheap generic acomplia levitra generic cialis cost levitra without prescription propecia prescription buy acomplia cheap acomplia prices acomplia cheap discount viagra purchase cialis no rx buy cialis us synthroid buy cheap cialis cheap zithromax cialis drug lowest price lasix clomid online cheap order acomplia online viagra online cheapest soma prices order cialis no rx cialis without a prescription cheap clomid buy viagra without prescription cheap generic accutane buy propecia without prescription cialis free sample propecia pharmacy buy viagra from us zithromax cheap buy levitra generic propecia no rx viagra cialis tablets cialis without prescription generic viagra cheap generic accutane discount cialis online clomid cheap buy discount viagra cheap viagra on internet overnight viagra viagra uk buy viagra from canada buy generic accutane viagra no prescription zithromax pills cheapest synthroid prices discount synthroid where to buy zithromax cheapest zithromax prices buy soma without prescription accutane no prescription cheap levitra tablets find cheap cialis online levitra pills