Skip to main content

Posts

Showing posts from August, 2018

Setup multiple domain in a single Apache instance

In Apache HTTP server allow to support multiple domain in a single instance. To do this you need to add some configuration into your Apache HTTP configuration file (httpd.conf) First you need to tell Apache to support multiple domain by add this directive to your httpd.conf NamedVirtualHost 80 This configuration will tell Apache to support multiple domain on port 80. You can change port number. Next, Add ServerName directive to your VirtualHost. Example below <VirtualHost *:80> ServerName www.mydomain1.com ServerAlias mydomain1.com DocumentRoot "my/path1" ... ... </VirtualHost> <VirtualHost *:80> ServerName www.mydomain2.com ServerAlias mydomain2.com DocumentRoot "my/path2" ... ... </VirtualHost> Next, Restart Apache HTTP server. After reboot you can access domain that you configure in httpd.conf.

Facebook's Platform Update on Publish Permission

Over the past few months, we've continued to make significant changes to Facebook to better protect your information. This has meant working closely with developers to make sure they can adapt their apps to our new, tighter rules, while also continuing to offer people useful social experiences, like playing games or sharing playlists with friends. In a blog post on April 24, we announced that the publish_actions permission — which grants apps access to publish posts to Facebook as the logged in user — would be deprecated by August 1. Roughly 60,000 apps will lose access to the publish_actions permission on August 1, and we encourage developers to switch to Facebook's Share dialogs for web, iOS and Android. However, this timing does not give some desktop apps and hardware partners enough time to make the switch as they have very long product lifecycles. Therefore, we've granted 6-month and 12-month extensions respectively to these categories of developers. These developers...

Parse Text from PDF with OCR using Apache Tika

Apache Tika is opensource software working about OCR from PDF, Image file. In this example is using Java Maven project to work with Apache Tika. First of all, you need to add dependencies for using Apache Tika by add these dependencies into pom.xml <dependency> <groupId> org.apache.tika </groupId> <artifactId> tika-parsers </artifactId> <version> 1.18 </version> </dependency> <dependency> <groupId> com.levigo.jbig2 </groupId> <artifactId> levigo-jbig2-imageio </artifactId> <version> 2.0 </version> </dependency> <dependency> <groupId> com.github.jai-imageio </groupId> <artifactId> jai-imageio-core </artifactId> <version> 1.4.0 </version> </dependency> <depende...

Install Spring Boot application as a Windows services.

I using  WinSW  to be wrapper for Spring Boot application to run as a Windows service (following section 61.3 of Spring Boot document). There few easy step to setup. Download WinSW binary distribution from website  https://github.com/kohsuke/winsw/releases Copy WinSW.exe into Spring Boot application folder (ex: my file is WinSW.Net4.exe) Rename your WinSW.exe to same as your jar file (for easy to remember). Create XML file name same as jar file. This file is using for configuration of Windows services. Put configuration for services wrapper in your xml file. 1 2 3 4 5 6 7 8 9 <?xml version="1.0" encoding="UTF-8"?> <service> <id>my-application-0.0.1</id> <name>my-application-0.0.1</name> <description>My Exaple Spring Boot Services</description> <executable>java</executable> <arguments>-jar -Xmx1024M -Xms128M "my-application-0.0.1.jar"</arguments> <logmode>rotate...

NVIDIA Unveils GeForce RTX, World’s First Real-Time Ray Tracing GPUs

In a series of announcements that left more than 1,200 gamers gathered Monday in Cologne alternately breathless, giddy with laughter, and shouting their enthusiasm, Jensen Huang introduced the GeForce RTX series of gaming processors, representing the biggest leap in performance in NVIDIA’s history. “This is a historic moment,” the NVIDIA founder and CEO declared as he rolled out the new GPUs, starting at just $499. “Computer graphics has been reinvented.” Delivering the “holy grail” of graphics to gamers, Huang introduced the world’s first real-time ray-tracing gaming GPUs — supported by a fat roster of upcoming blockbuster game titles — to a heaving crowd at the Palladium, a spare steel and concrete music venue tucked between railroad tracks and metal fabrication shops on Cologne’s gritty industrial north side. Unveiled ahead of Gamescom, the world’s largest gaming expo, the GeForce RTX 2080 Ti, 2080 and 2070 GPUs are the first gaming processors based on our new Turing architect...

