Showing posts with label using. Show all posts
Showing posts with label using. Show all posts
Thursday, September 28, 2017
Tutorial Running Windows Applications in OpenSUSE using PlayOnLinux
Tutorial Running Windows Applications in OpenSUSE using PlayOnLinux
One type of document that is ofter used in companies to share files / documents to the other party is Microsoft Office. Application Open Office or Libre Office that is able to read and revise files Microsoft Office is very helpful process to share document, but sometimes Office files that are opened / saved by Libre Office or Open Office is not 100% same. So, the alternative is to run Windows Applications, namely Microsoft Office in Linux. In this article, we try to run Microsoft Office in Linux OpenSUSE.
One of applications in Linux is easy to install and used for this purpose is PlayOnLinux application. PlayOnLinux application using Wine to run that application, but the process is made simple and intuitive.
Here is the process of running Microsoft Office 2007 on Linux openSUSE 12.2 using PlayOnLinux.
Note: Although the run on Linux, Microsoft Office application or any other application that requires a license is still proprietary.
- Install PlayOnLinux application.
The easiest way of installing the application is using One-Click-Install on openSUSE. Open URL http://software.opensuse.org/search. Then search "playonlinux" and then click Search button. Select the appropriate version and click the link 1-Click Install.
- After finish installed, run the application. If the menu does not appear, PlayOnLinux can also be run through the console by typing the name of "playonlinux" in a terminal.
- When executed, PlayOnLinux will check some requirements, such as standard font of Microsoft and other libraries, including the Wine app. We just need to follow the wizard.



- After installation is completed, we can select the program installation menu (Install a Program).
- Select group of Office applications if you want to install Microsoft Office applications. PlayOnLinux can also be used to run other applications such as Dreamweaver, Flash, and others.

- Then prepare the CD/DVD installer of windows applications.
- Installation process same with installation process on Windows operating system.

- After installation is completed, we can use application Microsoft Office on Linux openSUSE.

