- To set priority/order of ProxyPass (and ReverseProxyPass) rules, write the one with most precedence above the rest, and so forth.
- Delete any non-dot-confs (.conf) from config folders to avoid confusions and activity traps.
- Use commands provided by apache on debian/ubuntu to activate/deativate modules and sites.
Extract a selected polygon from an image to a new image file in Java
A reference code to extract a selected shape (this case polygon, could be another shape like Rectangle) –
[java]
BufferedImage in = ImageIO.read(new File(sourceFilePath));
Rectangle bounds = inputPolygon.getBounds(); // Polygon inputPolygon
BufferedImage extractor =new BufferedImage(bounds.width, bounds.height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = extractor.createGraphics();
polygon.translate(-bounds.x, -bounds.y);
g.setClip(polygon);
g.drawImage(in, -bounds.x, -bounds.y, null);
File extImageFile = new File(targetFilePath);
ImageIO.write(extractor, “png”, extImageFile);
[/java]
Torch installation fails with message “Error. OpenBLAS could not be compiled”
Problem : Torch installation fails to install dependencies (“bash install-deps”) with the message “Error. OpenBLAS could not be compiled”
Reason : gfortran dependencies could not be located.
Fix : Make sure gfortran and gcc are of the same versions. On terminal –
gcc --version
gfortran --version
sudo update-alternatives --config gcc
Enter the number corresponding to the version of gfortran. (my case 5)
Run install-deps again.
Should finish to completion this time.
Fix : No sound on Ubuntu (16.04) after a Bluetooth audio device power off.
Problem : After Bluetooth speakers were abruptly switched off, Ubuntu 16.04 on Alienware (17 R2) stopped producing sounds on its analog sound card.
Reason : Doubt an inviable configuration was left behind for the sound card.
Solution :
- Open terminal
- Run –
killall pulseaudio; rm -r ~/.config/pulse/* ; rm -r ~/.pulse*
- Wait for 10 seconds.
- Reboot the machine. (Fully power off and then boot)
- This should fix the problem, else look into the reference link below.
Reference : https://help.ubuntu.com/community/SoundTroubleshootingProcedure
Installing NetBeans IDE in Linux
Go to the link – https://netbeans.org/downloads/
Select Platform as Linux(x86/x64).
Download the installer for NetBeans.

From the terminal, navigate to the directory that contains the installer (netbeans-8.1-linux.sh)
Run the following command to change the permissions –
$ chmod +x netbeans-8.1-linux.sh
Start the installer using the command –
$ ./netbeans-8.1-linux.sh
Follow the steps and NetBeans would be installed.
AngularJS
AngularJS is a Javascript framework maintained by Google which simplifies the development and testing of web applications for developers and testers.
Core features –
1. MVC Framework –
Model is data. It can be static data or dynamically fetched from a data source using JSON.
View – This is UI (User Interface) or whatever is visible in the browser.
Controller – Controls the business logic of the application.
2. Two-way Data Binding –
It simply means that –
1. When properties in the model get updated, so does the UI.
2. When UI elements get updated, the changes get propagated back to the model.
3. Templates –
It allows you to create templates which can be used in other HTML pages.
4. Single Page Applications –
It simply points to the fact that navigation between different screens of the website is achieved without loading a different web-page in the browser.
Example – GMAIL – When you click on a message in your INBOX, browser stays on the same web-page, but JavaScript code hides the INBOX and brings the MESSAGE BODY on screen.
Installing Oracle Database XE in Linux
To install Oracle Database XE:
1. Log on to your computer with root permissions.
2. Go to the following Web site:
http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
3. Accept License Agreement and download the Linux version of Oracle Database XE.
4. Run the Oracle Database XE executable oracle-xe-11.2.0-1.0.x86_64.rpm to install Oracle Database XE using the command –
# rpm -ivh downloads/oracle-xe-11.2.0-1.0.x86_64.rpm
The installation displays a status of its progress.
5. When prompted, run the following command –
# /etc/init.d/oracle-xe configure
6. Enter the following configuration information –
A valid HTTP port for the Oracle Application Express (the default is 8080)
A valid port for the Oracle database listener (the default is 1521)
A password for the SYS and SYSTEM administrative user accounts
Confirm password for SYS and SYSTEM administrative user accounts
Whether you want the database to start automatically when the computer starts (next reboot)
This completes configuration.
Using Database Link in Oracle
Suppose data from a table X in database D is to be copied into table Y in the same database, then the problem can be solved easily by executing the query –
Assumption –
X(C(1),C(2),C(3)….C(N)) == Y(C(1),C(2),C(3)….C(N)) where C(1),C(2),etc. denote the columns of the table.
INSERT INTO Y SELECT * FROM X;
COMMIT;
Problem –
Data from a table X in database D1 has to be copied to table Y in database D2.
Assumption –
X(C(1),C(2),C(3)….C(N)) == Y(C(1),C(2),C(3)….C(N)) where C(1),C(2),etc. denote the columns of the table.
Workaround –
Oracle SQL Developer allows you to create INSERT query for each record in the table. The queries generated can be executed in database D2. But, suppose the table contains 2,00,000 records, it would take approximately 30 minutes to generate the INSERT script and almost an hour to execute the script.
Solution –
Login as SYSDBA(Database Administrator) using the query –
CONNECT SYS/ AS SYSDBA;
Allow the user to create database links using the query –
GRANT CREATE DATABASE LINK TO <userSchemaName(D2 in this case)>;
Connect to schema D2 and execute the query –
CREATE DATABASE LINK DATABASE_LINK_NAME CONNECT TO “SCHEMA_NAME(D1 IN THIS CASE)” IDENTIFIED BY “”
USING ‘(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = HOST_NAME)(PORT = XXXX))(CONNECT_DATA = (SERVICE_NAME = ##SERVICE_NAME##)))’;
Execute the query –
INSERT INTO Y
SELCT * FROM X@DATABASE_LINK_NAME;
COMMIT;