How to clear Oracle Alert Log and Trace files using ADRCI command?

Sometime you will face the problem about large alert log and trace files in Oracle database. You can use ADRCI tool to manage them. Run adrci command [oracle@dboraclel1 dboraclel1]$ adrci ADRCI: Release 12.2.0.1.0 - Production on Tue Aug 21 00:20:25 2018 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. ADR base = "/u01/app/oracle" adrci> show home ADR Homes: diag/rdbms/schooldb/schooldb diag/tnslsnr/dboraclel1/listener diag/tnslsnr/dboraclel1/listener6 diag/tnslsnr/dboraclel1/listener2 diag/tnslsnr/dboraclel1/listener3 diag/tnslsnr/dboraclel1/listener4 diag/tnslsnr/dboraclel1/listener5 diag/diagtool/user_oracle/adrci_3644429138_107 adrci> Set home directory to work. If you have only one home folder skip this step. set homepath diag/tnslsnr/dboraclel1/listener Run this command to purge alert log. PURGE -age 1440 -type ALERT This command will be purge alert log older than 1440 minutes. Parameter age i...

How to: Call url request from c#

In C# you can make a request to a web server by using WebRequest. In this blog will be show you some example to use WebRequest object to call a URL. Make a simple request 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 using System; using System.IO; using System.Net; using System.Text; namespace Examples.System.Net { public class WebRequestGetExample { public static void Main() { // Create a request for the URL. WebRequest request = WebRequest.Create( "http://www.myserver.com/index.html" ); // If required by the server, set the credentials. request.Credentials = CredentialCache.DefaultCredentials; // Get the response. WebResponse response = request.GetResponse(); // Display the status. Console.WriteLine (((HttpWebResponse)response).StatusDes...

Make a scheduling job in Spring Boot

You can make a class to run as a schedule job in Spring Boot. By using @EnableSchedule in your project. Below is example code to enable schedule in Spring Boot. Declare Spring Boot application to support schedule By declare @EnableSchedule at the main class (see at line 10). This enables detection of @ Scheduled annotations on any Spring-managed bean in the container. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 package com.myexample; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @SpringBootApplication @EnableScheduling public class MyExampleApplication { public static void main(String[] args) { SpringApplication.run(MyExampleApplication.class, args); } } Declare schedule configuration at...

Using composite key in Laravel

In this blog will be show you how to enable Laravel to support composite primary key (multiple column key). First of all you need to create class that override method save of class Model to support composite key. Below is the code. You can copy to your project. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 <?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use DB; class BaseModel extends Model { public function save ( array $options = []) { if ( ! is_array ( $this -> getKeyName ())) { return parent :: save ( $...

How to create controller to support JSON in Spring Boot

You can create your controller to support application/json request in many way. And if your request is not match with your controller that request will be fail. Controller to support JSON request and HEADER variables. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 package com.myexample; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController public class RecognizedReceiver { private static final Logger logger = LoggerFactory.getLogger(RecognizedReceiver.class); @RequestMapping(...

Serialize and Deserialize JSON data with C#

This post is about example for serialize and deserialize json data with C#. This example using Newtonsoft.Json to be a library to work with json data. You can add Newtonsoft.Json by download from  https://www.newtonsoft.com/json  or using Nuget to add it into your project. In this example is Bill object that hold billing data about Car object. Serialize Object to String Below is example code to serialize object to json string. At line 39 is code to convert object into json string with beautiful json format. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; namespace JSON { class JSonExample { static void Main( string [] args) { List<Car> cars = new List<Car>(); float to...