Separate favicons for the Frontend and Backend

AskApache.com

Here's a nifty little idea I had that has some merit. Separate favicons for separate areas of a site. Basically, I can't live without Firefox or Chrome and the way they use multiple tabs.

Separate favicons for the Frontend and Backend

I usually have several tabs open for a single site. Some tabs are in the backend, usually meaning WordPress administration area, and others are in the frontend, meaning the homepage or viewing a post. I'm constantly going back and forth between tabs, often to edit a post, and then switch to the preview of the post. Now, with 50 tabs open at one time, which isn't very unusual for me, it can become difficult to quickly spot which tab is which. Solution? Create 2 favicons. One for the frontend, and a different one for the backend! This makes it soooo much easier to quickly switch to the correct tab, and even though it's a fairly small trick/tip compared to most of the articles on this site, it's helpful enough that I wanted to put it out there for all you wonderful readers.

Separate favicons using WordPress

So there are many ways to do this, but probably the best is to just add a simple little function to your themes functions.php file.

Just add this to your functions.php file. Then you will need to create a favicon in your root folder where your wp-config.php file lives, and an admin-favicon.ico in your active themes folder where your style.css file lives.

View syntax-highlighted source.

<?php

function askapache_separate_favicons() {
    
    
// default for frontend
    
$favicon_uri WP_SITEURL '/favicon.ico';
    
    
// if in backend change to the admin-favicon.ico file located in the active theme directory where style.css is
    
if ( is_admin() ) $favicon_uri preg_replace'|https?://[^/]+|i'''get_stylesheet_directory_uri() ) . '/admin-favicon.ico';

    
// output the xhtml
    
echo '<link rel="shortcut icon" href="' $favicon_uri '" type="image/x-icon" />';
    
}
add_action'wp_head''askapache_separate_favicons' );
add_action'admin_head''askapache_separate_favicons' );

?>

Raw Code

<?php
 
function askapache_separate_favicons() {
  
  // default for frontend
  $favicon_uri = WP_SITEURL . '/favicon.ico';
  
  // if in backend change to the admin-favicon.ico file located in the active theme directory where style.css is
  if ( is_admin() ) $favicon_uri = preg_replace( '|https?://[^/]+|i', '', get_stylesheet_directory_uri() ) . '/admin-favicon.ico';
 
  // output the xhtml
  echo '<link rel="shortcut icon" href="' . $favicon_uri . '" type="image/x-icon" />';
  
}
add_action( 'wp_head', 'askapache_separate_favicons' );
add_action( 'admin_head', 'askapache_separate_favicons' );
 
?>

Separate favicons for the Frontend and Backend… originally appeared on AskApache.com

The post Separate favicons for the Frontend and Backend appeared first on AskApache.

Backing up Gmail messages with offlineimap

A while back I realised I had a ton of email archived on Gmail which I would be sad to lose if I lost access to my Google account or couldn’t access the internet for some reason. I also wanted a backup in case I decided to migrate away from Gmail to use another service.

The approach I took was to use offlineimap to download the contents of my mail using Gmail’s IMAP support. I set it up to download a few days of email at a time so I wouldn’t encounter any bandwidth limiting from Google or risk getting my account temporarily suspended for aggressive use.

I chose to use ‘Maildir’ format for the downloaded mail so I could use notmuch locally to read and search.

The matter of dealing with Gmail folders is a bit tricky. These are exposed as IMAP folders and if you’re not careful you can end up downloading emails multiple times for each folder. I didn’t really want the folder structure. I just wanted all emails and I’d use the tagging mechanism of notmuch to add tags after the fact.

The secret to ignoring folders is to create a folderfilter entry in the .offlineimaprc file. This is a lambda function that given a folder name should return true if it’s a folder you want to be downloaded by offlineimap. I use:

folderfilter = lambda foldername: foldername in ['[Gmail]/All Mail', '[Gmail]/Sent Mail']

