A.K.A Self notes

Online notes by and for Djaka PM

Head First On PyGtk GUI Programming

without comments

Disclaimer:
This tutorial is for beginners, I don’t want to waste your time Python veterans :D

Today, I was finished my adventure to find new languange that light enough for GUI programming
after I was dwelling too long on Java Swing and presume that its dead now(it has been 3 years since I used it)
Of course I want to hold on the nature of the Java Swing that its crossplatform nature.

So I began to Googling, I end up using Python and PyGtk because I found out its already in my machine :D
Thats why I use Python and PyGtk. For now I just following my guts.
Because for the love of god, I don’t know anything about Python and PyGtk, well I knew Python before but it just for “Hello World” project.

So here we go, before that there are some prerequisites and I gathered all the resources for you convinient

My environment:

  • Ubuntu 12.04
  • Python 2.7
  • PyGtk 2.0
  • cx_Freeze 4.3
  • PyDev 2.6.0 on Eclipse 4.2.0(Juno)

My aim is to understand the GUI programming on PyGtk(I am very curious how it compared to Java Swing :D)
and how to compile your application to native code in my case I want to compile my Python application to Linux binary

Short description for the project, it is a simple caculator where you can do basic arithmetics operation such as:
addition,subtraction, divide and multiply.

The most important command that you will need to remember is this:

python setup.py build_exe

The above command will compile your Python application to binary distribution
you can run above command inside the directory contain the setup.py file.

You can test whether the compilation is success or not go to the build folder
its should be together with the setup.py file, just double click file named “calculator”

If the calculator showed up then it is a success, if otherwise you can share the problem with me if you want to :D.
Just comment on this post.

There will be warning about missing python module, just ignored it.

The rest of the information is in the zip, you can download the project
and also you can download the .deb cx_Freeze 4.3 and .rpm cx_Freeze 4.3

Please share what you think about this post.

Enjoy.

Written by djakapm

September 23rd, 2012 at 9:27 pm

Posted in GUI,Tips and tricks

Tagged with , ,

Panduan Untuk Setup Modem AHA MyTV(Model EC156/Huawei) untuk Ubuntu 12.04 LST

without comments

Langkah-langkah proses setup ini di ambil berdasarkan blog berikut:

 

Di bawah ini adalah langkah-langkah praktisnya:

Buka terminal.

sudo apt-get install wvdial
Install wvdial dengan cara di atas.

lsusb
Lakukan listing USB device dengan cara di atas
kurang lebih akan menghasilkan output sebagai berikut:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 014: ID 12d1:140c Huawei Technologies Co., Ltd.
Bus 001 Device 004: ID 04f2:b257 Chicony Electronics Co., Ltd
Bus 002 Device 003: ID 147e:1002 Upek
Bus 001 Device 016: ID 1058:1110 Western Digital Technologies, Inc.

perhatikan line berikut:

Bus 001 Device 014: ID 12d1:140c Huawei Technologies Co., Ltd.

dimana 12d1 adalah vendor id dan 140c adalah device id.

modprobe usbserial vendor=0x12d1 product=0x140c
Ketik perintah di atas (dengan menambahkan 0x pada masing-masing vendor id dan device id) tunggu beberapa saat.

Ubahlah konfigurasi wvdial yang terletak di /etc/wvdial.conf dengan editor favoritmu
Isi dari /etc/wvdial.conf kurang lebih seperti di bawah ini:

[Dialer Defaults]

Modem = /dev/ttyUSB0
Phone = #777
Username = aha@aha.co.id
Password = aha
New PPPD = yes
Init1 = ATZ
Init2 = ATQ0 V1 E1 &D2
Modem Type = Analog Modem
Baud = 9600
;New PPPD = yes
;Modem = /dev/ttyUSB0
ISDN = 0
; Phone =
; Password =
; Username =

Simpan file.

sudo wvdial
Jika wvdial terhubung dengan sukses maka output pada terminal kurang lebih sebagai berikut

