Search

Posts

aripddev

JSF

JSFReferences What’s new in JSF 2.3? What’s new in JSF 2.3?WebsocketOne of the most attractive features is JSF 2.3 added native websocket support, it means you can write real-time applications with JSF and no need extra effort.To enable websocket support, you have to add javax.faces.ENABLE_WEBS...

aripddev

Deployment

DeploymentDigitalOceanapt-get update && apt-get upgradeapt-get install default-jdkapt-get install wget unzip git mavenapt-get install mysql-servermysql_secure_installationwget http://download.oracle.com/glassfish/4.1.1/release/glassfish-4.1.1.zipunzip glassfish-4.1.1.zip -d /optwget https...

aripddev

Persistence

PersistenceChanging Persistence Unit dynamicallyKeep the persistence unit file (Persistence.xml) as it’s. You can override the properties in it as follows.EntityManagerFactory managerFactory = null;Map<String, String> persistenceMap = new HashMap<String, String>();persistenceMap.put("...

aripddev

Derby

References Apache Derby: Documentation Derby TutorialApache DerbyConnect to the database with ijFirst run ij tool. The Derby ij tool is a JDBC tool that you can use to run scripts or interactive queries against a Derby database.java -jar /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Conten...

aripddev

JavaFX

References JavaFX CSS Reference Guide ControlsFX Scene Builder JavaFX CSS Reference GuideJavaFXPeriodic actionTimeline timeline = new Timeline( new KeyFrame( Duration.millis(2500), ae -> System.out.println("Periodic action") ));timeline.setCycleC...

aripddev

Jupyter Notebook

Installation of Jupyter Notebookdocker run -d -p 8888:8888 --datascience hello aripd/datascienceConverting Jupyter Notebook to HTMLjupyter nbconvert --template basic notebook.ipynb

aripddev

Ruby

Installation of different versions of Ruby in Mac OSX\curl -sSL https://get.rvm.io | bash -s stablesource /Users/dev/.rvm/scripts/rvmrvm list knownrvm install ruby-2.4.2ruby -vTo use the latest installed version, runrvm use ruby-2.4.2To set this as the default version, runrvm use ruby-2.4.2 --def...

aripddev

LaTeX

References Speed up pdf export from org-mode with latexmkLaTeXKeep watching the file for changes and recompilelatexmk -pvc -pdf -view=none document.tex

aripddev

MSSQL

References Run the SQL Server 2017 container image with DockerMSSQLRunning the SQL Server 2017 container image with DockerThe default memory on Docker is 2 GB. Increase Docker memory to 4 GB.docker pull microsoft/mssql-server-linuxdocker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourPassw...

aripddev

SSH

ReferencesSSHChecking for existing SSH keysEnter ls -al ~/.ssh to see if existing SSH keys are present:ls -al ~/.ssh# Lists the files in your .ssh directory, if they existCheck the directory listing to see if you already have a public SSH key.By default, the filenames of the public keys are one o...

aripddev

Maven

References Creating maven archetypesCreating maven archetypesGenerate the base-archetypecd into the project directory (or, in the case of a multi-module project, cd into the parent/aggregator project) and run the following command:$ mvn archetype:create-from-project$ mvn cleanThis will generate ...

aripddev

Testing

References Enterprise Java.next: A Slideless Keynote A Note On Java EE TestingTestingStress test jmeter - Apache JMeter to load test functional behavior and measure performance ab - Apache HTTP server benchmarking tool5 clients 1000 timesab -c 5 -n 1000 [url]Usually what you get per service a...

aripddev

VirtualBox

References NonePrerequisite LinuxCommandsConfigure full screensuapt-get update && apt-get upgradeapt-get install build-essential module-assistantm-a preparesh /media/cdrom/VBoxLinuxAdditions.runshutdown -r 0

aripddev

Markdown

References NonePrerequisite NoneExamplesLink to a named anchorPlace an anchor### <a name="head1234"></a>A Heading for the entry!where you want to link to and refer to it on the same page by [link](#head1234)Highlight ruby code with line numbers123456789101112# Program to find the fa...

aripddev

Hadoop

References Installing Hadoop on Mac Hadoop Eğitim Serisi (Veri Madenciliği) Hadoop File System ShellPrerequisite HomebrewInstalling Hadoop$ brew install hadoopHadoop will be installed in the following directory /usr/local/Cellar/hadoopConfiguring HadoopEdit hadoop-env.shThe file can be locate...

aripddev

KaTeX

References KaTeX Rendering LaTeX in Javascript with KaTeX and JekyllExamples The Normal Distribution Jekyll supports kramdown parser MathJax-compatible script type=”tex/math”inline text.

aripddev

Artificial Intelligence

References Artificial Intelligence: Look Ma, No Hands! Stanford University CS 229 Machine Learning Stanford University CS231n: Convolutional Neural Networks for Visual Recognition Machine Learning: The Basics, with Ron Bekkerman Machine Learning for Big Data in the Cloud GraphLab vs. Piccol...

aripddev

Glassfish

References How To Install Glassfish 4.0 on Ubuntu 12.04.3 Install Glassfish 4 on a Debian 8 VPS How To Determine java heap size From GC Logs Tuning Your Java VM Java Platform, HotSpot Virtual Machine Garbage Collection Tuning GuidePrerequisite Debian JavaInstall GlassfishDownload and unzip...

aripddev

Java

References How To Install Java with Apt-Get on Debian 8 Signing Using RSA CertificatesPrerequisite DebianJAVAPreperationCheck java version if existjava -versionInstallingapt-get updateapt-get install default-jdkCheck if Java has been properly installedjava -versionJava Webstart Java Web Start...

aripddev

Debian

Prerequisite LinuxPreperation# Check debian versionlsb_release -a# Update the systemapt-get update && apt-get upgradeCleaning up deinstalled packagesSee the list of all the currently installed and deinstalleddpkg --get-selectionsSee how many packages are in the ‘deinstalled’ state with t...

aripddev

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...

aripddev

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...

aripddev

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. Virtualization 9 Docker recipe...

aripddev

Hello World in Python on Apache

Create hello.py with this content:12345#! /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

aripddev

MongoDB, ElasticSearch and Marvel module installation

Prerequisite HomebrewInstalling mongoDB$ brew install mongodbConfiguring mongoDBConfiguration file is /usr/local/etc/mongod.confTo start mongoDB$ brew services start mongodbThis will use /usr/local/var/mongodb/ as data directoryor using mongoDB deamon$ mongodThis will use /data/db/ as data direc...

aripddev

Homebrew

Installing homebrew$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"Updating homebrew$ brew updateUpgrading homebrew$ brew upgradeReinstall outdated casks$ brew cask outdated | xargs brew cask reinstallTroubleshooting$ brew doctorInstalling mongodb formul...

aripddev

WordPress installation in a directory

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

aripddev

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...

aripddev

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...

aripddev

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 ...

aripddev

primefaces galleria redirect onclick using remoteCommand

aripddev

Git

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...

aripddev

MySQL

References How To Backup MySQL DatabasesCreating database, user and privilegesCREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;CREATE USER dbname@localhost IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON dbname.* TO dbname@localhost;FLUSH PRIVILEGES;Setting user passwordSET PAS...

aripddev

Gaussian plot

aripddev

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

aripddev

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) ...

