working with GIT
RETRIEVING COPY FROM SVN
note: the url specified should be a level below the trunk directory
git svn init <repository url> --stdlayout --no-minimize-url
note: specify a revision number where all branches have committed
git svn fetch -r<revision number>:HEADexample:
branch1 latest commit is revision 2370
branch2 latest commit is revision 2389
trunk latest commit is 2390
-to retrieve copies for all branches
git svn fetch -r2370:HEAD
-unless you only need the trunk and branch2
git svn fetch -r2389:HEADAFTER RETRIEVING COPY FROM REMOTE VERSIONING SYSTEM(GIT/SVN)
-list your local branches, initially you should only get ‘master’ which is the the local of trunk
git branch
-list your remote branches
git branch -r
-perform branching, one from listed remote branches
git checkout <remote branch>
-specify branch to be placed to your development environment, this will be the local branch, a copy of the remote branch you specified
git checkout -b <new local branch name>
-switch among trunk and branches
git checkout <local branch name>
notes:
if your trunk and branches still have the same structure, it can be used as a single workspace of your IDE
however if a restructuring has been made in your trunk, i suggest set-up a new work space for it in your IDE.MY USUAL WAY OF COMMITTING LOCALLY
-check files for commit
git status
-check changes made
git diff
-given that everything is okay and everything is for staging
git add .
-do commit
git commit -m <comment>
-check index
gitkMY USUAL WAY OF COMMITTING REMOTELY IN SVN
-update my local files
git svn fetch
-check conflicts and merge
git svn rebase
-given that there are no conflicts
git svn dcommitFIND COMMIT VERSION
git logUNDO WHAT HAS BEEN COMMITTED TO REMOTE REPOSITORY
git revert <commit version>THANKS to clim!
… creating thread …
Learned this from Ed
DO NOT do this
for (int idx = 1; idx <= processors+1; idx++) { new Thread(tg, this.new SampleProcessorServiceThread(), "thread" + idx).start(); } this.doWait(); ...—
Instead, DO it this way
Thread[] threads = new Thread[processors+1]; for (int idx = 1; idx <= processors+1; idx++) { threads[idx-1] = new Thread(tg, this.new SampleProcessorServiceThread(), "thread" + idx); threads[idx-1].start(); } for (int idx = 0; idx < processors; ++idx) { try { threads[idx].join(); } catch (InterruptedException e) { // Don't care } } ...
Firebug for your browser.
Here’s something Roy Natavio found.
If you need firebug for your browser other than Firefox, add this in your code
<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
You now have a firebug on that page.
mod_jk and jboss
1. Assuming you have Apache2 installed,
If not get the latest Apache2 package from Apache.org and install it. We require no special configuration, just use the default settings.
In the following steps, APACHE_HOME will represent the Apache install directory.2. Assuming you have downloaded and installed mod_jk 1.2
Download the latest package available from Tomcats’s ‘Download Tomcat connector section’ page . Always download the latest stable release if possible.
Rename the lib mod_jk.so and drop it in APACHE_HOME/modules directory.
NOTE: Don’t use any release prior to mod_jk 1.2.15. Earlier releases are fairly buggy.3. Setup Apache to use modjk
Add this line at the very bottom in APACHE_HOME/conf/httpd.conf
# Include mod_jk configuration file
Include conf/mod-jk.conf
4. Create the modjk config
Under APACHE_HOME/conf, create mod-jk.conf and populate it as follows:
# Load mod_jk module
# Specify the filename of the mod_jk lib, comment line if you already declared LoadModule jk_module modules/mod_jk.so
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicates to send SSK KEY SIZE
# Notes:
# 1) Changed from +ForwardURICompat.
# 2) For mod_rewrite compatibility, use +ForwardURIProxy (default since 1.2.24)
# See http://tomcat.apache.org/security-jk.html
JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"
# Mount your applications
JkMount /__application__/* node1
# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=node1
JkMountFile conf/uriworkermap.properties
# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
# Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to
# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452
JkShmFile run/jk.shm
# Add jkstatus for managing runtime data
<Location /jkstatus></Location>
JkMount node1
Order deny,allow
Deny from all
Allow from 192.168.241.116
</Location>
mod_jk is ready to forward requests to JBoss instances. We need now to setup the workersNote: As of mod_jk 1.2.6+ you need to include “JkMountCopy all” in globals if you intend to specify global JkMount’s or JkMountFile’s instead of per VirtualHost. If you do not want to copy the same JkMount/JkMountFile for each VirtualHost, you can specify “JkMountCopy On” inside the VirtualHost directive.
5. make sure that APACHE_HOME/run and APACHE_HOME/log folders exist
6. Configuring workers
Under APACHE_HOME/conf, create workers.properties and populate it as follows:
# Define list of workers that will be used
# for mapping requests
# The configuration directives are valid
# for the mod_jk version 1.2.18 and later
#
worker.list=node1
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=192.168.241.116
worker.node1.type=ajp13
worker.node1.lbfactor=1
# worker.node1.connection_pool_size=10 (1)
Note: this is a very simple worker file7. Create the URI to worker map file
Create a uriworkermap.properties file in the APACHE_HOME/conf directory. This file should contain the URL mappings you want Apache to forward to Tomcat. The format of the file is /url=worker_name. To get things started, paste this example into the file you created:
# Simple worker configuration file
#
# Mount the Servlet context to the ajp13 worker
/portal/=node1
/portal/*=node1
/*=node1
Note: I used /* to enable Apache show all contents(css, images, etc)
8. Restart Apache
9. Configure Jboss
Edit jboss-portal-2.6.6.GA/server/default/deploy/jboss-web.deployer/server.xml
locate <Engine> tag element and add an attribute jvmRoute
your tag will now look like
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
.In the server.xml file, make sure that the AJP 1.3 Connector is uncommented
10. Activate the UseJK Valve in JBoss
Edit jboss-portal-2.6.6.GA/server/default/deploy/META-INF/jboss-service.xml
Locate the element with a name of UseJK, and set its value to “true”:
<attribute name="UseJK">true</attribute>
11.Restart JBoss AS
PermGenSpace problem
okay, this issue i had a year ago. And got it again.
solution:
simply add in your JAVA_OPTS
-Xmx768m -XX:MaxPermSize=768m
by the way, i have i have 1G of memory.
maven and ear packaging
okay, i just needed to place some files in the ear file.
solution:
-create src/main/application
-anything you place in that folder will be included in the ear file
-DO NOT USE ’src/main/resources’, it will not get into your ear file-thanks to cata
Java, the IP address and reverse proxy
Okay so there is the
getRemoteAddr()method of HttpServletRequest, but when you’re using a reverse proxy that won’t work and it will just return 127.0.0.1If so, look for the header ‘X-Forwarded-For‘ of your request object. (
request.getHeader("X-Forwarded-For")).
But this will return null if using non-reverse proxy.
thanks to POLONKAI Gergely
Linux: finding files given text within…
after setting up the data source for my jbossportal,
i kinda need to play around with its layout and theme.
so i read the documentation,
but it was lacking on the files and its directories where those configurations can be found.thanks to Nap:), he gave me a way of finding those with
find . -name ‘*.xml’ | xargs grep “phalanx”
first part,
find . -name '*.xml'does find all xml files
second part,xargswhich tells to operate on each of those files
finally ,grep "phalanx"which text contained within the files i’m looking for.after it returned the files i needed,
did the configuration and played with the layout of jbossportal.oh, by the way, the output is kinda like this…
./server/default/deploy/jboss-portal.sar/portal-core.war/WEB-INF/portal-layouts.xml: phalanx
./server/default/deploy/jboss-portal.sar/portal-core.war/WEB-INF/portal-layouts.xml: /phalanx/index.jsp
./server/default/deploy/jboss-portal.sar/portal-core.war/WEB-INF/portal-layouts.xml: /phalanx/index.jsp
./server/default/deploy/jboss-portal.sar/portal-core.war/WEB-INF/portal-layouts.xml: /layouts/phalanx/maximized.jsp
./server/default/deploy/jboss-portal.sar/portal-core.war/WEB-INF/portal-layouts.xml: /layouts/phalanx/maximized.jsp
./server/default/deploy/jboss-portal.sar/portal-core.war/WEB-INF/portal-themes.xml: nphalanx
./server/default/deploy/jboss-portal.sar/portal-core.war/WEB-INF/portal-themes.xml:
./server/default/deploy/jboss-portal.sar/portal-core.war/WEB-INF/portal-themes.xml:
./server/default/deploy/jboss-portal.sar/conf/data/default-object.xml: phalanx
./server/default/deploy/jboss-portal.sar/conf/data/default-object.xml: phalanx
./server/default/deploy/jboss-portal.sar/META-INF/jboss-service.xml: phalanx
Oracle: Could not create another database? Create another data source.
I needed to set-up another data source using the same database server
—–
So using the SQL Plus, i created a user and granted privileges for it.
Creating User
SQL> create user username identified by password default tablespace user_tablespace temporary tablespace temp_tablespace;e.g.
SQL> create user wpsdbusr identified by password default tablespace users temporary tablespace temp;
Granting Privileges
SQL> grant connect, resource to username;e.g.
SQL> grant connect, resource to wpsdbusr;
now i have another data source for my project using the same database.
Transposing Records into One Field
As they say in Exist, There’s always a better way.
What I Did…
performed a loop for each record in my collection to retrieve another collection using a particular Id in the record
and placing the retrieved collection to be part of the record.The Effect…
my screen populates very slowThe Solution…
from backend, transpose those collection being retrieved to be just one field so you need not to loop in your code- thanks to ken and cata