download file now
Labels:
applications,
in,
opensuse,
playonlinux,
running,
tutorial,
using,
windows
Wednesday, September 27, 2017
Transit schedule data demystified using GTFS
Transit schedule data demystified using GTFS
General Transit Feed Specification (GTFS) is the Google-originated standard format for transit route, stop, trip, schedule, map, and fare data. Everything except realtime.
Its called a feed because it (usually) includes an RSS update for changes.
There are lists of feeds on the Google wiki, and on the separate GTFS data website.
Each organizations GTFS file includes all their services, so some agency files can get pretty big, and get updated often. Any schedule change or route adjustment means a new release of the entire GTFS file. The file itself is merely a big zipfile, containing several csv files that are strangely required to be mislabelled as .txt.
Heres the contents of Milwaukee County Transit Systems GTFS file:
$ unzip -l mcts.zip
Archive: mcts.zip
Length Date Time Name
--------- ---------- ----- ----
169 2014-01-10 05:01 agency.txt
40136 2014-01-10 05:00 calendar_dates.txt
5746 2014-01-10 05:01 routes.txt
307300 2014-01-10 05:00 stops.txt
35198135 2014-01-10 05:00 stop_times.txt
650622 2014-01-10 05:01 trips.txt
8369736 2014-01-10 05:01 shapes.txt
3490 2014-01-10 05:01 terms_of_use.txt
--------- -------
44575334 8 files
Yeah, 44MB unzipped.
But only 5MB zipped. Still not something you want to download every day to your phone.
Lets find a stop at Mitchell International Airport:
$ cat stops.txt | grep AIRPORT
7168,7168,AIRPORT,, 42.9460473, -87.9037345,,,1
7162,7162,AIRPORT & ARRIVALS TERMINAL,, 42.9469597, -87.9030569,,,0
Its right, there are two stops at the airport. Each stop has a latitude and longitude, a unique ID number, and a descriptive name. The final field designates a timepoint (1=Timepoint, 0=Not).
Lets try an intersection where two routes cross:
$ cat stops.txt | grep "HOWELL & OKLAHOMA"
709,709,HOWELL & OKLAHOMA,, 42.9882051, -87.9043319,,,1
658,658,HOWELL & OKLAHOMA,, 42.9885464, -87.9045333,,,1
$ cat stops.txt | grep "OKLAHOMA & HOWELL"
5152,5152,OKLAHOMA & HOWELL,, 42.9881561, -87.9046550,,,1
5068,5068,OKLAHOMA & HOWELL,, 42.9883466, -87.9041176,,,1
Heres a problem that will require some logic to solve. I consider the intersection to be one place (not a GTFS term). Many trips and routes can use the same stop. Multiple stops (GTFS terms) can exist at the same place. In this case, northbound, southbound, eastbound, and westbound buses each have a different stop at the same place.
This might make your job easier...or harder.
GTFS cares about trips and stops. It doesnt care that Stops #709 and #5152 are twenty meters apart, and serve different routes - that its a transfer point. Nothing in GTFS explicitly links the two stops. Generally, you must figure out the logic to do that - you have the lat/lon and the name to work with.
GTFS does have an optional transfers.txt file, that fills in the preferred transfer locations for you. But thats for a more advanced exercise.
Lets see what stops at #709:
$ grep -m 5 ,709, stop_times.txt
4819177_1560,06:21:00,06:21:00,709, 14,,0,0
4819179_1562,06:49:00,06:49:00,709, 14,,0,0
4819180_1563,07:02:00,07:02:00,709, 14,,0,0
4819181_1564,07:15:00,07:15:00,709, 14,,0,0
4819182_1565,07:28:00,07:28:00,709, 14,,0,0
These fields are trip_id, arrival_time, departure_time, and stop-sequence (14th).
Lets see the entire run of trip 4819177_1560:
$ grep 4819177_1560 stop_times.txt
4819177_1560,06:09:00,06:09:00,7162, 2,,0,0 # Hey, look - stops out of sequence in the file
4819177_1560,06:09:00,06:09:00,7168, 1,,0,0 # Begin Trip
4819177_1560,06:11:00,06:11:00,7178, 3,,0,0
[...]
4819177_1560,06:20:00,06:20:00,8517, 13,,0,0
4819177_1560,06:21:00,06:21:00,709, 14,,0,0 # Howell & Oklahoma
4819177_1560,06:22:00,06:22:00,711, 15,,0,0
[...]
4819177_1560,07:17:00,07:17:00,1371, 66,,0,0
4819177_1560,07:19:00,07:19:00,6173, 67,,0,0
4819177_1560,07:20:00,07:20:00,7754, 68,,0,0 # End of trip
We can also look up more information about trip 4819177_1560:
$ grep 4819177_1560 trips.txt
GRE,13-DEC_WK,4819177_1560,N BAYSHORE - VIA OAKLAND-HOWELL METROEXPRESS,0,515111,13-DEC_GRE_0_12
This needs a little more explanation
- route_id: Green Line (bus)
- service_id (weekday/days-of-service): 13-DEC_WK
- headsign: N BAYSHORE - VIA OAKLAND-HOWELL METROEXPRESS
- direction_id (binary, 0 or 1): 0
- block_id (useful only if the same bus changes routes): 515111
- shape_id (useful for route maps): 13-DEC_GRE_0_12
Lets look up the route_id:
$ grep GRE routes.txt
GRE,MCTS, GRE,MetroEXpress GreenLine,,3,http://www.ridemcts.com/Routes-Schedules/Routes/GRE/,,
The full route name is MetroEXpress GreenLine, its a bus (type-3 = bus) route, and we have the operator website for it.
Lets look up the service_id:
$ grep -m 10 13-DEC_WK calendar_dates.txt
13-DEC_WK,20140113,1
13-DEC_WK,20140114,1
13-DEC_WK,20140115,1
13-DEC_WK,20140116,1
13-DEC_WK,20140117,1
13-DEC_WK,20140120,1
13-DEC_WK,20140121,1
13-DEC_WK,20140122,1
13-DEC_WK,20140123,1
13-DEC_WK,20140124,1
Ah, this specific trip is a weekday (Monday-Friday) only trip.
Lets look up the route map shapefile for the trip:
$ grep 13-DEC_GRE_0_12 shapes.txt
13-DEC_GRE_0_12, 42.946054, -87.903810,10001
13-DEC_GRE_0_12, 42.946828, -87.903659,10002
13-DEC_GRE_0_12, 42.946824, -87.903588,10003
13-DEC_GRE_0_12, 42.946830, -87.903472,10004
[...]
13-DEC_GRE_0_12, 43.123137, -87.915431,670004
13-DEC_GRE_0_12, 43.123359, -87.915228,670005
13-DEC_GRE_0_12, 43.124016, -87.914535,670006
13-DEC_GRE_0_12, 43.124117, -87.914440,670007
The line for this trip has 520 points. Thats pretty detailed.
So what do we know?
We know that Stop #709 is served by the GreenLine route, its the 14th stop in direction 0, its a bus line, we have all the times the stop is served, and we have the route website. We know the route map and all the other stops of any trip serving that stop.
How can we find the next scheduled bus at stop #709?
One way is to start with all trips that stop at #709 from stop_times.txt.
Since we probably know what time it is, we can filter out all the past times, and most of the future times. This leaves us with a nice, small list of, say, 10 possibles that include trips that dont run today at all (we must delve deeper to determine).
We can look up each of those trips in trips.txt, and get the route.
Each trip also includes a service_id code. The calendar_dates.txt file tells us which dates each service_id code is valid.
Right, we need to do three lookups.
The shell code gets a bit complex with three lookups, so I shifted to Python and wrote a basic next-vehicle-at-stop-lookup in about 160 lines. Python lists are handy, since it can handle all the stops at a location just as easily as a single stop. Pythons zip module is also handy, so I can read data directly from the zipfile. But at 13 seconds, Python is probably too slow for this kind of application:
$ time ./next_bus.py
Next departures from Howell & Okahoma
16:16 GRE N AIRPORT - VIA OAKLAND-HOWELL METROEXPRESS
16:22 GRE N BAYSHORE - VIA OAKLAND-HOWELL METROEXPRESS
16:26 51 OKLAHOMA - TO LAKE DRIVE
16:28 51 TO 124TH ST. - VIA OKLAHOMA
16:30 GRE N AIRPORT - VIA OAKLAND-HOWELL METROEXPRESS
16:35 GRE N BAYSHORE - VIA OAKLAND-HOWELL METROEXPRESS
16:43 51 TO 124TH ST. - VIA OKLAHOMA
16:44 GRE N AIRPORT - VIA OAKLAND-HOWELL METROEXPRESS
16:45 51 TO NEW YORK
16:45 GRE N BAYSHORE - VIA OAKLAND-HOWELL METROEXPRESS
16:56 GRE N BAYSHORE - VIA OAKLAND-HOWELL METROEXPRESS
real 0m13.171s # Ugh. If I had started 13 seconds sooner, I wouldnt be bored now.
user 0m10.740s
sys 0m0.260s
All that time crunching the GTFS file has not gone unnoticed.
Trip planners (like Google) pre-process the data, mapping out and caching link-node and transfer relationships, limiting the trip data to the next hour or two (as appropriate), and using rather fancy algorithms to prune the link-node map to a likely set of possibilities before looking at trips along those links.
Thats one reason Google Transit is much faster than 13 seconds.
But thats all advanced stuff.
Also advanced is how to integrate real-time data, which uses one of several different formats. Next time...
download file now
Twitter users data using php api version 1 0
Twitter users data using php api version 1 0
I think you want to display your twitter update into your web. I coded it using curl and it display the twitter data without authentication. You can see the demo.
Code:
Code:
download file now
Saturday, September 16, 2017
Ubuntu Tip Simple Backup Command Using CP
Ubuntu Tip Simple Backup Command Using CP
Backing up your computers hard drive is extremely important. Should the worst happen and you lose all of your important data, you need a way back. While there are many excellent utilities in the Ubuntu repositories that handle partial and full system backups. Sometimes a simpler solution is all that is needed.
Fortunately Ubuntu and Linux in general in fact comes with everything you need in the for of the very simple but also extremely powerful cp command. In case you havent figured it out yet, cp is Linux command line speak for copy. The examples below will show you how to use cp to back up your entire system.
sudo cp -r -u -x -v [source directory] [destination directory]
Example 1:
sudo cp -r -u -x -v /home/ /media/MY_USB_DRIVE
sudo: Gives temporary root privileges.
cp: Linux command line copy command.
-r: Used with cp this switch causes cp to copy directory content recursively. Meaning it will copy all files and subdirectories in the directory being copied.
-u: Used with cp this switch causes cp to only copy files that have changed or dont already exist at the destination.
-x: Used with cp this switch stops cp jumping to other file systems which it will do if it encounters hard links or symbolic links.
This switch also stops cp eating its tail if you choose to back up your entire system. See examples 2 and 3 below.
-v: Used with cp this switch cause cp to give feed back on whats happening.
Full System Backup With CP
If we wish to perform a full system backup then we might feel inclined to use a command similar to that in Example 2 below. The trouble is without the -x switch cp will also attempt to backup the backup to the backup. Basically eating its own tail in a never ending loop until all disk space is used up.
This happens because all other file systems are mounted to a location branching from the root file system. So if root is / then home is mounted to /home. Within Ubuntu all USB drives tend to be mounted to /media/a_USB_drive, etc.
However with the -x switch the command in example 2 will not be enough to back up the entire system if there are several storage devices or file systems mounted to different mount points. To get around this problem we must write a small script that will backup each file system separately. Example 3 shows a small example where the root files system / and /home are backed up separately.
Example 2:
sudo cp -r -u -v / /media/MY_USB_DRIVE
Example 3:
#!/bin/sh
#
# cp based backup script.
#
sudo cp -r -u -x -v / /media/MY_USB_DRIVE
sudo cp -r -u -x -v /home/ /media/MY_USB_DRIVE
This script can be created in any text editor like gedit or nano. After the script has been saved it must be given permission to be run as a program. Example 4 shows the command needed to change to the directory/folder where the script is stored. How to apply execute permissions and how to run the script.
Example 4:
First open a terminal window if you havent already done so and enter the following commands. The actual location of your script is where you chose to save it.
cd /home/aikiwolfie/scripts/ (press enter)
chmod a+x my_backup_script (press enter)
./my_backup_script (press enter)
And thats it. Sit back and watch the backup script do its job.
download file now
Friday, September 15, 2017
Ubuntu Sound not working on HP Pavillion dv9000 Using the ICH8 Family
Ubuntu Sound not working on HP Pavillion dv9000 Using the ICH8 Family
I spent quite a bit of time researching my problem and found the solution at: http://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg549082.html Let me copy the relevant bits:
cd /tmp wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.16rc2.tar.bz2 tar -jxvf alsa-driver-1.0.16rc2.tar.bz2 cd alsa-driver-1.0.16rc2/ ./configure --with-cards=hda-intel && make sudo make install sudo cp ./modules/snd-hda-intel.ko /lib/modules/$( uname -r )/ubuntu/media/snd-hda-intel/ sudo depmod -a sudo rebootMake sure that you check the ftp://ftp.alsa-project.org/pub/driver directory to see if a new version has been released.
download file now
Thursday, September 14, 2017
Trick To Boost Torrent Speeds Using UTorrent Turbo Booster Plugin
Trick To Boost Torrent Speeds Using UTorrent Turbo Booster Plugin