--> local  IP address 10.76.9.30
--> pppd: k[7f]
--> remote IP address 172.19.129.96
--> pppd: k[7f]
--> primary   DNS address 10.8.15.15
--> pppd: k[7f]
--> secondary DNS address 10.8.17.4
--> pppd: k[7f]

Kelemahan dari metode ini adalah:

  1. Harus mengkoneksikan modem secara manual
  2. Harus membiarkan terminal terbuka selama modem digunakan
  3. Belum dapat diakses melalui User Interface

Selamat Ber-Internet ria!

Written by djakapm

August 2nd, 2012 at 6:11 am

Posted in Tips and tricks

Tagged with , ,

Bagaimana Membaca XML dari request POST dengan PHP

without comments

Hari ini saya jumpai beberapa masalah yang sangat mengganggu,

“Bagaimana membaca XML dari permintaan posting menggunakan PHP”

Dibutuhkan beberapa kali Googling untuk menemukan solusi yang tepat,
Jika Anda menghadapi masalah yang memerlukan pencarian 3 kali atau lebih di Google berarti masalah yang Anda hadapi lumayan sulit.

Jadi tanpa penundaan lebih lanjut ini adalah kodenya:

//Sample XML
//<message type="dr">
//<adn>123</adn>
//<msisdn>9820202020</msisdn>
//<tid>1234567890</tid>]
//<ccode>123SMSPULL2000</ccode>
//<status>1</status>
//<tdate>2012-02-21 12:31:20</tdate>
//</message>

$body = file_get_contents('php://input');
$xml = simplexml_load_string($body);
//CP shortcode
$adn = $xml->adn;
//Handset number
$msisdn = $xml->msisdn;
//Transaction Id
$tid = $xml->tid;
//Charging code
$ccode = $xml->ccode;
//DR status
$status = $xml->status;
//Transaction date
$tdate = $xml->tdate;

Selamat Menikmati.

Written by djakapm

July 13th, 2012 at 6:36 pm

How Read XML from POST request with PHP

without comments

Today I have encountered some really annoying problem,

“How to read XML from post request using PHP”

It takes quiet sometime to find the right solution using Google,
If you are facing a problem that took 3 or more times on Googling means that the problem is not so typical.

So with no more delay here is the code:

//Sample XML
//<message type="dr">
//<adn>123</adn>
//<msisdn>9820202020</msisdn>
//<tid>1234567890</tid>]
//<ccode>123SMSPULL2000</ccode>
//<status>1</status>
//<tdate>2012-02-21 12:31:20</tdate>
//</message>

$body = file_get_contents('php://input');
$xml = simplexml_load_string($body);
//CP shortcode
$adn = $xml->adn;
//Handset number
$msisdn = $xml->msisdn;
//Transaction Id
$tid = $xml->tid;
//Charging code
$ccode = $xml->ccode;
//DR status
$status = $xml->status;
//Transaction date
$tdate = $xml->tdate;

Enjoy.

Written by djakapm

July 13th, 2012 at 6:32 pm

Posted in HTTP,PHP

User Interface for Humans – Get Rid User’s Doubts

without comments

I have noticed there are changes made on application UI recently, they are more human friendly.

Instead they use some short wording on a button, now they tend to use longer wording to make sure the user confident when she needs to take some action e.g clicking a link or a button.

I feel that creating a comforting UI is a part that make an application`s success, regardless whether it is a web or desktop application. When a user feel afraid or unsure of herself it will also affect her productivity when using our application, then our application give more negative effects rather than positive effects.

For example when you want to do some important task such as:
doing some online payment or decision making in an application the last thing you want is a shady and unclear button that say “Add”, “Pay” or “Delete”.
Its better to have a bit longer wording but save the users from doubts, we can use wording like “Add Current Item to Chart” or “Pay Pending Monthly Credit Card Bills”.

The common example is the save dialog box in today application usually they contains three button that says
“Yes”,”No”,”Cancel” but I realize they change the wording to be more intuitive like so: “Save Changes”,”Don`t Save Changes”,”Cancel”. I have to admit that I rarely read the dialog box message, I tend to read the buttons now, whereas in the past I would read the dialog box first(which is still a good habit for avoiding some unintended mistakes :D).

