Command to remove all contents from current directory

Here, we can see the command to remove all files and directories from current directory in Linux via Terminal. It is a simple command, but only thing is, we have to ensure that the user have rights to remove the files and directories.

First open Terminal and  focus to the directory in which you want to remove the contents using the command cd. Once you have gone to that directory use the following command to delete the entire content inside that directory;

 

Read More

Rendering MathML properly in Windows

Here, I’m going to explain about the MathML rendering in Safari browser on Windows OS. When I was worked with MathML, I faced some issues while rendering in Windows (OS: XP, Windows 7) and I found the solution for it. The solution is we have to use either STIX fonts or Asana fonts in Windows.

I have downloaded those fonts and pasted in font folder inside control panel. After done this, I again take the corresponding page which contains MathML data and verified that the data is rendering well.

To download STIX fonts click here

To download Asana fonts click here

Read More

Image caching using javascript

Here I’m going to say a simple way to cache images while loading web page using JavaScript. Well we know where the images are located in our server. So first we need to specify the path of images into an JavaScript array, which you want to cache while loading a web page as shown below:

 

Copy and paste the above code inside the head tag of your web page and call the function preCacheImages()  in onLoad event of body tag.

<body onload=”javascript: preCacheImages(arrImages);” >

 

Read More

Get contents from a file php

We can approach in two ways to get content from a file which is located in other server,

1) Using file function file_get_contents()

file_get_contents(< file URL >);

2) Using curl

For doing this by using curl, you need to add php curl library. If you are working on LAMP server, to install php curl, do as follows:

Open the terminal.

Run the command sudo apt-get install php5-curl

After execution restart your web server.

If you are on WAMP server, to install php curl library,

Open the php.ini file

Remove # in front of the php curl which you can found in extension/modules including section.

Restart your web server.

Before removing #, please ensure that the php_curl.dll file exists in installation path of WAMP server [Example – C:wampbinphpphp5.3.4ext]

Once you finished the installation of php curl library, use the code given below to get the file contents which is located in another server:

$link = '<URL>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch,CURLOPT_URL,$link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch); 

Read More

Sesame installation with PHP in Ubuntu

Before going to installation process, we can understand what is RDF, SPARQL, SESAME etc…

RDF stands for Resource Description Framework. It is used for conceptual description or modeling of information that is implemented in web resources, using a variety of syntax formats [more].

SPARQL is a query language for RDF.  Using this we can manipulate, store and retrieve data which is stored in RDF. This standard was introduced by RDF data access working group of the w3c [more].

SESAME is a de-facto standard framework for processing RDF data [more].

Since OpenRdf.org providing SDK which is a Java based interface, we need to configure Tomcat (version 6 or higher) on our system. Steps to install Tomcat web server is:

i. Ensure that the you already installed Java

ii. Open the terminal

iii. Run the following commands

sudo apt-get update

sudo apt-get install tomcat6

Then download the SDK provided by openrdf.org [download link]. Go to the location where you are downloaded the SDK. Extract the downloaded SDK. You can see both Sesame server and OpenRdf workbench files inside the extracted folder. Open the war folder. You have to deploy those war-files inside Java Servlet Container (like Apache Tomcat 6 web server). By deploying means nothing but copying the war files found inside the extracted folder to the Java Servlet Container (tomcat6 web path. Most probably the path will be /var/lib/tomcat6/webapps).  Then take the following URL in your browser: http://<your servername>:8080/openrdf-sesame.

After that you have given full permission to the .aduna folder which you can found in the path /usr/share/tomcat6. Since we are using MYSQL as back end, we need to download the JDBC driver which will make the communication between the Sesame Workbench and MYSQL database. To download the MYSQL JDBC driver click here.  Copy the jar file from the downloaded JDBC driver and paste in to the WEB-INF/lib folder which you can see in the web application path (both /var/lib/tomcat6/webapps/openrdf-sesame/WEB-INF/lib/var/lib/tomcat6/webapps/openrdf-workbench/WEB-INF/lib).

If you have done this much work successfully, you are almost installed the Sesame Workbench in your machine. You can manage your Sesame Workbench through both http://<your servername>:8080/openrdf-sesame & http://<your servername>:8080/openrdf-workbench.

Note: If you are using MYSQL as back-end, sometimes the Workbench will crash if we haven’t properly shutdown the service of tomcat6 web server. That time just delete the locked table which you can see in the database where RDBMS repository created.

Read More