aripddev

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 ...

aripddev

EclipseLink and MultiTenant

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

aripddev

JSONP, JSONWithPadding

aripddev

SortedSetMultimap

aripddev

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

aripddev

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...

aripddev

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...

aripddev

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...

aripddev

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/

aripddev

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...

aripddev

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 %%...

aripddev

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 * * @param points * @return */public static Point2D.Double midpoint(List<Point2D.Double>...

aripddev

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;

aripddev

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-halflings-regular.eot?#iefix'...

aripddev

Upload, list and download files with Dropbox Java API

aripddev

Symfony2 optional requirements installation on Mac OS X

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...

aripddev

Apache Virtual Host and SSL on Mac OSX

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...

aripddev

Convert png image to jpg with white background

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

aripddev

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...

aripddev

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...

aripddev

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

aripddev

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...

aripddev

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...

aripddev

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...

aripddev

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...

aripddev

Linux

How to pronounce LinuxInternet 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 pronunciatio...

aripddev

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 ...

aripddev

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...

aripddev

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...

aripddev

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

aripddev

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 ...

aripddev

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,...

aripddev

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...

aripddev

Internationalization: Native-to-ASCII Converter

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

aripddev

Create favicon.ico

Using netpbm and GIMPInstall 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 o...

aripddev

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: ...

aripddev

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...

aripddev

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...