As a common law that if the user feel secure and comfy when using our application, their productivity can be ensured.

This is my to two cent on today`s application UI.So what do you think?
Don`t hesitate to leave a comment….

Cheers..

Written by djakapm

March 8th, 2012 at 7:18 pm

Posted in Personal,Social,Tips and tricks

Tagged with , , ,

Mass Effect 2 ARM DLC Crack Only

without comments

For you who looking for crack-only for the ARM DLC. Just click the link at the bottom. I am using Razor 1911 Release.

Download Crack

Written by djakapm

February 14th, 2012 at 8:39 pm

Posted in Game,Personal,Social

Tagged with , , , , ,

I am a JavaCodeGeeks Community Blogger

with one comment

In this post I would say thanks to Ilias Tsagklis at JavaCodeGeeks for the opportunity to become JavaCodeGeeks Community Blogger

For small time programming blog writer like me this is very big. Its bring motivation for beginner blog writer such as me to create better entry and to update the blog more often. Thanks Ilias!!

Written by djakapm

February 9th, 2012 at 8:16 am

Posted in Personal,Social

Tagged with , ,

Creating Feed Reader using XUL – Part 2

without comments

Add Real Application Features

In the first part We already created a simple application that can be use to get started. In the first part also we have learned how the XUL event and the UI interact. It is no different than creating a web page and use JavaScript for UI events.

In this post I am not going to talk all the details, I will only show and describe some highlights for the application.

Added Features

  • Add subscription(improved)
  • Remove subscription

Highlights

  • using jQuery for ajax request
  • add feed entry to listbox
  • show feed content in the browser
  • add listener to web progress
  • add status bar
  • when to use jQuery selector and when not

This is the latest UI for our Feed Reader application.

Add Subscription Improved!

Show feed name in the tree instead of feed URL. Below snippet show the code that used for adding the feed to the tree.

function addFeedToList(theUrl,data){
  var title = $(data).find("rss > channel > title").text();
  var treeNode = document.getElementById(subscriptionNodeId);
  var item = document.createElement("treeitem");
  var row = document.createElement("treerow");
  var cell = document.createElement("treecell");
  cell.setAttribute("label",title);
  cell.setAttribute("value",theUrl);
  row.appendChild(cell);
  item.appendChild(row);
  treeNode.appendChild(item);
  setAppStatus("Feed from "+theUrl+" added");
}

theUrl variable contains the feed URL whereas data variable contains RSS XML text. After we parse the data, we can obtain the feed title and assign it to the treecell label attribute and the feed URL to the treecell value attribute, such as in the following code.

  var cell = document.createElement("treecell");
  cell.setAttribute("label",title);
  cell.setAttribute("value",theUrl);

now we can see the feed title instead of feed URL.

Remove Subscription

When removing a subscription, basically user need to select the feed first than choose the “Remove Subscription” menu. Here are the snippet of the function that does it.

function onRemoveSubscription(event){
    var tree = document.getElementById(feedTreeId);
    if(tree.currentIndex == -1 || tree.currentIndex == 0){alert("Please select a subscription to remove.");return;}
    var currentItem = tree.view.getItemAtIndex(tree.currentIndex);
    var cellIndex = 0;
    var subscriptionName = tree.view.getCellText(tree.currentIndex, tree.columns.getColumnAt(cellIndex));
    var ans = confirm("Are you sure to unsubscribe from \""+subscriptionName+"\" ?");
    if(ans){
        currentItem.parentNode.removeChild(currentItem);
    }
}

The main code that remove the subscription is this.

currentItem.parentNode.removeChild(currentItem);

Now we already have some of the basic features Add and Remove subscription to/from our application.

Highlights

After I describe the high level features and how to achieve it, now for some details regarding those features.

Using jQuery for AJAX request, Why not using XUL built-in AJAX system

