tag:blogger.com,1999:blog-15462231029648163492024-02-19T16:34:47.550-08:00All That CodeAll things programmingAnonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-1546223102964816349.post-82661597721661268202015-08-06T07:08:00.001-07:002015-08-06T07:08:19.365-07:00Easy Listening Piano Bar Jazz Music Hitlist 2014 | The Best Pianobar Mus...<iframe allowfullscreen="" frameborder="0" height="344" src="https://www.youtube.com/embed/v0I87Sw0THk?list=PLiBwh7gSbIMHFIijkKokfLS6xnIsiZUuC" width="459"></iframe>Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0tag:blogger.com,1999:blog-1546223102964816349.post-21451852396922896022014-10-08T06:39:00.000-07:002014-10-08T07:11:45.607-07:00Django using Python3.3 on Debian wheezy - how toDebian 7 comes with python 2.7.3, and python 3.2.3<br />
<div>
<br /></div>
<div>
To use python2.7.3, we use the command "python" and to use python3.2.3 we use "python3"</div>
<div>
<br /></div>
<div>
The goal is we want to use python3.3.x. Why? you asked. That's a very good question!</div>
<div>
The reason is because I want to use MySQL as the database and MySQL Connector Python 2.0.1 only supports Debian 6. </div>
<div>
<br /></div>
<div>
I have to use the platform independent version of MySQL Connector Python instead of the Debian version.</div>
<p>
So, first I have to install Python3.3 from source and <a href="http://askubuntu.com/questions/244544/how-do-i-install-python-3-3">this page shows me how</a>.</p>
<p>
I am going to tell you how anyway.</p>
<pre class="brush:shell;">
sudo apt-get install build-essential
sudo apt-get install libsqlite3-dev
sudo apt-get install sqlite3
sudo apt-get install bzip2 libbz2-dev
</pre>
<p>Cool! then I download and compile Python3.3</p>
<pre class="brush:shell;">
cd /home/me/downloads
wget http://www.python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz
tar xJf ./Python-3.3.5.tar.xz
cd Python-3.3.5
./configure --prefix=/opt/python3.3
make && sudo make install
</pre>
<p>I prefer to use alias for Python3.3 and I called it "py"</p>
<pre class="brush:shell;">echo 'alias py="/opt/python3.3/bin/python3.3"' >> .bashrc</pre>
<p>That's it! I now have Python3.3 and the next step is to install Django 1.7. But before we do that, we must first install "distribute" and here how I did it. "Distribute" can be found on this <a href="">page</a></p>
<pre class="brush:shell;">
cd /home/me/downloads
wget https://pypi.python.org/packages/source/d/distribute/distribute-0.7.3.zip#md5=c6c59594a7b180af57af8a0cc0cf5b4a
unzip distribute-0.7.3.zip
cd distribute-0.7.3
py setup.py install
</pre>
<p>Now we have distribute package which is what we need to install Django 1.7. Without this package, it will throw an ImportError: "No module name setuptools"<br/>
Get the latest release of Django 1.7 <a href="https://www.djangoproject.com/download/">here</a></p>
<pre class="brush:shell;">
cd /home/me/downloads
wget https://www.djangoproject.com/download/1.7/tarball/
tar -zxvf Django-1.7.tar.gz
cd Django-1.7
py setup.py install
</pre>
<p>Great! I now have Django 1.7 installed. NOTE: when using django-admin.py, you must call it using "py" instead of just "django-admin.py"
as mentioned in the <a href="https://docs.djangoproject.com/en/1.7/intro/tutorial01/">Django tutorial</a>.<br/>
Find out where "django-admin.py" was installed here:</p>
<pre class="brush:shell;">
locate django-admin.py
/usr/local/bin/django-admin.py
</pre>
<p>Last step is to install MySQL Connector Python, well, because I want to use MySQL. That's the reason why this post is created.<br/>
Download MySQL Connector Python <a href="http://dev.mysql.com/downloads/connector/python/">here</a></p>
<pre class="brush:shell;">
cd /home/me/downloads
wget http://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-2.0.1.tar.gz
tar -zxvf mysql-connector-python-2.0.1.tar.gz
cd mysql-connector-python-2.0.1
py setup.py install
</pre>
<p>Now you can start a new project by calling</p>
<pre class="brush:shell;">py /usr/local/bin/django-admin.py startproject mysite</pre>
<p>To use MySQL Connector Python, edit your settings.py as below</p>
<pre class="brush:shell;">
DATABASES = {
'default': {
'ENGINE' : 'mysql.connector.django',
'NAME' : 'mysite',
'USER' : 'root',
'PASSWORD': 'IShallNotUseRoot',
'HOST' : '127.0.0.1',
'PORT' : '3306'
}
}
</pre>
<p>REMEMBER: Use "py" (in my case) for all the call, such as <b>py manage.py runserver</b>.<br/>Hope this helps you!</p>
Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0tag:blogger.com,1999:blog-1546223102964816349.post-37138816165545715122013-05-27T21:38:00.000-07:002013-05-27T21:38:01.325-07:00How to generate existing entity from existing databases - Symfony, DoctrineTo generate an entity, yes, an entity from a table in an existing database (in YAML):
<br /><br/>
<b>1. Create a mapping file.</b>
<br/>
<pre class="brush:shell;">
$ app/console doctrine:mapping:convert yml
./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm
--from-database --force --filter=TableName --em=defaultEntityManager
</pre>
<b>2. Import annotation.</b>
<br/>
<pre class="brush:shell;">
$ app/console doctrine:mapping:import BundleName annotation
--filter=TableName --em=defaultEntityManager
</pre>
<b>3. Generate the entity.</b>
<br/>
<pre class="brush:shell;">
$ app/console doctrine:generate:entitie Vendor/BundleName/Entity/EntityName
</pre>
Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0tag:blogger.com,1999:blog-1546223102964816349.post-75463100732956137142013-05-25T06:57:00.000-07:002013-05-25T07:08:12.031-07:00Uncaught TypeError: Object #<Object> has no method 'easeInOutCirc'This error typically appears when you use Primefaces 3.5.
<br />
<br />
I found the answer to this error :
http://forum.primefaces.org/viewtopic.php?f=3&t=28427<br />
<br />
Basically, just need to add somewhere in your .xhtml file a dummy dialog.<br />
<pre class="brush:xml;"><p:dialog></p:dialog>
</pre>
You can add this to your master template file, so that all your other pages will automatically include this dummy dialog.
Hope this helps.
Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0tag:blogger.com,1999:blog-1546223102964816349.post-78717423808501528772013-05-25T06:29:00.002-07:002013-05-25T07:07:31.480-07:00Glassfish: Exception while preparing the app : Invalid resource : __pm<span style="font-family: inherit;">I thought I'd like to share this information to anyone who might be having issue with deploying a WAR application on Glassfish Server.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">My case is Glassfish 3.1.2 and the error is </span>
<br />
<pre class="java" name="code">Error occurred during deployment: Exception while preparing the app : Invalid resource : jdbc/login__pm </pre>
<span style="font-family: inherit;"><code></code>It's something to do with glassfish-resources.xml file. If you are deploying a WAR file, it must be a web application, and you need to have glassfish-resources.xml file in your WEB-INF folder.</span><br />
<br />
<span style="font-family: inherit;">For other applications, this will be in your META-INF folder.</span><br />
<br />
<span style="font-family: inherit;">My glassfish-resources.xml looks like this and this gives me the error</span>
<span style="font-family: inherit;"> </span>
<br />
<pre class="brush:xml;"><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-connection-pool
allow-non-component-callers="false" associate-with-thread="false"
connection-creation-retry-attempts="0"
connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0"
connection-validation-method="auto-commit"
datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
fail-all-connections="false" idle-timeout-in-seconds="300"
is-connection-validation-required="false"
is-isolation-level-guaranteed="true"
lazy-connection-association="false" lazy-connection-enlistment="false"
match-connections="false" max-connection-usage-count="0"
max-pool-size="128" max-wait-time-in-millis="0"
name="java:app/LoginPool" non-transactional-connections="false"
pool-resize-quantity="5"
res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1"
steady-pool-size="10" validate-atmost-once-period-in-seconds="0"
wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
<property name="portNumber" value="3307"/>
<property name="databaseName" value="clientdb_user"/>
<property name="User" value="login1"/>
<property name="Password" value="login1"/>
<property name="URL" value="jdbc:mysql://localhost:3307/clientdb_user?zeroDateTimeBehavior=convertToNull"/>
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="create" value="true" />
<property name="connectionAttributes" value=";create=true" />
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="java:app/jdbc/login"
object-type="user" pool-name="java:app/LoginPool"/>
</resources></pre>
Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0tag:blogger.com,1999:blog-1546223102964816349.post-46435081153677526782013-01-02T16:25:00.002-08:002013-05-25T07:07:07.882-07:00Multiple Modules EJB, JPA, JAR, WAR - Maven Netbeans<span style="font-family: Trebuchet MS, sans-serif;">I hope this can be a useful post for those who are looking to do an EAR project, with multiple modules.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;">First stop, using Netbeans 7.2.1 create Maven Enterprise Application, and this will give you the EAR, EJB, and WAR project. You will have one parent project which consists only one pom.xml</span><br />
<ol>
<li><span style="font-family: Trebuchet MS, sans-serif;"><b>Create a new module</b>, a JAR project, to contain all your POJO classes, supposedly your entity classes, java classes with @Entity annotation. Nothing else, only POJO classes. Note: don't forget to include these classes in your persistence.xml file, this is where you put the persistence.xml, not anywhere else.</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">In your EJB projects, <b>placed all your session beans</b>, in NetBeans, normally this has suffix "Facade". This is where the EntityManager lives. Note: don't forget to include your database dependency jar, for MySQL is something like mysql-connector-java, there is one for PostgreSQL as well. Include JAR project as dependency here.</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;"><b>In your WAR projects</b>, all web application files, html, css, images, resources and etc. This is where your controller files (managed beans, converters, utils, and etc) live. Note: include JAR, and EJB projects as dependencies here.</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">Finally, <b>your EAR projects</b>, which is supposed to package all three modules above.
<ul>
<li>Your glassfish-resources.xml should be here (if you want to use application scoped resources).</li>
<li>In your EAR pom.xml, package the JAR project into a folder called "lib" or whatever name you specify in the <defaultLibBundledir/>.</li>
<li>Use option <unpack>true</unpack>.</li>
<li>List all three modules above as dependency</li>
</ul>
</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">You should be good to go</span></li>
</ol>
Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0tag:blogger.com,1999:blog-1546223102964816349.post-2189388661339766662012-09-11T18:14:00.004-07:002013-05-25T07:06:40.513-07:00Installing Ubuntu 12.04 TLS on HP 530<script src="https://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js" type="text/javascript">
</script>
<script src="https://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushBash.js" type="text/javascript">
</script>
<span style="font-family: Verdana, sans-serif;">Simply follow the tutorial from Ubuntu <a href="https://help.ubuntu.com/community/Installation/FromUSBStickQuick">site</a></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">After my installation I encountered a few glitches and issues:</span><br />
<span style="font-family: Verdana, sans-serif;"></span>
<br />
<ol>
<li><span style="font-family: Verdana, sans-serif;">Can't boot into Ubuntu, I have to have my USB plugged in and boot from it</span></li>
<li><span style="font-family: Verdana, sans-serif;">Unable to set up my wireless network, the wireless button on HP530 not working</span></li>
<li><span style="font-family: Verdana, sans-serif;">Unable to find my graphics driver</span></li>
</ol>
<span style="font-family: Verdana, sans-serif;">For issue 1:</span>
<br />
<pre class="brush:bash;">sudo grub-install /dev/sda </pre>
<br />
<span style="font-family: Verdana, sans-serif;">Then I modify the /boot/grub/menu.lst and change somewhere in the line "quiet splash" to "nomodeset" </span><br />
<br />
<span style="font-family: Verdana, sans-serif;">For issue 2:</span><br />
<pre class="brush:bash;">sudo rfkill unblock all </pre>
<br />
<span style="font-family: Verdana, sans-serif;">For issue 3:</span><br />
<span style="font-family: Verdana, sans-serif;">Can anyone help? I can't seem to find the correct driver. </span>
<script type="text/javascript">
try{
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.ClipboardSwf = 'Scripts/clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');
} catch(e){}</script>
Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com1tag:blogger.com,1999:blog-1546223102964816349.post-46814614600171757102012-07-30T19:09:00.002-07:002012-08-02T18:19:53.189-07:00BroadLEARN Early Learning Credits<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small; line-height: 16px;">BroadLEARN™ Early Learning is a multi-award winning early childhood literacy and numeracy program which features over 300 interactive learning and assessment activities</span>
</div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small; line-height: 16px;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small; line-height: 16px;">BroadLEARN™ Early Learning encourages exploration play for your child while developing speaking, listening, reading, writing and computer skills.</span>
</div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">My Credit:</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><a href="http://www.broadlearn.com/credits">http://www.broadlearn.com/credits</a></span></div>Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0tag:blogger.com,1999:blog-1546223102964816349.post-65115504903717726602012-07-30T18:53:00.001-07:002013-05-25T06:51:07.843-07:00How to obtain JTA Transaction / User Transaction from JSF Context<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">There are 3 ways UserTransaction can be obtained from JSF Context, ie. InitialContext object.</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">1. Using SessionContext or EJBContext from within your EJB implementation class. Only Bean-Managed transaction beans can have access</span></div>
<pre class="brush:java;" >@Resources EJBContext context;
UserTransaction utx = (UserTransaction) context.getUserTransaction();
</pre>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">2. Using InitialContext from your JSF controller class or utility class using the EJB </span></div>
<pre class="brush:java;">UserTransaction utx;
try {
InitialContext context = new InitialContext();
utx = (UserTransaction) context.lookup("java:comp/UserTransaction");
} catch(Exception e){}
</pre>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">3. Using InitialContext from your JSF controller class or utility class using the EJB</span> </div>
<pre class="brush:java;">UserTransaction utx;
try {
InitialContext context = new InitialContext();
utx = (UserTransaction) context.lookup("java.transaction.UserTransaction");
} catch(Exception e){}
</pre>
Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0tag:blogger.com,1999:blog-1546223102964816349.post-58335824341260278052012-07-25T17:10:00.003-07:002013-05-25T07:07:48.883-07:00Embedded Glassfish 3.1.2 - Arquillian compile errorIf you get :
<br />
<pre class="brush:xml;">Absent Code attribute in method that is not native or abstract in class file javax/validation/constraints/Pattern$Flag</pre>
Solution: remove this dependency (if you have it)
<br />
<pre class="brush:xml;"><dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</pre>
Another one:
<br />
<pre class="brush:xml;">ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.</pre>
which is caused by
<br />
<pre class="brush:xml;">Error invoking ServletContainerInitializer org.apache.jasper.runtime.TldScanner
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration;
at org.apache.jasper.runtime.TldScanner.onStartup(TldScanner.java:231)</pre>
Solution is to modify your pom.xml. Tell maven-surefire-plugin to ignore servlet-api 2.3<br />
<pre class="brush:xml;"><plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<forkMode>always</forkMode>
<classpathDependencyExcludes>
<classpathDependencyExcludes>
javax.servlet:servlet-api
</classpathDependencyExcludes>
<classpathDependencyExcludes>
org.apache.felix:javax.servlet
</classpathDependencyExcludes>
<classpathDependencyExcludes>
</configuration>
</plugin>
</pre>
Taken from this site: <a href="http://java.net/jira/browse/GLASSFISH-17445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=323464#action_323464" target="_blank">http://java.net/jira/browse/GLASSFISH-17445</a>
Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com2tag:blogger.com,1999:blog-1546223102964816349.post-50741713840362625602012-04-14T17:06:00.002-07:002012-08-01T17:52:05.686-07:00Learning JSF?<span style="font-family: Verdana, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;">Here are some cool tutorials and references:</span><br />
<div>
<ul>
<li><span style="-webkit-text-size-adjust: none; font-family: Verdana, sans-serif; text-align: -webkit-auto; white-space: pre-wrap;"><a href="http://www.java-forums.org/javaserver-faces-jsf/27079-jsf-facelets-tutorial.html">JSF Facelets Tutorial</a></span></li>
<li><span style="-webkit-text-size-adjust: none; font-family: Verdana, sans-serif; text-align: -webkit-auto; white-space: pre-wrap;"><a href="http://docs.oracle.com/javaee/6/tutorial/doc/giepx.html">Introduction to Facelets - The Java EE 6 Tutorial</a></span></li>
<li><span style="-webkit-text-size-adjust: none; font-family: Verdana, sans-serif; text-align: -webkit-auto; white-space: pre-wrap;"><a href="http://www.mastertheboss.com/web-interfaces/365-primefaces-vs-richfaces-vs-icefaces.html?start=1">PrimeFaces vs RichFaces vs IceFaces - RichFaces vs PrimeFaces vs IceFaces part 2</a></span></li>
<li><span style="-webkit-text-size-adjust: none; font-family: Verdana, sans-serif; text-align: -webkit-auto; white-space: pre-wrap;"><a href="http://www.primefaces.org/">PrimeFaces</a></span></li>
<li><span style="-webkit-text-size-adjust: none; font-family: Verdana, sans-serif; text-align: -webkit-auto; white-space: pre-wrap;"><a href="http://netbeans.dzone.com/articles/develop-java-ee-6-app-jsf2?page=0,1">How to Create a Java EE 6 Application with JSF 2, EJB 3.1, JPA, and NetBeans IDE 6.8 | NetBeans Zone</a></span></li>
<li><span style="-webkit-text-size-adjust: none; font-family: Verdana, sans-serif; text-align: -webkit-auto; white-space: pre-wrap;"><a href="http://wiki.netbeans.org/Main_Page">NetBeans Wiki</a></span></li>
<li><span style="-webkit-text-size-adjust: none; font-family: Verdana, sans-serif; text-align: -webkit-auto; white-space: pre-wrap;"><a href="http://wiki.netbeans.org/DevelopAjaxJSF2App">DevelopAjaxJSF2App - NetBeans Wiki</a></span></li>
</ul>
</div>Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0tag:blogger.com,1999:blog-1546223102964816349.post-65079984043853832502008-02-12T18:08:00.000-08:002008-02-12T18:10:24.195-08:00Recent Projects: BroadLEARN IELTSRecently completed IELTS registration and IELTS login for Mediasphere Pty Ltd.<br />Well it's not just a normal registration form and normal login form. It does more than that.<br />It has blocking system that analyse user login details to match their registration details.<br />It will block or warn user for illegal use or account abuse.Anonymoushttp://www.blogger.com/profile/06329970584821301706noreply@blogger.com0