Skip to content

DPJ Online Blog

Computer Programming, Health, Science and Information Technology, Google Adsense, Online Business & Adventure

Archive

Category: Programming

I’m using WAMP Server 2.0 on W7

First, edit your php.ini file and add the ff. lines

[java]
java.java_home = “C:\Program Files\Java\jre6\bin”
java.java = “C:\Program Files\Java\jre6\bin\java”
java.class.path = “C:\wamp\bin\php\php5.3.0\ext\JavaBridge.jar”
java.library = “C:\Program Files\Java\jre6\lib”
java.library.path = “C:\wamp\bin\php\php5.3.0\ext;C:\Program Files\Java\jre6\lib”

Just change the directory location according to your java and php installation folders.

also place the file “Java.inc” on your php include path.

you can download the Javan.inc and JavaBridge.jar at http://php-java-bridge.sourceforge.net/pjb/

Restart wamp services.

To test your java bridge capability just create and open this php file on your browser

test.php

<?php

try {

/* invoke java.lang.System.getProperties() */
$props = java(“java.lang.System”)->getProperties();

/* convert the result object into a PHP array */
$array = java_values($props);
foreach($array as $k=>$v) {
echo “$k=>$v”; echo “<br>\n”;
}
echo “<br>\n”;

/* create a PHP class which implements the Java toString() method */
class MyClass {
function toString() { return “hello PHP from Java!”; }
}

/* create a Java object from the PHP object */
$javaObject = java_closure(new MyClass());
echo “PHP says that Java says: “; echo $javaObject;  echo “<br>\n”;
echo “<br>\n”;

echo java(“php.java.bridge.Util”)->VERSION; echo “<br>\n”;

} catch (JavaException $ex) {
echo “An exception occured: “; echo $ex; echo “<br>\n”;
}

?>

This is how I changed my default boot option to my Ubuntu 9.10 , I installed my ubuntu through Wubi w/in my W7

1. Click Windows Knob ->Control Panel

blog.dpjonline.com , Start Control Panel

Start Control Panel

2. At the control panel window click “system”

www.blog.djonline.com , Control Panel Window

Control Panel Window

3. at the system window, click “Advnace Settings”

www.blog.dpjonline.com , Windows System Options

Windows System Options

4. click advance tab->settings

5. choose ubuntu

these lines worked with my ubuntu 9.10 installed in compaq cq40.

edit your /etc/modprobe.d/alsa-base.conf and add the following lines

options snd-pcsp index=-2
alias snd-card-0 snd-hda-intel
alias sound-slot-0 snd-hda-intel
options snd-hda-intel model=dell-m4-1
options snd-hda-intel enable_msi=1

* use alsa in sound configuration

After updating windows 7, you might also experience that the Documents and Settings folder can no longer be opened.

It happened in my laptop after installing the updates from Microsoft.

This is what I did.

1. Right click documents and settings and click properties menu.

Docments and Settings Windows 7 Folder

Documents and Settings Windows 7 Folder

2. On the property window click “security” tab.

3. Scroll down on the permission for Everyone.

Docments and Settings Windows 7 Folder

Documents and Settings Windows 7 Folder

4. Uncheck Deny on the special permission. If it can’t be unchecked, remove “everyone” from the group or usernames by clicking the “Remove” button and proceed below. If it can be unchecked then click apply and you’re done.

5. After removing “Everyone”, add it back by clicking the “Add” button.

Docments and Settings Windows 7 Folder

Documents and Settings Windows 7 Folder

6. On the “select user or group” window, click “advance” button.

Docments and Settings Windows 7 Folder

Documents and Settings Windows 7 Folder

7. click “Find Now” button leaving the text fields empty.

Docments and Settings Windows 7 Folder

Docments and Settings Windows 7 Folder

8. Choose “Everyone” and click the “OK” button.

9. Apply all changes, and you’re done.

happy coding!!!






To enable apache’s mod_rewrite in ubuntu type the following at the terminal window

sudo a2enmod rewrite

restart apache
sudo /etc/init.d/apache2 restart

a2enmod means “apache2 enable module <-module->”

Here are the steps on how to add a favorite icon on your wordpress blog web address
1. Choose your favorite image that you want to place on your web address.
2. Resize your image to 16×16 and save it as an ico image. (favicon.ico)
(You may use GIMP Photo Editor or any)
3. Upload the image file (favicon.ico) to your wordpress blog root directory through an FTP software.
4. Login to your wordpress admin. Go to dashboard, appearance and click Editor menu. Choose header.php at the right pane and add the following lines
<*link rel="shortcut icon" href="<*?php echo get_settings('home'); ?*>/favicon.ico” /*> without the asterisk. Remove all the asterisk, I just made it so so that it wont be interpreted by the web browser.