I am using jQuery when comes to AJAX request because I am familiar with it and also I have tried the built-ind XUL’s AJAX system and it does not work. Maybe I have missed something obvious here. But I need a running prototype fast and I do not have time to search why the built-in XUL’s AJAX does not work.
There has been a question out there similar to what I have encountered.

So we already familiar with the jQuery code to send an AJAX request such as this one

function readNewFeedFrom(theUrl){
    if(!theUrl){return;}

jQuery.support.cors = true;
$.ajax({
      url: theUrl,
      contentType:"text/xml",
      success: function(data){
        addFeedToList(theUrl,data);
        showFeedItem(data);
        setAppStatus("Feed from: "+theUrl+" added.");
      },
      error:function(jqXHR, textStatus, errorThrown){
          alert(textStatus);
      },
      beforeSend:function(jqXHR, settings){
          setAppStatus("Adding feed from: "+theUrl);
      }
    });
}

Basically it is quite simple but very IMPORTANT. But one thing to remember that when using jQuery especially on the AJAX request part you need to activate the cross-domain scripting flag on jQuery, it showed the following line.

jQuery.support.cors = true;

If this flag set to false the AJAX request will not work and the error handler on the AJAX request will be executed.

Add Feed Entry to Listbox

<listbox id="feed-item" onclick="onFeedItemSelected()"></listbox>

JavaScript code

function showFeedItem(data){
  var feedItemList = $("#"+feedItemId);
  clearFeedItemList(feedItemId);
  $(data).find("rss > channel > item").each(function(idx){
      var title = $(this).find("title").text();
      var link = $(this).find("link").text();
      var item = document.createElement("listitem");
      item.setAttribute("label",title);
      item.setAttribute("value",link);
      feedItemList.append(item);
  });
}

As you can see I have used the jQuery to read the feed XML and iterate all the item tags.

var feedItemList = $("#"+feedItemId);

var item = document.createElement("listitem");
item.setAttribute("label",title);
item.setAttribute("value",link);
feedItemList.append(item);

In the code above it is very easy to add an item to the listbox, just append the new item to it.

Show feed content in the browser

At this point we already manage to add new subscription and show its item in a listbox, the last thing to do is to display
the feed item contents in a browser. Luckily in XUL there is already a browser component.
The following snippet shows how to display the feed item content in the browser.

function onFeedItemSelected(event){
    var feedItem = document.getElementById(feedItemId);
    var currentItem = feedItem.currentItem;
    var url = currentItem.getAttribute("value");
    var title = currentItem.getAttribute("label");
    var browser = document.getElementById(feedItemViewId);
    browser.setAttribute("src",url);
}

After you set the src attribute of the browser component it will start to render the URL.
We need to know what is being loaded and rendered by the browser we need to “listen” to this process progress.

Add listener to web progress

This part has more code to show because it a bit tricky. First we need to create a listener for the process.

function configureProgressListener(){
    var obj = new Object();
    obj.wpl = Components.interfaces.nsIWebProgressListener;
    obj.QueryInterface = function(aIID) {
        if (aIID.equals(obj.wpl) ||
        aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
        aIID.equals(Components.interfaces.nsISupports)) return this;
        throw Components.results.NS_NOINTERFACE;
    }

obj.onStateChange = function(aProgress, aRequest, aFlag, aStatus) {
        if (aFlag &amp; listObj.wpl.STATE_START) {
            setAppStatus("Loading entry "+aRequest.name+"...");
        } else {
            if (aFlag &amp; listObj.wpl.STATE_STOP) {
                if ( aFlag &amp; listObj.wpl.STATE_IS_WINDOW ) {
                    // This fires when ALL load finish
                    setAppStatus("Entry loaded, well almost.");
                }
                if ( aFlag &amp; listObj.wpl.STATE_IS_NETWORK ) {
                    // Fires when ALL load are REALLY over,
                    // do something "final" here
                    // (my two cents)
                    setAppStatus("Entry loaded.");
                }
            }
        }
        return 0;
    }   

return obj;
}

