Search

Recent Posts

Artificial Intelligence

References Artificial Intelligence: Look Ma, No Hands!AI in StepsMost common steps towards creating artificial intelligence are - Know the Domain, what you are solving for Study the data — Data Mining Cleanse , Normalize Data, develop tools Choose a Model Test with Few Models —> Shortlis...

Install Glassfish on Debian

References HOW TO INSTALL ORACLE JAVA 8 IN DEBIAN VIA REPOSITORY JDK8 How To Install Glassfish 4.0 on Ubuntu 12.04.3 Install Glassfish 4 on a Debian 8 VPSPreperation# Check debian versionlsb_release -a# Check java version if existjava -version# Update the systemapt-get update && apt-ge...

Creating UML, EER, ERD Diagrams

In MySQLWorkbench you can export EER Diagram to PNG, SVG, PDF and PostScript formats by following Reverse Engineer wizard steps.In Sequel Pro you can export Graphviz dot files. The result is a basic table-based ERD. You can use graphviz to export the diagram to svg.Install Sequel Pro, run the app...

Artifical Intelligence and BigData

BasicsMachine Learning: The Basics, with Ron Bekkerman Supervised Learning (Classification): is powerful when the classifications are known to be correct for instance, when dealing with diseases. Unsupervised Learning (Clustring): can be useful to find hidden structure in unlabeled data. Reinf...

How to Convert an ePub to Mobi Format

Since Kindle cannot read files in the EPUB file format we need to convert it to MOBI file format.If you are looking for an online converter please go to this site. You can convert file formats such as DOC, PPT, ODS, and PDF.If you are using Linux or OSX, install the program called Calibre to conv...

Docker

What is Docker? Package your Java EE Application using Docker and Kubernetes MySQL on Docker: Building the Container Image Modular and Reusable Java EE Architecture with Docker Step-by-Step High Availability with Docker and Java EE The Difference: Docker vs. VirtualizationInstallation of d...

Hello World in Python on Apache

Create hello.py with this content:#! /usr/bin/pythonprint "Content-type: text/html"print ""print "Hello, World!"and make it executable:$ chmod +x hello.pyand dropped this .htaccess:Options +ExecCGIAddHandler cgi-script .py

Homebrew, MongoDB, ElasticSearch and Marvel module installation on Mac

Installing homebrew$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"Installing mongoDB with homebrew$ brew update$ brew install mongodbConfiguration file is /usr/local/etc/mongod.confTo start mongoDB using brew services$ brew services start mongodb(This w...

WordPress installation in a directory

Copy index.php to root. Edit the file and add subdirectoryrequire( dirname( __FILE__ ) . '/capsim/wp-blog-header.php' );Edit .htaccess file# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /capsim/RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCon...

Using Mono to compile CSharp files on MacOS X

Download Connector/Net (mysql-connector-net-version-noinstall.zip) and extract the contents to a directory.Ensure the file MySql.Data.dll is present.You must register the Connector/Net component, MySql.Data, in the Global Assembly Cache (GAC). In the current directory enter the gacutil command:su...

Passing image stream to jasper report

3 steps to pass image stream to jasper report. Convert the image to stream and set it in parameter (“logo”) In jrxml file , create a parameter with parameter class as “java.io.InputStream” Place a image on the jrxml design, set “Image Expression” to $P{logo} and “Expression class” to java.lang...

Free NTFS read and write on Mac

Edit fstab filesudo nano /etc/fstabAdd below line where DRIVE_NAME is the name of the drive. The drive’s name should contain no spaces, as adding a space to the configuration file would tell your Mac to interpret whatever’s after that space as a separate command. If your DRIVE_NAME is made up of ...

primefaces galleria redirect onclick using remoteCommand

Loading ....

Suppressing GPG signing for Maven builds

Add gpg plugin in a profile as below and then when you need to do a release, add the property to your mvn command:mvn -DperformRelease=true ...<profiles> <profile> <id>release-sign-artifacts</id> <activation> <property> <name>performRel...

Git commands

Delete a Tag on Gitgit tag -d [tag]git push origin :[tag]If your tag has the same name as one of your branches;git tag -d [tag]git push origin :refs/tags/[tag]See all Branchesgit branchCreate a Branch from previous commitgit branch branchname <sha1-of-commit>Push the new Branch to servergit...

jdbc connection pool for mssql