uTorrent Turbo Booster is a recent plug-in designed to improve the functionality of probably the most popular P2P file sharing application around � uTorrent.
This tool comes equipped with modern technology that aims at getting your download speed way up so you can grab the files you want so badly much quicker than you�ve been used to. Movies, music, games, applications, you name it - uTorrent Turbo Booster will deliver at a fast pace. It will be there doing its job in the background without upsetting any other activity you might perform on your computer.So Now Click On Given below Link For Download UTorrent Turbo Booster Plugin
Click Here For Download
download file now
Wednesday, September 13, 2017
Trident ML Text Classification using KLD
Trident ML Text Classification using KLD
This post shows some very basic example of how to use the Kullback-Leibler Distance text classification algorithm in Trident-ML to process data from Storm Spout.
Firstly create a Maven project (e.g. with groupId="com.memeanalytics" artifactId="trident-text-classifier-kld"). The complete source codes of the project can be downloaded from the link:
https://dl.dropboxusercontent.com/u/113201788/storm/trident-text-classifier-kld.tar.gz
For the start we need to configure the pom.xml file in the project.
Configure pom.xml:
Firstly we need to add the clojars repository to the repositories section:<repositories>
<repository>
<id>clojars</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
Next we need to add the storm dependency to the dependencies section (for storm):
<dependency>
<groupId>storm</groupId>
<artifactId>storm</artifactId>
<version>0.9.0.1</version>
<scope>provided</scope>
</dependency>
Next we need to add the strident-ml dependency to the dependencies section (for text classification):
<dependency>
<groupId>com.github.pmerienne</groupId>
<artifactId>trident-ml</artifactId>
<version>0.0.4</version>
</dependency>
Next we need to add the exec-maven-plugin to the build/plugins section (for execute the Maven project):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>false</includePluginDependencies>
<executable>java</executable>
<classpathScope>compile</classpathScope>
<mainClass>com.memeanalytics.trident_text_classifier_kld.App</mainClass>
</configuration>
</plugin>
Next we need to add the maven-assembly-plugin to the build/plugins section (for packacging the Maven project to jar for submitting to Storm cluster):
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass></mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Implement Spout for training data
Once the pom.xml update is completed, we can move to implement the ReuterNewsSpout which is the Storm spout that emits batches of training data to the Trident topology:package com.memeanalytics.trident_text_classifier_kld;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import backtype.storm.task.TopologyContext;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Values;
import storm.trident.operation.TridentCollector;
import storm.trident.spout.IBatchSpout;
public class ReuterNewsSpout implements IBatchSpout {
private static final long serialVersionUID = 1L;
private List<List<Object>> trainingData=new ArrayList<List<Object>>();
private static Map<Integer, List<Object>> testingData=new HashMap<Integer, List<Object>>();
private int batchSize=10;
private int batchIndex=0;
public ReuterNewsSpout()
{
try{
loadReuterNews();
}catch(FileNotFoundException ex)
{
ex.printStackTrace();
}catch(IOException ex)
{
ex.printStackTrace();
}
}
public static List<List<Object>> getTestingData()
{
List<List<Object>> result=new ArrayList<List<Object>>();
for(Integer topic_index : testingData.keySet())
{
result.add(testingData.get(topic_index));
}
return result;
}
private void loadReuterNews() throws FileNotFoundException, IOException
{
Map<String, Integer> topics=new HashMap<String, Integer>();
String filePath="src/test/resources/reuters.csv";
FileInputStream inputStream=new FileInputStream(filePath);
BufferedReader reader= new BufferedReader(new InputStreamReader(inputStream));
String line;
while((line = reader.readLine())!=null)
{
String topic = line.split(",")[0];
if(!topics.containsKey(topic))
{
topics.put(topic, topics.size());
}
Integer topic_index=topics.get(topic);
int index = line.indexOf(" - ");
if(index==-1) continue;
String text=line.substring(index, line.length()-1);
if(testingData.containsKey(topic_index))
{
List<Object> values=new ArrayList<Object>();
values.add(topic_index);
values.add(text);
trainingData.add(values);
}
else
{
testingData.put(topic_index, new Values(topic_index, text));
}
}
reader.close();
}
public void open(Map conf, TopologyContext context) {
// TODO Auto-generated method stub
}
public void emitBatch(long batchId, TridentCollector collector) {
// TODO Auto-generated method stub
int maxBatchIndex = (trainingData.size() / batchSize);
if(trainingData.size() > batchSize && batchIndex < maxBatchIndex)
{
for(int i=batchIndex * batchSize; i < trainingData.size() && i < (batchIndex+1) * batchSize; ++i)
{
collector.emit(trainingData.get(i));
}
batchIndex++;
//System.out.println("Progress: "+batchIndex +" / "+maxBatchIndex);
}
}
public void ack(long batchId) {
// TODO Auto-generated method stub
}
public void close() {
// TODO Auto-generated method stub
}
public Map getComponentConfiguration() {
// TODO Auto-generated method stub
return null;
}
public Fields getOutputFields() {
// TODO Auto-generated method stub
return new Fields("label", "text");
}
}
As can be seen above, the ReuterNewsSpout is derived from IBatchSpout, and emits a batch of 10 tuples at one time, each tuple is a new article containing the fields ("label", "text"). The "label" field is integer value (represents the topic of the news article), while "text" field is a string which is text of the news article. the training records are obtained in such a way that the correct prediction learned from the text classification should be predicting the topic of a news article given the text of the news article.
KLD Text Classification in Trident topology using Trident-ML implementation
Once we have the training data spout, we can build a Trident topology which uses the training data to create a class label for each of the data record using KLD classifier algorithm in Trident-ML. This is implemented in the main class shown below:package com.memeanalytics.trident_text_classifier_kld;
import java.util.List;
import com.github.pmerienne.trident.ml.nlp.ClassifyTextQuery;
import com.github.pmerienne.trident.ml.nlp.KLDClassifier;
import com.github.pmerienne.trident.ml.nlp.TextClassifierUpdater;
import com.github.pmerienne.trident.ml.preprocessing.TextInstanceCreator;
import storm.trident.TridentState;
import storm.trident.TridentTopology;
import storm.trident.testing.MemoryMapState;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.LocalDRPC;
import backtype.storm.generated.AlreadyAliveException;
import backtype.storm.generated.InvalidTopologyException;
import backtype.storm.generated.StormTopology;
import backtype.storm.tuple.Fields;
public class App
{
public static void main( String[] args ) throws AlreadyAliveException, InvalidTopologyException
{
LocalDRPC drpc=new LocalDRPC();
LocalCluster cluster=new LocalCluster();
Config config=new Config();
cluster.submitTopology("KLDDemo", config, buildTopology(drpc));
try{
Thread.sleep(20000);
}catch(InterruptedException ex)
{
ex.printStackTrace();
}
List<List<Object>> testingData = ReuterNewsSpout.getTestingData();
for(int i=0; i < testingData.size(); ++i)
{
List<Object> testingDataRecord=testingData.get(i);
String drpc_args="";
for(Object val : testingDataRecord){
if(drpc_args.equals(""))
{
drpc_args+=val;
}
else
{
drpc_args+=(","+val);
}
}
System.out.println(drpc.execute("predict", drpc_args));
}
cluster.killTopology("KLDDemo");
cluster.shutdown();
drpc.shutdown();
}
private static StormTopology buildTopology(LocalDRPC drpc)
{
ReuterNewsSpout spout=new ReuterNewsSpout();
TridentTopology topology=new TridentTopology();
TridentState classifierModel = topology.newStream("training", spout).each(new Fields("label", "text"), new TextInstanceCreator<Integer>(), new Fields("instance")).partitionPersist(new MemoryMapState.Factory(), new Fields("instance"), new TextClassifierUpdater("newsClassifier", new KLDClassifier(9)));
topology.newDRPCStream("predict", drpc).each(new Fields("args"), new DRPCArgsToInstance(), new Fields("instance")).stateQuery(classifierModel, new Fields("instance"), new ClassifyTextQuery("newsClassifier"), new Fields("prediction"));
return topology.build();
}
}
package com.memeanalytics.trident_text_classifier_kld;
import java.util.ArrayList;
import java.util.List;
import backtype.storm.tuple.Values;
import com.github.pmerienne.trident.ml.core.TextInstance;
import com.github.pmerienne.trident.ml.preprocessing.EnglishTokenizer;
import com.github.pmerienne.trident.ml.preprocessing.TextTokenizer;
import storm.trident.operation.BaseFunction;
import storm.trident.operation.TridentCollector;
import storm.trident.tuple.TridentTuple;
public class DRPCArgsToInstance extends BaseFunction{
private static final long serialVersionUID = 1L;
public void execute(TridentTuple tuple, TridentCollector collector) {
// TODO Auto-generated method stub
String drpc_args=tuple.getString(0);
String[] args=drpc_args.split(",");
Integer label=Integer.parseInt(args[0]);
String text=args[1];
TextTokenizer textAnalyzer=new EnglishTokenizer();
List<String> tokens=textAnalyzer.tokenize(text);
TextInstance<Integer> instance=new TextInstance<Integer>(label, tokens);
collector.emit(new Values(instance));
}
}
As can be seen above, the Trident topology has a TextInstanceCreator<Integer> trident operation which convert raw ("label", "text") tuple into an TextInstance<Integer> object which can be consumed by TextClassifierUpdater. The TextClassifierUpdater object from Trident-ML updates the underlying classifierModel via KLDClassifier training algorithm.
The DRPCStream allows user to pass in a new testing instance to the classifierModel which will then return a "predict" field, that contains the predicted label of the testing instance. The DRPCArgsToInstance is a BaseFunction operation which converts the arguments passed into the LocalDRPC.execute() into an TextInstance<Integer> (Note you can set the label to null in DRPCArgsToInstance.execute() method as the label will be predicted instead) which can be passed into the ClassifyTextQuery which then uses KLD and classifierModel to determine the predicted label.
Once the coding is completed, we can run the project by navigating to the project root folder and run the following commands:
> .mvn compile exec:java
download file now
Monday, September 11, 2017
Ubuntu auto backup to remote host using scp rsync crontab
Ubuntu auto backup to remote host using scp rsync crontab
Bash script to transfer files via SCP
#!/bin/bashSave the above script to autoscp.sh and give the execute permission. The SourceFolder is the folder whose contents are sent to DestFolder on the remote host .
REMOTE_IP="x.x.x.x"
SCP_PASSWORD="mypassword"
expect -c "
set timeout 1
spawn scp -r /Local/SourceFolder uname@$REMOTE_IP:/Remote/DestFolder
expect yes/no { send yes ; exp_continue }
expect password: { send $SCP_PASSWORD }
expect 100%
sleep 1
exit
"
$ chmod +x file.shInstall expect if its not on our machine, expect is a program that "talks" to other interactive programs according to a script. We use this in this script to provide the password when asked for by the scp command.
$ ./file.sh
sudo apt-get install expect
Bash script to sync local & remote folder via rsync
#!/bin/bash-a preserves the date and times, and permissions of the files
REMOTE_IP="x.x.x.x"
SCP_PASSWORD="mypassword"
#And now transfer the file over
expect -c "
set timeout 1
spawn rsync -azvv -e ssh /Local/SrcFolder uname@$REMOTE_IP:/Remote/DstFolder
expect yes/no { send yes ; exp_continue }
expect password: { send $SCP_PASSWORD }
expect 100%
sleep 1
exit
"
-z compresses the data
-vv increases the verbosity of the reporting process
-e specifies remote shell to use
Save the above script to autorsync.sh file and give the execute permission.
Refer this Ubuntu documentation for more details on rsync. Both the bash scripts mainly automate the rsync and scp transfer, so that password dont need to be supplied.
Scheduling this rsync and scp scripts to run periodically
Use crontab to schedule these scripts to run periodically. To edit crontab usecrontab -eAdd the below lines
# m h dom mon dow commandm - minute
0 * * * * cd /location/of/script;./autoscp.sh
30 * * * * cd /location/of/script;./autorsync.sh
h - hour
dom - day of the month
mon - month
dow - day of the week
0 * * * * will run the script at 0 minutes every hour, every day of all the months.
30 * * * * will run the script at every 30 minutes on every hour, every day of all the months.
download file now
Wednesday, September 6, 2017
Twitter blog using blogger blog
Twitter blog using blogger blog
I have just visit blog.twitter.com and found that it is using blogger.com hosting blog. I am gettng surprise to see that they have not put any link to blogger.com. I guess if they use wordpress blog then they must use a phrase Proudly powered by wordpress.My question is why twitter authority have not mention any acknowledgement to blogger. They should write a single line like me. I wrote a single line at the bottom of my blog "Powered by Blogger." This is a common courtesy to using any free service online, but twitter failed to show it.
download file now
Tuesday, September 5, 2017
Tutorial Installation and Configuration FTP Server in Linux Ubuntu Using ProFTPd
Tutorial Installation and Configuration FTP Server in Linux Ubuntu Using ProFTPd
ProFTPd is an application that used to transfer data or familiar called as FTP (File Transfer Protocol). By using proFTPd, we can create an FTP server that can make a server can provide facilities to upload and download from the server.
ProFTPd is easy to configure. This step-by-step installation and configuration FTP server using proFTPd.
Installation ProFTPd:
- Install proftpd with the following command:
sudo apt-get install proftpd
- While the installation process, you are given two options to running proFTPd from inetd or standalone. If FTP traffic is large, you must choose standalone. You mus create FTP user with the following commands for edit file:
sudo nano /etc/shells
Then add the following code:/bin/false
Then create folder/directory what you want to share using FTP, for example: /home/ShareFTP. So you must type this command to create that directory:sudo mkdir /home/ShareFTP
- Create user and password with type this command:
sudo useradd name_user -p password_user -d /home/ShareFTP -s /bin/false
*name_user is username for account FTP server. password_user is password of that username. - Then create download and upload directory into ShareFTP with the following command:
sudo mkdir /home/ShareFTP/download
sudo mkdir /home/ShareFTP/upload
- Setting permission directory for user with the following command:
sudo chmod 755 /home/ShareFTP
sudo chmod 755 /home/ShareFTP/download
sudo chmod 755 /home/ShareFTP/upload
Configuration ProFTPd:
- Edit configuration file /etc/proftpd/proftpd.conf using nano editor with this following way:
sudo nano /etc/proftpd/proftpd.conf
- Will display the text editor of proftpd configuration, then put your cursor on the bottom line. Then add this script:
<Anonymous /home/ShareFTP/>
User nama_user
Group nogroup
UserAlias anonymous ftp
DirFakeUser on ftp
DirFakeGroup on ftp
RequireValidShell off
MaxClients 10
DisplayLogin welcome.msg
DisplayChdir .message
<Directory *>
<Limit WRITE>
AllowAll
</Limit>
</Directory>
</Anonymous> - Save and restart proftpd service with the following command:
sudo /etc/init.d/proftpd restart
- Configuration proFTPd has been completed. For transfer file from windows to linux server, you can run an application FileZilla, then fill with this configuration:
hostname: alamat IP server
username: username FTP
password: password user FTP
port : 21
or you can type ftp localhost in linux Terminal, then type username and password.
download file now
Monday, September 4, 2017
Ubuntu Using Numix to make things unique and beautiful
Ubuntu Using Numix to make things unique and beautiful