The actual listener class is the nslWebProgressListener which is attached to plain JavaScript object obj.

var obj = new Object();
obj.wpl = Components.interfaces.nsIWebProgressListener;

The original snippet is here
We need to override the onStateChange function in order to “listen” to the process’s progress.
Now need to find a perfect place to show the progress to the user. Here comes the statusbar.

Add status bar

The status bar will shows the resource being loaded and rendered on the browser.

The XUL

  <statusbar>
    <statusbarpanel label="" id="app-status" flex="1"/>
  </statusbar>

The JavaScript

function setAppStatus(status){
    $("#"+appStatusId).attr("label",status);
}

When to use jQuery selector and when not

To avoid confusion when to use or not to use the jQuery selector I will try explain.

Do use jQuery when you only need

  • To manipulate DOM common operation such as setting an attribute or appending child node
  • To shorten the code instead using document.getElementById("tag_id") instead you can use $("#tag_id")

Example:

$("#app-status").attr("label",status);

Do not user jQuery when you need

  • To call XUL specific method on a XUL tag such as:

Example:

This will work

var tree = document.getElementById(feedTreeId);
var currentItem = tree.view.getItemAtIndex(tree.currentIndex);

This will not work

var tree = $("#"+feedTreeId);
var currentItem = tree.view.getItemAtIndex(tree.currentIndex);

Because when you get the DOM object using jQuery style it will resulting a jQuery object and the methods you are trying to call are not available. So be careful. Alright its a wrap, but I know that there are some improvements can be made. I really expect your feedback about the tutorial :D, because I am still learning to and I hoping that I can learn together with you.

You can download the code here

Next feature is to persist the feed we already save in the Feed Reader and load it in start up. Cheers

Written by djakapm

February 8th, 2012 at 2:53 pm

Posted in CSS,Javascript,XUL

Tagged with , , ,

Creating Feed Reader using XUL – Part 1

with one comment

What is XUL

XUL stand for XML User interface Language. XUL is maintained by Mozilla. It contains XML User Interface Language(XUL), Javascript and CSS for easy skinning to create desktop application.

Why XUL?

I have Java Swing background, I been there long enough to know that creating kick-ass look and feel on swing is not easy. The Mozilla team use XUL to create Thunderbird email client and Firefox web browser.The easiest styling I have known is CSS, and XUL just about that.

Layout, in swing layout is abit painful if you are using the built-in layout manager, although there are some of open source swing layout managers are very good such as: JGoodies Form Layout and MigLayout.
Layout also improved in Eclipse SWT. but nothing is more simple than plain old CSS.

XUL also has the most known programming/scripting language JavaScript and I am sure most of the web developers are very familiar with JavaScript so it will be very easy to learn.

Download XUL Runner

First you need the XUL runner from Mozilla its runtime for XUL-based applications. You can download the XUL runner here. Choose the one that suit your OS. I am using 1.8.0.1 version.

Download Orangevolt Eclipse Plugins

I am using Eclipse to create the application but you can start developing it using simple text editor, the advantage is you don`t have to create a set of default files and folders that require by the XUL because it quite a lot folders to create.

Oragevolt`s Eclipse plugins needed to create XUL application project you can download the plug in using the “Help > Install new software” menu on Eclipse.

The plugins url is http://eclipsexul.sourceforge.net/update-site. Install the plugins and you are ready to go (almost).

After the installation finished, you need to tell eclipse where the XUL Runner are.

Go to “Window > Preference”, type XUL on the textbox

You are ready now, create new XUL project on Eclipse, I named mine is “Feed Reader” this application will try to imitate google reader behavior(barely try hahaha…) just for example.

Eclipse will create the folder structure for you and several default files.

Above picture is the default folder structure that Eclipse has created for you. If you run the application without editing anything. It will show more or less like the following picture.

Now edit the file called feed_reader.xul to something like the following snippet

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<!DOCTYPE window SYSTEM "chrome://feed_reader/locale/feed_reader.dtd">

