Tuna Töre

> IOC Advocate, Coder

How to connect MySQL Database on Linux with command

Posted by Tuna Töre on 20/05/2012


If you want to connect MySQL database on linux apply the following commands;

[root@server~]# mysql -h localhost -u root -pPassword
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is —
Server version: — MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>use yourDataBaseName;

Database changed
mysql> truncate table anyTables;

Posted in Linux | Leave a Comment »

How to start MySQL Database on Linux

Posted by Tuna Töre on 20/05/2012


You can use the following commands if you want to start,stop or restart MySQL Services on Linux;

[root@server ~]# /etc/init.d/mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@server ~]# /etc/init.d/mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@server ~]# /etc/init.d/mysqld start
Starting mysqld:                                           [  OK ]

Posted in Linux | Tagged: , | Leave a Comment »

SCRIPT5007: Unable to get value of the property ‘display’: object is null or undefined flexigrid.js, line 692 character 5

Posted by Tuna Töre on 23/04/2012


If you get the exception mentioned below while using Flexigrid in your project

SCRIPT5007: Unable to get value of the property ‘display’: object is
null or undefined
flexigrid.js, line 692 character 5

Try to use Microsoft IE Developer tools first and my problem was related to removing the last coma in colModel

colModel :{display: ‘Row ID’, name : ‘id’, width : 100, sortable : false, align: ‘left’, hide: true},
{display: ”, name : ”, width : 100, sortable : true, align: ‘left’},
{display: ”, name : ”, width : 100, sortable : true, align: ‘left’},
{display: ”, name : ”, width : 150, sortable : true, align: ‘left’},
{display: ”, name : ”, width : 150, sortable : false, align: ‘left’},
{display: ”, name : ”, width : 150, sortable : true, align: ‘left’},
},

Posted in Exceptions | Tagged: | Leave a Comment »

java.lang.NoClassDefFoundError: com/jhlabs/image/UnsharpFilter

Posted by Tuna Töre on 05/04/2012


For the exception mentioned below;

Exception in thread “main” java.lang.NoClassDefFoundError: com/jhlabs/image/UnsharpFilter
at com.mortennobel.imagescaling.AdvancedResizeOp.filter(AdvancedResizeOp.java:84)
at ImageService.scaleImage(ImageService.java:21)
at ImageService.main(ImageService.java:31)
Caused by: java.lang.ClassNotFoundException: com.jhlabs.image.UnsharpFilter
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 3 more

You need to download Filters.jar (Java Image Processing Filters) from the following link;

http://www.jhlabs.com/ip/filters/download.html

Posted in Exceptions | Tagged: | Leave a Comment »

How to call a top level JavaScript function inside iframe simple solution

Posted by Tuna Töre on 04/04/2012


You can call a top level JavaScript function inside an iframe with the following line;

window.parent.functionName();

 

Posted in JavaScript | Tagged: | Leave a Comment »

java.util.regex.PatternSyntaxException: Unmatched closing ‘)’ solution

Posted by Tuna Töre on 02/04/2012


If you encountered the following exception during run time;

java.util.regex.PatternSyntaxException: Unmatched closing ‘)’
Change your code such as the following for the parenthesis

String replaced = string.replaceFirst(“)“, “replaced”);  –> run time exception
String replaced = string.replaceFirst(“\\)“, “replaced”); –> correct usage

Posted in Exceptions, Java | Tagged: , | Leave a Comment »

<p:fileUpload> PrimeFaces handleFileUpload method not called solution

Posted by Tuna Töre on 05/03/2012


If you encounter this problem, you need to apply the following steps (2 Steps),

First of all, the following jars must be downloaded as they are required by the Primefaces fileupload component,

commons-fileupload (latest version) http://commons.apache.org/fileupload/
commons-io (latest version) http://commons.apache.org/io/download_io.cgi

Also the following filter should be defined inside web.xml file;

<filter>
   <filter-name>PrimeFaces FileUpload Filter</filter-name>
   <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>

<filter-mapping>
   <filter-name>PrimeFaces FileUpload Filter</filter-name>
   <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

Posted in JSF 2.0 | Tagged: | 4 Comments »

PrimeFaces p:calendar style (JQuery Calendar Size)

Posted by Tuna Töre on 24/02/2012


If you want to resize the calendar size use the following style in your view;

<style>

div.ui-datepicker{
font-size:10px!important;
}
</style>

Posted in jQuery, JSF, JSF 2.0 | Tagged: , | Leave a Comment »

JQuery DatePicker year range property

Posted by Tuna Töre on 21/02/2012


<script>
$(function() {
$( “#datepicker” ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: ‘dd/mm/yy’,
yearRange: ‘-20:+15′
});
});
</script>

This will adjust the datepicker  20 years back from now and 15 years after today.

 

Posted in jQuery | Tagged: | Leave a Comment »

Datatables JQuery pagination on both top and bottom solution (if you use bJQueryUI)

Posted by Tuna Töre on 11/02/2012


If you use the Datatables plugin with JQuery found on this address and need to pagination on both the top and bottom location of  Datatable plugin, you should apply the following;

Just add the property sDom like the following one (p parameter will add the pagination functionality for both on the top and bottom location)

“sDom”: ‘<”H”lfrp>t<”F”ip>’

sample script;

oTable = $(‘#table’).dataTable({
“bServerSide”: true,
“bJQueryUI”: true,
“bSort”: true,
“bFilter”: false,
“bAutoWidth”: false,
 ”sDom”: ‘<”H”lfrp>t<”F”ip>’,

Posted in jQuery | 2 Comments »

 
Follow

Get every new post delivered to your Inbox.