This downloads “All Mail” and “Sent Mail”. This way I get everything in my Gmail without the folder structure.

I chose to add a nametrans entry so that the downloaded folders in the Maildir have more relevant names. nametrans is a lambda function that, given a folder name, returns the name that should be used locally for that folder. Here I translate “All Mail” to “all” and “Sent Mail” to “sent”:

nametrans = lambda foldername: 
              re.sub('^\[Gmail\]/All Mail$', 'all', 
              re.sub('^\[Gmail\]/Sent Mail$', 'sent',foldername))

To connect to Gmail the following entries are used in the remote repository section:

type = Gmail
remotehost = imap.gmail.com
realdelete=no
maxconnections=1
ssl = yes
cert_fingerprint = 6d1b5b5ee0180ab493b71d3b94534b5ab937d042
remoteport = 993
remoteuser = ...
remotepass = ...

My local repository section is:

type = Maildir
localfolders = ~/.Mail

To prevent having to run offlineimap for a long time on the initial sync I did it over a series of days. I used the maxage setting in the Account section. When set mail older than this number of days is not synced. So I’d set it for 100 days, do a sync. Then I’d increase it by a 100 the next day and do another sync. Over a series of days/weeks I have all my email. Once completely synced I removed the entry from the .offlineimaprc file. I’m not sure what the best value is and maybe it doesn’t matter but this worked for me.

My .offlineimaprc then looks like:

[general]
accounts = gmail
ui = TTY.TTYUI

[Account gmail]
localrepository = gmailLocal
remoterepository = gmailRemote
maxage = 1000

[Repository gmailLocal]
type = Maildir
localfolders = ~/.Mail

[Repository gmailRemote]
type = Gmail
remotehost = imap.gmail.com
realdelete=no
maxconnections=1
ssl = yes
cert_fingerprint = 6d1b5b5ee0180ab493b71d3b94534b5ab937d042
remoteport = 993
remoteuser = ...
remotepass = ...
nametrans = ...show above...
folderfilter = ...show above...

I used notmuch to process and search the Maildir locally. By setting synchronize_flags=true in my .notmuch-config file I could read the offline email in notmuch, incrementally sync with offlineimap, and the ‘read’, ‘replied’, etc flags are synchronized between them.

To tag with notmuch I run a script after syncing with .offlineimap that tags based on certain criteria. Something like:

offlineimap
notmuch new
notmuch tag +sent -- folder:sent and not tag:sent 
notmuch tag +bugzilla -inbox -- tag:inbox and from:bugzilla-daemon@mozilla.org
notmuch tag +ats -inbox -- tag:inbox and to:ats-lang-users
...etc...

Original iPhone will soon reach ‘obsolete’ status in Apple Retail Stores

iphoneAccording to internal Apple documentation, the original iPhone, which first debuted in 2007, will soon enter “obsolete” status, with a few exceptions. The official switch will happen on June 11, 2013, when the iPhone, along with several other Macs and Xserve models will officially be classified as vintage and obsolete products by Apple. Thanks, G! 

Apple’s support site defines vintage products as:

 …those that were discontinued more than five and less than seven years ago. Apple has discontinued hardware service for vintage products with the following exception:

-Products purchased in the state of California, United States, as required by statute.

-Owners of vintage Macintosh products may obtain service and parts from Apple service providers within the state of California, United States.

-Owners of vintage iPod products in the state of California may obtain service from Apple Retail Stores or by contacting AppleCare at 1-800-APL-CARE.

An obsolete product, on the other hand, is one that was discontinued more than seven years ago, and will not be supported under any circumstance. It’s worth noting that over 18 months ago, AT&T stopped activating the original iPhone, without any roundabout solution.

While the original iPhone will be now considered obsolete in the U.S. at walk-in Apple stores and around the world, the “vintage” status will still apply with AppleCare  and Authorized Service Providers, meaning it is possible to have the device serviced if you call directly.

