P____k
Recent tracks
-
Finally Moving (James Brown Remix) by {u'mbid': u'3a07764c-7cc5-42e9-8205-3de7532f4771', u'#text': u'Pretty Lights'}5 days ago
-
Hot Like Sauce (Rustified Remix) by {u'mbid': u'3a07764c-7cc5-42e9-8205-3de7532f4771', u'#text': u'Pretty Lights'}5 days ago
-
Steve Miller Band Fly Like An Eagle Remix by {u'mbid': u'3a07764c-7cc5-42e9-8205-3de7532f4771', u'#text': u'Pretty Lights'}5 days ago
-
Jay Z Empire State Of Mind Remix by {u'mbid': u'3a07764c-7cc5-42e9-8205-3de7532f4771', u'#text': u'Pretty Lights'}5 days ago
-
Kanye West All Of The Lights Remix by {u'mbid': u'3a07764c-7cc5-42e9-8205-3de7532f4771', u'#text': u'Pretty Lights'}5 days ago
-
Pink Floyd Time Remix by {u'mbid': u'3a07764c-7cc5-42e9-8205-3de7532f4771', u'#text': u'Pretty Lights'}5 days ago
-
NYE Chicago Bulls (Intro Remix) by {u'mbid': u'3a07764c-7cc5-42e9-8205-3de7532f4771', u'#text': u'Pretty Lights'}5 days ago
-
Pretty Lights vs Radiohead vs Nirvana vs NIN by {u'mbid': u'3a07764c-7cc5-42e9-8205-3de7532f4771', u'#text': u'Pretty Lights'}5 days ago
-
Solar Sailer (Pretty Lights Remix) by {u'mbid': u'056e4f3e-d505-4dad-8ec1-d04f521cbb56', u'#text': u'Daft Punk'}5 days ago
-
Try To Remember by {u'mbid': u'3a07764c-7cc5-42e9-8205-3de7532f4771', u'#text': u'Pretty Lights'}5 days ago
Top artists
Top tracks
-
78 plays
-
67 plays
-
60 plays
-
59 plays
-
46 plays
-
46 plays
-
46 plays
-
45 plays
-
44 plays
-
44 plays
-
42 plays
-
40 plays
-
38 plays
-
38 plays
-
37 plays
-
37 plays
-
36 plays
-
35 plays
-
35 plays
-
34 plays
-
34 plays
-
34 plays
-
33 plays
-
32 plays
-
31 plays
-
28 plays
-
28 plays
-
28 plays
-
27 plays
-
27 plays
-
27 plays
-
26 plays
-
26 plays
-
25 plays
-
25 plays
-
25 plays
-
24 plays
-
24 plays
-
24 plays
-
24 plays
-
23 plays
-
23 plays
-
22 plays
-
22 plays
-
22 plays
-
21 plays
-
21 plays
-
21 plays
-
20 plays
-
20 plays
Posts
Humm….
Excuse me, but i’m french and i dont understand when you wrote like that :$
My english is too poor, like every french people ;) ahaha
Audio
Latest checkin
-
@RER Yerres [D] (Rue de la Gare)17 months ago in Yerres, Île-de-France
Badges
Checkin history
-
@RER Yerres [D] (Rue de la Gare)17 months ago
-
@Clicmobile (3 rue Primo Levi)2 years ago
Photos
Posts
Wallch is a wallpaper changer for Gnome which can change the desktop wallpaper after an adjustable time. It has a friendly and easy to use graphical interface. Wallch also supports Live Earth wallpaper which updates every 1/2 hour.
Features:
- Live Earth Wallpaper
- Picture of The Day
- Folder Monitoring
- Unity Integration
- Statistics
- Features JPG, PNG, GIF, and BMP support
- Radom image changing
- Desktop/Sound notification
- History Logging
- Taking screenshot
- Taking webcam image
Installation and Usage:
Wallch is available in ubuntu 12.04 software center by default. Just search and install it.
Now, launch wallch and you can see the main window (see the top picture). Click Add or Add Folder to add images, adjust timing and finnally click Start.
Wallch must be opened for it to run the slideshow, so click Edit -> Preferences you can ‘enable startup option’
Live Earth Wallpaper, Picture of The Day, and Monitor Folder features can be enabled via Edit -> Extras dialog.
Related posts:
xplanetFX est une application permettant de bénéficier d’un magnifique fond d’écran de la terre en temps réel sur laquelle j’avais publié un premier billet en janvier 2011 expliquant comment l’installer dans Ubuntu puis un deuxième en février 2011 pour présenter les nouvelles fonctionnalités. Ce troisième billet vous propose d’installer ce fond d’écran dans Ubuntu 12.04 LTS.
Cette version s’enrichit de nouveaux thèmes téléchargeables directement à partir de l’application, vous devriez donc trouvez facilement celui qui vous correspond le mieux.
xplanetFX n’étant pas disponible dans les dépôts officiels d’Ubuntu, vous ne devez suivre les explications suivantes qu’en toute connaissance de cause.
Pour installer xplanetFX dans Ubuntu 12.04 LTS, ouvrez un terminal et, afin de télécharger l’application dans sa dernière mouture, entrez la commande :
wget http://repository.mein-neues-blog.de:9000/latest/xplanetFX.deb
Une fois ce téléchargement terminé, lancez l’installation à l’aide de la commande :
sudo dpkg -i xplanetFX.deb
puis, si des erreurs sont apparues dans le terminal lors de l’installation, lancez la commande suivante :
sudo apt-get install -f
Il ne vous reste plus qu’à rechercher « xplanetFX » dans le dash puis le lancer.
Amusez-vous bien
Source : Ubuntu Portal
Billets reliés
- Le fond d’écran de la Terre xplanetFX s’enrichit
- Un fond d’écran de la Terre intégralement paramétrable en haute qualité
- Un nouveau fond d’écran dynamique avec des images de la Nasa
- Un nouveau fond d’écran dynamique de la Terre vue par satellite en temps réel sur mon bureau Ubuntu
- Un fond d’écran qui donne l’heure
Original post of Clapico.Votez pour ce billet sur Planet Libre.
Articles similaires
- Clapico : Utilisez facilement Ubuntu 12.04 LTS Precise Pangolin en version GNOME Shell (GNOME 3) (30/04/2012)
- Clapico : Utilisez Ubuntu 12.04 Precise Pangolin en version Gnome Classic (21/04/2012)
- Clapico : Une horloge « Ubuntu » sur votre site (07/02/2012)
- Clapico : Ubuntu 12.04 LTS Precise Pangolin Bêta 1 en test sur mon PC (03/03/2012)
- Clapico : Comment mettre à jour un plugin obsolète lors de la sortie d’une nouvelle version de Firefox (ou Thunderbird) ? (08/03/2012)
@G+ users: Ever wanted to use shotwell to mass-publish your pics taken with your high resolution camera to picasa? Ever found that you cannot publish using the max pic size that gives G+ users unlimited storage (2048px) easily?
If so: I made a tiny patch for shotwell that allows you to do exactly that and prepared a package for Ubuntu 12.04 LTS (precise). You can get it from my ppa: https://edge.launchpad.net/~asac/+archive/ppa with just a few clicks/commands away:
sudo add-apt-repository ppa:asac/ppa sudo apt-get update sudo apt-get install shotwell sudo add-apt-repository -r ppa:asac/ppa
Here a screenshot of what it does:
Hope this is useful for some! Have fun!
Update: uploaded an untested backport for Ubuntu 11.10 (oneiric) to the same ppa. Report back how things go!
Update: trivial patch from my package forwarded to shotwell issue tracker http://redmine.yorba.org/issues/5210
Basée sur Xubuntu, il était logique avec la sortie de la version 12.04 LTS Precise Pangolin de voir naître une nouvelle mouture de Voyager crée par l’ami Rodofr sur laquelle on retrouve le fameux bureau XFCE enrichi du dock AWN.
Une des nouveautés marquante de cette distribution est sans conteste Conky Control, le gestionnaire de Conky qui permet d’une part d’en lancer plusieurs simultanément et d’autre part d’en programmer le démarrage automatique lors de l’ouverture de session.
Live Voyager 12.04 étant une distribution légère présente l’avantage de pouvoir être installée sur des machines vieillissantes et peu puissantes. Si la liste des applications disponibles ne correspond pas tout à fait à vos attentes, sachez qu’elle bénéficie de tous les dépôts d’Ubuntu 12.04 LTS Precis Pangolin et qu’il est donc possible d’installer toute application se trouvant dans la logithèque Ubuntu.
Synapse a également été intégré pour la recherche rapide d’applications et de documents.
Moi qui suis un fervent utilisateur d’Ubuntu, je me sers régulièrement de Voyager en Live-USB sur l’ordinateur portable fourni par l’entreprise qui m’emploie lors de mes fréquentes nuitées passées dans des hôtels à l’occasion de déplacements professionnels car le boot est beaucoup plus rapide que lors de l’utilisation d’un Live-USB Ubuntu.
Comme à son habitude, Rodofr a intégré dans son travail des centaines de somptueux fonds d’écran permettant à tout un chacun de trouver son bonheur en matière de personnalisation.
Que ce soit pour la télécharger ou pour bénéficier de plus d’information sur cette distribution, n’hésitez pas à aller faire un tour sur le site officiel.
Un grand bravo à Rodofr pour son travail et pour sa capacité à développer une distribution « Made in France » qui commence à s’exporter un peu partout dans le monde.
Amusez-vous bien
Billets reliés
- Ubuntu 12.04 LTS Precise Pangolin Bêta 1 en test sur mon PC
- Live VOYAGER 11.10 ou quand sobriété rime avec efficacité
- Hybryde 12.04 Hy-menu dans les starting blocks
- La version 11.10 d’Hybride est arrivée
- Utilisez facilement Ubuntu 12.04 LTS Precise Pangolin en version GNOME Shell (GNOME 3)
Original post of Clapico.Votez pour ce billet sur Planet Libre.
Articles similaires
- Clapico : Ubuntu 12.04 LTS Precise Pangolin Bêta 1 en test sur mon PC (03/03/2012)
- Clapico : Hybryde 12.04 Hy-menu dans les starting blocks (23/03/2012)
- Clapico : Utilisez facilement Ubuntu 12.04 LTS Precise Pangolin en version GNOME Shell (GNOME 3) (30/04/2012)
- Clapico : Live VOYAGER 11.10 ou quand sobriété rime avec efficacité (26/10/2011)
- Taltan : Le live Ubuntu Voyager 12.04 LTS est sur orbite (29/04/2012)
The makers of Shotwell have launched the first release of a new e-mail client for Linux.
Geary 0.1 is described by Yorba as ‘a lightweight email reader for the GNOME desktop’. It supports basic viewing and composing of e-mail, keyboard shortcuts and displays multi-threaded mails in a ‘conversation’ view.
Set Up
Setting up Geary is easy, and on first launch you will be prompted to enter your GMail or Yahoo! Mail account details. Other accounts/services can be added by choosing ‘Other’ and entering the relevant IMAP settings.
Using
Like most e-mail clients – whether desktop or web-based – Geary is straightforward to use.
But, unlike most desktop-based e-mail clients such as Thunderbird or Evolution, Geary displays multi-threaded emails as ‘conversations’. That is, they are all grouped in the one e-mail rather than, as with Thunderbird, having an individual mail for each reply.
‘Conversation’ style threading not only keep things neat and tidy but surrounds mails in context - especially useful on mailing lists.
As you can see in the image above, a ‘conversation’ counter is displayed next to a mail should it contain more than one reply.
On to the important part of an e-mail client: the ability to reply. In Geary the ‘Compose’ mail button remains clickable at all times, but the other buttons - reply, reply to all, forward, archive and ‘mark’ – are only available when an e-mail is selected.
By default Geary shows a message preview (a short excerpt of the mail) but this can be disabled.
Clicking on a mail instantly marks it as ‘read’ and loads the body into the conversation pane.
Distinguishing between read and unread mail could be easier. Currently unread mails are denoted by a small icon to the left of the excerpt body.
With such a small area on show I would, personally, find visually noting what is and isn’t read easier were Geary to copy GMail and display read mail subject titles and the senders name in a regular weight to avoid drawing the eye.
Composing
Geary’s Compose window is straightforward to use, although it doesn’t support auto-completion of contacts from your address book (a big ask) yet.
Formatting features include pretty much everything you’d need: -
- Choice of three fonts
- Choice of three font sizes
- Basic text formatting (bold, underline, strikeout, etc)
- Link support
- ‘Remove formatting’ button
- Indentation
- Spell checking
Keyboard Shortcuts
With no App Menus to relay keyboard shortcuts it would be easy to assume that Geary doesn’t support them – but it does.
- Ctrl+N creates a new mail
- Ctrl+R to reply to a selected mail
- Ctrl+Shift+R to reply to all in a selected mail
- Hit Delete to archive a mail
What Geary Doesn’t Do
Geary is very early on in development, and whilst this release does seem stable it will contain bugs, missing features and design quirks.
Ubuntu users shouldn’t expect much in the way of system integration: there is no HUD support, no App Menu support, no Messaging Menu integration, and no notification alerts on new mail arrival.
Yet.
There is also no support for e-mail attachments, and image-rich e-mails don’t display as you’d expect.
Yet.
Avid e-mailers should also note that, at present, there is no support for configuring a signature; you can only add one account; and once added you can’t elegantly ‘log out’ to sign in to a different one.
There is also no mail searching and no way to set a refresh period (or even learn what the refresh period defaults to).
But if you can overlook these short-term shortcomings then you’ll find a functional and stable e-mail client capable of dealing with basic mail needs. And, whether you miss the other stuff listed above or not, this is precisely what a first release should be doing.
Install Geary in Ubuntu 12.04
Geary can be installed in Ubuntu 12.04 by adding the following PPA to your Software Sources. As with any software that doesn’t come through the Ubuntu repositories you add these at your own risk.
At the time of writing the 64bit build of Geary has yet to build.
The quickest and easiest way to add a PPA to your Software Sources is to run the following commands in a new Terminal window.
- sudo add-apt-repository ppa:yorba/ppa
- sudo apt-get update && sudo apt-get install geary
Download and Install Google Earth from the official website:
Download the .deb package from earth.google.com. Then use this command to install this .deb:
sudo dpkg -i google-earth-*.deb
It may prompt missing dependencies, just install them use apt-get command then:
sudo apt-get -f install
Fix the ugly fonts:
After installation, at first launch if you get following unreadable fonts. Just install MSttCoreFonts by:
sudo apt-get install msttcorefonts
If still not satisfied, try following method from ubuntuforums.org
Following fixes may or may not work, try them at your own risk!
Method 1: Download Google-fix aka replacement.7z and save it into ~/Downloads, then run following commands in terminal to extract the package and copy and paste into google earth installation directory:
sudo apt-get install p7zip-full #insall p7zip command line 7zip. cd ~/Downloads/ #navigate to the download folder 7z x replacement.7z #extract downloaded package cd replacement #navigate to the extracted folder sudo cp -r * /opt/google/earth/free/ #copy all in the folder to..
Method 2. Try this on omgubuntu. If you tried method 1 and it failed, completely remove google-earth via synaptic package manager and reinstall it before this.
Related posts:
Beatbox music player has been updated and made available for Ubuntu 12.04.
The former-elementary application, which hits version 0.4 with this release, gains stability, performance and bug fixes in addition to a number of significant new features.
Basics
As any music app should be Beatbox is simple to get started with, even prompting you on first run to import some music – a super intuitive gesture that will save you staring at a blank screen, or cause you to root through menus.
The importing my library was slow, and at times I thought the app had frozen, but in around the same time that it takes to boil an overly-full kettle twice my 15,000 track library was ready and waiting to be played.
Looks
One thing that is clear from the get-go is that the application has been designed solely to complement the elementary GTK theme.
For example, there are parts where colour of text used by the app drowns in Ubuntu’s orange highlights; there are no icons on either of the ‘view’ buttons, and the monochromatic symbols for menu unfolding, shuffle, repeat, etc are simplistic but not consistent in style with the rest of the system icon theme.
But if you can overlook the (likely temporary) cosmetic inconsistencies you’ll find some cracking features on offer…
Features
The search needs to be singled out as the standout feature in Beatbox. It suggests artists and albums as you type giving you a super quick way to play what you want with a minimum of fuss.
A sole click on an album cover in the ‘Album View’ presents you with a pop-over track-list from which to choose tracks to play, add to play-lists etc.
I’ll be blunt: I don’t like the single-click approach. It breaks the expectation the rest of my desktop gives me (double-click to open something). Hopefully an option to set this as a double-click will appear in later versions.
Other features include: -
- Sound Menu support
- Two Views – Album art and ‘list’
- CD Playback
- iPod Syncing
- Auto-fetching of missing album art
- Album art renderer in ‘List View’
- Scrobble support
- Equaliser
Install Beatbox on Ubuntu 12.04
Like a lot of apps at the moment Beatbox is not yet available to install through the Ubuntu Software Center, but it can be installed by adding the official PPA – Personal Package Archive – to your systems’ Software Sources.
This can be done quickest by using the Terminal application and running the following commands: -
- sudo add-apt-repository ppa:sgringwe/beatbox
- sudo apt-get update && sudo apt-get install beatbox
Once Beatbox has fully installed you can launch it using the Dash.
If you’re particularly impressed with Beatbox you can ‘Flattr’ the developer @ flattr.com/thing/633135/BeatBox-Music-Player.
Good news for GIMP fans: after 3 long years in development a new stable version of GIMP has been released.
Announcing the release on the official GIMP website, the developers also state that the update sees ‘other important changes to the user interface’ that brings the team closer to matching their ‘product vision‘.
GIMP 2.8 boasts a wealth of improvements - both under the hood and above it.
The GIMP Users site has an excellent summary of all that’s new in GIMP 2.8, but a few choice highlights include: -
Single window mode
Sure to be the headline feature in this release for many, the single window mode has long been requested. With GIMP 2.8 it finally becomes stable.
On canvas text editing
GIMP 2.8 supports the editing of text directly – no more pop-up windows!
Layer Groups
Converts from Photoshop will welcome the ability to group layers, and apply changes to all the layers within a group, with a click.
Download
There are several ways to get GIMP 2.8.
It can be downloaded and manually compiled from source using the packages available @ gimp.org/downloads
But if you’re seeking something a little easier you can add the following PPA to install the release in Ubuntu 12.04.
The usual caveats apply when installing software from third party sources:
- sudo add-apt-repository ppa:otto-kesselgulasch/gimp
- sudo apt-get update && sudo apt-get install gimp
Via GIMP Users
TV-MAXE is an application which provides the ability to watch TV stations and listen radio via different streams, such is SopCast. Currently it has a large number of channels, both romanian and international.
Here’s a list of available TV-Channels on TV-MAXE: ABC, Acasă, A and E TV, Alfa Omega Movies, Alfa Omega TV, Alfa Omega Youth TV, Animal Planet, Antena 1, Antena 2, Antena 3, AXN, AXN Crime, AXN Sci-Fi, B1 TV, BBC News, BBC World, Biography channel, Boomerang, Cartoon Network, CBS, CNBC, CNN, Comedy Central, Cosmos TV, Dance TV, Digi Sport Plus, Discovery Channel, Discovery Science, Discovery Travel&Living, Discovery World, Discovery ID, Disney Channel, DIVA International, DR1, ESPN, Eurosport, Eurosport 2, Film4, FOX 43, FOX Sports, France 24, France 24 (english), GSP TV, HBO, History Channel, Hit Music TV, Iaşi TV Life, Jurnal TV, Kanal D, KISS TV, Lifetime Movie Network, Musicbox, NatGeo Wild, National Geographic, Naţional TV, Nickelodeon, OTV, Prima TV, ProCinema, Pro TV, Pro TV Internaţional, Publika MD, Realitatea TV, Romstyle TV, Sony Entertainment, Sport.ro, Taraf TV, TBS, TCM, Tele’M Iaşi, TNT, TV 1000, TVM Piatra Neamţ, TVR 1, TVR 2, TvRM Cultural, TvRM Educaţional, USA, UTV, Wgal 8.
Also radio channels*: BBC Radio 2, Europa FM, Impact FM, Kiss FM, Magic FM, Naţional FM, PRO FM, Radio Iaşi, Radio Intens, Radio România Actualităţi, Radio România Cultural, Radio Vocea Evangheliei, Radio ZU, Rock FM, Sky FM Dance, Sky FM Top Hits, Vibe FM.
List can differ from the one in application. If you got an PBX TV account you can also use it in TV-MAXE.
Install TX-MAXE in Ubuntu
Ubuntu 12.04, 11.10, 11.04, 10.04,10.10 can install TX-MAXE from ppa:venerix/blug, just execute following commands in terminal:
sudo add-apt-repository ppa:venerix/blug sudo apt-get update sudo apt-get install tv-maxe
Related posts:
Snappy is an open-source video player "that gathers the power and flexibility of gstreamer inside the comfort of a minimalistic clutter interface".
Its look is minimalistic yet interesting, featuring a transparent control bar with big play/pause buttons, progressbar, elapsed time and played clip title support, that represents, at the moment, the only visible part to interact with Snappy.
A just now announcement clarifies Snappy's new position as part of the official GNOME project, consequently, Snappy's project details are now available on http://live.gnome.org/snappy
At the moment, in Ubuntu, Snappy can only be launched via the terminal (probably Snappy is to receive various near-future improvements), nevertheless it playing functionality is usable in both windowed and fullscreen mode.
In order to play a clip, type in a terminal:
snappy clipname
snappy -f clipname
Snappy 0.2 is available via Ubuntu Software Center (Oneiric, Precise, Quantal).
TV-Maxe is an application that you can use to watch TV stations online, through a P2P technology called SopCast. It comes with two TV channel lists by default: one international and one Romanian, but more unofficial lists are available on its wiki (for France, Hungary, United Kingdom, Danmark, Spain, Russia and Ukraine).
TV-Maxe 0.07 Released, Ubuntu PPA Available [SopCast Player For Linux]The old Gnome 2 User and Groups management tool has been turned off since Ubuntu 11.10 Oneiric. But it’s still avaiable in Ubuntu repository contained by package gnome-system-tools.
So if you’re looking for this easy to use graphical method for modifying users’ group membership in Ubuntu 12.04, use following method to get it back.
In Ubuntu Software Center search and install gnome-system-tools, then you can launch Users and Groups in the Dash.
Or install it via apt-get command:
sudo apt-get install gnome-system-tools
Now, you get back this old Users Settings tool:
easily edit user advance settings:
manager groups:
Related posts:
Music files can be specified either by a directory, or can be automatically discovered using Beagle, Google Desktop, or Spotlight. Recently you can also specify which music player you use and share the songs in it’s collection. For typical configurations, a graphical tool is included.
On the System where you have music collection located, install the DAAP server using following command
sudo apt-get install tangerine
Ubuntu 12.04 LTS was released just days ago, nevertheless, there are already numerous Unity lenses available for 12.04, some of them developed and strengthened prior to its release, others just "in time" for the new Ubuntu LTS:
- Unity Gwibber lens exposes Messages, Replies, Images, Videos, Links, etc from one's account taking advantage of the new card view with properly displayed pictures, messages preview and support to filter exposed items by account types (like for instance, showing only messages from Identi.ca).
sudo apt-get install unity-lens-gwibber
- Unity Askubuntu lens allows users to easily type a desired word and then click on results like Questions With Accepted Answers, Answered Questions, Unanswered Questions (clicking on a result will open an askubuntu web-page via the default web-browser).
sudo add-apt-repository ppa:markjtully/ppa
sudo apt-get update
sudo apt-get install unity-lens-askubuntu - Unity Binary Clock lens displays in a definitely interesting "format" the time (hours, minutes, seconds) via a simple method (in order to find out the hour, add up the orange circles as such: if under an orange circle is the number 1 and under other orange circle is number 16, the correct time is 17 hours, etc).
sudo add-apt-repository ppa:markjtully/ppa
sudo apt-get update
sudo apt-get install unity-binaryclock-lens - Unity Reddit lens exposes Reddit's What Hot, Controversial, New, Top in the handiness of the Dash with support to click and launch (via the default web-browser) the relevant items.
sudo add-apt-repository ppa:markjtully/ppa
sudo apt-get update
sudo apt-get install unity-reddit-lens - Unity Cooking lens introduces a domestic applicability into the Dash by delivering plenty of food recipes ranging from pizza to meat, soup and ice-creams, recipes exposed with "love" amount, required cooking time and difficulty level.
sudo add-apt-repository ppa:scopes-packagers/ppa
sudo apt-get update
sudo apt-get install unity-lens-cooking - Unity Graphic Design lens corroborates a solid amount of design resources.
sudo add-apt-repository ppa:scopes-packagers/ppa
sudo apt-get update
sudo apt-get install unity-lens-cooking unity-scope-deviantart - Unity Photo lens combines and displays images from both online and local sources, such as Flickr and Shotwell with a double-sided approach: clicking on a local image, opens it in Eye Of Gnome/Image Viewer and clicking on a Flickr item, opens it via the default web-browser.
In order to expose images from Shotwell, one must first import them viaShotwell-->File-->Import From Folder or/and Import From Applicationsudo add-apt-repository ppa:scopes-packagers/ppa
sudo apt-get update
sudo apt-get install unity-lens-photo unity-scope-flickr unity-scope-shotwell - Unity Torrents lens displays Pirate Bay torrents categorized in Audio, Video, Applications, etc (with exposed details such as size and seeders) and opens them via Ubuntu's default Transmission.
sudo add-apt-repository ppa:scopes-packagers/ppa
sudo apt-get update
sudo apt-get install unity-lens-torrents unity-scope-piratebay - Unity Utilities lens exposes (in Dash's home view), by simply typing in the search are city names with country support, the city's clock, temperature, wind speed and Google Maps-powered coordinates, as well as a handy calculator utility (typing in Dash's home view 3+7 triggers the result due to it).
sudo add-apt-repository ppa:scopes-packagers/ppa
sudo apt-get update
sudo apt-get install unity-lens-utilities unity-scope-cities unity-scope-calculator - Unity Wikipedia lens allows a fast and easy search through Wikipedia's massive base and, when clicked, opens the desired result via the default web-browser.
sudo add-apt-repository ppa:scopes-packagers/ppa
sudo apt-get update
sudo apt-get install unity-lens-wikipedia - Unity Stock Ticker lens presents various economic symbols in headlines from reputable financial sources, as well as a presenting graphs in Yahoo! Finance (when opened in the default web-browser).
sudo add-apt-repository ppa:scopes-packagers/ppa
sudo apt-get update
sudo apt-get install unity-stock-ticker-lens - Unity Adult lens is a powerful adult-oriented lens that gathers various pornographic clips categorized in Amateur, Group, Webcam, etc, clips that, when clicked, are opened in VLC media player (if it is installed), thus removing the need for web-browsers and, furthermore, with a plus a playing quality.
sudo add-apt-repository ppa:scopes-packagers/adult-scopes
sudo apt-get update
sudo apt-get install unity-lens-adult unity-scope-youporn
Calibre is a versatile e-book library management tool with plenty of features and numerous file types support (MOBI, LIT, EPUB, etc).
Calibre is available in Precise's Ubuntu Software Center but the version is "old" (0.8.38), nevertheless a more up-to-date Calibre version is available in the bellow PPA, PPA that improves Calibre's integration into Ubuntu via various minor under-the-hood tweaks.
Calibre 0.8.48 brings a completely revamped search and replace process, as well as, along with bug fixes and enhanced news sources, support for Amazon's new AZW3 file (now detected as e-book with the view/convert ability).
How do we install Calibre 0.8.48?
Add the following PPA (Precise)
sudo add-apt-repository ppa:n-muench/calibre
sudo apt-get update
sudo apt-get install calibre
Ubuntu 12.04 final has been released. Check out our post installation guide for Precise.
Ubuntu 12.04 installer allows you to install updates and refresh ...
Full Article
Ubuntu Tweak is a full-fledged tweaking tool that bring an easy-to-use yet powerful interface with a vast stack of configuration options.
Ubuntu Tweak has been updated to another interesting release, 0.7, being labeled as "Precise Tweak", due to Precise Pangolin's imminent release, presenting itself as indeed, a "professional" tweaking app that properly categorizes items, making them available and usable for both advanced users and newcomers.
What is new in Ubuntu Tweak 0.7?
- option to install icon themes
- ability to switch ON/OFF the HUD and the Shortcut Hints Overlay
- enhanced login screen support with option to select ON/OFF the Draw Grid and the login sound, as well as selecting its theme
- new additions: Application Center (useful to install popular applications), Source Center (collection of various software sources to ensure a more up-to-date software experience), Templates and Scripts (useful scripts that can bring additional functionality to the context menu)
- option to easily create quicklists for apps
- enriched Janitor (cleans the computer's junk) with per-application filtering (thus allowing users to clean, for instance, only the cache from Firefox)
- "live" "global" search area positioned on the top-right corner with sub-category coverage (typing edge will return Workspace, which contains an edge configuration options)
- redesigned button sizes and improved alignments, giving the app a more professional "tight" look
- boost in speed
- numerous fixes and minor improvements
How do we install Ubuntu Tweak 0.7?
Add the following official PPA (Oneiric, Precise)
sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak
Bugs can be reported on https://bugs.launchpad.net/ubuntu-tweak
Google’s newly-launched ‘Drive’ feature may have failed to give Linux users a client from the get go – but that doesn’t mean we need to go without entirely.
A temporary solution is available for those willing to try it. It’s not as elegant or featured as the clients Google provides for Windows and Mac users, but it may help bide the time for avid Google-users looking to make the most of Drive before something more official arrives.
Google Docs Drive FS
The package comes courtesy of Luca Invernizzi, and is based on the discontinued ‘google docs fs’ project that ”[allows] you to connect to Google Docs and treat it as a file system.”
Sounds technical, but put simply it means you can access the files and documents in your Google Drive as you would any other folder.
But there are limitations to this approach.
The majority of features billed in the Google Drive clients themselves are not provided in this fix – the most notable of which is the inability to add files, sync files or otherwise access the folder whilst offline; uploading additional files to the Drive also doesn’t seem to function fully.
With the disclaimers out of the way lets see how you get it all set up.
First you need to add the packages provided by Luca and available in his PPA (11.10 only at present): -
- sudo add-apt-repository ppa:invernizzi/google-docs-fs
- sudo apt-get update && sudo apt-get install google-docs-fs
Once everything that’s needed has been installed log out and back in.
- Open Nautilus
- Create a new folder in your Home folder titled ‘Drive’
- Open a Terminal and run: -
- gmount Drive username@gmail.com
- Input your password
- Your Google Drive is now mounted in the ‘Drive’ folder
With thanks to Luca
Salut tout le monde,
Quelques jours avant la sortie de la nouvelle version d'Ubuntu, voici un article qui plaira certainement aux personnes à la recherche d'une alternative agréable et configurable aux différentes sessions disponible (Unity, Gnome-Shell, Gnome-Classic, etc.) ou toutes les autres personnes simplement à la recherche d'amélioration graphique en complément de leur session actuelle !
Bref, voici un article d'introduction à Cairo-Dock 3.0
Cairo-Dock 3.0 apporte une interface de bureau agréable et conviviale
Cairo-Dock, placé sur votre bureau, permet de surveiller et de contrôler vos applications préférées : des lecteurs de musiques, des clients de chat et mails, Twitter, des clients torrents, des flux RSS, la gestion d'un calendrier / tâches, les conditions météorologiques, les avertisseurs de mails, etc. sans oublier sa barre des tâches puissante.
Sur cette copie d'écran, à part les deux icônes "Stack" et "TODO" sur le bureau, tout le reste est géré par Cairo-Dock
Il vous présente les informations et permet leur contrôle sous la forme de docks, de widgets de bureau et des tableaux de bords. Il permet également de les personnaliser autant que vous voudrez, de sorte que votre bureau soit définitivement unique et réponde à vos besoins.
La personnalisation est très facile, et beaucoup de thèmes sont déjà disponibles.
Vidéo
Un petit screencast de présentation de la version 3.0 avec une session Cairo-Dock sous Ubuntu 12.04 et le thème Default Panel :
- Sans annotations (au format WebM):
- Avec annotations (avec la possibilité d'utiliser l'HTML 5: ici):
(À visualiser en bonne qualité et en pleine écran bien-entendu )
Les nouveautés en résumé
- La barre des tâches a été grandement améliorée.
- L'applet de Déconnexion a été réécrite et permet le changement rapide d'utilisateurs.
- La possibilité de contrôler le dock depuis le clavier est maintenant plus puissant :
- Plusieurs raccourcis ont été ajoutés dans différents greffons.
- Vous pouvez activer un lanceur en pressant le raccourci clavier et son numéro.
- Tous les raccourcis peuvent être réglés depuis un tableau récapitulatif dans la fenêtre de configuration.
- Le Menu de son d'Ubuntu a été intégré dans l'applet Contrôleur de Son.
- Une nouvelle applet externe Twitter vous permettra de tweeter en un clic.
- Une autre applet externe vous permettra d'inhiber le verrouillage de l'écran en un clic.
- Les séparateurs sont transparents au clic dans la vue 'Tableau de bord'.
- Cairo-Dock utilisent maintenant GTK3 pour une meilleur intégration avec l'environnement de bureau Gnome.
- Quelques nouveautés sont disponible dans l'API DBus pour que d'autres applications ou applets interagissent avec le dock.
- De nombreux détails au niveau graphique et manipulation du dock ont été réglés (comme essayer d'être moins gênant à l'apparition/disparition si le dock est caché).
- Il est possible de faire des dons pour supporter le projet !
Il est également possible de démarrer directement une session "Cairo-Dock" depuis le gestionnaire de sessions afin d'obtenir un bureau comme comme avec les screenshots ci-dessous.
Présentation de la version 3.0
Comme ou contrairement à certains shells 'modernes', Cairo-Dock vient avec certaines fonctionnalités que vous attendez pour la gestion du bureau
- Une barre des tâches puissante qui vous laisse la possibilité de grouper et réorganiser les fenêtres dans le dock, fermer et ouvrir de nouvelles instances en un clic, de changer de fenêtre d'une même application avec un coup de roulette, etc.
Les fenêtres d'Empathy sont regroupées dans un sous-dock (mais ça reste optionnel). Un coup de roulette de la souris change la fenêtre active parmi ces 3 fenêtres
Un clic sur l'icône principal affiche le plugin Echelle (Scale) de Compiz ou Kwin
- Un menu d'applications contenant les lanceurs de tous vos différents programmes classés par catégories (des lanceurs que vous pouvez ajouter dans le dock par un simple glissé-déposé
Une manière classique et pourtant très efficace d'obtenir toutes vos applications installées en un clic
- Un simple calendrier qui vous permet de gérer les événements et vous averti avant la date.
En cliquant sur l'icône de l'applet Horloge, vous obtenez un calendrier ; en double-cliquant sur un jour, vous avez la possibilité d'ajouter des événements pour ce jour
- Modifier l'utilisateur courant, verrouiller l'écran quand vous quittez votre PC, hiberner, mettre en veille, redémarrer ou éteindre votre ordinateur : toutes ces actions de base sont disponible via le menu d'une seule applet.
En cliquant sur l'applet de déconnexion, vous obtiendrez un menu avec toutes ces actions ; il vous avertira également si votre système doit être redémarré après une mise à jour
- Une intéressante applet nommée 'Sélecteur de bureau' pour bien entendu changer de bureau courant mais également alterner entre les fenêtres. Il peut afficher les fenêtres présentes sur les différents bureaux mais vous laisse aussi renommer ces derniers pour une meilleure organisation. Il fournit une manière rapide de changer de fenêtres/bureaux afin d'améliorer votre efficacité de travail.
Un clic du milieu sur l'applet 'Sélecteur de bureau' peut afficher un menu avec la liste des fenêtres triées par bureau.
Vous pouvez également appeler les modes 'Exposé' (Expose) et 'Échelle' (Scale) de Compiz/Kwin depuis cette applet. Vous pouvez retrouver ces actions depuis un clic droit sur l'applet ou choisir d'utiliser ces actions via un raccourci clavier ou un clic du milieu.
- Une liste de tous vos périphériques (disques durs, espaces de stockage via USB, etc.) et vos signets (les mêmes que ceux de Nautilus).
Tous les périphériques sont listées au dessus avec une indication rapide de l'espace disponible. Tous les signets sont ensuite affichés en-dessous.
Vous pouvez éjecter un périphérique grâce à un clic du milieu sur son icône
- Intégration des indicateurs d'Ubuntu : une des récentes meilleurs créations d'Ubuntu sont ses indicateurs. Cairo-Dock vous permet de les avoir à l'intérieur de vos docks.
L'applet 'Notification de messages' regroupe les informations concernant les clients mails et de messagerie aussi bien pour changer le statut courant que pour vous avertir de l'arrivée de nouveaux messages
Le menu de son vous permet de contrôler le son et le lecteur de musique. Un coup de roulette sur l'icône change le volume sonore.
- L'accès instantané à des événements récents, y compris: les documents récents, les vidéos récemment regardées ou les musiques écoutées, les pages Web visitées, etc. L'applet est bien-entendu désactivable si vous n'aimez pas cela ou que vous faites partie des Anonymous
Avec la fenêtre de l'applet 'Événements récents', vous pouvez faire une recherche pour un mot donné et choisir l'application avec laquelle vous désirez ouvrir le fichier.
Vous pouvez également supprimer l'historique pour protéger votre vie privée.
- Divers applets sont disponibles, de l'applet gardant un historique du presse-papiers (qui enregistre le texte que vous sélectionnez / copiez) à l'applet qui envoie sur des serveurs en ligne (uppix.net, pastebin, dropbox, dl.free.fr, etc.) n'importe quel fichier que vous déposez sur lui.
L'applet météo affiche les conditions actuelles et les prévisions dans un sous-dock
- Les docks sont entièrement contrôlables depuis le clavier
Composez un raccourci clavier pour activer la navigation au clavier, puis pressez la touche correspondant au numéro de l'icône que vous souhaitez sélectionner.
Vous pouvez aussi naviguer avec les flèches du clavier, tout en ayant accès aux actions aux clics droit / du milieu, etc. (voir la description de l'applet depuis le panneau de configuration)
Plusieurs applets offrent également des possibilités d’interactions via des raccourcis claviers pour leurs principales actions.
(ex.: + L pour verrouiller l'écran, + F1 pour faire apparaître le menu d'applications, + F2 pour le lancement rapide, etc.)
- Et de nombreuses autres fonctionnalités intéressantes comme le mode de visibilité intelligent (le dock ne se cache que si la fenêtre active est devant lui ou ne réapparaît qu'après un délai +/- long en fonction de l'angle formé par la trajectoire de la souris avant de toucher le bord de l'écran), des animations 3D, le placement des docks de n'importe quel côté de l'écran, l'historique du presse papier, des piles de raccourcis (lorsqu'un fichier ou dossier est déposé dans le dock), les prévisions météorologiques, le monitoring du système, etc.
- Cairo-Dock fonctionne avec n'importe quel gestionnaire de fenêtres, tourne sur n'importe quel matériel (même les plus vieux), il peut utiliser la carte graphique pour être très fluide ou un mode de secours si les pilotes ne supporte pas l'accélération matériel. Il est très bien intégré avec les environnements de bureau communs et est activement développé.
Configurez le dock comme vous le souhaitez et non le contraire
Ici on peut apercevoir 4 actions différents sur un seul screenshot
La session Cairo-Dock
Si vous désirez avoir le même bureau que celui proposé sur les précédents screenshots, installez simplement Cairo-Dock 3.0.0 (ici c'était sur Ubuntu 12.04), déconnectez-vous de la session et connectez-vous dans une session Cairo-Dock.
(screenshot venant de iloveubuntu.net)
Si vous avez précédemment installé Cairo-Dock, vous pouvez charger le thème 'Default-Panel' (Clic droit dans le dock / Cairo-Dock / Configurer / Thèmes)
Comme vous pouvez le remarquer sur ce screenshot, une session Cairo-Dock avec le panel Unity est disponible si vous désirez garder ce panel d'Unity mais avoir Cairo-Dock comme dock principal.
Installation
Si vous désirez installer la nouvelle version, les tarballs contenant le code source sont disponible de ce côté :
- Core: https://launchpad.net/cairo-dock-core/3.0/3.0.0/+download/cairo-dock-3.0.0.tar.gz
- MD5: a119abf3f3b05ff214fafddab371cdbd
- Signature: https://launchpad.net/cairo-dock-core/3.0/3.0.0/+download/cairo-dock-3.0.0.tar.gz.asc
- Plug-ins: https://launchpad.net/cairo-dock-plug-ins/3.0/3.0.0/+download/cairo-dock-plugins-3.0.0.tar.gz
- MD5: b19935b72c071ca91d9295b17f53253a
- Signature: https://launchpad.net/cairo-dock-plug-ins/3.0/3.0.0/+download/cairo-dock-plugins-3.0.0.tar.gz.asc
Pour installer nos applets externes (avec les applets Twitter, GMail, Pidgin, Transmission, Deluge, Calendar, et.c), peu importe la distribution, il suffit de se rendre sur cette page web et glisser-déposer le lien d'une applet dans le dock: http://glx-dock.org/mc_album.php?a=8
Pour ArchLinux et autres distribution avec Python 3 par défaut (bref, pour ArchLinux ), il est demandé d'utiliser le tarball python2 : https://launchpad.net/cairo-dock-plug-ins-extras/3.0/3.0.0 (ou plus simplement en utilisant le PKGBUILD en question)
Pour les utilisateurs d'Ubuntu : notre dépôt et notre PPA ont été mis à jour. Si vous voulez utiliser notre ppa, il suffit simplement d'exécuter ces commandes dans un terminal :
sudo apt-get update
sudo apt-get install cairo-dock cairo-dock-plug-ins
Pour les utilisateurs de Debian : notre dépôt a été également mis à jour (et nous vous conseillons de les utiliser à la place des paquets des dépôts officiels) : Dépôt Debian
Pour les autres distributions: Merci de jeter un coup d’œil de ce côté : Installation
Si vous aimez le boulot réalisé
Si vous aimez le travail réalisé sur ce logiciel libre, n'hésitez pas à aider la toute petite équipe de Cairo-Dock (voir le À propos pour voir les personnes qui contribue à ce projet durant leur temps libre pour votre plus grand plaisir ) en rapportant des bugs, en donnant via Paypal ou Flattr, en traduisant le dock ou le wiki (ou en corrigeant les traductions), en proposant de nouveaux thèmes ou nouveaux patches (en C pour le Core et les Plug-ins et en Python, Bash, Vala, Ruby, Mono, etc. pour les applets externes réalisées en quelques dizaines de lignes de code), en proposant de nouvelles idées, en postant un article sur votre blog et/ou simplement en écrivant un petit commentaire positif ou constructif sur notre forum
Pour plus d'information à ce sujet : Comment nous aider
Merci d'avance
Si vous désirez nous "suivre", il y a différents moyens : Suivez-Nous
Bon amusement avec cette nouvelle version et bonne journée/soirée
Original post of Cairo-Dock.Votez pour ce billet sur Planet Libre.
Articles similaires
- Clapico : Dnd2share ou comment insérer des images dans les forums grâce au dock Unity d’Ubuntu (17/09/2011)
- Ulrich Van Den Hekke : KMDAlert - Logiciel de surveillance de périphérique RAID - Version pour KDE 4.0 (14/08/2011)
- Jeyg : Dive into Git (18/08/2011)
- Geek de France : [TUTO] Serveur de messagerie IMAP (Fetchmail, postfix, procmail, spamassasin) (25/08/2011)
Posts
Posts
Today we will be using the HTML5 geolocation API to present the user with a personalized weather forecast. Using jQuery, we will issue AJAX request to two of Yahoo’s popular APIs to obtain additional geographical information and a weather forecast. This example also makes use of the wonderful climacons icon set.
Obtaining an Application Key
Yahoo provides a large collection of useful APIs that are free for developers to use. The requirement is that you register your application with through their developer dashboard. The registration is simple and straightforward, and as a result you obtain an application id (look for it under the title of your application). You are going to need this later in the tutorial, but first let’s see how everything would work together.
The Idea
Here is what we need to do in order to display our weather forecast:
- First we’ll use the Geolocation API supported by modern browsers. The API will prompt the user to authorize location access and will return a set of GPS coordinates;
- Next, we will issue a request to Yahoo’s PlaceFinder API, passing the above coordinates. This will give us the name of the city and country, and a woeid – a special ID used to identify the city in weather forecasts;
- Finally, we will issue a request to Yahoo’s Weather API with that woeid. This will give us current weather conditions, as well as a forecast for the rest of the current and the next day.
Great! We are now ready for the HTML.
The HTML
We will start with a blank HTML5 document, and we will add a reference to our stylesheet to the head section, along with two fonts from Google’s Webfonts library. In the body we will add a h1 header and markup for the weather forecast slider.
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Weather Forecast with jQuery & Yahoo APIs | Tutorialzine Demo</title>
<!-- The stylesheet -->
<link rel="stylesheet" href="assets/css/styles.css" />
<!-- Google Fonts -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Playball|Open+Sans+Condensed:300,700" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header>
<h1>Weather Forecast</h1>
</header>
<div id="weather">
<ul id="scroller">
<!-- The forecast items will go here -->
</ul>
<a href="#" class="arrow previous">Previous</a>
<a href="#" class="arrow next">Next</a>
</div>
<p class="location"></p>
<div id="clouds"></div>
<!-- JavaScript includes - jQuery, turn.js and our own script.js -->
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="assets/js/script.js"></script>
</body>
</html>
Before the closing body tag we are adding the latest version of jQuery and our script.js file, which we are discussing in the following sections.
The JavaScript
The first step is to define two configuration variables in /assets/js/script.js:
var APPID = ''; // Your Yahoo Application ID var DEG = 'c'; // c for celsius, f for fahrenheit
These are passed as parameters with the AJAX requests for the location and weather APIs as you will see in a moment.
Following the outline in the idea section, we should now look into using the HTML5 Geolocation API to obtain a set of GPS coordinates. This API is supported by all new browsers including IE9 and mobile devices. To use it, we need to test whether the global navigator object has a geolocation property. If it does, we call its getCurrentPosition method passing two event handling functions for success and failure. Here is the relevant code from script.js that does this:
// Does this browser support geolocation?
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(locationSuccess, locationError);
}
else{
showError("Your browser does not support Geolocation!");
}
function locationSuccess(position) {
var lat = position.coords.latitude;
var lon = position.coords.longitude;
// We will make further requests to Yahoo's APIs here
}
function locationError(error){
switch(error.code) {
case error.TIMEOUT:
showError("A timeout occured! Please try again!");
break;
case error.POSITION_UNAVAILABLE:
showError('We can\'t detect your location. Sorry!');
break;
case error.PERMISSION_DENIED:
showError('Please allow geolocation access for this to work.');
break;
case error.UNKNOWN_ERROR:
showError('An unknown error occured!');
break;
}
}
function showError(msg){
weatherDiv.addClass('error').html(msg);
}
The locationSuccess function is where we will be issuing requests to Yahoo’s APIs in a moment. The locationError function is passed an error object with the specific reason for the error condition. We will use a showError helper function to display the error messages on the screen.
The full version of locationSuccess follows:
function locationSuccess(position) {
var lat = position.coords.latitude;
var lon = position.coords.longitude;
// Yahoo's PlaceFinder API http://developer.yahoo.com/geo/placefinder/
// We are passing the R gflag for reverse geocoding (coordinates to place name)
var geoAPI = 'http://where.yahooapis.com/geocode?location='+lat+','+lon+'&flags=J&gflags=R&appid='+APPID;
// Forming the query for Yahoo's weather forecasting API with YQL
// http://developer.yahoo.com/weather/
var wsql = 'select * from weather.forecast where woeid=WID and u="'+DEG+'"',
weatherYQL = 'http://query.yahooapis.com/v1/public/yql?q='+encodeURIComponent(wsql)+'&format=json&callback=?',
code, city, results, woeid;
// Issue a cross-domain AJAX request (CORS) to the GEO service.
// Not supported in Opera and IE.
$.getJSON(geoAPI, function(r){
if(r.ResultSet.Found == 1){
results = r.ResultSet.Results;
city = results[0].city;
code = results[0].statecode || results[0].countrycode;
// This is the city identifier for the weather API
woeid = results[0].woeid;
// Make a weather API request (it is JSONP, so CORS is not an issue):
$.getJSON(weatherYQL.replace('WID',woeid), function(r){
if(r.query.count == 1){
// Create the weather items in the #scroller UL
var item = r.query.results.channel.item.condition;
addWeather(item.code, "Now", item.text + ' <b>'+item.temp+'°'+DEG+'</b>');
for (var i=0;i<2;i++){
item = r.query.results.channel.item.forecast[i];
addWeather(
item.code,
item.day +' <b>'+item.date.replace('\d+$','')+'</b>',
item.text + ' <b>'+item.low+'°'+DEG+' / '+item.high+'°'+DEG+'</b>'
);
}
// Add the location to the page
location.html(city+', <b>'+code+'</b>');
weatherDiv.addClass('loaded');
// Set the slider to the first slide
showSlide(0);
}
else {
showError("Error retrieving weather data!");
}
});
}
}).error(function(){
showError("Your browser does not support CORS requests!");
});
}
The PlaceFinder API returns its results as plain JSON. But as it is on a different domain, only browsers that support CORS (cross origin resource sharing) will be able to retrieve it. Most major browsers that support geolocation also support CORS, with the exception of IE9 and Opera, which means that this example won’t work there.
Another thing to consider is that the weather API returns only two days of forecasts, which somewhat limits the utility of our web app, but unfortunately there is no way around it.
We are only using the Weather API for temperature data, but it provides additional information that you might find useful. You can play with the API and browse the responses in the YQL console.
After we retrieve the weather data, we call the addWeather function, which creates a new LI item in the #scroller unordered list.
function addWeather(code, day, condition){
var markup = '<li>'+
'<img src="assets/img/icons/'+ weatherIconMap[code] +'.png" />'+
' <p class="day">'+ day +'</p> <p class="cond">'+ condition +
'</p></li>';
scroller.append(markup);
}
Now we need to listen for clicks on the previous / next arrows, so we can offset the slider to reveal the correct day of the forecast.
/* Handling the previous / next arrows */
var currentSlide = 0;
weatherDiv.find('a.previous').click(function(e){
e.preventDefault();
showSlide(currentSlide-1);
});
weatherDiv.find('a.next').click(function(e){
e.preventDefault();
showSlide(currentSlide+1);
});
function showSlide(i){
var items = scroller.find('li');
// Exit if the requested item does not exist,
// or the scroller is currently being animated
if (i >= items.length || i < 0 || scroller.is(':animated')){
return false;
}
// The first/last classes hide the left/right arrow with CSS
weatherDiv.removeClass('first last');
if(i == 0){
weatherDiv.addClass('first');
}
else if (i == items.length-1){
weatherDiv.addClass('last');
}
scroller.animate({left:(-i*100)+'%'}, function(){
currentSlide = i;
});
}
With this our simple weather web app is complete! You can see everything together in /assets/js/script.js. We won't be discussing the styling here, but you can read through /assets/css/styles.css yourself.
Done!
In this example you learned how to use the HTML5 geolocation with Yahoo's Weather and Places APIs to present a location-aware weather forecast. It works on most modern web browsers and mobile devices.
Nearly two weeks ago, you participated in a giveaway for $50 credit at 4Templates. Now is time to draw the winners!
And they are:
Alejandro Carrillo and Patschi
They have been contacted and will receive their prizes shortly. Congratulations!
I want to share a little experiment with Tutorialzine readers – TouchTouch. It is a jQuery plugin that turns a collection of photos on a webpage into a touch-friendly mobile gallery. It works on all major browsers (except for IE7 and below) and most importantly is specifically designed with iOS and Android in mind.
Highlights
- Smooth CSS3 animations and transitions;
- A responsive CSS interface that fills the screen and responds to changes in device orientation;
- Preloads photos only when they are needed;
- Supports swiping through photos;
- Displays onscreen arrows and listens for arrow key presses on desktop browsers;
TouchTouch relies entirely on CSS3 for animations, which means that transitions are extra smooth on mobile devices (naturally, this also means that you won’t see any on older browsers). Using some clever CSS, the interface automatically adjusts to the size and orientation of the device, with photos growing to fill the available screen estate (test it by resizing your browser window). And with the help of jQuery, going through photos is done by swiping left or right.
On the desktop, you get that same responsive interface and smooth animations. Browsing the gallery there is done either with the onscreen arrows, or the arrow keys on the keyboard.
How to use
Using it is simple. Drop the touchTouch folder (you can find it in the download under assets/) somewhere in your website folder tree. After this, include touchTouch/touchTouch.css in your <head>, and touchTouch.jquery.js right after the jQuery library. The script depends on jQuery 1.7 or above.
After you do all of this, simply call the gallery as a regular jQuery plugin:
$(function(){
// Initialize the gallery
$('#thumbs a').touchTouch();
});
You must pass anchor elements which point to images in their href attributes for the gallery to work. In addition to conveying which images are to be displayed in the gallery, this also provides a graceful fallback in case JavaScript is not available.
Following Tutorialzine’s tradition of releasing quality resources for developers, the gallery source code is extensively commented and released on Github.
4Temlates.com has hundreds of awesome website templates and WordPress themes with amazing graphics, standards compliant XHTML and CSS code, PSD files, and great tech support whenever you need it. And with pricing $25 or below, you’ll always find something that works great no matter the project or budget.
Today two of you will have a chance to win $50 in credit for their online store! You can use it to download any themes you wish.
How to win?
- Follow @4Templates on Twitter.
- Tweet this article and leave a comment below.
The winners will be announced on May 7th 2012 in a follow-up post. Announced!
We all love jQuery. This site is even dedicated to building beautiful examples that use the library. But there are situations in which jQuery is not the smart choice. If you are using it only for simple DOM manipulation or an AJAX request or two, why slow down your page load times and introduce an additional dependency?
The problem is more severe on mobile devices. You see, although we include jQuery via a CDN like Google’s, it is still not free – downloading it and parsing it still takes time. The very thing that made jQuery popular – perfect cross browser support, also makes it too bulky for use on mobile devices. After all, why would you need your mobile website to support old IE versions if it is meant to be viewed only on iOS and Android?
Getting Lean
There are additional problems to be solved. jQuery’s approach to animations for instance is to modify the css style properties of an element in small intervals. This works fine on the desktop, but performs poorly on mobile devices. Pure CSS animations on the other hand (that use transitions and @keyframes) are hardware accelerated and smooth.
This means that a whole new approach must be taken for building mobile websites. Fortunately, there are five libraries that can help us with that.
Zepto.js
This is the most feature-rich library out there that is specifically designed for iOS and Android (both using the webkit engine). It retains nearly all of jQuery’s functionality in 8kb (instead of jQuery’s 32) and adds support for touch events (including pinch to zoom) and pure CSS animations. It takes a modular approach – you only add the components that you need for an even leaner library.
Snack.js
Snack is a small and simple JavaScript library. Though ideal for small projects, it’s got enough in it to build complex, cross-browser web apps. It takes a different approach than Zepto in that it breaks away from the jQuery API but at 3kb is half the size. You will have to handle animations yourself with this one.
$dom
$dom is even smaller – at 2kb it packs quite a punch. It keeps cross-browser compatibility and even handles animations (albeit taking jQuery’s approach with a timeout), but omits functionality like array manipulation functions and AJAX. The perfect use case for this library is when building responsive websites, which can be viewed on smartphones, tablets and desktops.
xui.js
At 4kb XUI is a small framework for authoring HTML5 mobile web applications. It works across all of the devices in the mobile landscape and even has special builds for webkit, ie mobile and blackberry browser. It supports touch events and even has a jQuery compatibility plugin.
140medley
You can’t go more micro than 140medley. This 0.5kb collection of functionality was inspired by the 140bytes contest, where participants create tweet-sized JavaScript snippets. It supports templates, events and even AJAX. This is pro territory only, as the only documentation provided is through comments in the cryptic source code.
Conclusion
These are only some of the exciting new frameworks that are out there. But it isn’t enough to have an awesome name or site – the community is what makes or breaks an open source project. So if you find something interesting that is worth your time, make sure to spread the word about it.
Timeline is a jQuery plugin specialized in showing a chronological series of events. You can embed all kinds of media including tweets, videos and maps, and associate them with a date. With some design tweaks, this will make it perfect for a portfolio in which you showcase your work and interests.
The HTML
Timeline comes with a light colored theme by default. It is perfectly usable and in most cases would be exactly what you need. However, for our portfolio, a dark design would be a better fit, so we will customize it to our liking.
First, let’s look at the basic layout of the page:
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Timeline Portfolio | Tutorialzine Demo</title>
<!-- The default timeline stylesheet -->
<link rel="stylesheet" href="assets/css/timeline.css" />
<!-- Our customizations to the theme -->
<link rel="stylesheet" href="assets/css/styles.css" />
<!-- Google Fonts -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Dancing+Script|Antic+Slab" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="timeline">
<!-- Timeline will generate additional markup here -->
</div>
<!-- JavaScript includes - jQuery, turn.js and our own script.js -->
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="assets/js/timeline-min.js"></script>
<script src="assets/js/script.js"></script>
</body>
</html>
In the head section, we have the plugin’s stylesheet – timeline.css, and styles.css, which will hold our customizations. In the footer we have the jQuery library, timeline plugin and script.js which initializes it.
When we call the plugin, it will search for a div on your page with the ID of timeline. Inside it, it will inserts all the markup it needs to present the timeline:
<div class="container main" id="timeline">
<div class="feature slider" style="overflow-y: hidden;">
<div class="slider-container-mask slider-container slider-item-container">
<!-- The divs below are the events of the timeline -->
<div class="slider-item content">
<div class="text container">
<h2 class="start">Johnny B Goode</h2>
<p><em><span class="c1">Designer</span> & <span class=
"c2">Developer</span></em></p>
</div>
<div class="media media-wrapper media-container">
<!-- Images or other media go here -->
</div>
</div>
<div class="slider-item content content-container">
<div class="text container">
<h2 class="date">March 2009</h2>
<h3>My first experiment in time-lapse photography</h3>
<p>Nature at its finest in this video.</p>
</div>
<div class="media media-wrapper media-container">
<!-- Images or other media go here -->
</div>
</div>
<!-- More items go here -->
</div>
<!-- Next arrow -->
<div class="nav-next nav-container">
<div class="icon"></div>
<div class="date">March 2010</div>
<div class="title">Logo Design for a pet shop</div>
</div>
<!-- Previous arrow -->
<div class="nav-previous nav-container">
<div class="icon"></div>
<div class="date">July 2009</div>
<div class="title">Another time-lapse experiment</div>
</div>
</div>
<div class="navigation">
<!-- The navigation items go here (the tooltips in the bottom)
one for each of the events -->
<div class="time">
<!-- The timeline numbers go here -->
</div>
</div>
<div class="timenav-background">
<div class="timenav-line" style="left: 633px;"></div>
<div class="timenav-interval-background top-highlight"></div>
</div>
<div class="toolbar" style="top: 27px;">
<div class="back-home icon" title="Return to Title"></div>
<div class="zoom-in icon" title="Expand Timeline"></div>
<div class="zoom-out icon" data-original-title="Contract Timeline"></div>
</div>
</div>
</div>
As we will be modifying the CSS of the timeline, the fragment above will give you a better idea of the customizations. Note that we won’t be recreating the plugin’s stylesheet from scratch, we will only be overriding some of the rules in our own css file. This has the benefit of making future updates to the plugin straightforward, not to mention that it will be much easier.
Writing the CSS by looking at the markup alone would be a tough undertaking, given that our rules must have precedence over the ones used in timeline.css. Fortunately, there is a much easier way, as you will see in the CSS section of this tutorial.
The jQuery
To initialize the plugin, we need to call the VMM.Timeline() method on document ready:
$(function(){
var timeline = new VMM.Timeline();
timeline.init("data.json");
});
The init method takes single argument – the data source. It can either be a json file like above, or a Google spreadsheet (reminiscent of our Spredsheet Powered FAQ Tutorial).
For more information on the supported data sources, see the documentation on the plugin’s site, or browse the data.json file in the zip download for this tutorial.
The CSS
I used Firebug’s HTML Inspector to get the right selectors for the elements that we are about to customize. In the HTML tab, it is easy to see what rules have been applied to each element by timeline.css. To override them, I copied the same selectors to styles.css which is where our modifications will take place. On several occurrences, however, I have used the !important flag to make my work easier.
All the customizations you see below override only a handful of CSS styles. The rest are inherited by the default stylesheet. Let’s begin!
The first thing we will do in styles.css, after styling the page itself, is to change the backgrounds of the timeline:
#timeline{
background:none;
}
/* The individual events in the slider */
.slider .slider-container-mask .slider-container{
background:none;
}
/* Setting a custom background image */
#timeline div.navigation{
background: url('../img/timeline_bg.jpg') repeat;
border-top:none;
}
To create the 3D effect of the timeline navigation, we will need to use additional elements. But the Timeline plugin doesn’t include such in its markup. An easy solution is to use :before / :after pseudo elements. The :after element is the darker top part and it uses a linear gradient to enhance the effect.
#timeline div.navigation:before{
position:absolute;
content:'';
height:40px;
width:100%;
left:0;
top:-40px;
background: url('../img/timeline_bg.jpg') repeat;
}
#timeline div.navigation:after{
position:absolute;
content:'';
height:10px;
width:100%;
left:0;
top:-40px;
background:repeat-x;
background-image: linear-gradient(bottom, #434446 0%, #363839 100%);
background-image: -o-linear-gradient(bottom, #434446 0%, #363839 100%);
background-image: -moz-linear-gradient(bottom, #434446 0%, #363839 100%);
background-image: -webkit-linear-gradient(bottom, #434446 0%, #363839 100%);
background-image: -ms-linear-gradient(bottom, #434446 0%, #363839 100%);
}
Then we add a dark background to the timeline navigation (the section with the small clickable tooltips that represent the events):
#timeline div.timenav-background{
background-color:rgba(0,0,0,0.4) !important;
}
#timeline .navigation .timenav-background .timenav-interval-background{
background:none;
}
#timeline .top-highlight{
background-color:transparent !important;
}
Later we style the zoom-in / zoom-out buttons and toolbar:
#timeline .toolbar{
border:none !important;
background-color: #202222 !important;
}
#timeline .toolbar div{
border:none !important;
}
The numeric scale at the bottom comes next:
#timeline .navigation .timenav .time .time-interval-minor .minor{
margin-left:-1px;
}
#timeline .navigation .timenav .time .time-interval div{
color: #CCCCCC;
}
The previous and next arrows:
.slider .nav-previous .icon {
background: url("timeline.png") no-repeat scroll 0 -293px transparent;
}
.slider .nav-previous,.slider .nav-next{
font-family:'Segoe UI',sans-serif;
}
.slider .nav-next .icon {
background: url("timeline.png") no-repeat scroll 72px -221px transparent;
width: 70px !important;
}
.slider .nav-next:hover .icon{
position:relative;
right:-5px;
}
.slider .nav-previous:hover, .slider .nav-next:hover {
color: #666;
cursor: pointer;
}
#timeline .thumbnail {
border: medium none;
}
The loading screen:
#timeline .feedback {
background-color: #222222;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.2) inset;
border:none;
}
#timeline .feedback div{
color: #AAAAAA;
font-size: 14px !important;
font-weight: normal;
}
Then we move on to the slides:
#timeline .slider-item h2,
#timeline .slider-item h3{
font-family:'Antic Slab','Segoe UI',sans-serif;
}
#timeline .slider-item h2{
color:#fff;
}
#timeline .slider-item p{
font-family:'Segoe UI',sans-serif;
}
#timeline .slider-item img,
#timeline .slider-item iframe{
border:none;
}
Finally, we will customize the appearance of the front page. I am using nth-child(1) to target only the first slider-item, which contains the name and description of the timeline which have been defined in the JSON data source.
/* Customizing the first slide - the cover */
#timeline .slider-item:nth-child(1) h2{
font:normal 70px/1 'Antic Slab','Segoe UI',sans-serif;
background:rgba(0,0,0,0.3);
white-space: nowrap;
padding:10px 5px 5px 20px;
position:relative;
right:-60px;
z-index:10;
}
#timeline .slider-item:nth-child(1) p i{
font:normal normal 40px 'Dancing Script','Segoe UI',sans-serif;
background:rgba(0,0,0,0.3);
white-space: nowrap;
padding:5px 20px;
position:relative;
right:-60px;
z-index:10;
}
#timeline .slider-item:nth-child(1) p .c1{
color:#1bdff0;
}
#timeline .slider-item:nth-child(1) p .c2{
color:#c92fe6;
}
#timeline .slider-item:nth-child(1) .media-container {
left: -30px;
position: relative;
z-index: 1;
}
#timeline .slider-item:nth-child(1) .credit{
text-align: center;
}
The only thing left is to open up timeline.psd that is bundled with the download of the plugin, and change the color of some of the icons in photoshop. I have included the necessary files in the zip download for this tutorial. With this our timeline portfolio is complete!
Done!
You can use this portfolio to display not only your recent projects, but also interests and important moments of your career. Share your thoughts and suggestions in the comment section.
You probably know about MightyDeals.com, it is a flash sales platform for digital goods aimed at web professionals. Their deals include products and services that are heavily discounted, exclusively for their customers, usually from 50% to 90% off.
Today they are offering a one-time offer for Tutorialzine readers. Five of you will have a chance to get whichever deal their want from their catalog for free!
How to participate
For a chance to win one of their deals, do the following:
- Enter your email in the box below;
- Leave a comment (using the same email) with the deal you would like to win from the list of currently active deals.
The winners will be chosen on April 4th using random.org and announced in this post.
The winners have been chosen and contacted by Mighty Deals. Thanks to everybody that participated!
Two weeks ago, you participated in the DigiSeller giveaway. Now it’s time to draw the lucky winners.
And they are: Max Requião, chiuto and Giorgos Yfantis.
The winners have been contacted and will receive their prizes shortly.
The page flip effect used to be the quintessential Flash animation. On the web, it has powered everything from magazines to presentations, with its popularity declining over time, only to be reinvented on mobile devices as ebook reading apps.
In this tutorial we are going to use PHP and the turn.js plugin, an implementation of the page flip effect with pure CSS3 and jQuery, to build a pretty magazine. We will fetch the most popular images from Instagram every hour, and use them as pages.
HTML
First we need to lay down the foundations of today’s example. We will use a single page design, which combines HTML5 markup and PHP in the same file for greater simplicity. You can see the resulting layout below:
index.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Making an Instagram Magazine | Tutorialzine Demo</title>
<!-- Our Stylesheet -->
<link rel="stylesheet" href="assets/css/styles.css" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="magazine" class="centerStart">
<!-- PHP will go here -->
</div>
<!-- JavaScript includes - jQuery, turn.js and our own script.js -->
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="assets/js/turn.js"></script>
<script src="assets/js/script.js"></script>
</body>
</html>
We include styles.css in the head, and our JavaScript files at the bottom. The latter are the jQuery library, the turn.js plugin and script.js, where we will be initializing the plugin and listening for keyboard events. The PHP code that we will be writing in the next section will go in the #magazine div. PHP will have the job of generating the pages of our magazine, which will be used by turn.js.
As an example, here is the markup of the first three pages of the magazine:
Generated code
<div id="page1" class="page"> <div class="img1"> <!-- The pageNum span can be either on the left, or the right if the page is odd/even. --> <span class="pageNum right">1 // 32</span> <img src="assets/img/cover.jpg" alt="Cover" /> </div> </div> <div id="page2" class="page"> <div class="img2"> <span class="pageNum left">2 // 32</span> <img src="http://distilleryimage7.instagram.com/..." alt="Little tulips" /> </div> </div> <div id="page3" class="page"> <div class="img3"> <span class="pageNum right">3 // 32</span> <img src="http://distilleryimage2.instagram.com/..." alt="My style" /> </div> </div>
The divs you see above are direct descendants of the #magazine div. This is the only requirement imposed by turn.js. You don’t need to have any special classes or data attributes for the elements to be interpreted as pages. With this we are ready to move on with the PHP code!
PHP
PHP will have the task of communicating with Instagram’s API, caching the results, and generating the markup you saw above.
The first step is to register at the Instagram developer website. After you obtain your client_id key, place it in index.php as the value of $instagramClientID. We won’t be needing any of the advanced functionality of the API, we will only be requesting the most popular images. This frees us from having to implement OAuth authentication, which would make today’s example significantly more complex.
Note that if you want to modify the magazine and show photos other than the most popular, say your latest images, you will need to implement OAuth and authenticate your app to have access to your photos. Consult the docs for further information.
Here is an example JSON response of the currently popular images on Instagram. I have omitted some of the attributes to make the code easier to read.
Popular images JSON response
{ "meta": {
"code": 200
},
"data": [{
"tags": ["beautiful", "sky"],
"location": "null",
"comments": {
"count": 31,
"data": [...]
},
"filter": "Normal",
"created_time": "1331910134",
"link": "http:\/\/instagr.am\/p\/IPNNknqs84\/",
"likes": {
"count": 391,
"data": [..]
},
"images": {
"low_resolution": {
"url": "http:\/\/distilleryimage8.instagram.com\/03c80dd86f7911e1a87612313804ec91_6.jpg",
"width": 306,
"height": 306
},
"thumbnail": {
"url": "http:\/\/distilleryimage8.instagram.com\/03c80dd86f7911e1a87612313804ec91_5.jpg",
"width": 150,
"height": 150
},
"standard_resolution": {
"url": "http:\/\/distilleryimage8.instagram.com\/03c80dd86f7911e1a87612313804ec91_7.jpg",
"width": 612,
"height": 612
}
},
"caption": {
"created_time": "1331910148",
"text": "Goodnight.\ue056",
"from": {
"username": "jent99",
"profile_picture": "http:\/\/images.instagram.com\/profiles\/profile_6227738_75sq_1319878922.jpg",
"id": "6227738",
"full_name": "jent99"
},
"id": "148395540733414783"
},
"type": "image",
"id": "148395420004568888_6227738",
"user": {
"username": "jent99",
"website": "",
"bio": "Mostly nature pics.\ue32b\ue32b\ue32b Hope you like them.\ue056\ue32a \ue334gi\ue334 ",
"profile_picture": "http:\/\/images.instagram.com\/profiles\/profile_6227738_75sq_1319878922.jpg",
"full_name": "jent99",
"id": "6227738"
}
}, {
/* More photos here*/
}]
}
The API is limited to returning only 32 pics, but this is plenty for our example. You can see that each photo has three image sizes, but we will only be needing the standard one. There is also various other information that you can use like caption, dimensions, tags, comments, and more.
PHP will cache the results of this API call so we hit Instagram’s servers only once per hour. This will make our application more responsive and limit the number of calls.
index.php
// You can obtain this client ID from the Instagram API page
$instagramClientID = '-- place your client id key here --';
$api = 'https://api.instagram.com/v1/media/popular?client_id='.$instagramClientID;
$cache = 'cache.txt';
if(file_exists($cache) && filemtime($cache) > time() - 60*60){
// If a cache file exists, and it is
// fresher than 1 hour, use it
$images = unserialize(file_get_contents($cache));
}
else{
// Make an API request and create the cache file
// Fetch the 32 most popular images on Instagram
$response = file_get_contents($api);
$images = array();
// Decode the response and build an array
foreach(json_decode($response)->data as $item){
$title = '';
if($item->caption){
$title = mb_substr($item->caption->text,0,70,"utf8");
}
$src = $item->images->standard_resolution->url;
$images[] = array(
"title" => htmlspecialchars($title),
"src" => htmlspecialchars($src)
);
}
// Remove the last item, so we still have
// 32 items when when the cover is added
array_pop($images);
// Push the cover in the beginning of the array
array_unshift($images,array("title"=>"Cover", "src"=>"assets/img/cover.jpg"));
// Update the cache file
file_put_contents($cache,serialize($images));
}
# Generate the markup
$totalPages = count($images);
foreach($images as $i=>$image){
?>
<div id="page<?php echo $i+1?>" class="page">
<div class="img<?php echo $i+1?>">
<span class="pageNum <?php echo ($i+1)%2? 'right' : 'left'?>"><?php echo $i+1?> // <?php echo $totalPages?></span>
<img src="<?php echo $image['src']?>" alt="<?php echo $image['title']?>" />
</div>
</div>
<?php
}
Caching is straightforward: we are using a temporary file – cache.txt – to store a serialized representation of the image array. If the cache file is non-existing or is older than an hour, we issue a new API request.
Notice the calls to array_pop and array_unshift. These are necessary as to make room for the custom cover image that is stored in assets/img. The magazine works best if we have an even number of pages, otherwise we would be unable to turn the last one, which would feel unnatural.
We are now ready for the plugin!
jQuery
Using turn.js is really simple. As we already have the markup of the magazine, we just need to call the turn() method. While we are at it, we will also listen for presses on the arrow keys, which will trigger page transitions.
assets/js/script.js
$(function(){
var mag = $('#magazine');
// initiazlie turn.js on the #magazine div
mag.turn();
// turn.js defines its own events. We are listening
// for the turned event so we can center the magazine
mag.bind('turned', function(e, page, pageObj) {
if(page == 1 && $(this).data('done')){
mag.addClass('centerStart').removeClass('centerEnd');
}
else if (page == 32 && $(this).data('done')){
mag.addClass('centerEnd').removeClass('centerStart');
}
else {
mag.removeClass('centerStart centerEnd');
}
});
setTimeout(function(){
// Leave some time for the plugin to
// initialize, then show the magazine
mag.fadeTo(500,1);
},1000);
$(window).bind('keydown', function(e){
// listen for arrow keys
if (e.keyCode == 37){
mag.turn('previous');
}
else if (e.keyCode==39){
mag.turn('next');
}
});
});
You can read more about what events the plugin emits and how to use them, in the turn.js reference.
Now let’s make it pretty!
CSS
We need to set explicit dimensions of the magazine and style the pages and page numbers. turn.js will handle the rest.
assets/css/styles.css
#magazine{
width:1040px;
height:520px;
margin:0 auto;
position:relative;
left:0;
opacity:0;
-moz-transition:0.3s left;
-webkit-transition:0.3s left;
transition:0.3s left;
}
#magazine .page{
width:520px;
height:520px;
background-color:#ccc;
overflow:hidden;
}
/* Center the magazine when the cover is shown */
#magazine.centerStart{
left:-260px;
}
/* Center the magazine when the last page is shown */
#magazine.centerEnd{
left:260px;
}
.page img{
height:520px;
width:520px;
display:block;
}
/* Show a dark shadow when the cover is shown */
.centerStart .turn-page-wrapper:first-child{
box-shadow:0 0 10px #040404;
}
/* Page Numbers */
span.pageNum{
background-color: rgba(0, 0, 0, 0.3);
bottom: 25px;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.25);
color: #FFFFFF;
font-size: 11px;
height: 24px;
line-height: 22px;
opacity: 0.9;
position: absolute;
text-align: center;
width: 55px;
}
span.pageNum.left{
left:0;
right:auto;
}
span.pageNum.right{
left:auto;
right:0;
}
/* Hide the page number on the cover */
#page1 .pageNum{
display:none;
}
With this our magazine is complete!
We’re done!
This example works in all recent browsers – Firefox, Chrome, Safari, Opera and even IE. It is even usable on iOS and Android. You can use this effect as part of photo galleries, templates or even real magazines. However you will have to create a fallback version for older browsers, which don’t have what it takes to display it properly.
Do you love to build things? I know I do. It can be a web app, template, PSD, a PHP script, or even an ebook. Sooner or later, an idea comes to your mind – you can turn your love for building things into an extra revenue stream. But I have bad news for you.
Selling online sucks
You have a choice – join a marketplace or do it yourself. Doing it yourself clearly has a lot of benefits – you can choose your own pricing, design your shop, and keep all of your profits. But the bad thing is that you have to deal with heavy and archaic CMS systems that are a nightmare to customize, or join an equally unfriendly platform for a monthly fee.
I was looking for a solution that was quick to set up, easy to customize, and lightweight. I wanted something that I could throw on a domain and have a working microsite with PayPal integration. I couldn’t find one, so I built it myself.
Introducing DigiSeller
DigiSeller is a PHP+MySQL script for setting up a digital shop. It has full PayPal integration and helps you sell a digital item securely. You only need to upload it to your hosting space along with your product in a zip file, add your PayPal email address to the config file, and start selling!
Notable Features:
- Everything is controlled from a config file – no cumbersome admin panel that will only be used once;
- It has semantic HTML5 markup, with a pretty design that is easy to customize with CSS;
- Has a straightforward integration with PayPal – you only need to add the email on which you wish to receive payments;
- Buyers receive a download link after the purchase. This is the only way to download your file. The link expires after a set period of time;
- DigiSeller can collect email addresses for your newsletter and has a built-in contact form;
- You get readable and well commented source code along with PSDs, so you can change everything;
- You can use the script on unlimited domains and set it up for your clients.
Win a copy!
Three of you will have a chance to win a copy of the script for free. To participate, do the following:
- Leave a comment under the post;
- Tweet about this article.
The winners will be announced on March 20 in a follow-up post.
A product page is any page on your website that showcases a product. It has to describe its features, give some screenshots, and be descriptive. Naturally, this is the place where you build up the visitor’s interest towards your product, but it is getting increasingly difficult to be original in grabbing their attention. Luckily, a new compact JavaScript library can help you make a splash.
impress.js is a small, standalone library that makes it easy to design advanced CSS3 presentations with eye-catching effects. But what if we used impress.js for something other than a presentation? This is what we are doing today – we will be spicing up a plain old product page with some CSS3 magic!
The HTML
We start of with a simple HTML5 document that will be the backbone of today’s example.
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Impressive CSS3 Product Showcase | Tutorialzine Demo</title>
<!-- Google Webfonts and our stylesheet -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Narrow|Open+Sans:300" />
<link rel="stylesheet" href="assets/css/styles.css" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="impress" class="impress-not-supported">
<!-- The Slides Will Go Here -->
</div>
<a id="arrowLeft" class="arrow"><</a>
<a id="arrowRight" class="arrow">></a>
<!-- JavaScript includes -->
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="assets/js/impress.js"></script>
<script src="assets/js/script.js"></script>
</body>
</html>
Nothing unusual here. Along with the Google Webfonts include in the head, we also have our main stylesheet (we will go back to it in the next section) and a number of JavaScript source files before the closing body tag.
The #impress div will hold the slides. The id is required in order to be recognized by impress.js (you can override this by passing a different id to the impress function call in script.js). After this, we have the arrows that initiate the slide transitions.
Last on the page, we have our JavaScript source files. impress.js is standalone and does not need jQuery to work, but we will be including it so we can listen for clicks on the arrows in our script.js file.
Each of the slides of our showcase contains three elements – a title, a paragraph of text, and a smartphone image. These are all positioned uniquely for each slide. The promo images and text for this example were taken from Google’s Galaxy Nexus web site.
The elements of the slides are grouped into individual “step” divs inside the #impress container. With this we have set the stage for impress.js!
Using impress.js
With this tiny library, we can create smooth CSS3 transitions between the slides of our showcase. To do this, we have to instruct impress.js on how to orient the slides. This is easy to do – we will use data attributes on the step divs. These attributes are translated into real CSS3 transformations by the library, depending on the current browser, and affect the slide.
Impress.js supports a number of attributes:
- data-x, data-y, data-z will move the slide on the screen in 3D space;
- data-rotate, data-rotate-x, data-rotate-y rotate the element around the specified axis (in degrees);
- data-scale – enlarges or shrinks the slide.
You can see the markup for the slides below:
<!-- The first slide retains its default position. We could omit the data attributes --> <div id="intro" class="step" data-x="0" data-y="0"> <h2>Introducing Galaxy Nexus</h2> <p>Android 4.0<br /> Super Amoled 720p Screen<br /> <img src="assets/img/nexus_1.jpg" width="232" height="458" alt="Galaxy Nexus" /> </div> <!-- We are offsetting the second slide, rotating it and making it 1.8 times larger --> <div id="simplicity" class="step" data-x="1100" data-y="1200" data-scale="1.8" data-rotate="190"> <h2>Simplicity in Android 4.0</h2> <p>Android 4.0, Ice Cream Sandwich brings an entirely new look and feel..</p> <img src="assets/img/nexus_2.jpg" width="289" height="535" alt="Galaxy Nexus" /> </div> <!-- Same for the rest.. --> <div id="connect" class="step" data-x="-300" data-y="600" data-scale="0.2" data-rotate="270"> <h2>Connect & Share</h2> <p>Real-life sharing is nuanced and rich. Galaxy Nexus makes sharing.. </p> <img src="assets/img/nexus_3.jpg" width="558" height="329" alt="Galaxy Nexus" /> </div> <div id="upload" class="step" data-x="-200" data-y="1500" data-rotate="180"> <h2>Instant Upload</h2> <p>Your photos upload themselves with Instant Upload, which makes ..</p> <img src="assets/img/nexus_4.jpg" width="248" height="510" alt="Galaxy Nexus" /> </div> <div id="music" class="step" data-x="-1200" data-y="1000" data-scale="0.8" data-rotate="270"> <h2>Jam on with Google Music</h2> <p>Google Music makes discovery, purchase, and listening effortless and..</p> <img src="assets/img/nexus_5.jpg" width="570" height="389" alt="Galaxy Nexus" /> </div>
When the slideshow starts, impress.js will compensate for these transformations, and apply the reverse rules to the #impress div with a smooth CSS transition. The result is the eye-catching presentation you see in the demo. Of course, this comes at the price that you have to manually tweak the data attributes of each slide for the best result.
The CSS
To make the presentation work, we will have to apply some CSS rules. The first step is to style the presentation container and declare default styling for the slide elements.
assets/css/style.css
/*----------------------------
Styling the presentation
-----------------------------*/
#impress:not(.impress-not-supported) .step{
opacity:0.4;
}
#impress .step{
width:700px;
height: 600px;
position:relative;
margin:0 auto;
-moz-transition:1s opacity;
-webkit-transition:1s opacity;
transition:1s opacity;
}
#impress .step.active{
opacity:1;
}
#impress h2{
font: normal 44px/1.5 'PT Sans Narrow', sans-serif;
color:#444648;
position:absolute;
z-index:10;
}
#impress p{
font: normal 18px/1.3 'Open Sans', sans-serif;
color:#27333f;
position:absolute;
z-index:10;
}
#impress img{
position:absolute;
z-index:1;
}
As you can see in the rules above, and in the HTML fragment in the beginning of this tutorial, the #impress container is assigned a .impress-not-supported class. The class is removed only if the current browser supports the functionality required for the library to run successfully.
Now we need to style the individual slides. I will only include the classes for the first slide here, you can find the rest in assets/css/styles.css.
/*----------------------------
Slide 1 - Intro
-----------------------------*/
#impress #intro{
width: 500px;
}
#intro h2{
text-align: center;
width: 100%;
}
#intro p{
font-size: 22px;
left: 290px;
line-height: 1.6;
top: 220px;
white-space: nowrap;
}
#intro img{
top: 120px;
}
All that is left is for a quick JS snippet to initiate impress.js, and listen for clicks on the arrows.
jQuery
To initialize the impress library we need to call the method of the same name. This will also return a new object, with methods for showing the previous / next slides.
script.js
$(function(){
var imp = impress();
$('#arrowLeft').click(function(e){
imp.prev();
e.preventDefault();
});
$('#arrowRight').click(function(e){
imp.next();
e.preventDefault();
});
});
With this our impress-ive product showcase is complete!
Done!
You can use this example for product and landing pages, feature showcases and with some randomization you could even turn it into an image gallery.
Hey did you know that you can flip elements in 3D space with CSS3? You probably should as this has been possible for nearly two years. First only in Webkit browsers – Safari and Chrome, but now in Firefox as well. This means that more than half of the world (that use a non IE browser) can see advanced, CSS driven animations and effects.
In this tutorial we will see how we can use these transforms to create an interesting flipping effect on an Apple-inspired form.
The Idea
We will have two forms – login and password recovery, with only one visible at a time. Clicking a link (the ribbons in the example), will trigger a CSS3 rotation on the Y axis, which will reveal the other form with a flipping effect.
We will use jQuery to listen for clicks on the links, and add or remove a class name on the forms’ container element. With CSS we will apply the rotateY transformation (a horizontal rotation) to both forms, but with a 180deg difference depending on this class. This will make the forms appear on opposite sides of an imaginary platform. To animate the transition, we will use the CSS transition property.
Learn more about CSS3 3D transforms, read an intro or see some demos.
The markup
We need two forms – login and recover. Each form will have a submit button, and text/password inputs:
index.html
<div id="formContainer"> <form id="login" method="post" action="./"> <a href="#" id="flipToRecover" class="flipLink">Forgot?</a> <input type="text" name="loginEmail" id="loginEmail" placeholder="Email" /> <input type="password" name="loginPass" id="loginPass" placeholder="Password" /> <input type="submit" name="submit" value="Login" /> </form> <form id="recover" method="post" action="./"> <a href="#" id="flipToLogin" class="flipLink">Forgot?</a> <input type="text" name="recoverEmail" id="recoverEmail" placeholder="Your Email" /> <input type="submit" name="submit" value="Recover" /> </form> </div>
Note the IDs of the elements in the form. We will be using them extensively in the CSS part. Only one of these forms will be visible at a time. The other will be revealed during the flip animation. Each form has a flipLink anchor. Clicking this will toggle (add or remove) the flipped class name on the #formContainer div, which will in turn trigger the CSS3 animation.
The jQuery Code
The first important step is to determine whether the current browser supports CSS3 3D transforms at all. If it doesn’t, we will provide a fallback (the forms will be switched directly). We will also use jQuery to listen for clicks on the flipLink anchors. As we will not be building an actual backend to these forms we will also need to prevent them from being submitted.
Here is the code that does all of the above:
assets/js/script.js
$(function(){
// Checking for CSS 3D transformation support
$.support.css3d = supportsCSS3D();
var formContainer = $('#formContainer');
// Listening for clicks on the ribbon links
$('.flipLink').click(function(e){
// Flipping the forms
formContainer.toggleClass('flipped');
// If there is no CSS3 3D support, simply
// hide the login form (exposing the recover one)
if(!$.support.css3d){
$('#login').toggle();
}
e.preventDefault();
});
formContainer.find('form').submit(function(e){
// Preventing form submissions. If you implement
// a backend, you will want to remove this code
e.preventDefault();
});
// A helper function that checks for the
// support of the 3D CSS3 transformations.
function supportsCSS3D() {
var props = [
'perspectiveProperty', 'WebkitPerspective', 'MozPerspective'
], testDom = document.createElement('a');
for(var i=0; i<props.length; i++){
if(props[i] in testDom.style){
return true;
}
}
return false;
}
});
For convenience, the functionality that checks for 3D CSS3 support is extracted into a separate helper function. It checks for support of the perspective property, which is what gives our demo a depth.
We can now move on to the CSS part.
The CSS
CSS will handle everything from the presentation of the forms and form elements, to the animated effects and transitions. We’ll start with the form container styles.
assets/css/styles.css
#formContainer{
width:288px;
height:321px;
margin:0 auto;
position:relative;
-moz-perspective: 800px;
-webkit-perspective: 800px;
perspective: 800px;
}
As well as a width, height, margin and positioning, we also set the perspective of the element. This property gives depth to the stage. Without it the animations would appear flat (try disabling it to see what I mean). The greater the value, the farther away the vanishing point.
Next we’ll style the forms themselves.
#formContainer form{
width:100%;
height:100%;
position:absolute;
top:0;
left:0;
/* Enabling 3d space for the transforms */
-moz-transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
/* When the forms are flipped, they will be hidden */
-moz-backface-visibility: hidden;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
/* Enabling a smooth animated transition */
-moz-transition:0.8s;
-webkit-transition:0.8s;
transition:0.8s;
/* Configure a keyframe animation for Firefox */
-moz-animation: pulse 2s infinite;
/* Configure it for Chrome and Safari */
-webkit-animation: pulse 2s infinite;
}
#login{
background:url('../img/login_form_bg.jpg') no-repeat;
z-index:100;
}
#recover{
background:url('../img/recover_form_bg.jpg') no-repeat;
z-index:1;
opacity:0;
/* Rotating the recover password form by default */
-moz-transform:rotateY(180deg);
-webkit-transform:rotateY(180deg);
transform:rotateY(180deg);
}
We first describe the common styles that are shared between both forms. After this we add the unique styles that differentiate them.
The backface visibility property is important, as it instructs the browser to hide the backside of the forms. Otherwise we would end up with a mirrored version of the recover form instead of showing the login one. The flip effect is achieved using the rotateY(180deg) transformation. It rotates the element right to left. And as we’ve declared a transition property, every rotation will be smoothly animated.
Notice the keyframe declaration at the bottom of the form section. This defines a repeating (declared by the infinite keyword) keyframe animation, which does not depend on user interaction. The CSS description of the animation is given below:
/* Firefox Keyframe Animation */
@-moz-keyframes pulse{
0%{ box-shadow:0 0 1px #008aff;}
50%{ box-shadow:0 0 8px #008aff;}
100%{ box-shadow:0 0 1px #008aff;}
}
/* Webkit keyframe animation */
@-webkit-keyframes pulse{
0%{ box-shadow:0 0 1px #008aff;}
50%{ box-shadow:0 0 10px #008aff;}
100%{ box-shadow:0 0 1px #008aff;}
}
Each of the percentage groups corresponds to a time point in the animation. As it is repeating the box shadow will appear as a soft pulsating light.
Now let us see what happens once we’ve clicked the link, and the flipped class is added to #formContainer:
#formContainer.flipped #login{
opacity:0;
/**
* Rotating the login form when the
* flipped class is added to the container
*/
-moz-transform:rotateY(-180deg);
-webkit-transform:rotateY(-180deg);
transform:rotateY(-180deg);
}
#formContainer.flipped #recover{
opacity:1;
/* Rotating the recover div into view */
-moz-transform:rotateY(0deg);
-webkit-transform:rotateY(0deg);
transform:rotateY(0deg);
}
The flipped class causes the #login and #recover div to get rotated by 180 degrees. This makes the #login form disappear. But as the #recover one was already facing us with its back side, it gets shown instead of hidden.
The opacity declarations here are only a fix for a bug in the Android browser, which ignores the backface-visibility property and shows a flipped version of the forms instead of hiding them. With this fix, the animation works even on Android and iOS in addition to desktop browsers.
Done!
CSS 3D transforms open the doors to all kinds of interesting effects, once reserved only for heavy flash web pages. Now we can have lightweight, crawlable and semantic sites that both look good and provide proper fallbacks for subpar browsers.
One of the benefits to having new browser versions out every six weeks, is the rapid pace with which new functionality is introduced. The transition from nightly builds to official releases is merely weeks away. This means that even those of you who keep a close eye on the feature lists might miss an api or two.
This is the case with the Full Screen API. As if overnight, it went from a neat experiment to a feature supported by more than half of the browsers in the wild. Right now you might be wondering how is this different from the regular full screen we’ve had for ages.
What you need to know
With this api, you can display not only entire pages full screen, but individual elements within them as well (something you can’t do with the regular full screen). The intent here is to allow for full screen HTML5 videos and games, so that we can finally declare HTML5 as a viable alternative to Flash.
In short, here is what you need to know about the FullScreen API:
- Works in Firefox 10, Safari and Chrome;
- You trigger it using the new
requestFullScreen()method; - It can display any element full screen, not only the entire page;
- For security reasons, full screen can only be triggered from an event handler (as to be user initiated);
- Also for security, Safari blocks all keyboard input except for the arrows and control keys, other browsers show warning messages when typing;
- The API is still a work in progress, so you have to use the vendor specific methods (prefixed with moz and webkit);
The idea of allowing developers to programatically take up the user screen doesn’t come without serious security implications, which is why keyboard usage is limited. Of course, there are many legitimate uses for keyboard input in full screen, which is going to be addressed in future revisions of the API via some kind of permission prompt.
However, even in its current, limited form, the API still gives us an opportunity to enhance the experience of the end user.
The basics
According to the W3 draft, we have access to a number of methods and properties that will aid us with the task of switching an element to full screen.
var elem = document.getElementById('#content');
// Make this element full screen asynchronously
elem.requestFullscreen();
// When a full screen change is detected,
// an event will be dispatched on the document
document.addEventListener("fullscreenchange",function(){
// Check if we are in full screen
if(document.fullscreen)){
// We are now in full screen!
}
else{
// We have exited full screen mode
}
}, false);
// We can also exit the full screen mode with code
document.exitFullscreen();
At this time, however, dealing with the API is quite more cumbersome, as no browser has support for these methods yet – we will need to use vendor specific ones like elem.mozRequestFullScreen() and elem.webkitRequestFullScreen().
The API also introduces a new CSS pseudo-selector that you can use to style the full screen element.
#content:fullscreen {
font-size: 18;
}
Of course, it goes without saying that you will also need to supply moz and webkit prefixed versions of this as well. But there is an easier solution.
The jQuery plugin
There is a more elegant solution than ending up with a bunch of ugly code checking for every browser. You can use the jQuery FullScreen plugin, which works around various browser differences and gives you a simple method for triggering full screen mode.
$('#fsButton').click(function(e){
// Use the plugin
$('#content').fullScreen();
e.preventDefault();
});
This will bring the #content element full screen. The plugin also adds a flag to the jQuery support object, so you can conditionally show your full screen button or trigger:
if($.support.fullscreen){
// Show the full screen button
$('#fsButton').show();
}
To exit the mode, call the fullScreen() method again.
The plugin adds the .fullScreen class to your element, so you can style it without needing to worry about browser-specific versions. Now let’s use it to do some good for the world!
The fun part
If you are a website owner you’ve probably made decisions that deteriorate the experience of your users. This should not come as a surprise to you – you need to show advertising, you need a search box, a navigation bar, a twitter widget, a comment section and all the things that make your site what it is. These are all necessary, but make your content, the very thing that people came to your site for, more difficult to read.
There is also a practical limit to how large your font can be before it gets out of place, not to mention the choice of a type face. If you have a sidebar, this also limits the horizontal space your content can take.
But we can fix this with the new API. We will use the functionality to bring the content section of your site full screen, thus improving the reading experience of your readers even on devices with small displays like laptops and netbooks.
Reader Mode Using the Full Screen API
Making the reading mode
It is pretty straightforward, we only need to some kind of button that will trigger the FullScreen plugin. We can use the $.support.fullscreen flag to test if the current browser supports the API. If it does, we will add the full screen button to the page.
if($.support.fullscreen){
var fullScreenButton = $('<a class="goFullScreen">').appendTo('#buttonStrip');
fullScreenButton.click(function(e){
e.preventDefault();
$('#main').fullScreen();
});
}
When the #main div is brought full screen, it is assigned a width and height of 100%. We will have to work around this if we want it centered in the middle of the screen. This will call for some additional styling, applied only in full screen mode.
a.goFullScreen{
/* The styling of the full screen button goes here */
}
/* The following styles are applied only in Full Screen mode */
#main.fullScreen{
/* Adding a width and margin:0 auto to center the container */
width: 860px;
margin: 0 auto;
/* Increasing the font size for legibility*/
font: 17px serif;
padding: 45px 45px 10px;
}
#main.fullScreen h1{
/* Styling the heading */
font: 56px/1.1 Cambria,"Palatino Linotype",serif;
text-align: center;
}
#main.fullScreen h3{
/* Subheadings */
font: 28px Cambria,"Palatino Linotype",serif;
}
#main.fullScreen #postAuthor{
/* Centering the post author info */
/* ... */
}
/* Hiding unneeded elements and ads */
#main.fullScreen #featuredImage,
#main.fullScreen #topMiniShare,
#main.fullScreen #wideZineBanner,
#main.fullScreen #downloadDemo{
display:none;
}
That is all there is to it! Only browsers that support full screen mode will display the button and users will enjoy a better, distraction-free reading experience.
Done!
There are plenty of places in a website where you can use a full screen view – from videos and canvas-based games, to reports and print preview dialogs. I would personally love to see this used for infographics and presentations. We can go a long way with a useful feature like this.
In this tutorial we will build a small application with CodeIgniter that will be backed by a MySQL database. It will present questions and give visitors the ability to post answers. There isn’t an admin interface for adding or changing questions, but if you follow and understand this tutorial, you will be able to create one yourself.
As this might be the first exposure to CodeIgniter for some of you, we will start with a brief intro. If you know what CI is, you can skip directly to the code.
First, what is CodeIgniter?
CodeIgniter is a framework for developing web applications in PHP. It will help you properly organize your code using the model-view-controller (MVC) pattern, and give you useful functionality for getting your site up and running quickly. It hides away the tedious work like building and validating forms, communicating with a database, managing error pages and much more.
There are certainly a lot of frameworks to choose from, but CI has the winning combination of a big community, nice documentation and good performance. Unless you enjoy spending time building sites from scratch (which is not a bad thing), using a framework is the smarter way to go.
You should probably start by reading the CodeIgniter introductory guide, which will give you a better understanding of how CI works. Of course, if you are experienced with PHP you can grab the zip and jump directly to the code.
Let’s begin!
The database
Naturally, we will need a table for the questions, and a table for the answers.
The Database Schema
The questions table has only two fields – the ID of the question (automatically assigned with auto_increment) and the question body field. The answers also have an ID column, but they also have a qid field for the id of the question they relate to. The rest of the fields are the email and name of the author, along with the answer body and a timestamp (the dt field).
It is possible to create these tables with PHP code (CI gives us the ability to manipulate tables), but we will keep things simple and design them using a database management system like phpMyAdmin. It is even simpler for you, as I’ve included an export of the tables as an SQL file (tables.sql in the download archive). Import it into your database or copy/paste the code into the SQL tab of phpMyAdmin and you should be ready to go.
Setting up CodeIgniter
At this point you should download CodeIgniter. In this tutorial I am using version 2.1.0, the latest at the time of writing. Extract it in the directory where you are developing your website (move the files outside the CodeIgniter_2.1.0 folder and remove it). We will need to edit a few settings so the framework works the way we want it.
Important: This section assumes that you are downloading a fresh copy of CodeIgniter. If you only want to make the downloaded demo work, you will only need to change your $config['base_url'] setting in config.php, and add your MySQL login details to database.php. The other changes are already made (you still need to create the MySQL tables).
Edit routes.php
The application/config/routes.php file determines which controller is called by default. We need to set this to questions, which we will be creating in a moment.
// Find this line: $route['default_controller'] = "welcome"; // Replace it with this: $route['default_controller'] = "questions";
This will show the questions controller as the start page of the application.
Edit config.php
The application/config/config.php file holds much of the configuration settings of the framework.
// Find this line: $config['base_url'] = ''; // Replace it with the following: $config['base_url'] = 'http://example.com/';
The above setting, base_url, tells CI where your site is located. This information is used when forming links and including resources like stylesheets and images.
The following setting is optional. CodeIgniter adds index.php to every URL by default (like so: http://example.com/index.php/products/). If you want to hide it (so that the url becomes http://example.com/products/), you will need to edit the index_page setting:
// Find this line: $config['index_page'] = 'index.php'; // Replace it with the following: $config['index_page'] = '';
You will also need to create an .htaccess file, which rewrites the URLs so that they still get to index.php, although it is not included explicitly. The .htaccess I use in the demo follows:
.htaccess
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php/$1 [L]
Now you only need to add your MySQL connection settings so that your application can connect to your database.
Edit database.php
Find these four lines in application/config/database.php and change them to reflect your connection settings:
$db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'user'; $db['default']['password'] = 'pass'; $db['default']['database'] = 'your_database_name';
Great! We are done setting up CodeIgniter, so we can now move on with the code.
Showing the questions
To show the questions we will need to create two files – a controller, which will be called when we visit the /question/ URL, and a view, which outputs the HTML code of the page. The controller will handle selecting records from the database and passing them to view. Note that we are not using any models in this app (the M in MVC). For simple applications like this one, they are purely optional and you can write CI apps without them.
/application/controllers/questions.php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Questions extends CI_Controller {
public function index(){
// Loading only the libraries and helpers that we need.
// This is one of the things that make CI fast.
$this->load->database();
$this->load->helper(array('date','url'));
// Get the id of the last question
$res = $this->db->
select_max('id')->
get('qod_questions')->
result_array();
$id = $res[0]['id'];
$this->show($id);
}
public function show($id = -1){
$this->load->database();
$this->load->helper(array('date','url'));
// Select the question
$q = $this->db->
where(array('id'=>$id))->
get('qod_questions')->
result_array();
if(empty($q)){
// Show an error page
show_404();
}
$a = $this->db->
where(array('qid'=>$id))->
order_by('id','desc')->
get('qod_answers')->
result_array();
// Get the ids of the previous
// and next questions
$prev = 0;
$next = 0;
$res = $this->db->
select_min('id')->
where("id > $id")->
get('qod_questions')->
result_array();
if(!empty($res)){
$next = $res[0]['id'];
}
$res = $this->db->
select_max('id')->
where("id < $id")->
get('qod_questions')->
result_array();
if(!empty($res)){
$prev = $res[0]['id'];
}
$this->load->view('question_of_the_day',array(
'question' => $q[0]['question'],
'answers' => $a,
'previous' => $prev,
'next' => $next,
'id' => $id
));
}
}
The controller is basically a class that extends CI_Controller and resides in the controllers folder. The class methods are called by the framework depending on the URL. For example http://example.com/questions/ will execute the index method, and http://example.com/questions/show/213 – the show method. In the latter case, 213 will be passed as the id parameter.
In the show method we select the question with the passed ID and display it in the view. What the index method does, is to select the id of the newest question, and also call the show method. Because it is set as the default controller, this would mean that when you visit the start page of the application (the base url you set in the previous section), the latest question will be shown.
Read more about the URLs, controllers, views, helpers and the database class of CodeIgniter in the docs.
Now let’s see how the view works. When we load it, we pass an array. Each of the array keys (question, answers, previous, next and id) will be extracted and transformed into a variable. Instead of a class, the view is a simple PHP file.
/application/views/question_of_the_day.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><?php echo $question?> - Question of the day | Tutorialzine Demo</title>
<!-- Our CSS stylesheet file -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Rancho" />
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/styles.css" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header id="blackboard">
<h1><?php echo $question?></h1>
<?php if($previous) echo anchor("questions/show/$previous",'«','class="arrow left"')?>
<?php if($next) echo anchor("questions/show/$next",'»','class="arrow right"')?>
</header>
<?php
// This method will create a link to the answer form. It is given relative
// to your index page, but will be transformed depending on your base in config.php
echo anchor("answers/add/$id",'Add your answer','class="addAnswer"');
?>
<ul id="answers">
<?php foreach ($answers as $ans): ?>
<li>
<?php
// Forming the URL of the gravatar image.
$gravatar = 'http://www.gravatar.com/avatar/'.md5( strtolower( trim($ans['email']) ) ).'?d=mm';
?>
<span class="avatar" style="background-image:url(<?php echo $gravatar?>)"></span>
<span class="meta">
<a href="#" class="author"><?php echo $ans['name']?></a>
<?php
// We are using the built-in timestamp method. We are using
// array slice to limit the shown time divisions.
$ts = explode(',', timespan(strtotime($ans['dt'])));
$t = implode(',',array_slice($ts,0,2));
?>
<i><?php echo $t?> ago</i>
</span>
<p class="answer"><?php echo $ans['answer']?></p>
</li>
<?php endforeach; ?>
</ul>
</body>
</html>
The script loops through the $answers array and outputs a li element for each answer. It assembles a gravatar URL by generating an md5 hash of the email and includes it as the background-image of a rounded span element.
This gives us a functional answer browsing page. But how do we let people answer these questions?
Posting answers
We will again need to write a controller and a view for adding answers. Here we will use a few more of the neat CodeIgniter features – generating forms and validating them. The generation is handled by the form helper, and the validation – by the form validation class.
You can see the answers controller below.
/application/controllers/answers.php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Answers extends CI_Controller {
public function add($id = -1){
$this->load->database();
$this->load->helper(array('url','form'));
$this->load->library('form_validation');
// Check if there is such a question
$q = $this->db->
where(array('id'=>$id))->
get('qod_questions')->
result_array();
if(empty($q)){
// Show an error page
show_404();
}
// Adding validation rules.
$this->form_validation->set_rules('name', 'Name', 'required|min_length[2]|max_length[32]');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('answer', 'Answer', 'required|min_length[5]|max_length[255]');
// If there are errors, show the form
if ($this->form_validation->run() == FALSE){
$this->load->view('add_answer',array(
'question' => $q[0]['question'],
'qid' => $q[0]['id']
));
}
else{
// Otherwise insert the answer to the database
$this->db->insert('qod_answers', array(
'qid' => $q[0]['id'],
'email' => htmlspecialchars($this->input->post('email')),
'name' => htmlspecialchars($this->input->post('name')),
// preserving new lines:
'answer'=> nl2br(htmlspecialchars($this->input->post('answer')))
));
redirect('questions/show/'.$q[0]['id']);
}
}
}
With the help of the form validation class, we are able to add rules by which the data should be validated. We will insert the answer in the database only when presented with correct data. I am using the htmlspecialchars() PHP function to escape any HTML code that might have been typed in the form fields. When the answer is inserted, we redirect to the question page. If everything went as it should, the newly added answer should be at the top.
Equally interesting is how the answer form is generated. For this we will take a look at the view file.
/application/views/add_answer.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><?php echo $question?> - Add Answer | Tutorialzine Demo</title>
<!-- Our CSS stylesheet file -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Rancho" />
<link rel="stylesheet" href="<?php echo base_url()?>assets/css/styles.css" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header id="blackboard">
<h1><?php echo $question?></h1>
</header>
<?php
// This will print a link to the question page
echo anchor("questions/show/$qid",'Back to the question','class="addAnswer"');
// Creating the form using the form helper
echo form_open('');
echo form_label('Name','name');
echo form_input(array(
'name' => 'name',
'id' => 'name',
'value' => set_value('name'),
'maxlength' => '64'
));
echo form_label('Email (gravatar enabled)','email');
echo form_input(array(
'name' => 'email',
'id' => 'email',
'value' => set_value('email'),
'maxlength' => '128'
));
echo form_label('Answer','answer');
echo form_textarea(array(
'name' => 'answer',
'id' => 'answer',
'value' => set_value('answer'),
));
echo form_submit('subm', 'Add Answer!');
// Showing the validation errors
$validation = validation_errors();
if($validation):
?>
<div class="errorMessages">
<?php echo $validation?>
</div>
<?php endif;?>
<?php echo form_close()?>
</body>
</html>
As we included the form helper in the controller, we have access to all of its functions here, in the view. These functions make it easier to create forms and form fields. Of course, you can directly write the HTML of the forms, but you will have to update the code if you change the URL of your site.
At the bottom of the file we are accessing the validate_errors() function which will return a string with error messages, generated by the validation class. If there are any errors, we show them in a .errorMessages div.
That is it! All that is left is to add a pretty stylesheet and some images.
The styling
To finish this application, we need to add a stylesheet and images. Where we put them is more a matter of personal preference. I have chosen to go with an assets folder in the base directory of the application (you can see it in the zip file).
In the views I have specified the URL of the stylesheet like this: <?php echo base_url()?>assets/css/styles.css which gives us the correct location. base_url() is a function defined in the URL helper of the framework, which we’ve included in the controller.
As the tutorial is already quite lengthy, I won’t be discussing the styling here. You can see it for yourself by opening /assets/css/styles.css in your code editor.
We’re done!
I am hoping that you learned a lot in this tutorial. If you decide to go with CodeIgniter for your next website, it will be a useful experience for you. Although there is a learning curve, once you understand the basics, you will appreciate just how much time you can save. And with Sparks, you will become even more productive by adding easy to use open source modules to your projects.
You’ve probably noticed we’ve been quiet lately. Well, we’re extremely excited to announce that Summify has been acquired by Twitter! I know, right? We can hardly believe it ourselves!
Roughly 2 years ago, we moved from Romania to Vancouver after being accepted into Bootup Labs, an awesome startup incubator. It has been an incredible journey, with lots of highs, a few lows, and many product iterations. In March 2011 we launched our email summary product and we’ve been blown away by the response ever since. Many of our users tell us we found a magical solution to a truly unsolved problem.
Our long-term vision at Summify has always been to connect people with the most relevant news for them, in the most time efficient manner. As hundreds of millions of people worldwide are signing up and consuming Twitter, we realized it’s the best platform to execute our vision at a truly global scale. Since Twitter shared this vision with us, joining the company made perfect sense.
We’d like to give a big thanks to all of our investors and advisors, especially Bootup Labs, Boris Wertz, Rob Glaser, Andrew Braccia, Stewart Butterfield, Steve Olechowski, our users, our team and, of course, the city of Vancouver. Thank you for your support and your faith in us, we couldn’t have made it so far without you!
Follow us on Twitter:
@mirceapasoi, @cgst, @mkychua, @therealnybbles, @prostul
And, a huge thanks to @robncampbell for all his work with us over the last 7 months.
Best,
The Summify Team
FAQ
What happens to Summify?
We will be disabling new account registrations immediately and we will also be removing some features. We will keep the email summaries for a few more weeks, but at some point we will shut down the current Summify product. In the meantime, if you’re a user of Summify you’ll still receive your summaries, just like before.
What features are you removing?
Starting today, the following changes will take effect:
We’re removing the ability to make your summaries public (i.e. all summaries will be private)
We’re removing profile pages and influence pages
We’re removing the auto-publish feature
We’re disabling user registration from the website, iPhone and Hootsuite apps
Why are you removing these features?
We are offering a more streamlined service as we transition our efforts to working at Twitter.
Will you still be in Vancouver?
We will be moving down to San Francisco and will work out of the Twitter office.
What will you be doing at Twitter?
We are joining Twitter’s Growth team and will continue to explore ways to help people connect and engage with relevant, timely news.
UPDATE
Thanks for your notes of congratulations. We’re thrilled to be joining Twitter. Some of you have expressed concerns about the product being shut down. We appreciate your support and enthusiasm. At Twitter, we are going to focus our efforts on making Twitter even more engaging and useful for you. While we can’t get into details on what’s to come, we can say that we’re excited and we think you will be too.
Every story that arrives in your summary comes from your social networks, shared by a human much like yourself. Summify assumes that popular stories being shared by those you follow, are likely to be of interest to you, but that’s not always the case. Just like humans, algorithms aren’t perfect. The solution: tweak your sources and spread content you love.
Filter out contributors you don’t enjoy
There are two options here. We recommend trying the first, before making any permanent changes to who you follow on Twitter.
1) Filter domains or human contributors from appearing in future summaries. No change is permanent. Any filters you create will be added to the Filters section of your settings, which can be undone at anytime. Filters are completely private and nobody will ever know if you’ve filtered them out from your summaries.
2) Radically clean your Twitter follow list using iunfollow or more selectively with socialbro. This is a tip from @boichot. Check out our recent Summify Spotlight with him for more tips and tools that will improve your Twitter work-flow.
Like a story? Let contributors know. Nothing says “thank-you” better than sharing.
1) Share, Retweet, and Like stories – sharing content that you really like with the world is the best way to show the original author or person who shared it that it’s valued. This will likely lead them to share similar types of content that you will also enjoy. Social signals such as the number of shares, likes, and retweets are a major part of how Summify populates your summaries, so spread the love and share what you like, so that other’s can enjoy it too!
2) Automatically share your summaries to Twitter and Facebook – this is an easy way to share your summaries with your followers each day. To try it out, go to your Sharing settings and select which network you’d like to share to under “Promote.” There are also options for customizing your auto-share message and excluding mentions for contributors.
Note: You can also automatically post your summaries to a Facebook Page, LinkedIn, Instapaper, Read it Later, or Readability using ifttt – a fantastic third party service!
3) After reading your summary, line-up your favorite stories to be shared throughout the day with Buffer. Check out this popular post on how to pair Buffer with Summify – it will change your 2012 social media life – How To Be Awesome On Social Media In 20 Minutes A Day.
Along with the tips above, there’s one more simple thing that will help you improve your summaries.
Summify is designed to handle massive amounts of incoming content and your summaries will tend to get better as you connect more accounts. Haven’t done so already? Give it a try and experience the difference.
Note: you can connect more than one account for each of Twitter, Facebook and Google Reader.
Are you using any of the above methods to enhance your summaries? Maybe you have a tip or two of your own. Share what’s working for you in the comments below.
1. Fotoshop by Adobé
2. Search, plus Your World
Google Search has always been about finding the best results for you. Sometimes that means results from the public web, but sometimes it means your personal content or things shared with you by people you care about. These wonderful people and this rich personal content is currently missing from your search experience. Search is still limited to a universe of webpages created publicly, mostly by people you’ve never met. Today, we’re changing that by bringing your world, rich with people and information, into search. Read More
3. Why I Hate Android
Why do I hate Android? It’s definitely one of the questions I get asked most often these days. And most of those that don’t ask probably assume it’s because I’m an iPhone guy. People see negative take after negative take about the operating system and label me as “unreasonable” or “biased” or worse.
I should probably explain.
Believe it or not, I actually don’t hate Android. That is to say, I don’t hate the concept of Android — in fact, at one point, I loved it. Read More
4. If I Die: Facebook App Lets You Leave Sweet Last Words
Facebook profiles don’t die the same way people do. If I Die is a Facebook app that makes sure, even if you die, your social self can still send out your last wishes and post messages to your friends years after you’re gone. Read More
5. Real-Life Examples Of How Google’s “Search Plus” Pushes Google+ Over Relevancy
The new Google “Search Plus Your World” feature — which I’m now simply calling “Search Plus” — has just gone live for me. Huge debate erupted yesterday over whether it somehow favors Google+. I can see now that it clearly does, even more than I thought. Here’s a closer look at the changes, including how they turn Google+ into an essential social network for any search marketer. Read More
By now, I’m sure you’ve heard just how much content is being shared and consumed out there. So here’s the big question: why are you consuming all this media and content, you must have a reason, right? Clearly define what you want to achieve out of reading the news. Have a goal. Limiting yourself to what’s important at the moment is key. It’s easy to get caught up reading stacks of information that you won’t immediately use, with your knowledge of it disappearing in a tenth the time it took to consume it – not so productive.
Once you know what you want to read, make a habit of constraining means. It’s easy to go bananas, reading everything you can get your hands on and more. Make sure you’re not being wasteful of your two biggest resources: time and mental sanity. Set constraints to minimize waste and focus your energy on reading what really matters.
Adjust the frequency, timing and number of stories for your summaries
Most people could afford to read less when it comes to their news and that’s why we’ve purposely set a minimalist delivery schedule: 1 summary a day with your top 5 stories. If you find that this lean reading list doesn’t quite suit you, you can tweak the following settings:
Create it at…
Set a base-time that you’re summaries will be generated at each day – we suggest first thing in the morning. If you choose to receive more than one summary per day, this base time is the jumping off point for your delivery schedule.
Want more? Increase story quantity or summary frequency
The default is to receive one summary a day with 5 stories. We recommend starting here and then experimenting if you want more, first by increasing the number of stories in each summary, between 5-15, and then increasing the frequency of your summaries, 1-4 per day. Sometimes summaries will be great and at times they could be better. An alternative to a fixed increase in your summary frequency is to click the on-demand “Get A New Summary” button at the bottom of your email summary whenever you feel like reading more – careful, it’s a slippery slope!
Finding the right combination
Depending on your news reading habits and needs, certain delivery combos might work better for personal vs. work use, however we always recommend starting with less and going from there. Do you have a combo that works especially well for you? Share it below.
1. This is What Happens When You Give Thousands of Stickers to Thousands of Kids
This December, in a surprisingly simple yet ridiculously amazing installation for the Queensland Gallery of Modern Ar, artist Yayoi Kusama constructed a large domestic environment, painting every wall, chair, table, piano, and household decoration a brilliant white, effectively serving as a giant white canvas. Over the course of two weeks, the museum’s smallest visitors were given thousands upon thousands of colored dot stickers and were invited to collaborate in the transformation of the space, turning the house into a vibrantly mottled explosion of color. Read More
2. Apple’s Jonathan Ive gets knighthood in honours list
Jonathan Ive, Apple’s head of design, has been awarded a knighthood in the New Year Honours list.
Mr Ive, who can now style himself Sir Jonathan, has been made a Knight Commander of the British Empire (KBE).
Raised in Chingford, Mr Ive began working for Apple in 1992 and since then has been the brains behind many of its products.
He described the honour as “absolutely thrilling” and said he was “both humbled and sincerely grateful”. Read More
3. Kodak Teeters on the Brink
Eastman Kodak Co. is preparing to seek bankruptcy protection in the coming weeks, people familiar with the matter said, a move that would cap a stunning comedown for a company that once ranked among America’s corporate titans.
The 131-year-old company is still making last-ditch efforts to sell off some of its patent portfolio and could avoid Chapter 11 if it succeeds, one of the people said. But the company has started making preparations for a filing in case those efforts fail, including talking to banks about some $1 billion in financing to keep it afloat during bankruptcy proceedings, the people said. Read More
4. Welcome to Instagram, President Barack Obama!
We’re excited to welcome President Barack Obama to Instagram! We look forward to seeing how President Obama uses Instagram to give folks a visual sense of what happens in the everyday life of the President of the United States. In addition to sharing photos through the @barackobama Instagram account, the Obama 2012 staff is asking supporters to share their photos from the campaign trail with the tag #obama2012. Read More
5. M.I.T. Game-Changer: Free Online Education For All
For Wall Street Occupiers or other decriers of the “social injustice” of college tuition, here’s a curveball bound to scramble your worldview: a totally free college education regardless of your academic performance or background. The Massachusetts Institute of Technology (M.I.T.) will announce on Monday that they intend to launch an online learning initiative called M.I.T.x,which will offer the online teaching of M.I.T. courses free of charge to anyone in the world. Read More