<window
  	id     = "&app.id;"
  	title  = "&app.title;"
  	width  = "800"
  	height = "600"
  	xmlns  = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  	onload = "onLoad();">
			
  	<script src="feed_reader.js"/>
  	
          	
  	<toolbox>
	<menubar>
		<menu id="help-menu" label="&menuHelp.label;" accesskey="&menuHelp.accesskey;">
      		<menupopup>
        		<menuitem label="&menuitemAbout.label;" accesskey="&menuitemAbout.accesskey;" oncommand="onAbout();"/>
      		</menupopup>
    	</menu>
  	</menubar>
  	</toolbox>
  		<hbox flex="1">
	    <tree width="300">  
	      <treecols>  
	          <treecol id="header" label="Feed Name" primary="true" flex="10"/>  
	          <treecol id="header" label="Count" flex="1"/>  
	      </treecols>  
	      
	      <treechildren>  
	        <treeitem container="true" open="true">  
	          <treerow>  
	            <treecell label="Subscriptions" />  
	          </treerow>  
	      
	          <treechildren id="subscription-tree">  
	            <!--treeitem>  
	              <treerow>  
	                <treecell label="Daily WTF"/>  
	                <treecell label="6"/>  
	              </treerow>  
	            </treeitem-->  
	          </treechildren>  
	        </treeitem>  
	        
	        
	      </treechildren>  
	    </tree>  
	     <splitter collapse="before" resizeafter="farthest">
    		<grippy/>
  			</splitter>  		
			<listbox flex="1">
			  <!-- listitem label="Butter Pecan"/-->
			</listbox>  			
  		</hbox>

</window>

now if you run the application it will resulting a single window a treeview and a list, I know that this application it just a skeleton application. I just want to show you how XUL application works, more in-depth topics will follow :D.

Adding The Main menu

In the default application the “Help” main menu is the only menu. Now we want to add “Subscription” menu and “Add Subscription” sub-menu, here are the steps add these lines after the <menubar></menubar> tag.

		
<menu id="subscription-menu" label="&menuSubscription.label;" accesskey="&menuSubscription.accesskey;">
      		<menupopup>
        		<menuitem label="&menuitemAddSubscription.label;" accesskey="&menuitemAddSubscription.accesskey;" oncommand="onAddSubscription();"/>
      		</menupopup>
    	</menu>

also you need to edit the feed_reader.dtd file in

/feed_reader/chrome/locale/en_US/feed_reader folder and add these lines

<!ENTITY menuSubscription.label "Subscription">
<!ENTITY menuSubscription.accesskey "S">
<!ENTITY menuitemAddSubscription.label "Add Subscription">
<!ENTITY menuitemAddSubscription.accesskey "A">

Save all and try to run the application again. Voila! the “Subscription” menu appear.

I want that after user clicks the “Add Subscription” menu a simple dialog appear to receive the target url feed, something like this.

Here are the steps to create the dialog

Create new files called add_feed_dialog.xul and add_feed_dialog.js in /feed_reader/chrome/content/feed_reader/ folder.

Modify the add_feed_dialog.xul file with the following xml

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<dialog id="add-feed-dialog" title="Add Subscription"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  buttons="accept,cancel"
  buttonlabelcancel="Cancel"
  buttonlabelaccept="Add"
  onload="onLoad();"
  ondialogaccept="return doOK();"
  ondialogcancel="return doCancel();">
    <script src="add_feed_dialog.js"/>
 	<label control="subscription-url" value="Enter URL:"/>  
  	<textbox id="subscription-url" value=""/>  
  	<label value="e.g: http://blog.djakapm.com/feed/"/>
</dialog>

also modify add_feed_dialog.js

function doOK(){
	var url = document.getElementById("subscription-url").value;
	if(!url){
		alert("Please enter valid URL");
		return false;
	}
	
	window.arguments[0].out = url;
	return true;
}


function doCancel(){
	return true;
}

