Saturday, October 19, 2013

Google News Search parameters (The Missing Manual)

There is a severe lack of documentation of Google News Search’s query parameters. Here is the most comprehensive list I am aware of. A number of these overlap with Google Search’s query parameters. I exclude any Google Search parameters that don’t make sense in the context of Google News Search. These parameters are primarily of interest to anyone querying Google News for articles using its RSS and Atom output formats.

Search

The following query parameters control Google’s interpretation of keywords. Although as_epqmay be attractive for some use cases, it breaks sorting by date (scoring=n) when output is “rss” or “atom”, so stick with q for consistent sorting. Update: It seems the as_* parameters don’t work when output is “rss” or “atom”.
  • q=TERMS retrieve results with all of the terms. Alias: as_q
  • as_epq=TERMS retrieve results with the exact phrase
  • as_oq=TERMS retrieve results with at least one of the words
  • as_eq=TERMS retrieve results without the terms
  • as_qdr=dTERMS retrieve results within specified number of days example &as_qdr=d1 results within one day
  • as_qdr=wTERMS retrieve results within specified number of weeks example &as_qdr=w1 results within one week
  • as_qdr=yTERMS retrieve results within specified number of years example &as_qdr=y1 results within one year
  • as_occt=SECTION retrieve results where my terms occur…
    • any anywhere in the article
    • title in the headline of the article (same as using “allintitle:” in q)
    • body in the body of the article (same as using “allintext:” in q)
    • url in the URL of the article (same as using “allinurl:” in q)

Filter

The following query parameters filter results by Google News edition, topic, location, date, news source or author.
  • ned=EDITION limits results to a specific edition. Possible values: editions
  • topic=TOPIC limits results to a specific topic. Possible values: topics
  • geo=LOCATION limits results to a specific location
    • detect_metro_area determines location based on IP
    • a city, state, country, or US zip code
  • as_drrb=q retrieves articles added by Google News…
    • as_qdr=a anytime
    • as_qdr=h last hour
    • as_qdr=d last day
    • as_qdr=w past week
    • as_qdr=m past month
    • as_qdr=y past year
  • as_drrb=b retrieves articles added by Google News between…
    • as_minm=NUM minimum month. Possible values: [1, 12]
    • as_mind=NUM minimum day. Possible values: [1, 31]
    • as_maxm=NUM maximum month. Possible values: [1, 12]
    • as_maxd=NUM maximum day. Possible values: [1, 31]
  • as_nsrc=SOURCE limits results to a specific news source (same as using “source:” in q)
  • as_nloc=LOCATION limits results to news sources from a specific location (same as using “location:” in q)
  • as_author limits results to a specific author (same as using “author:” in q)
The as_ddrb family of parameters is occasionally set using the tbs parameter when using the web interface. You do not need to learn the tbs syntax. Note that as_nloc and geo are not synonymous.

Boost

I’m not confident that these parameters do anything when output is “rss” or “atom”, but here they are for completeness.
  • gl=COUNTRY boosts search results from a specific country of origin. Possible values:country codes
  • gll=LATITUDE,LONGITUDE boosts search results near that point. Latitude and longitude must be integer microdegrees. In otherwords, multiply each number by a million and round to the nearest integer.
  • gr=REGION boosts search results from a specific region. Possible values: province codes
  • gm=METRO boosts search results from a specific metropolitan area. Possible values: metro codes
  • gpc=ZIPCODE boosts search results from a specific zip code. gl must be “us”.
  • gcs=CITY boosts search results from a specific city. Possible values: city names in theUnited States and worldwide

Order

  • scoring=ORDER sorts search results. Default: “r”. Alias: “as_scoring”
    • "r" by relevance
    • "n" by date (newest first)
    • "d" by date (newest first) with duplicates
    • "o" by date (oldest first)

Paginate

  • num=NUM retrieves NUM results. Default: 10. Possible values: if q present [1,100], otherwise [1, 30]
  • start=OFFSET retrieves results starting from OFFSET. NUM plus OFFSET must be less than 1000, otherwise you will get zero results. Ignored if output is “rss” or “atom”. Default: 0. Requires q.

Output

  • output=FORMAT sets the output format
    • rss retrieves RSS feed
    • atom retrieves Atom feed
  • hl=LANGUAGE sets host language. Default: “us”. Possible values: languages
  • hdlOnly=1 displays headlines only
  • qsid=ID used in combination with cf=q. Update: This feature has been removed.
In older versions of Google News, it was possible to change the output of the web interface using a cf parameters. It no longer seems to work, but it is here for completeness. Note that when output is set to “rss” or “atom”, this parameter is in fact ignored.
  • cf=CODE
    • all retrieve any content
    • q retrieve only quotes. Requires qsid. Update: This feature has been removed.
    • i retrieve only images
    • b retrieve only blogs

Google tracking