The numix project can be browsed here: http://numixproject.org/
You can add the PPA in ubuntu with the following commands:
sudo apt-add-repository ppa:numix/ppa
sudo apt-get update
Installing the theme:
sudo apt-get install numix-gtk-theme
Icon themes:
sudo apt-get install numix-icon-theme-circle
sudo apt-get install numix-icon-theme-shine
sudo apt-get install numix-icon-theme-utouch
A nice wallpaper:
sudo apt-get install numix-wallpaper-notd
You can use Gnome Tweak tool to change the icon theme and such, works nicely. Install it with:
sudo apt-get install gnome-tweak-tool
download file now
Trident ML Clustering using K Means
Trident ML Clustering using K Means
This post shows some very basic example of how to use the k means clustering algorithm in Trident-ML to process data from Storm Spout.
Firstly create a Maven project (e.g. with groupId="com.memeanalytics" artifactId="trident-k-means"). The complete source codes of the project can be downloaded from the link:
https://dl.dropboxusercontent.com/u/113201788/storm/trident-k-means.tar.gz
For the start we need to configure the pom.xml file in the project.
Configure pom.xml:
Firstly we need to add the clojars repository to the repositories section:
<repositories>
<repository>
<id>clojars</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
Next we need to add the storm dependency to the dependencies section (for storm):
<dependency>
<groupId>storm</groupId>
<artifactId>storm</artifactId>
<version>0.9.0.1</version>
<scope>provided</scope>
</dependency>
Next we need to add the strident-ml dependency to the dependencies section (for k-means clustering):
<dependency>
<groupId>com.github.pmerienne</groupId>
<artifactId>trident-ml</artifactId>
<version>0.0.4</version>
</dependency>
Next we need to add the exec-maven-plugin to the build/plugins section (for execute the Maven project):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>false</includePluginDependencies>
<executable>java</executable>
<classpathScope>compile</classpathScope>
<mainClass>com.memeanalytics.trident_k_means.App</mainClass>
</configuration>
</plugin>
Next we need to add the maven-assembly-plugin to the build/plugins section (for packacging the Maven project to jar for submitting to Storm cluster):
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass></mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Implement Spout for training data
Once the pom.xml update is completed, we can move to implement the RandomFeatureSpout which is the Storm spout that emits batches of training data to the Trident topology:package com.memeanalytics.trident_k_means;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.github.pmerienne.trident.ml.core.Instance;
import com.github.pmerienne.trident.ml.testing.data.Datasets;
import backtype.storm.task.TopologyContext;
import backtype.storm.tuple.Fields;
import storm.trident.operation.TridentCollector;
import storm.trident.spout.IBatchSpout;
public class RandomFeatureSpout implements IBatchSpout{
private int batchSize=10;
private int numFeatures=3;
private int numClasses=3;
public void open(Map conf, TopologyContext context) {
// TODO Auto-generated method stub
}
public void emitBatch(long batchId, TridentCollector collector) {
// TODO Auto-generated method stub
List<Instance<Integer>> data = Datasets.generateDataForMultiLabelClassification(batchSize, numFeatures, numClasses);
for(Instance<Integer> instance : data)
{
List<Object> values=new ArrayList<Object>();
values.add(instance.label);
for(double feature : instance.getFeatures())
{
values.add(feature);
}
collector.emit(values);
}
}
public void ack(long batchId) {
// TODO Auto-generated method stub
}
public void close() {
// TODO Auto-generated method stub
}
public Map getComponentConfiguration() {
// TODO Auto-generated method stub
return null;
}
public Fields getOutputFields() {
// TODO Auto-generated method stub
return new Fields("label", "x0", "x1", "x2");
}
}
As can be seen above, the RandomFeatureSpout is derived from IBatchSpout, and emits a batch of 10 tuples at one time, each tuple is a training record containing the fields ("label", "x0", "x1", "x2"). The label is integer, while x0, x1, x2 are double values. the training records are obtained from Trident-MLs DataSets.generateDataForMultiLabelClassification() method.
K-means in Trident topology using Trident-ML implementation
Once we have the training data spout, we can build a Trident topology which uses the training data to create a class label for each of the data record using k-means algorithm in Trident-ML. This is implemented in the main class shown below:package com.memeanalytics.trident_k_means;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.github.pmerienne.trident.ml.clustering.ClusterQuery;
import com.github.pmerienne.trident.ml.clustering.ClusterUpdater;
import com.github.pmerienne.trident.ml.clustering.KMeans;
import com.github.pmerienne.trident.ml.core.Instance;
import com.github.pmerienne.trident.ml.preprocessing.InstanceCreator;
import com.github.pmerienne.trident.ml.testing.data.Datasets;
import storm.trident.TridentState;
import storm.trident.TridentTopology;
import storm.trident.testing.MemoryMapState;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.LocalDRPC;
import backtype.storm.generated.AlreadyAliveException;
import backtype.storm.generated.InvalidTopologyException;
import backtype.storm.generated.StormTopology;
import backtype.storm.tuple.Fields;
public class App
{
public static void main( String[] args ) throws AlreadyAliveException, InvalidTopologyException
{
LocalDRPC drpc=new LocalDRPC();
Config config=new Config();
LocalCluster cluster=new LocalCluster();
cluster.submitTopology("KMeansDemo", config, buildTopology(drpc));
try{
Thread.sleep(10000);
}catch(InterruptedException ex)
{
ex.printStackTrace();
}
for(int i=0; i < 10; ++i)
{
String drpc_args=generateRandomTestingArgs();
System.out.println(drpc.execute("predict", drpc_args));
try{
Thread.sleep(1000);
}catch(InterruptedException ex)
{
ex.printStackTrace();
}
}
cluster.killTopology("KMeansDemo");
cluster.shutdown();
drpc.shutdown();
}
private static String generateRandomTestingArgs()
{
int batchSize=10;
int numFeatures=3;
int numClasses=3;
final Random rand=new Random();
List<Instance<Integer>> data = Datasets.generateDataForMultiLabelClassification(batchSize, numFeatures, numClasses);
String args="";
Instance<Integer> instance = data.get(rand.nextInt(data.size()));
args+=instance.label;
for(double feature : instance.getFeatures())
{
args+=(","+feature);
}
return args;
}
private static StormTopology buildTopology(LocalDRPC drpc)
{
TridentTopology topology=new TridentTopology();
RandomFeatureSpout spout=new RandomFeatureSpout();
TridentState clusterModel = topology.newStream("training", spout).each(new Fields("label", "x0", "x1", "x2"), new InstanceCreator<Integer>(), new Fields("instance")).partitionPersist(new MemoryMapState.Factory(), new Fields("instance"), new ClusterUpdater("kmeans", new KMeans(3)));
topology.newDRPCStream("predict", drpc).each(new Fields("args"), new DRPCArgsToInstance(), new Fields("instance")).stateQuery(clusterModel, new Fields("instance"), new ClusterQuery("kmeans"), new Fields("predict"));
return topology.build();
}
}
package com.memeanalytics.trident_k_means;
import java.util.ArrayList;
import java.util.List;
import backtype.storm.tuple.Values;
import com.github.pmerienne.trident.ml.core.Instance;
import storm.trident.operation.BaseFunction;
import storm.trident.operation.TridentCollector;
import storm.trident.tuple.TridentTuple;
public class DRPCArgsToInstance extends BaseFunction{
private static final long serialVersionUID = 1L;
public void execute(TridentTuple tuple, TridentCollector collector) {
// TODO Auto-generated method stub
String drpc_args = tuple.getString(0);
String[] args = drpc_args.split(",");
Integer label=Integer.parseInt(args[0]);
double[] features=new double[args.length-1];
for(int i=1; i < args.length; ++i)
{
double feature=Double.parseDouble(args[i]);
features[i-1] = feature;
}
Instance<Integer> instance=new Instance<Integer>(label, features);
collector.emit(new Values(instance));
}
}
As can be seen above, the Trident topology has a InstanceCreator<Integer> trident operation which convert raw ("label", "x0", "x1", "x2") tuple into an Instance<Integer> object which can be consumed by ClusterUpdator. The ClusterUpdate object from Trident-ML updates the underlying clusterModel via k-Means algorithm.
The DRPCStream allows user to pass in a new testing instance to the clusterModel which will then return a "predict" field, that contains the predicted label of the testing instance. The DRPCArgsToInstance is a BaseFunction operation which converts the arguments passed into the LocalDRPC.execute() into an Instance<Integer> which can be passed into the ClusterQuery which then uses kmeans and clusterModel to determine the predicted label.
Once the coding is completed, we can run the project by navigating to the project root folder and run the following commands:
> .mvn compile exec:java
download file now
Sunday, September 3, 2017
Tutorial Install VirtualBox in Linux Ubuntu Using apt get
Tutorial Install VirtualBox in Linux Ubuntu Using apt get
Installation VirtualBox can do with command:
apt-get install virtualbox-ose vboxgtk
Also need to install kernel module. There are some kernel module option, ie:
- virtualbox-ose-modules-386
- virtualbox-ose-modules-generic
- virtualbox-ose-modules-openvz
- virtualbox-ose-modules-rt
- virtualbox-ose-modules-server
- virtualbox-ose-modules-virtual
For example:
apt-get install virtualbox-ose-modules-generic
Make sure <user> have access rights to directory /dev/vboxdrv
adduser <user> vboxusers
Or the other way a bit more brutal
chmod-Rf 777 /dev/vboxdrv
Restart VirtualBox
/etc/init.d/virtualbox-ose restart
download file now
Saturday, September 2, 2017
UES 357 Using IP address or domain name to access UES gadgets
UES 357 Using IP address or domain name to access UES gadgets
You may get the following error and your gadgets wont work as expected if you try to use an IP address/domain name instead of the default URL with https.
Eg :-
Default :
https://localhost:9443/portal/gadgets/intro-gadget-2/intro-gadget-2.xml
Updated :
https://10.100.0.128:9443/portal/gadgets/intro-gadget-2/intro-gadget-2.xml
or
https://ues.udara.me/portal/gadgets/intro-gadget-2/intro-gadget-2.xml
Detailed error: 500 javax.net.ssl.SSLException: hostname in certificate didnt match: <10.100.1.128> != <localhost> shindig.js:9By default all WSO2 products shipped with a self signed certificate for the domain localhost, to overcome this issue you have to create and add a certificate for your IP/Domain name.
1. Lets assume you need to add a self signed certificate for your IP address(10.100.0.128), run following command and provide information when required, here Im using wso2carbon as my keystore password so I dont have to do any configuration changes.
keytool -genkey -alias ues -keyalg RSA -keystore ues.jks -keysize 2048
Note :- I have created ues.jks within /home/udara/key/ directory and you have to provide your IP or domain name as your first and last name (CN).
udara@thinkPad:~/key$ keytool -genkey -alias ues -keyalg RSA -keystore ues.jks -keysize 2048
Enter keystore password: wso2carbon
Re-enter new password: wso2carbon
What is your first and last name?
[Unknown]: 10.100.0.128
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]: WSO2
What is the name of your City or Locality?
[Unknown]: Mountain View
What is the name of your State or Province?
[Unknown]: CA
What is the two-letter country code for this unit?
[Unknown]: US
Is CN=10.100.0.128, OU=Unknown, O=WSO2, L=Mountain View, ST=CA, C=US correct?
[no]: yes
Enter key password for <wso2carbon>
(RETURN if same as keystore password): wso2carbon
Re-enter new password: wso2carbon
2.Take a back-up of the current <UES_HOME>/repository/resources/security/ directory.
3.Run following command within <UES_HOME>/repository/resources/security/ directory to import your certificate into wso2carbon.jks.
Since I have created my ues.jks inside /home/udara/key/ directory in step-1,
udara@thinkPad:/wso2/support/workspace/wso2ues-1.0.0/repository/resources/security$ keytool -importkeystore -srckeystore /home/udara/key/ues.jks -destkeystore wso2carbon.jks -srcstoretype jks -deststoretype jks -srcstorepass wso2carbon -deststorepass wso2carbon4. Since we cant have two different private keys, lets delete the previous one.
Entry for alias ues successfully imported.
Import command completed: 1 entries successfully imported, 0 entries failed or cancelled
udara@thinkPad:/wso2/support/workspace/wso2ues-1.0.0/repository/resources/security$ keytool -delete -alias wso2carbon -keystore wso2carbon.jks -storepass wso2carbon5. Lets export our public key from wso2carbon.jks and import it in to the client-truststore.jks.
I) Export public key from wso2carbon.jks as test.cer.
udara@thinkPad:/wso2/support/workspace/wso2ues-1.0.0/repository/resources/security$ keytool -export -keystore ues.jks -alias ues -file test.cerII) Import public certificate test.cer into client-truststore.jks.
Enter keystore password:
Certificate stored in file <test.cer>
udara@thinkPad:/wso2/support/workspace/wso2ues-1.0.0/repository/resources/security$ keytool -import -alias ues -file test.cer -keystore client-truststore.jks6. Since we have updated the key store alias from wso2carbon to ues, we have to modify this in few configs to make SSO works.
Enter keystore password:
Owner: CN=10.100.0.128, OU=Unknown, O=WSO2, L=Mountain View, ST=CA, C=US
Issuer: CN=10.100.0.128, OU=Unknown, O=WSO2, L=Mountain View, ST=CA, C=US
Serial number: 4a460fad
Valid from: Tue Apr 08 11:49:26 IST 2014 until: Mon Jul 07 11:49:26 IST 2014
Certificate fingerprints:
MD5: 54:CD:B8:CD:7D:3D:B5:29:2B:A4:45:61:18:C9:5A:59
SHA1: 53:03:B5:6D:32:D2:07:33:0D:49:7A:37:32:C7:13:DA:4E:29:60:28
SHA256: C5:23:6D:09:F3:97:45:3A:F8:19:A1:F9:14:18:DE:BC:F3:C7:C9:C1:FF:0E:D9:E6:94:EF:DA:A3:6D:79:36:B9
Signature algorithm name: SHA256withRSA
Version: 3
Extensions:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 92 70 EA 1B 80 6B F8 07 84 0A D9 B0 FE 52 A3 41 .p...k.......R.A
0010: C0 DA B0 17 ....
]
]
Trust this certificate? [no]: yes
Certificate was added to keystore
Update <UES_HOME>repository/conf/carbon.xml,
<KeyStore>If we take portal jaggery app(<UES_HOME>/repository/deployment/server/jaggeryapps/portal),
<!-- Keystore file location-->
<Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
<!-- Keystore type (JKS/PKCS12 etc.)-->
<Type>JKS</Type>
<!-- Keystore password-->
<Password>wso2carbon</Password>
<!-- Private Key alias-->
<KeyAlias>ues</KeyAlias>
<!-- Private Key password-->
<KeyPassword>wso2carbon</KeyPassword>
</KeyStore>
Update ssoConfiguration section in portal.json as follows,
"ssoConfiguration" : {You have to made the above update in all other jaggery apps within the <UES_HOME>/repository/deployment/server/jaggeryapps/ directory.
"enabled" : true,
"issuer" : "portal",
"identityProviderURL" : "%https.host%/sso/samlsso.jag",
"keyStorePassword" : "wso2carbon",
"identityAlias" : "ues",
"responseSigningEnabled" : "true",
"keyStoreName" : "/repository/resources/security/wso2carbon.jks",
"storeAcs" : "%https.host%/store/sso.jag",
"portalAcs" : "%https.host%/portal/sso.jag",
"appAcsHost" : "%https.host%"
}
ssoConfiguration = {
"enabled": true,
"issuer": "{{appName}}",
"identityProviderURL": config.ssoConfiguration.identityProviderURL,
"keyStorePassword": "wso2carbon",
"identityAlias": "ues",
"responseSigningEnabled": "true",
"keyStoreName": "/repository/resources/security/wso2carbon.jks"
}
7. Restart WSO2 UES server.
If you browse Home>Configure>Key Stores>View Key Store, you can see the certificate of the private key section as follows.