Keep in mind, we’re talking about the first-generation iPhone, with its EDGE (2G) connectivity and 128 MB of RAM. Meanwhile, you can buy a blazing fast iPhone 5 with LTE (4G) for as low as $99 in some cases.

 


PayPal, Payment Method in Google Play?

There are multiple payment options in Google Play, from credit and debit cards to carrier billing and gift cards, but PayPal isn't one of them. Google Wallet competes with PayPal and this could be one of the reasons why you can't use PayPal in Google Play.

Despite this, some Google Wallet JavaScript files that are used in Google Play include many references to PayPal. For example, PayPal is placed next to Maestro, Automated Clearing House (ACH), proxy cards and carriers like Sprint, Softbank and Vodafone. Google's code also mentions PayPal UUIDs, which are used by the PayPal Merchant API, and there's a function named "onRedirectToPayPalPopup". There's also an error message: "PAYPAL_INSTRUMENT_ERROR" next to messages like "GIFT_CARD_ALREADY_REDEEMED" and "INVALID_CREDIT_CARD".



1Password keyboard shortcuts for the Mac and PC power user in all of us

photo via pj_vanf

photo via pj_vanf

Let’s face it, we call them keyboard “shortcuts” for a reason. Shortcuts help you get from point A to point B faster, and in your daily work and play on a computer, you have a lot of point As and Bs. Fortunately, 1Password is packed with quite a few shortcuts to help, so here are some of our favorites for Mac and PC.

Mac

  • Command-\ – A staple of any shortcut fan, this triggers the 1Password browser extension to AutoFill and AutoSubmit your Login for the current site. If you have multiple Logins for the current site, the extension displays them together at the top. From there you can arrow up and down, then press Return to AutoFill and get in
  • Option-Command-\ – This triggers the browser extension, but no AutoFill or AutoSubmit. This allows you to use some other shortcuts listed below (you can customize these two extension trigger shortcuts under Preferences)
  • Type to Find – While viewing any list in the browser extension (Logins, Credit Cards, Identities), you can type a couple letters of the item you want. If it’s a Login, you can arrow to it and hit Return to open the website, AutoFill, and AutoSubmit to log right in. How’s that for saving some time?
  • Tab – In the browser extension, this cycles through the main sections—Logins, Credit Cards, Identities, Strong Password Generator, Settings
  • Right/Left Arrow – With an item selected in the browser extension (a Login or Credit Card), the right arrow will show its details. Use the Left Arrow to get back out to the list
  • Option-Command-C – In 1Password for Mac, this copies the password for the selected Login to your clipboard
  • Option – In 1Password for Mac, this will reveal the password field(s) in any item including Account items like Email Account, Server, and Database. Hold it to view passwords, let go to obfuscate them again with those little dots
  • Command-E – In 1Password for Mac, this switches to Edit mode for the currently selected item. Use it a second time to save the item, confirm your changes, and switch out of edit mode

PC

  • Ctrl+\ – Triggers the browser extension to AutoFill and AutoSubmit a Login. On a German keyboard layout, this shortcut defaults to Ctrl+#
  • Ctrl+R: In 1Password for Windows, this reveals the password(s) for the currently selected item. Hold to view, let go to conceal
  • F2: In 1Password for Windows, this changes the selected folder name
  • Enter/Return: In 1Password for Windows, this will edit a Login item or, depending on your preferences, open login item’s URL in web browser
  • Ctrl+C: In 1Password for Windows, the 1st time you press it will copy the Login item’s password to the clipboard. Press it again, and it will copy the login item’s username to the clipboard

How’d I do? Be honest. Did I miss your favorite shortcut? Let us know on Twitter, Facebook, or in our forum and I can update the post with a shout out to you!

How to get 100% CPU usage from a C program

Answers: 7
Accepted answer: yes

No content.

‘Accentify’ Lets You Pick a Color Scheme for Your User Interface



Customization is great fun. That’s why it’s such a popular thing to do after you have jailbroken your device.