Google uses parameters to track how users are using the web interface, which may include aq,authuser, btnmeta_news_search, edchanged, client, rls, oi, oq, resnum, sa, source,sourceid, swrnum, tab. You don’t need to worry about these, unless you want to bias Google’s internal statistics on user behavior.

Google Search

If using the web interface, performing a keyword search from Google News will redirect you to a Google Search page. The tbm=nws query parameter informs Google to display news results only.

Undocumented

I haven’t yet figured out what these do, but their impact seems minimal. If you have a clue, please mention it in the comments!
  • pz is usually set to 1. Default: 1. Possible values: [0, 1]
  • ict Possible values: “ln”, “itn0”, “tnv0”
  • csid

Deprecated

The following parameters work only on the deprecated Google News Search API.
  • v=1.0 sets the API version. Possible values: “1.0”
  • rsz=SIZE sets results size
    • small retrieves four results
    • large retrieves eight results
  • userip sets user’s IP as an abuse counter-mesure
  • callback runs JavaScript callback
  • context sets callback context
  • key sets API key

Examples:

To create RSS for US top stories:
http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss

To create RSS for Topic: Technology:
https://news.google.com/news/section?pz=1&cf=all&topic=tc
Or
https://news.google.com/news/section?pz=1&cf=all&ned=us&hl=en&topicsid=en_us:tc&ict=tnv3

To create RSS for keyword search (google) in Topic: Technology:
https://news.google.com/news/section?pz=1&cf=all&ned=us&hl=en&q=Google&topicsid=en_us:tc&ict=tnv3

To create RSS for keyword search (AT&T) in Topic: Technology:
https://news.google.com/news/section?pz=1&cf=all&ned=us&hl=en&q=AT%26T&topicsid=en_us:tc&ict=tnv5

To create RSS for keyword (google) and sort output by newest:
http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&scoring=n&q=google&output=rss

Friday, December 14, 2012

100 Best Mac OS X Apps Of Year 2011


Reference:

http://www.addictivetips.com/mac-os/100-best-mac-os-x-applications-of-year-2011-editors-pick/

Saturday, December 8, 2012

Speed Up SSD On OSX By Disabling Access-Time

To enable noatime:

1. Open up Applications>Utilities>Terminal.app
2. At command prompt type sudo bash then press Enter.
3. It will ask you to input your user password make sure you have the admin rights.
4. At the bash prompt type vi /etc/rc.local then press Enter.
5. Then you will be in the rc.local editor screen.
6. Press I (in order to start editing)
7. Input the following code or you can basically cut and paste to it from here

#!/bin/sh
mount -vuw -o noatime /

8. Press ESC to stop editing and type :wq then press Enter to exit the editor.
9. Back to the prompt type chmod 775 /etc/rc.local then press Enter
10. Type Exit and press Enter to exit.

Friday, January 13, 2012

Making Any OS X Application Full Screenable In Apple Lion OSX


Copy the App You probably don't want to edit the original, so copy the app to the Desktop.
Locate the compiled nib files Compiled nib files can be found in the app bundle's Contents/Resources folder. In more internationalized apps, they may appear in lproj subfolders. You need to locate the nib files you want to edit.
  1. cd whatever.app/Contents/Resources
  2. grep -iRl NSWindowBacking *
This returns a list of all nib files which define the NSWindowBacking key. That key more or less tells you that there's a window definition there. You can try to edit them all, or you can do what I did: just edited the three files in Colloquy's Resources folder that matched: JVChatWindow.nib, JVTabbedChatWindow.nib, and JVSidebarChatWindow.nib.
Convert to XML Use Apple's plutil or my plusutil to convert each nib file from a binary property list to proper XML.
plutil -convert xml1 filename.nib
Edit those XML files Once converted, open the now text-based XML files in TextEdit. Search for the NSWindowBacking key/value pair in each file. After that pair add
<key>NSWindowCollectionBehavior</key>
<integer>128</integer>
This tells the window that its behavior includes full size resizing. Save your changes and close the file.
Convert back to BPlist Convert your edited files back to a binary plist. Strictly speaking? This isn't a necessary step. It just pleases me aesthetically.
plutil -convert binary1 filename.nib
Run it With luck, your app now has full screen zooming support. Enjoy it. Make sure to back up the original app before replacing it with your edited version. And do not expect to upgrade this version, like, you know, ever.

Saturday, January 7, 2012

Remove Spotlight "developer" and "Web searches"

Here is a fix for removing the developer category from Spotlight.
  1. Go to ~/Library/Preferences/com.apple.spotlight.plist
  2. Open Terminal. You will need to convert the file to XML (from binary) so you can edit it in TextEdit. The command you need is plutil -convert xml1 ~/Library/Preferences/com.apple.spotlight.plist
  3. Open this file in TextEdit. Just before at the bottom, add the following:
    Code:
          <dict>
          <key>enabled</key>
          <false/>
          <key>name</key>
          <string>SOURCE</string>
      </dict>
    
  4. Convert the file back to binary using plutil -convert binary1 ~/Library/Preferences/com.apple.spotlight.plist
  5. Log out and back in again.