<jdbc-resource enabled=”true” jndi-name=”jdbc/b2bc_mssql” object-type=”user” pool-name=”b2bc_mssql”></jdbc-resource><jdbc-connection-pool allow-non-component-callers=”false” associate-with-thread=”false” ...

Bulk update with JPA CriteriaUpdate

public void bulkUpdatePricesInLocal() { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaUpdate<ProductEntity> cu = cb.createCriteriaUpdate(ProductEntity.class); Root<ProductEntity> root = cu.from(ProductEntity.class); Join<ProductEntity, CurrencyEntity> currenc...

Resetting a forgotten MySQL root password

/etc/init.d/mysql stop/usr/bin/mysqld_safe --skip-grant-tables &amp;mysql --user=root mysqlmysql> update user set Password=PASSWORD('new-password-here') WHERE User='root';mysql> flush privileges;mysql> exit/etc/init.d/mysql start

Pattern Examples

AcronymDescriptionShift PeriodAggregationComparison YTDYear To DateX QTDQuarter To DateX MTDMonth To DateX MATMoving Annual TotalX PYPrevious YearX PQPrevious QuarterX PMPrevious MonthX PPPrevious Period (automatically selects year, quarter, or month)X PMATPrevious Year Moving Annu...

Apriori Algorithm

Apriori Algorithm is to find association rules and frequent item sets (also closed and maximal as well as generators). It is used for Frequent Pattern Mining.References: http://lsirwww.epfl.ch/courses/dis/2005ws/exercises/apriori/www/ http://www2.cs.uregina.ca/~dbd/cs831/notes/itemsets/itemset_...

Gaussian plot

Loading ....

Making a polar plot (describing the radiation pattern of an antenna)

Loading ....Loading ....

Mortgage calculation with SAGE

PMT: Payment PV: Present Value (loan’s principal, amount barrowed) r: monthly interest rate (compounded monthly) t: number of years of the loan m: 12 (compounding period) i: r/m=r/12 (intereset rate per compounding period) n: mt=12*t (loan’s term, number of monthly payments)PMT(PV, i, n) ...

Compounded interest calculation with SAGE

Suppose you deposit $5000 in an account that earns 4.5% compounded monthly. You are curious when your total will reach $ 7000. Using the formula A = P(1+i)n, where P is the principal, A is the amount at the end, i is the interest rate per month, and n is the number of compounding periods (number ...

Inject Maven project informations into Java application

References: http://ovaraksin.blogspot.com.tr/2012/02/inject-maven-project-informations-into.html

EclipseLink and MultiTenant

References: http://www.eclipse.org/eclipselink/documentation/2.5/solutions/multitenancy001.htmMultitenantType.SINGLE_TABLELoading ....## MultitenantType.TABLE_PER_TENANT## MultitenantType.VPD

JSONP, JSONWithPadding

Loading ....

SortedSetMultimap

Loading ....

Install local jar with the maven-install-plugin

References: http://www.baeldung.com/install-local-jar-with-maven/Loading ....

Location of the SQLite DB file

on WindowsC:\Users\%USERNAME%\AppData\Local\Apple Computer\Safari\Databaseson Mac/Users/[username]/Library/Safari/Databases/http_[URL of the site creating the DB]_0/Users/[username]/Library/Safari/Databases/file__0Name of the database is something like 0000000000000002.db

alternatedocroot example

glassfish-web.xml<property description="Uploaded images" name="alternatedocroot_1" value="from=/images/* dir=/Users/[username]/Developments/backup"/>xhtml file<p:graphicImage value="/images/logo.png"/>Note: Be sure that there is “/Users/[username]/Developments/backup/images” directory...

LOGO TIGERPLUS VIEW - SATIŞ İRSALİYE SATIRLARI

—2014—USE [TIGERPLUS]GO/****** Object: View [dbo].[LV_001_SATIS_IRSALIYE_SATIRLARI] Script Date: 09/24/2014 20:21:16 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER VIEW [dbo].[LV_001_SATIS_IRSALIYE_SATIRLARI]ASSELECT S.DATE_ AS TARIH, F.FICHENO AS IRSALIYE_NO, C.CODE AS CARI_KO...

glassfish mail-resource for domain, gmail and yandex using no-ssl, ssl, tis

Domain settings with no-ssl<mail-resource jndi-name="mail/myMailSession" host="mail.domain.com" user="user@domain.com" from="user@domain.com" object-type="user" store-protocol="imap" store-protocol-class="com.s...

Running socat on Mac OS X

References: http://www.xappsoftware.com/wordpress/2013/10/10/how-to-run-socat-on-mac-os-x/ http://scott.cranton.com/2011/04/socat-is-so-cool.html http://justcheckingonall.wordpress.com/2009/06/09/howto-vsp-socat/ http://buhadram.wordpress.com/2008/10/07/some-useful-socat-commands/Install soca...

enum type with numeric key

public enum BarcodeType { QR_CODE(1), CODE_128(2), EAN_13(3); private final int value; private BarcodeType(int value) { this.value = value; } public int getValue() { return value; } public static BarcodeType parse(int value){ for (BarcodeType type : Barco...

Random hex html color code in Java

Random rnd = new Random();int intVal = rnd.nextInt(16777215 + 1);return Integer.toHexString(intVal);orreturn Integer.toString(intVal, 16);16777215 == ffffff in decimalReferences: http://www.paulirish.com/2009/random-hex-color-code-snippets/

Recover Glassfish admin password

changeitadmin;{SSHA256}dvCEGFNHGtSyXIhJvwR5FnviH+u8fCadrUIqp6uJc1tP9Bv10CGT7A==;asadminemptyadmin;{SSHA256}2GiTMM0n4ulpMfRaMPMImYvVF522XY6nW2cKSXoY1EoM2QlHrHUkDQ==;asadmin

Manually creating a service in Windows

To create a windows service manually, the syntax is:sc create <servicename> binpath=<pathtobinaryexecutable> [option1] [option2] [optionN]An example:sc create aripd binPath="C:\Program Files\ARIPD\start.exe" DisplayName="ARIPD" start=autoIf it is worked you will see:[SC] CreateService...

How to add a local library to a maven project in NetBeans?

Right-click on the "Dependencies" folder in the Projects viewEnter some groupId, artifactId and version informationDependency will be added to the pom.xml and will appear under "Libraries" node of maven projectRight-click lib node and "manually install artifact", fill the path to the jarJar shoul...

Rename files by removing first x characters and last y characters

@echo offsetlocal enabledelayedexpansionrem set S=0set /p S="The number of characters to be trimmed from the beginning of the file name: " %=%rem set X=6set /p X="The number of characters to be trimmed from the end of the file name: " %=%set FOLDER_PATH=.pushd %FOLDER_PATH%for %%f in (*) do if %%...

node.js update version

check current node.js versionnode -vnode --versionclean npm cachesudo npm cache clean -finstall nsudo npm install -g nupgrade to stable versionsudo n stable  

When using @FlowScoped, flow command actions did not work when entered a flow

Fixed in the Majorra 2.2.3 and later. (Ref: https://github.com/hantsy/ee7-sandbox/wiki/jsf-flow)Download the latest mojarra version from https://maven.java.net/content/repositories/releases/org/glassfish/javax.faces/Then copy it in the /glassfish/modules directory (/Applications/NetBeans/gla...

JPA sort and pageable

findAll();findAll(Pageable pageable);findAll(Sort sort);final PageRequest page1 = new PageRequest( 0, 20, Direction.ASC, "lastName", "salary");final PageRequest page2 = new PageRequest( 0, 20, new Sort( new Order(Direction.ASC, "lastName"), new Order(Direction.DESC, "salary") ));dao.fin...

Java calculation of the geographic midpoint for two or more points on the earth's surface

    /**     * Calculation of the geographic midpoint (also known as the geographic center,     * or center of gravity) for two or more points on the earth's surface Ref:     * http://www.geomidpoint.com/calculation.html     *&n...

Copying one single row to insert into the same table

CREATE TEMPORARY TABLE tmptable SELECT * FROM teacher WHERE id = 1;UPDATE tmptable SET id = 2 WHERE id = 1;INSERT INTO teacher SELECT * FROM tmptable WHERE id;

JSF2 image path in css as background-image

You should be using the EL variable #{resource} in CSS to specify image resources.Change below lines for bootstrap.css for example@font-face {  font-family: 'Glyphicons Halflings';  src: url('../fonts/glyphicons-halflings-regular.eot');  src: url('../fonts/glyphicons-half...

Upload, list and download files with Dropbox Java API

Loading ....

Dynamic bean naming in EL

If bean scope is known${requestScope[beanName].methodName}If not${util:getBean(beanName).methodName}

Symfony2 optional requirements installation on Mac OS X Mountain Lion (version 10.8)

intl extensionUse "port" to install php5-intlsudo port install php5-intlCopy intl.so into active php extensions directorysudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/intl.so /usr/lib/php/extensions/no-debug-non-zts-20090626/Add "extension=intl.so" into php.inisudo nano /etc/php...

Apache Virtual Host and SSL on Mac OS

sudo pico /etc/hosts127.0.0.1 localhost127.0.0.1 albatros.project.aripd.comsudo pico /etc/apache2/httpd.confInclude /private/etc/apache2/extra/httpd-vhosts.confInclude /private/etc/apache2/extra/httpd-ssl.confsudo pico /etc/apache2/extra/httpd-vhosts.confNameVirtualHost *:80<Virtua...

Install mod_jk, Tomcat behind Apache with multiple (sub)domains and web apps

Install mod-jk apt-get install libapache2-mod-jkEnable Apache modulea2enmod jkCreate /etc/apache2/workers.properties and add the following into it# List workersworker.list=worker1,worker2# Define worker1worker.worker1.port=8009worker.worker1.host=domain1.tldworker.worker1.type=ajp13# Define worke...

Convert png image to jpg with white background

http://www.imagemagick.org/www/mogrify.htmlmogrify -format jpg -background white -flatten *.png 

To get mysql random integer range

update `store_products_categories` set `category_id` = FLOOR( 2 + RAND( ) * 8 ) where category_id = 1; 

Reset local repository to be like the remote repo

Setting your branch to exactly match the remote branch can be done in two steps:git fetch origingit reset --hard origin/masterIf you want to save your current branch's state before doing this (just in case), you can do:git commit -a -m "Saving my work, just in case"git branch my-saved-work

Error when generating the bootstrap

To resolve the issue with the bootstrap file generation,php composer update --no-scriptsphp vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php 

One-To-Many, Unidirectional with Join Table

/** * One-To-Many, Unidirectional with Join Table * http://docs.doctrine-project.org/en/2.0.x/reference/association-mapping.html#one-to-many-unidirectional-with-join-table * * @ORM\ManyToMany(targetEntity="ARIPD\UserBundle\Entity\User") * @ORM\JoinTable(name="dms_dealer_users", * joi...

Mount an ISO Image

Under UNIX and Linux like oses a loop device (a pseudo-device) can make a file accessible as a block device. It is is often used for CD / DVD ISO images and floppy disc images. Mounting a file containing a filesystem via such a loop mount makes the files within that filesystem accessible. They ap...

Accurate Platform Detection

shtool platform -v -F "%sc (%ac) %st (%at) %sp (%ap)"cat /etc/*-release 

SEO for video pages

<meta name="title" content="Video Başlığı"> <meta name="description" content="Video Açıklaması"> <meta name="medium" content="video"> <meta name="video_height" content="402"> <meta name="video_width" content="468"> <meta name="video_type" content="application/x-sh...

Sami: Yet another PHP API documentation generator

Ref: http://fabien.potencier.org/article/63/sami-yet-another-php-api-documentation-generatorphp bin/sami.php update bin/sami_config.phpuse Sami\Sami;use Symfony\Component\Finder\Finder;$iterator = Finder::create() ->files() ->name('*.php') ->exclude('Resources') ->exclude(...

Installing PHPUnit

Installing PHPUnit for Symfony2sudo apt-get remove phpunitsudo pear channel-discover pear.phpunit.desudo pear channel-discover pear.symfony-project.comsudo pear channel-discover components.ez.nosudo pear update-channelssudo pear upgrade-allsudo pear install --alldeps phpunit/PHPUnitsudo pear inst...

Physical mapping

Apache uses a physical mapping technique to map URLs to a physical files. The easiest way to register a FrontController with apache is to move physical file into the ~DocumentRoot directory. Assuming a DocumentRoot of /home/user/public_html, apache will map http://www.mydomain.com/index.php?categ...

JSONStringer

JSONStringer js = new JSONStringer();// Begin arrayjs.array();js.object().key("name").value("jason"). key("email").value("jason@gmail.com").endObject();js.object().key("name").value("alex"). key("email").value("alex@hotmail.com").endObject();js.endArray();// end array// Print out JSON strin...

Reading All Request Parameters

response.setContentType("text/html");response.setCharacterEncoding("UTF-8");request.setCharacterEncoding("UTF-8");PrintWriter out = response.getWriter();String title = "Reading All Request Parameters";out.println("<H1 ALIGN=CENTER>" + title + "</H1>\n" +"<TABLE BORDER=1 ALIGN=CENTE...

Getting username and password from Basic realm authorization header

private String getUsername(HttpServletRequest request) throws IOException {String user_name = null;String user_pass = null;boolean valid = false;// Get the Authorization header, if one was supplied// Example: Authorization: Basic cGFua2FqOnBhbmthag==String authHeader = request.getHeader("Authoriz...

Form based authentication - logout

When using form based authentication in a J2EE application, the standard way to logout the user would be to invalidate the user session on the web server. In a simple servlet, the logout steps would look like this:public void doGet(HttpServletRequest req, HttpServletResponse resp) throwsServletEx...

Method Chaining in PHP5

Chaining method calls can help shorten the amount of code you have to write while accomplishing the same programatic goals.Let’s say, you have a class that needs to have some data set to it before you can start applying methods. A traditional approach may look like this.class A { private $data...

Converting a ResultSet to a Result Object

You want to convert a java.sql.ResultSet to a javax.servlet.jsp.jstl.sql.Result object so that the object can be used with the JSTL. Creates a ResultSet by querying a database. Converts the ResultSet to a Result.Use the javax.servlet.jsp.jstl.sql.ResultSupport.toResult( ) method. Forwards the R...

Accessing the Virtual Server from the Host System

Now that our server is up and running, we want to be able to access it from our host system. We’ll set it up so we can SSH to it, transfer files to it via SFTP, and make HTTP requests to Apache.To do all this we need to edit the xml configuration file for our virtual machine: On a Mac, the file ...

Google Earth on debian amd64

Add contrib to /etc/apt/sources.listaptitude install googleearth-packagedpkg -L googleearth-packagemake-googleearth-package --forcedpkg -i –force-architecture googleearth_4.1.7076.4458+0.1.0-1_i386.debgoogleearth

How to pronounce Linux

Internet newsgroup participants have long debated the proper pronunciation of Linux. Because the name Linux was conferred by Linux kernel author Linus Torvalds, his pronunciation of the word should reign as standard as I see it. However, Linus is Finnish and his pronunciation of Linux is difficul...

What is and is not Spring?

Source: Wrox Professional Java Development With The Spring Framework, page 50There is some confusion about whether Spring competes with J2EE. It does not. J2EE is most successful as a set of specifications for low-level services; Spring is essentially an enabler of an application programming mode...

Restore Database from backed up .sql file

To restore database from backed up .sql filemysql -u [username] -p [database] < yourbackup.sql

Webmin

Download Debian Package and run itwget http://prdownloads.sourceforge.net/webadmin/webmin_1.480_all.debdpkg --install webmin_1.480_all.debIf it asks for dependenciesaptitude install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl libmd5-perl

MySQL5 and Apache2 with PHP5 Support

Install MySQL5 and Apache2 with PHP5 Supportaptitude install apache2 mysql-server libapache2-mod-php5 php5-cli php5-common php5-cgi phpmyadmincontd

Reverse a string

public class StringDemo { public static void main(String[] args) { String palindrome = "Dot saw I was Tod"; int len = palindrome.length(); char[] tempCharArray = new char[len]; char[] charArray = new char[len]; // put original string in an array of chars ...

RewriteEngine and RewriteRule for .htaccess

To enable rewrite, run below commanda2enmod rewriteTo rewrite your url, add below lines between <VirtualHost></VirtualHost> tagRewriteEngine onRewriteCond %{http_host} ^yourdomain.com [nc]RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [r=301,nc]To rewrite your url, open your .htacces...

Php - setlocale

If money_format doesn't seem to be working properly, make sure you are defining a valid locale. For example, on Debian, 'en_US' is not a valid locale - you need 'en_US.UTF-8' or 'en_US.ISO-8559-1'.Debian has a list of valid locales at /usr/share/i18n/SUPPORTED; find yours there if it's not worki...

How to format a hard drive in linux

To create partition on hard drive Bcfdisk /dev/sdbChoose New, Primary and then Write and QuitTo format 1st partition on hard drive Bmkfs /dev/sdb1

Linux commands

To set home directoryusermod –d /home/user1/To set root gid and groups for the user1usermod –g 0 –G 0 user1To change access rights for a directorychmod 777 /var/www/directoryTo remove package with configuration filesaptitude remove --purge package-nameTo remove old configuration filesdpkg --purge...

How to read smarty config variable from PHP behind?

$smarty->configLoad($config_file, $sections = null) // Load config file with section$smarty->getConfigVars(); // returns variables as array$smarty->getConfigVariable("BUTTON_Login"); // return variable value

Associations

Object-oriented languages represent associations using object references; but inthe relational world, an association is represented as a foreign key column, withcopies of key values (and a constraint to guarantee integrity). There are substan-tial differences between the two representations.Objec...

MSSQL Connection with PHP and JAVA

Edit php.ini and activate extension.extension=php_mssql.dllThe default way to connect to MSSQL Server with user names and passwords, but the mssql extension can be configured to use secure/trusted connections. So you have to set mssql.secure_connection = On in php.ini.mssql.secure_connection = On...

Create a self-signed certificate and Activate SSL on Apache2

Install opensslsudo apt-get install opensslTo create a self-signed certificatesudo openssl req -new -x509 -days 365 -nodes -out /path/to/cert.pem -keyout /path/to/cert.pemFill the fields as belowCountry Name (2 letter code) [AU]:IEState or Province Name (full name) [Some-State]:Locality Name (eg,...

libstdc++.so.5: cannot open shared object file

To run 32-bit applications, you need to install the 32-bit version of libstdc++5 on your 64-bit system. So the steps are below:Edit sources.listnano /etc/apt/sources.listand add belowdeb http://archive.ubuntu.com/ubuntu hardy main universesave and close. Then run aptitude updateaptitude updateYou...

Charset Pitfalls in JSP/Servlet Containers

To make Tomcat container to read UTF-8 GET parameters correctly, specify URIEncoding="UTF-8" in Tomcat's connector settings within the server.xml file.Source: http://weblogs.java.net/blog/joconner/archive/2005/07/charset_traps.html

Converting string type array to integer type on php

$data1 = array("1","2","3","4","5");$data2 = $array_map( create_function('$value', 'return (int)$value;'), array_values($data1) );$data2 array will be$data2 = array(1,2,3,4,5);

How to create a .JAR file?

Java Archive (JAR) files allow developers to package many classes into a single file. JAR files also use compression, so this can make applets and applications smaller.Creating a .JAR file is easy. Simple go to the directory your classes are stored in and type :-jar -cf myfile.jar *.classIf your ...

Query with comma delimited values

Since IN() function is not a good way to retrieve fields with comma delimited values unless it’s the exact string, we will use FIND_IN_SET() function to retrive comma delimited integer values which points question_id numbers./***  ***/SELECT *FROM`educa_exam` AS `ex`,`educa_question` AS `eq`WHERE...

Network Testing Basics

Install netkit-ping, traceroute, dnsutils, ipchains (for 2.2 kernel), iptables (for 2.4 kernel), and net-tools packages and:ping google.com           # check Internet connectiontraceroute google.com     # trace IP packetsifconfig                  # check host configroute -n                  # che...

REALM Security

UserDatabaseRealm%TOMCAT_HOME%\conf\server.xmlBasic<Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0" resourceName="UserDatabase"/>Digest<Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0" resourceName="UserDatabase" digest="MD5"/>%TOMCAT_HOM...

i386, amd64, x86_64, em64t

- AMD invents the extension, calls it x86-64.- Linux, the first OS that supports x86-64, calls the arch accordingly.- AMD renames x86-64 to amd64, to make clear they invented it.- Intel implements amd64 support, but calls it em64t, to trick users into thinking they didn't copy from AMD.- Intel as...

Changing browser useragent setting

Open a new tab and in the address bar enter about:config. This will open a page that shows all the browsers settings. In the filter box at the top of the page enter useragent. This should reduce the number of settings to around a dozen. There should be a setting called general.useragent.extra.fir...

Committing a Transaction

The way to allow two or more statements to be grouped into a transaction is to disable auto-commit mode.con.setAutoCommit(false);PreparedStatement updateSales = con.prepareStatement( "UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ?");updateSales.setInt(1, 50);updateSales.setString(2, "Colom...

Using a Loop to Set Values

PreparedStatement updateSales;String updateString = "update COFFEES " + "set SALES = ? where COF_NAME like ?";updateSales = con.prepareStatement(updateString);int [] salesForWeek = {175, 150, 60, 155, 90};String [] coffees = {"Colombian", "French_Roast", "Espresso", ...

Leap Day Algorithm - Artık Gün Algoritması

if year modulo 400 is 0 then leapelse if year modulo 100 is 0 then no_leapelse if year modulo 4 is 0 then leapelse no_leap

How to format a hard drive on linux

To create partition on hard drive Bcfdisk /dev/sdbChoose New, Primary and then Write and QuitTo format 1st partition on hard drive Bmkfs /dev/sdb1

Boot debian in text mode instead of graphical mode (GUI)

To disable the login manager from automatically running at boot up, run the following command as rootupdate-rc.d -f gdm removeTo start X manually, you would then have to login at the command prompt and enter the commandstartxTo reset your login manager so that it runs at boot up, doupdate-rc.d -f...

Cleaning up deinstalled packages on Debian

See the list of all the currently installed and deinstalleddpkg --get-selectionsSee how many packages are in the 'deinstalled' state with this command:dpkg --get-selections | grep deinstall | wc -lTo purge all of these packages at once:dpkg --get-selections | grep deinstall | sed 's/deinstall/\lp...

Internationalization: Native-to-ASCII Converter

http://java.sun.com/javase/6/docs/technotes/tools/windows/native2ascii.html

Accessing the Virtual Server from the Host System

Edit the xml configuration file for our virtual machine: On a Mac, the file is found at ~/Library/VirtualBox/Machines/<machine name>/<machine name>.xml On Windows, it's inside the .VirtualBox/Machines subdirectory in your home folder.So for my machine, which I've called "Ubuntu Serv...

Mount NTFS partition

umask is a filter of permissions, so it works in the opposite way to chmod. Full permissions are equivalent to 777 (rwxrwxrwx). A umask of 0222 (-w–w–w-) leaves 555 (r-xr-xr-x).mount /dev/sda1 /mnt/sda1 -t ntfs -r -o umask=0222,uid=cem,gid=cem-rwxr-x— 1 cem cem 28096 Aug 24 1996 chkdsk.exeumount ...

Mount External HDD (NTFS)

Install ntfs-3g libraryaptitude install ntfs-3gShows all the disk drivesfdisk -lTo make writable mountmount /dev/sda1 /mnt/sda1 -t ntfs-3g -o rw,umask=0022,uid=cem,gid=cem

Create favicon.ico on linux

Install netpbm and GIMPaptitude install netpbm gimpStep # 1: Convert logo to ppm raw format Open your logo using GIMP Now cut and paste logo in square Next resize logo by visiting Image > Scale image option. Set pixel size to 16 x 16 or 32 x 32 or 48 x 48. Next click on File > Save as &...

How to remove Windows (Desktop) Search

Run below command to uninstall it%systemroot%\$NtUninstallKB940157$\spuninst\spuninst.exeIf it fails and you get a “The system cannot find the path specified.” error, then download the zipped copy from here. To work out where to extract it to, type:echo %systemroot%Open the zip file, and extract ...

Stored Procedure

A stored procedure is a group of SQL statements that form a logical unit and perform a particular task, and they are used to encapsulate a set of operations or queries to execute on a database server.String createProcedure = "create procedure SHOW_SUPPLIERS " + "as " + "select SUPPLIERS.SUP...

Changing cache_dir and log_dir with Symfony2

Add the following methods to app/AppKernel.php (AppKernel extends Kernel) making them return your preferred paths:public function getCacheDir() { return $this->rootDir . '/my_cache/' . $this->environment;}public function getLogDir() { return $this->rootDir . '/my_logs';}

Using multiple databases in Symfony2

Edit app/config/config.yml# Doctrine Configurationdoctrine: dbal: default_connection: default connections: default: dbname: db1 user: user1 password: pwd1 host: ...

VirtualBox OSE Installation

Install the virtualbox-ose package and appropriate kernel module package for your system:aptitude install virtualbox-ose virtualbox-ose-modules-$(uname -r)Instruct udevd(8) to reload the installed udev rules (Debian bug 509014):invoke-rc.d udev reloadLoad the VirtualBox kernel module:modprobe vbo...

List of Common TCP Ports

The following is a list of common ports. During a network security audit, port scans will be perfeormed to determine what network services are available. These services can be on different Operating systems.20 FTP data (File Transfer Protocol)21 FTP (File Transfer Protocol)22 SSH (Secure Shell)23...

Blank image encoded as data-uri

transparent image 1x1 pixeldata:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==white image 1x1 pixeldata:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==tiniest imagedata:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw...

Welcome to Jekyll!

You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.To add...