By providing your IP address or domain name as the first and last name in step 1, you can overcome this host-name mismatch issue while loading UES gadgets.
You can refer this article[1] which explains how to create and add CA signed certificate to any Carbon product.
[1] . http://wso2.com/library/knowledge-base/2011/08/adding-ca-certificate-authority-signed-certificate-wso2-products/
download file now
Ubuntu like Debian Font Rendering using Infinality Font
Ubuntu like Debian Font Rendering using Infinality Font
In this guide we are going to see the steps to improve Debian font rendering and get Ubuntu like font rendering using Infinality font. I�m not going to add any before/after screenshots as the font rendering will differ from display to display based on the resolution, the pixel density etc.
Before we proceed, I would like to let you know that installing packages by adding PPA is not the way things are done usually in Debian.
But in this case, this is the easiest way to do it as these packages does not have any dependencies.
First let add the infinality font repository from launchpad.
sudo nano /etc/apt/sources.list
#Infinality Fonts
deb http://ppa.launchpad.net/no1wantdthisname/ppa/ubuntu trusty main
deb-src http://ppa.launchpad.net/no1wantdthisname/ppa/ubuntu trusty main
First we have to add keys to access the repository. To do that, we have to run,
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E985B27B
Now lets update & install infinality font.
sudo apt-get update
sudo apt-get install fontconfig-infinality
To configure infinality font, follow these steps
cd /etc/fonts/infinality/
sudo bash infctl.sh setstyle
Select a style:
1) debug 3) linux 5) osx2 7) win98
2) infinality 4) osx 6) win7 8) winxp
#?
I chose 3 (i.e. linux).
Now lets change the font style.
sudo vi /etc/profile.d/infinality-settings.sh
#################################################################
########################### EXAMPLES ############################
#################################################################
#
# Set the USE_STYLE variable below to try each example.
# Make sure to set your style in /etc/fonts/infinality.conf too.
#
# Possible options:
#
# DEFAULT � Use above settings. A compromise that should please most people.
# OSX � Simulate OSX rendering
# IPAD � Simulate iPad rendering
# UBUNTU � Simulate Ubuntu rendering
# LINUX � Generic �Linux� style � no snapping or certain other tweaks
# WINDOWS � Simulate Windows rendering
# WINDOWS7 � Simulate Windows rendering with normal glyphs
# WINDOWS7LIGHT- Simulate Windows 7 rendering with lighter glyphs
# WINDOWS � Simulate Windows rendering
# VANILLA � Just subpixel hinting
# CUSTOM � Your own choice. See below
# �� Infinality styles ��
# CLASSIC � Infinality rendering circa 2010. No snapping.
# NUDGE � CLASSIC with lightly stem snapping and tweaks
# PUSH � CLASSIC with medium stem snapping and tweaks
# SHOVE � Full stem snapping and tweaks without sharpening
# SHARPENED � Full stem snapping, tweaks, and Windows-style sharpening
# INFINALITY � Settings I use
# DISABLED � Act as though running without the extra infinality enhancements (just subpixel hinting).USE_STYLE=�UBUNTU�
Now search for �USE_STYLE� or scroll (around line 710) till you see the option to set the style.
Now change the value of USE_STYLE as per your preference & save the file. I�m using UBUNTU style in this example.
LCD Filter Setting
We need to set the LCD filter setting in our home directory using a file called �.Xresources�.
Method 1
- Create a new file and name it as �.Xresources�.
- Open the file (If you can�t see the file, then you need to change setting to show hidden files), add the following line, save & close the file
- Xft.lcdfilter: lcddefault
Method 2
Run the following command
echo "Xft.lcdfilter: lcddefault" >> ~/.Xresources
Note: In my LCD display, font rendering look best with hinting set to slight. You may change this value �medium or full� as per your preference.
Xfce
Go to Settings -> Appearance.
- Tick the checkbox to Enable anti-aliasing
- Set Sub-pixel order to RGB
- Set Hinting to Slight
Gnome
Gnome does not have options to configure font rendering methods. So you need to install gnome-tweak-tool which can be done by running the following command.
sudo apt-get install gnome-tweak-tool
Then change the settings
Open Gnome tweak tool and to fonts setting.
- Set Antialiasing to RGB
- Set Hinting to Slight
Logout & login back to see the new font rendering.
Check Font Rendering Settings
You can check the current font rendering settings by running the following command,
xrdb -query
On running the above command, you should see the following settings.
Xft.dpi: 96
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault
Xft.rgba: rgb
download file now
Subscribe to:
Posts (Atom)