here’s my example:
in the address bar it looks like this

in the tab it looks like this

And also on this blog. You can see my favorite icon at the address bar.

If you are going to bookmark it, the little icon will also be shown in the bookmark list.

Happy Coding

dojo.query (returns dojo.NodeList)
dojo.require(“dojo._base.query”);

dojo.query() is the swiss army knife of DOM node manipulation in Dojo. Much like Prototype’s “$$” (bling-bling) function or JQuery’s “$” function, dojo.query provides robust, high-performance CSS-based node selector support with the option of scoping searches to a particular sub-tree of a document.
Supported Selectors:

dojo.query() supports a rich set of CSS3 selectors, including:

  • class selectors (e.g., .foo)
  • node type selectors like span
  • descendant selectors
  • > child element selectors
  • #foo style ID selectors
  • * universal selector
  • ~, the immediately preceeded-by sibling selector
  • +, the preceeded-by sibling selector
  • attribute queries:
    • [foo] attribute presence selector
    • [foo='bar'] attribute value exact match
    • [foo~='bar'] attribute value list item match
    • [foo^='bar'] attribute start match
    • [foo$='bar'] attribute end match
    • [foo*='bar'] attribute substring match
  • :first-child, :last-child, and : only-child positional selectors
  • :empty content emtpy selector
  • :checked pseudo selector
  • :nth-child(n), :nth-child(2n+1) style positional calculations
  • :nth-child(even), :nth-child(odd) positional selectors
  • :not(…) negation pseudo selectors

Usage
var foo: dojo.NodeList=dojo.query(query: String, root: String|DOMNode?, listCtor: Function?);

parameter type description
query String The CSS3 expression to match against. For details on the syntax of CSS3 selectors, see
root String|DOMNode Optional. A DOMNode (or node id) to scope the search from. Optional.
listCtor Function Optional.

Example 1

search the entire document for elements with the class “foo”:

dojo.query(“.foo”);

these elements will match:


Example 2

search the entire document for elements with the classes “foo” and “bar”:

dojo.query(“.foo.bar”);

these elements will match:

while these will not:

Example 3

find elements which are descendants of paragraphs and which have a “highlighted” class:

dojo.query(“p span.highlighted”);

the innermost span in this fragment matches:



Example 4

set an “odd” class on all odd table rows inside of the table #tabular_data, using the > (direct child) selector to avoid affecting any nested tables:

