Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Thursday, June 21, 2007

Best Javascript Practises

During my research, I came across a website that teaches a few best practices for Javascript programmers.

Here are some of them:

- only javascript 1.7 have block scope. Hence its a very good idea to put this code in the script definition:
<script type="text/javascript" version="1.7">
- define variables with 'var', to differentiate variable's scope
global var:
var x; //global
x =0;
function init()
{
var x = 5;
alert(x); // shows 5
}
alert(x); // shows 0



Tuesday, June 12, 2007

Setting up for FFox extension development

- create a project folder , somewhere, ex: C:\myext\ . This will be our root.
- inside it, we create another folder call chrome
- inside chrome, we create another folder called content, this is where we keep our .xul and .js files
- Now go back to root, create 2 text files, install.rdf and chrome.manifest
- for stuff to put inside install.rdf and chrome.manifest , and more details, you can check out FF extension tutorial @ MDC

- for development purposes, we don't need to create a .xpi package.
- to test whether our extension can be used or not, do this:
- go into your Firefox Profile's extension folder ex: C:\Documents and Settings\USER\Application Data\Mozilla\Firefox\Profiles\USER_PROFILE.default\extensions\
- create a text file, with your app id (the one you put in tag inside install.rdf) as its name. Just put the id, no .TXT or any other extension required.
- open the text file, put the path of your extension root folder, ex: C:\myext\ , don't forget the following '\'
- start Firefox and your app should run :D

How to use xmpp4moz server-side applications

At least xmpp4moz and SamePlace need to be installed and working to use server-side applications.

== Generic way ==

- Connect your Jabber account.
- Open a conversation with one of your contacts in !SamePlace.
- In the browser, navigate to a server-side application (e.g. http://apps.sameplace.cc/notes/notes.xhtml).
- Click on the `connect` [[Image(connect.png)]] icon in the upper right of the conversation panel.
- Start using the application.

The same steps need to be followed by your contact.

== Quicker way ==

- In the browser, navigate to a server-side application (e.g. http://apps.sameplace.cc/notes/notes.xhtml).
- Bookmark it inside the `SamePlace` folder.
- In the contact list, right-click on your contact, then select '''Communicate in browser using... -> '''


taken from http://dev.hyperstruct.net/xmpp4moz/wiki/DocUsingRemoteApplications?format=txt

Monday, June 11, 2007

Creating my x4m client-side app

- get codes from here
- message will be send only when I'm connected to a server through SPS.
- mesage is displayed on the sidebar only, can't be displayed in the 'conversation' box on the right.
- there are no xmpp4moz divs, because it catches incoming message by using channel.on() function.
- app is connected to the xmpp4moz library through this code =>
<script type="application/x-javascript" src="chrome://xmpp4moz/content/xmpp.js"/>
- posted this problem in forum

Types of of apps related to Firefox
- Server-side :
- usually in .xhtml format, so it can be understood by most current browsers
- resides on the server
- Client-side :
- usually in .xul format
- understood by Firefox only
- installed as extension within Firefox

Friday, June 8, 2007

XUL-related links

Just a collection of links I've found today:

- XUL Success Stories
- Firefox extension developers guides
- XUL test cases with codes and examples
- Working with windows in chrome code
- Spket IDE: Nice XUL IDE, interface like Eclipse, can also be installed as Eclipse plug-in. But still no viewer like dreamweaver
- Content Management System (CMS) - created using XUL/AJAX
- XML DOM - node object properties reference

Tuesday, June 5, 2007

XUL : In-Depth Learning

- tutorial reference
- Element reference
- There are several ways that XUL applications are created:
* Firefox extension - an extension adds functionality to the browser itself, often in the form of extra toolbars, context menus, or UI to customize the browser UI. This is done using a feature of XUL called an overlay, which allows the UI provided from one source, in this case, the Firefox browser, to be merged together with the UI from the extension. Extensions may also be applied to other Mozilla based products such as Thunderbird.
* Standalone XULRunner application - XULRunner is a packaged version of the Mozilla platform which allows you to create standalone XUL applications. A browser isn't required to run these applications, as they have their own executable file.
* XUL package - in between the other two are applications which are created in the same way as an extension, but they act like a separate application in a separate window. This is used when you don't want to have the larger size of a complete XULRunner application, but don't mind requiring a Mozilla browser to be installed to be able to run the application.
* Remote XUL application - you can also just place XUL code on a web server and open it in a browser, as you would any other web page. This method is limited however, as there will be security concerns that will limit the kinds of things you will be able to do, such as opening other windows.
- When the user downloads it, it will be installed onto the user's machine. It will hook into the browser using a XUL specific feature called an overlay which allows the XUL from the extension and the XUL in the browser to combine together. To the user, it may seem like the extension has modified the browser, but in reality, the code is all separate, and the extension may be uninstalled easily. Registered packages are not required to use overlays, of course. If they don't, you won't be able to access them via the main browser interface, but you can still access them via the chrome URL, if you know what it is.
- Functions/node used for xmpp4moz and Frefox extensions:
- DOMNodeInserted : This event is sent when a node is added as a child of a element. If you capture this element at the document level, you can be notified of document changes (eg: Triggerred when incoming xmpp packet arrived).
- xmpp4moz:: sample code/API
- caught when a DOMNodeInserted event is triggered.

Monday, June 4, 2007

xmpp4moz: Getting it to work

- http://dev.hyperstruct.net/xmpp4moz
- found the only "Hello World" xmpp4moz tutorial, with a handful of bugs, which I've successfully repaired@ http://www.pixzone.com/blog/84/embed-jabber-in-firefox-with-xmpp4moz-chat-application-how-to/
- sample of the stanza that xmpp4moz catches:













































- this chat app demonstrate the usage of xmpp4moz.
- to use this, you must login to a jabber account using SamePlace Suite 1st.
- then activate the chat page by clicking a button in the SamePlace side panel.
- for detail explanation, refer to here.

How-To make and test Java2Script working (properly)

Here are the ways you should follow:
1) Refer to http://j2s.sourceforge.net/update/
2) Download and install IDE for Java (Eclipse is recommended by J2S developers)
2) Download the J2S library using Eclipse's Update Manager. Choose the default sourceforge.net server. This is to ensure you'll get the library that is 100% compatible with your IDE.
3) To test your newly setup environment, follow the tutorial @ http://j2s.sourceforge.net/articles/getting-started.html