Linux.com

Home Linux Community Community Blogs

Community Blogs



PostgreSQL features that may interest you

Range Types

Ever had start_date and end_date columns? Have you written queries like this to find overlapping date ranges?:

… WHERE ('2014-07-15 15:20:00’ >= start_date
AND '2014-07-15 15:20:00’ < end_date)
OR ('2014-07-15 15:50:00’ > start_date
AND '2014-07-15 15:50:00’ <= end_date);

Well this isn’t necessary in PostgreSQL

CREATE TABLE appointments (
id serial primary key,
appointment tstzrange,
details text);
INSERT INTO appointments (appointment, details)
VALUES ('[2014-07-15 15:00:00,2014-07-15 15:30:00)’, 'Dentist’);
SELECT *
FROM appointments
WHERE appointment && '[2014-07-15 15:20:00, 2014-07-15 15:50:00)’::tstzrange;

Square brackets mean “including”, round brackets mean “from/to but not including”. So the appointment is from 15:00, and up to, but not including, 15:30. We want it this way because if we had an appointment at 15:30, we don’t want it overlapping the previous appointment at all. The && operator means "overlaps".

 

Arrays

Ever had several items that you wanted to store together, but had to create a column for each one? In PostgreSQL any type (even user-created ones) can be specified as an array type by adding "[]" to the end of the type name. (note: the ISBN13 type shown below is part of the core extension "lsn")

CREATE TABLE books (isbn ISBN13, title TEXT, author text, tags TEXT[]);INSERT INTO books (isbn, title, author, tags)
VALUES
('978-0575081406','The Name of the Wind','Patrick Rothfuss', ARRAY['fantasy','fiction','epic']),
('978-0753827666','Gone Girl','Gillian Flynn',ARRAY['mystery','fiction']),
('978-0575079755','The Lies of Locke Lamora','Scott Lynch', ARRAY['fantasy','epic']);

SELECT *
FROM books
WHERE tags @> '{fantasy}';

       isbn        |          title           |      author      |          tags        
-------------------+--------------------------+------------------+------------------------
978-0-575-08140-6 | The Name of the Wind | Patrick Rothfuss | {fantasy,fiction,epic}
978-0-575-07975-5 | The Lies of Locke Lamora | Scott Lynch | {fantasy,epic}
(2 rows)


Function Languages

PostgreSQL supports not just SQL and plpgsql as function languages, but many others including Perl, Python, Bash, TCL, Sh, R, Java, Javascript, Javascript V8, LOLcode, Scheme, PHP, Ruby, Lua, or any other language you wish to add:

CREATE OR REPLACE FUNCTION divide_python(a numeric, b numeric) RETURNS numeric AS $$
if b > 0:
return a / b
$$ LANGUAGE plpython3u;

CREATE OR REPLACE FUNCTION divide_perl(numeric, numeric) RETURNS numeric AS $$
if ($_[1] > 0) {
return $_[0] / $_[1];
}
$$ LANGUAGE plperl;

 

Foreign Data Wrappers

PostgreSQL can connect to pretty much any external data source:

-- Create the file_fdw extension so we can read in files from disk.
CREATE EXTENSION file_fdw;
-- Create the server definition which is straight-forward for files
CREATE SERVER file FOREIGN DATA WRAPPER file_fdw;
-- Now create the definition of the foreign table that will read in the file when queried.
CREATE FOREIGN TABLE report_file (report_date date, item text, count int) SERVER file
OPTIONS (FILENAME '/tmp/report.csv', HEADER 'true', FORMAT 'csv');
-- Let's query it as if it were just a regular table
SELECT * FROM report_file ORDER BY count desc;
 report_date | item | count
-------------+---------+-------
 2014-10-15 | Books | 15
 2014-10-15 | Glasses | 5
 2014-10-17 | Laptops | 3
(3 rows)

 

 

 

Try the New Makulu Cinnamon Debian Edition: Gaming-Ready, Cinnamon at Its Peak

In the past I have reviewed MakuLinux MATE Edition, which came with a very polished and beautiful interface, but also bundled in the ISO a big number of applications to be installed. At the time the MATE edition made a very good impression on me, so I kept a close eye on the development of Makulu.

 

So now it’s time to look at the brand new MCDE – MakuluLinux Cinnamon Debian Edition – which features Cinnamon 2.2, is based on Debian Testing and comes ships with components to make it a great choice for gamers, beautiful appearance customization themes and wallpapers, a custom control center and many more features.

 

Read more

 

TAMASHARE : Instant Sharing

Tamashare is the first application for instant sharing.
With Tamashare, you can save time by inviting the participants directly to a private and secure sharing room
The file appearing in the sharing room is instantly visible to all the participants
Everyone can talk with you about the document thanks to the display of the hands of users, an audio conferencing module and annotation tools.

Tamashare is a free application available soon for all devices.

You can download here : TAMASHARE DOWNLOAD FOR FREE

Or watch our teaser :

YOU TUBE CHANNEL


Enjoy

 

Emacs 24.4 Ships with Integrated Web Browser [Ubuntu Installation]

Emacs 24.4 has been released earlier today, and it ships with several new features and improved functionality, on the most notable being the presence of an integrated web browser.

Emacs is the powerful integrated development environment developed by the GNU project, with support for countless features and tools. You can program with it, read mail, browse files, and even play the built-in games, and version 24.4 extends its functionality with a web browser as well.

The list of changes that went into Emacs 24.4 is rather large, so here are the main new improvements.

Full article

 

Ubuntu 15.04 to Be Codenamed Vivid Vervet, Ubuntu Celebrates 10 Years Birthday

With only a few days before Ubuntu 14.10 will officially see the light of day, Mark Shuttleworth posted a blog entry filled with a richness of Vibrant words in which he announced the codename for the next version of Ubuntu, which will follow Utopic.

 

This announcement also comes as to celebrate the 10th anniversary since Warty Warthog, the first Ubuntu version, was released.

 

Full article

 

Marble Atlas Review - Alternative to Google Earth

Marble is a 3D virtual globe application which features various map views, Internet services integration for geographical and meteorological data, satellite views, routes suggestions, plugins.

Marble comes included by default in the KDE environment, in the KDE Education package.


By default, there are 10 different map view modes in Marble, each showing specific information, however, tens more can be downloaded and installed.

 

Full article

 

DigiKam 4.4.0 Review & Ubuntu Installation

It’s been a while since I had a look at DigiKam, and even though I’m not much into using a specialized application for organizing and keeping track of photos, I decided to have a look at the state of this popular and feature-complete photo manager for KDE.

 

Full article

 

Linutop OS 14.4 is released

New Linutop OS 14.04 for PC

Linutop announced the latest version of its Operating System 14.04 for PC and Intel NUC PC:

Linutop OS is an optimized version of Ubuntu XFCE LTS 14.04 including up to date Linux drivers and major softwares VLC 2.1 , Firefox 32, Libre Office 4.2 in the smallest package (< 1GB)

Linutop Security Lock: A simple solution for Secure Desktops in public spaces

The system can be locked into read only mode, preventing alterations by viruses or other mishaps. Its ability to recover its initial state at each startup is key to minimizes maintenance costs.

IDEAL for schools, libraries, associations that want to provide a desktop in a public space without needs for maintenance.

Linutop Kiosk software :

-Internet Kiosk: Allows to easily setup an internet/intranet web kiosk

IDEAL for hotels that want to provide an internet cafe OR stores/libraries that need to provide online catalog browsing

-Display Kiosk: Allows users to configure a playlist of Images, Web Pages, URLs, Video, folders, PDF  and sounds files with an intuitive interface, in order to  display the media in full screen.

IDEAL for information, orientation, advertising

 

Linutop OS 14.4 complete details and download are available at: http://www.linutop.com/software.en.html

 

 

Why To Use Cloud Hosting Technology?

Cloud hosting? It's a buzz-phrase, it's popular and appears to work – but is that enough justification for you really to utilize it? Cloud hosting has its pros and cons, just as the traditional IT solutions it replaces. Read the list below to see if oahu is the right solution for you.

 

Actually, What Is Cloud Hosting?

 

First of all, let's make sure most of us have exactly the same perception of ‘cloud hosting '. The concepts of cloud hosting and computing aren't new. You can consider ‘cloud' as a kind of shorthand to explain a network of computing resources(typically servers). A user connecting to the ‘cloud' via a terminal, a PC or a mobile device like a smartphone can utilize the resources in the cloud to store data and run software applications on the servers in the cloud. To mix metaphors a little, the cloud is just a black box: as long as do you know what you place in and that which you escape, you do not have to be concerned about the way the cloud works inside. Physically however, the computer files and commands you send to the cloud all go to one or more real servers somewhere and connected to the network (very often the Internet) that you too are accessing. The recent development in cloud hosting that folks speak about today has come about as more and more service providers have made online computing resources available as services to consumers and enterprises.

 

What are the Fortes of Cloud Hosting?

 

Cloud hosting services that are available over Internet frequently have the next advantages:

 

Financial Flexibility. You rent a site from somebody else rather than investing in your server. Which means you pay lower monthly charges (some cloud hosting is even free), rather than committing a more substantial quantity of capital. In many cases, cloud hosting can be more cost-effective. However, you must always compare the sum total startup and ongoing costs of all of the solutions you're considering (cloud or other) to see what's best for you.

 

Universal Access. You can connect to the cloud hosting service anywhere you can connect to the web. With broadband, 3G and Wi-Fi access points, meaning pretty much everywhere.

 

Reliability and Resilience. Service providers have extensive server networks and can host multiple copies of your data in different locations. If you have a problem with a server in one single place, your data can be recovered from another server elsewhere on the network.

 

Scaling of Resources. For a person person or company, there's typically no limit to the total amount of storage space or power for applications that may be made available. Cloud hosting providers operate huge, networked data centers giving ample room for growth for only the largest customers.

 

Up to Date Backup and Encryption Software. Cloud hosting services run current versions of software and a number of them also provide ‘strong encryption ', which makes it practically impossible for someone minus the encryption key to hack your data. However, see below for more information.

 

Service Choice and Flexibility. Because you rent a site rather than invest in your server, you can even move your data from one cloud hosting provider to some other if you obtain another hosting deal you prefer.

 

Eco-friendly. Cloud resources are also shared between customers (with appropriate security), making total power consumption per customer less than if each customer had to utilize its own individual private server.

 

                    

Please check at http://www.thesagenext.com if you are looking for cloud hosting.

 

 

 

 

A brief tour of new features in the management console for UCS 4.0

UCS 4.0 will be released in November. The second milestone, released last week, already includes the completely redesigned and restructured Univention Management Console (UMC).

People who are interested in finding out more about the new design and the motives behind it, are invited to read the article from Alexander Kläser, product developer at Univention, who explains it all in there.

The second milestone of UCS 4.0 is available to download for anyone and feedback for the improvement of this next major release is more than welcome.

http://blog.univention.com/new-features-umc-ucs-4-0/

 

For beginners - 3D assisted drawing

Have just tested a simple idea to make drawing easier. Basically I used the 3D software Blender to make a simple model of what I was going to draw. The model as in the screenshot below consists only of primitives and is very crude. First I thought of using an armature in the software but this was unnecessary. Just move and rotate the various body parts. Since I’m not trained at all in drawing I just put a piece of paper over screen and begin following contours. Then it was easy just to correct the drawing.

 

sBlenderDino

 

Blender 3D assisted sketch of the dino.

sDino

s

 

 
Page 5 of 147

Upcoming Linux Foundation Courses

  1. LFD312 Developing Applications For Linux
    05 Jan » 09 Jan - Virtual
    Details
  2. LFS220 Linux System Administration
    05 Jan » 08 Jan - Virtual
    Details
  3. LFD331 Developing Linux Device Drivers
    12 Jan » 16 Jan - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board