Monday, December 12, 2011

Set Safari's Default Size and Location

If you like to have Safari starts with a specific window size and location, put the below code in the address bar:
javascript:self.moveTo(120,75);self.resizeTo(1440,900);self.location="http://www.apple.com";

You must paste the code and hit enter, to save the window size and location, hit CTRL+T and close the old tab, this new tab must be the last one. Then close Safari (CTRL+Q) and re-open it.

My 13" MacBook Air is set to
javascript:self.moveTo(200,0);
self.resizeTo(1040,900);
self.location="http://www.apple.com";

Thursday, December 8, 2011

Mac: Find & Delete Specific File Type From The Terminal

Sometimes I'd like to find and delete temporary files, backup files, or any file type. This example will show you how to find and delete the LOG file from the terminal:


sudo find / -iname *.log -print0 | xargs -0 rm -frv {}


You will be prompted for your admin password.

Monday, November 28, 2011

Recover Memory On Mac OS X Lion For Free

Using the technique below I noticed significant gains, you can verify them aswell by opening the Activity Monitor.app, right clicking the icon in the Dock and setting it to show the Memory.
Keep an eye on the green part of the pie chart when the script runs.

First, select the text editor of your choice, I personally use Textmate, and create a new file:

mate ~/Library/LaunchAgents/org.itweak.purge.plist

For the bash novices the tilde (~) sign indicates your home directory, usually /Users/yourname

Copy/paste this code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>org.itweak.purge</string>
  <key>Program</key>
  <string>/usr/bin/purge</string>
  <key>StartInterval</key>
  <integer>3600</integer>
</dict>
</plist>

Save the file (CMD+S will suffice) and close the editor.

What we just did is to build a plist file that instructs our system to run the value of the Program key (/usr/bin/purge) every 3600 seconds.

Open up a Terminal and write this:

launchctl load -w ~/Library/LaunchAgents/org.itweak.purge.plist

Now, this job will run every hour, you can tweak the number of seconds by changing the StartInterval integer number (in seconds) and it will free up your memory, you said it, for free.

To stop it:

launchctl unload -w ~/Library/LaunchAgents/org.itweak.purge.plist

A downside of this is that the purge command will kinda freeze your mac for few seconds when it runs. It can be annoying at times.

Monday, November 21, 2011

Parallels Desktop 7 VMWare Offer


http://www.parallels.com/products/desktop/vmwareoffer/

Tuesday, November 15, 2011

Mac OS X Lion Keyboard Shortcuts


Mac OS X Lion Keyboard Shortcuts

All these Mac OS X Lion shortcuts work in the Finder, and many work in other programs you find in Mac OS X Lion, as well. Want to know how to make these shortcuts second nature? Print out this chart and tape it to your monitor where you'll see it while using Mac OS X Lion.
CommandKeyboard Shortcut
Add Selected Item to SidebarCommand+T
Close All WindowsOption+Command+W
Close WindowCommand+W
CopyCommand+C
CutCommand+X
DashboardF12 (fn+F12 on laptops)
DuplicateCommand+D
Eject DiskCommand+E
Empty TrashShift+Command+Delete
FindCommand+F
Get Info (on selected item or items)Command+I
Go to All My FilesShift+Command+F
Go to Applications FolderShift+Command+A
Go to DesktopShift+Command+D
Go to Home FolderShift+Command+H
HelpShift+Command+?
Hide Current ApplicationCommand+H
Log Out Current UserShift+Command+Q
Make AliasCommand+L
Minimize WindowCommand+M
Mission Control: All WindowsControl+Up Arrow (F3 on Apple keyboards)
Mission Control: Application WindowsControl+Down Arrow (Control+F3 on Apple keyboards)
Mission Control: Show DesktopF11 (fn+F11 on laptops) (Command+F3 on Apple keyboards)
Move to TrashCommand+Delete
Empty TrashShift+Command+Delete
New Finder WindowCommand+N
New FolderShift+Command+N
New Smart FolderOption+Command+N
Next WindowCommand+`
OpenCommand+O
Open InspectorOption+Command+I
PasteCommand+V
Quick Look (at selected item)Command+Y or Spacebar
Select AllCommand+A
Show Original (of selected alias)Command+R
Show View OptionsCommand+J
Show/Hide SidebarOption+Command+S
Show/Hide DockOption+Command+D
Show/Hide Status BarCommand+/
Turn VoiceOver On/OffCommand+F5 (fn+F5 on laptops)
Turn Zoom On/OffOption+Command+8
UndoCommand+Z
View Window as IconsCommand+1
View Window as ListCommand+2
View Window as ColumnsCommand+3
View Window as Cover FlowCommand+4