dojo.query(“#tabular_data > tbody > tr:nth-child(odd)”).addClass(“odd”);

Example 5

remove all elements with the class “error” from the document and store them in a list:

var errors = dojo.query(“.error”).orphan();

Example 6

add an onclick handler to every submit button in the document which causes the form to be sent via Ajax instead:

dojo.query(“input[type='submit']“).onclick(function(e){
dojo.stopEvent(e); // prevent sending the form
var btn = e.target;
dojo.xhrPost({
form: btn.form,
load: function(data){
// replace the form with the response
var div = dojo.doc.createElement(“div”);
dojo.place(div, btn.form, “after”);
div.innerHTML = data;
dojo.style(btn.form, “display”, “none”);
}
});
});

Example 7

Find every element in the page with the class “blueButton” assigned
dojo.addOnLoad(function(){
dojo.query(“.blueButton”).forEach(function(node, index, arr){
console.debug(node.innerHTML);
});
});

Simple Queries

// all h3 elements
dojo.query(‘h3′)
// all h3 elements which are first-child of their parent node
dojo.query(‘h3:first-child’)
// a node with id=”main”
dojo.query(‘#main’)
// all h3 elements within a node with id=”main”
dojo.query(‘#main h3′)
// a ‘div’ with an id=”main”
dojo.query(‘div#main’)
// all h3 elements within a div with id=”main”
dojo.query(‘div#main h3′)
// all h3 elements that are immediate children of a ‘div’, within node with id=”main”
dojo.query(‘#main div > h3′)
// all nodes with class=”foo”
dojo.query(‘.foo’)
// all nodes with classes “foo” and “bar”
dojo.query(‘.foo.bar’)
// all h3 elements that are immediate children of a node with id=”main”
dojo.query(‘#main > h3′)

Immediate Child Elements

dojo.query(‘#main > *’)
dojo.query(‘#main >’)
dojo.query(‘.foo >’)
dojo.query(‘.foo > *’)

Queries rooted at a given element

dojo.query(‘> *’, dojo.byId(‘container’))
dojo.query(‘> h3′, ‘main’)

Compound queries
Combining 2 or more selectors to produce one resultset

dojo.query(‘.foo, .bar’)

Multiple class attribute values

dojo.query(‘.foo.bar’)

Using attribute selectors

Picking out elements with particular attributes/values

dojo.query(‘[foo]‘)
dojo.query(‘[foo$=\"thud\"]‘)
dojo.query(‘[foo$=thud]‘)
dojo.query(‘[foo$=\"thudish\"]‘)
dojo.query(‘#main [foo$=thud]‘)
dojo.query(‘#main [ title $= thud ]‘)
dojo.query(‘#main span[ title $= thud ]‘)
dojo.query(‘[foo|=\"bar\"]‘)
dojo.query(‘[foo|=\"bar-baz\"]‘)
dojo.query(‘[foo|=\"baz\"]‘)
dojo.query(‘.foo:nth-child(2)’)

Descendant selectors

dojo.query(‘>’, ‘container’)
dojo.query(‘> *’, ‘container’)
dojo.query(‘> [qux]‘, ‘container’)

Sibling selectors

dojo.query(‘.foo + span’)
dojo.query(‘.foo ~ span’)
dojo.query(‘#foo ~ *’)
dojo.query(‘#foo ~’)

Sub-selectors, using not()

dojo.query(‘#main span.foo:not(span:first-child)’)
dojo.query(‘#main span.foo:not(:first-child)’)

Nth-child

dojo.query(‘#main > h3:nth-child(odd)’)
dojo.query(‘#main h3:nth-child(odd)’)
dojo.query(‘#main h3:nth-child(2n+1)’)
dojo.query(‘#main h3:nth-child(even)’)
dojo.query(‘#main h3:nth-child(2n)’)
dojo.query(‘#main h3:nth-child(2n+3)’)
dojo.query(‘#main > *:nth-child(2n-5)’)

Using pseudo-selectors

dojo.query(‘#main2 > :checked’)
dojo.query(‘#main2 > input[type=checkbox]:checked’)
dojo.query(‘#main2 > input[type=radio]:checked’)

Count of checked checkboxes in a form with id myForm
dojo.query(‘input:checked’, ‘myForm’).length

I was wondering how can i rearrange wordpress navigation menu. I usually place the “About” menu at the right most of my page. In wordpress’ case it is placed right after “Home” menu. When you add another page, the page’s navigation menu will be automatically be placed right beside the “About” menu. I’ve rearranged mine like this wordpress blog [Cebu, Philippines. The Queen City Of The South]



To do it please follow the simple steps below:

  • 1. Login to your wordpress admin page.
  • 2. On the dashboard, click pages.
    http://cebu.dpjonline.com
  • 3. On the Edit Pages window, click the page you want to rearrange. Do one after the other.
  • 4. At the right part of the edit window, you can find attributes option. Place a number in the “Order” field that corresponds to your page menu location. It is arranged in ascending order from left to right.
    http://cebu.dpjonline.com

To view a working sample, you can visit http://cebu.dpjonline.com

Happy Coding

This is how I added a video on my wordpress blog post (http://bisdak.dpjonline.com)

1. Login in to your WP Dashboard.

2. Click Plugins

WP Plugins Window

3. At the new plugins search for youtube

search

4. Look for the youtuber plugin

youtuber

And click the install link at the right most.

5. After the installation click on the activate plugin button

activate

6. Add or Edit your post and insert this line

youtuberx

anywhere in your post where xxxxx is the youtube video ID.

Good Luck and More Power!!!

http://www.dpjonline.com

It was a hard night on Oct 23, 2009. We stayed late with my friends preparing for a bigger project on a web based database system. After a few hours of brain storming, the table was almost flooded with coffee and cookies :) thank you nescafe, we were able to stand still.

Of course, out of topic discussions but recorded, just kidding, were the main ice breaker especially when Ken opened up his online experience thing. I can’t believe that he dated plenty of his online contacts, wew…. I thought online friends are just for an online activity but they were not :) you know what I mean. Not just one but more than five. They were able to escape the virtual lounge and they made it!! I was surprised and think for a while that how I was left behind on this online episode.

I have a friend too that always denies that meeting in person is impossible for the online activity. I do believe but not in the case of Ken.

Back to our project, I was so excited with this one. This is the first time I will be involved in implementing Zend Framework and PostgreSQL in a Linux Server. I know this will be something to be work on everyday but I am excited in doing this. Hopefully if the proposal will be accepted with our customer, we’ll start coding early next week. So it’s gonna be a busy 6 months to go!!.. But I know after a heavy rain the sun will shine as bright as crystals.. :) hmm a good vacation may be or a good scuba dive at panglao bohol :) or just stay at home and redesign my kitchen, let’s see.

Come on let the ball rollin’ sign the contract ! :) :) :)