Ok we are done creating the dialog but its now used yet by the application main window.

Now open feed_reader.js file and modify it. We need to add new function to it.

function onAddSubscription(e){
	var params = {out:null};    
	  window.openDialog("add_feed_dialog.xul", "",
	    "chrome, dialog, modal",params).focus();
	  
	  var treeNode = document.getElementById("subscription-tree");
	  var item = document.createElement("treeitem");
	  var row = document.createElement("treerow");
	  var cell = document.createElement("treecell");
	  cell.setAttribute("label",params.out);
	  row.appendChild(cell);
	  item.appendChild(row);
	  treeNode.appendChild(item);	  
}

As you can see the function name is the same as the function name when you are adding the
“Add Subscription” sub-menu. It seems familiar right?! :D. Please pay attention to these lines.

var params = {out:null};    
  window.openDialog("add_feed_dialog.xul", "",
   "chrome, dialog, modal",params).focus();

Above line is the way XUL passes variables to the dialog window, as you can see the params is passed to the window.openDialog function which will open the dialog window.
The following line is how the dialog window assign a value to the passed variable from outside.

	window.arguments[0].out = url;

Now you can click the “Add Subscription” menu and enter your favourite feed URL and the URL will be added to the treeview, like in the following picture.

Ok, thats it you can download the complete source code for this tutorial here. Its a complete Eclipse project so you can directly import it to your Eclipse IDE.Cheers

UPDATE

I forgot to mention that Orangevolt plugins has some problem when opening XUL perspective on Eclipse as it stated here. But I think that it still usable, currently I am using my Java perspective on Eclipse. I would try to get better IDE for XUL development.

Your suggestions, critics and comments are welcome.

Written by djakapm

February 5th, 2012 at 8:36 am

Posted in CSS,Javascript,XUL

Tagged with , , ,

Setting up Trac on Localhost on Ubuntu 11.10

without comments

Hi,

Today I just want to show you how to set up Trac on localhost, the tutorials I have found are scattered in a way.
So I hope with this post I will sum it up somehow.

I am using Trac 0.12.2

First you need to follow all the steps from Trac on Ubuntu help page

What I want is that my local Trac could be accessed locally and remotely

such as:

http://localhost/trac/my_project

and

http://192.168.100.118/trac/my_project

The difference is that I put two virtual host inside /etc/apache/sites-enable/trac file(the file name could be differ than yours).

Here are the contents of the trac file

<VirtualHost 192.168.100.118:80>
  ServerName localhost
  DocumentRoot /var/trac/projects

  WSGIScriptAliasMatch ^/trac/([^/]+) /var/trac/projects/$1/deploy/cgi-bin/trac.wsgi
  <Directory /var/trac/projects>
    WSGIApplicationGroup %{GLOBAL}
    Options Indexes +ExecCGI +SymLinksIfOwnerMatch
    AllowOverride None
    Order allow,deny
    allow from all
  </Directory>

  <LocationMatch /trac/[^/]+/login>
   AuthType Basic
   AuthName "trac"
   AuthUserFile /var/trac/.passwd
   Require valid-user
  </LocationMatch>

</VirtualHost>

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot /var/trac/projects

  WSGIScriptAliasMatch ^/trac/([^/]+) /var/trac/projects/$1/deploy/cgi-bin/trac.wsgi
  <Directory /var/trac/projects>
    WSGIApplicationGroup %{GLOBAL}
    Options Indexes +ExecCGI +SymLinksIfOwnerMatch
    AllowOverride None
    Order allow,deny
    allow from all
  </Directory>

  <LocationMatch /trac/[^/]+/login>
   AuthType Basic
   AuthName "trac"
   AuthUserFile /var/trac/.passwd
   Require valid-user
  </LocationMatch>

</VirtualHost>

After you change the apache site configuration you should restart the apache web server using the following command:

sudo service apache2 reload

Ok thats it.

I hope it helped.

Written by djakapm

January 25th, 2012 at 5:35 pm

Posted in Tips and tricks

Tagged with ,