A new jailbreak tweak called Accentify by iOS developer rms is something every customizer should try. Accentify allows you to pick a color scheme for your iOS device; the color scheme you pick will affect all kinds of interface elements, including the Status Bar, navigation bar, button bar, and more. Depending on the application, more or less elements may be affected by the tweak.

Accientify doesn’t require WinterBoard to use, and

Popular Reeder iOS App Updated With Support for Feedbin, a Google Reader Alternative



As we have heard, Google has decided to put an end to Google Reader on July 1st of this year. Google Reader is by far the most popular way to keep all of your news in one place. Many iOS users choose Reeder to keep an eye on their Google Reader content.

Reeder has been updated Saturday to version 3.1. Reeder is popularly used in combination with Google Reader; however, with Google Reader coming to an end, the developers of the application have added support for Feedbin, a Google Reader alternative. Feedbin isn't free like Google Reader – you will have to pay $2 per month for the service.

A Second Teaser of Angry Birds Cloud Sync (Now Removed)

About a month ago, we announced that a "Cloud Sync System" was making its way into the Angry Birds world. (If you don't remember, click here for our post.) Angry Birds v3.1.2 was released yesterday and it seems that Rovio might have accidentally included the Cloud system in the package (or maybe it just wasn't disabled quickly enough, or maybe we're just too fast!). We had originally reported that Cloud Sync was now available, but alas the icon and service have since been disabled so we will have to wait just a bit longer.That said, if you are unfamiliar with Cloud Sync, check out our first look at the system in this post. We have more details about what might be to come there.As soon as Sync is officially released you will be the first to know. Speaking of being the first to know. If you want to know as soon as this -- or any -- update lands on your platform then be sure to opt-in to our new update notification system via your profile. It’s easy. If you’re logged in just hover or tap your username in the yellow navigation bar (top right), then select "Notifications". Once there just scroll down and tick yes next to, "Platform Update" and save. You’ll now be notified as soon as this update lands on your primary platform. Woot!Update 7 May:Rovio Accounts is now live (permanently) for ABo for iOS devices in Finland and Poland! More geographic areas will be rolled out gradually. For more information, see Rovio's official release.

Wikidata is a huge step for Wikipedia and the Internet

While Wikipedia is certainly the most prominent project of the Wikimedia Foundation, it is not the only one. Twelve different project websites are maintained currently, from Wikimedia Commons, the creative commons media library to Wikiquote, a quotation database and Wikisource, a collection of free and open texts. All of these projects are maintained independently from each other even though they are using the same framework.

Data changes up until now had to be handled independently as well. If the name of a city changed, or its population, all articles that referenced it had to be changed.

The introduction of Wikidata changes that. To explain it in simple terms: it is a data source that all Wikimedia projects - and third party projects as well - can make use of. Think of a variable that Wikipedia authors can add to articles that pulls the current information from Wikidata. Instead of having to edit the data in multiple articles, with the chance of missing some, it only needs to be edited on Wikidata so that the updated information are propagated automatically to all pages that use it as a source. This not only makes the editing more efficient - thanks to a single source that needs to be edited instead of multiple ones - but ensures that the data on Wikimedia properties is the same across all properties.

For a month, eleven Wikipedias (different language versions of Wikipedia) could make use of Wikidata in articles. The English Wikipedia was added to the group three days ago, and all other language versions of Wikipedia were added yesterday. What this means is that all Wikipedias can now make use of Wikidata as a source of data in articles that get published on the sites.

Wikidata is still a work in progress as the creators of the project mention in a blog post. Editors can use the new functionality in two ways. First by using a parser function, and second for things that are more complicated with the help of the LUA scripting language.

The data is licensed under the Creative Commons CC Zero license which indicates basically that the work is not copyrighted and available for the public domain.

The post Wikidata is a huge step for Wikipedia and the Internet appeared first on gHacks Technology News | Latest Tech News, Software And Tutorials.