[sourcerank] switch places for symlink and actual file for README
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sourcerank] switch places for symlink and actual file for README
- Date: Mon, 11 Apr 2011 13:49:15 +0000 (UTC)
commit 0a65aa297c423945386e47367f8f8f44c78aa9a5
Author: �yvind Kolås <pippin linux intel com>
Date: Mon Apr 11 14:48:48 2011 +0100
switch places for symlink and actual file for README
Making cgit a little bit happier
README | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/README.c | 195 +---------------------------------------------------------
2 files changed, 195 insertions(+), 195 deletions(-)
---
diff --git a/README b/README
deleted file mode 120000
index 08286cd..0000000
--- a/README
+++ /dev/null
@@ -1 +0,0 @@
-src/README.c
\ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 0000000..968ab58
--- /dev/null
+++ b/README
@@ -0,0 +1,194 @@
+ /*
+SourceRank - a trend monitoring service *
+====================================== *
+ *
+SourceRank allows monitoring trends for using the sources of items that a user*
+is acting upon over time. This allows "smart" allocaiton of space and sorting*
+of items when showing a selection of a bunch items. This document is a *
+tutorial for using the C bindings to the DBUS service provided by SourceRank. */
+
+
+#include <sourcerank.h>
+#include <glib-object.h>
+ /*
+Utility function to generate ressed as a 64 bit integer like tv_sec of *
+ timeval / GTimeVal, to simplify code we'll use a utility function.. */
+static glong timestamp (const char *string)
+{
+ GTimeVal timeval;
+ g_time_val_from_iso8601 (string, &timeval);
+ return timeval.tv_sec;
+}
+ /*
+We will operate on an engine called ENGINE, all commands for sourcerank *
+operate on named isolated engines, the engines are created on demand. */
+
+#define ENGINE "sourcerank-README-test"
+ /*
+Let's add some items that sourcerank keeps track of, sourcerank is designed to*
+be used with strings acting as unique identifiers, URIs are a good example of *
+such strings. *
+ *
+The daemon for sourcerank is automatically started upon first use, changes are *
+batched up and saved periodically to a gzipped custom text file format. */
+
+int
+main (int argc, char **argv)
+{
+
+ g_type_init (); /* must be done before initializing sourcerank */
+ sr_init (); /* initialize sourcerank */
+
+ /*
+Add a set of items to be managed, in two different sources for our engine. */
+
+ sr_add_item (ENGINE, "http://some.blog/blog.rss",
+ "http://some.blog/?14", timestamp ("2011-11-09T"));
+ sr_add_item (ENGINE, "http://some.blog/blog.rss",
+ "http://some.blog/?15", timestamp ("2011-10-08T"));
+ sr_add_item (ENGINE, "http://some.blog/blog.rss",
+ "http://some.blog/?16", timestamp ("2011-08-02T"));
+ sr_add_item (ENGINE, "http://some.blog/blog.rss",
+ "http://some.blog/?17", timestamp ("2011-08-01T"));
+ sr_add_item (ENGINE, "http://other.blog/blog.rss",
+ "http://other.blog/?12", timestamp ("2011-08-02T"));
+ sr_add_item (ENGINE, "http://other.blog/blog.rss",
+ "http://other.blog/?13", timestamp ("2011-08-02T"));
+
+ /*
+You can make an item belong to multiple sources by doing multiple add calls. */
+
+ sr_add_item (ENGINE, "http://aggregate.of.blogs/feed.rss",
+ "http://some.blog/?16", timestamp ("2010-08-02T"));
+
+ /*
+Let's define a macro to show the first few items in our list. */
+
+#define LIST_ITEMS(title, count) { \
+ char **items; \
+ g_print ("\n--------[%s]----------\n", title); \
+ items = sr_list_items (ENGINE, count); \
+ for (int i = 0; items && items[i]; i++) \
+ g_print ("%s %s\n", sr_item_is_consumed (items[i])?" ":"NEW ",\
+ items[i]); \
+ g_strfreev (items); /* frees an array of string pointer and the array */ \
+ }
+
+ LIST_ITEMS("items added", 4); /*
+
+--------[items added]----------
+NEW http://some.blog/?16
+NEW http://other.blog/?13
+NEW http://some.blog/?14
+NEW http://other.blog/?12 */
+ /*
+This is a GList of allocated gchar * strings, the order and ratio of selection*
+from the various sources is altered/determined by the karma collected through *
+items. The first part, consisting of likable uncomsumed items is called the *
+"summary", following the summary is a "backlog" of both consumed and *
+unconsumed items. *
+ *
+When an item is positively interacted with a little amount, perhaps hovering *
+it to expand or otherwise indicating interest in the item, a bit of karma can *
+be left on the item. */
+
+ sr_add_karma ("http://some.blog/?16", 0.1); /* sources with no karma
+ get high karma due to
+ novelty, so lets add
+ a little */
+ sr_add_karma ("http://other.blog/?12", 1.0);
+ /*
+When an item is opened for reading a bigger amount of positive karma is *
+appropriate. Karma for opening/consuming an item should be given before *
+calling sr_item_consume() to make the karma count for unconsumed sorting. */
+
+
+ LIST_ITEMS("karma modified", 4); /*
+ *
+--------[karma modified]---------- *
+NEW http://other.blog/?13 *
+NEW http://other.blog/?12 *
+NEW http://some.blog/?16 *
+NEW http://some.blog/?14 */
+
+
+
+ sr_item_consume ("http://some.blog/?16"); /* consume item */
+ sr_add_karma ("http://other.blog/?12", 1.0);
+ sr_item_consume ("http://other.blog/?12"); /* consume item */
+
+ LIST_ITEMS("items consumed", 4); /*
+-------[items consumed]---------- *
+NEW http://other.blog/?13 *
+NEW http://some.blog/?14 *
+ http://other.blog/?12 *
+ http://some.blog/?16 */
+
+ g_print ("\n\n");
+ /*
+When items that are already consumed are given karma, the karma is primarily *
+affecting the ordering/ratios in the backlog. */
+ sr_add_karma ("http://some.blog/?15", 0.4);
+
+ /*
+Karma is not tied to the items but is stored and relates to the various *
+sources, for some tasks adding karma directly on the sources is preferable. */
+ sr_add_karma ("http://some.blog/feed.rss", 0.4);
+
+ /*
+The behavior of sourcerank can be configured on a per engine basis, *
+Only the primary application consuming sourcerank sorted lists should be *
+tweaking the configuration to avoid it changing erratically, re-setting the *
+configuration at each launch is not a problem. *
+ *
+The following reflects default engine configuration: *
+ *
+how many percent of listed items should be summary items */
+ sr_configure (ENGINE, "summary-ratio", 0.5);
+
+ /*
+show at least one item from each should be summary items */
+ sr_configure (ENGINE, "full-summary", 1.0);
+ /*
+amount of mixin of consumed karma for unconsumed items */
+ sr_configure (ENGINE, "consumed-mixin", 0.0);
+ /*
+amount of mixin of unconsumed karma for consumed items, set this *
+and previous to 1.0 to remove distinction between consumed/unconsumed karma */
+ sr_configure (ENGINE, "unconsumed-mixin", 0.0);
+
+ /*
+value from 0.0-1.0 indicating how important scaling down far away times *
+in the day/week are. This enables sensing temporal context for time of day */
+ sr_configure (ENGINE, "time-of-day-importance", 0.0);
+ sr_configure (ENGINE, "time-of-week-importance", 0.0);
+ /*
+How long data is kept in the system, items older than this are dropped from *
+the database. */
+ sr_configure (ENGINE, "days-to-keep-items", 30.0);
+ sr_configure (ENGINE, "days-to-keep-karma", 30.0);
+ /*
+Automagic is designed to be used as an external tool for ordering the list of *
+unique item ids. It is however also possible to store string based key/value *
+pairs on items, allowing to use sourcerank as the persistent data store used *
+for an RSS reader/blog post engine. */
+
+ sr_add_item (ENGINE, "foo", "id", 0);
+ sr_item_set_key ("id", "key", "value");
+
+ {
+ char *value = sr_item_get_key ("id", "key");
+ g_print ("id key = %s\n", value);
+ g_free (value);
+ g_print ("\n");
+ }
+
+ /*
+Free up all the test data we've added */
+ sr_engine_remove (ENGINE);
+ /*
+Look at src/sourcerank-dump.c which contains source to dump all item *
+data in all engines for how to use most of the rest of the API *
+ */
+ return 0;
+}
diff --git a/src/README.c b/src/README.c
deleted file mode 100644
index 968ab58..0000000
--- a/src/README.c
+++ /dev/null
@@ -1,194 +0,0 @@
- /*
-SourceRank - a trend monitoring service *
-====================================== *
- *
-SourceRank allows monitoring trends for using the sources of items that a user*
-is acting upon over time. This allows "smart" allocaiton of space and sorting*
-of items when showing a selection of a bunch items. This document is a *
-tutorial for using the C bindings to the DBUS service provided by SourceRank. */
-
-
-#include <sourcerank.h>
-#include <glib-object.h>
- /*
-Utility function to generate ressed as a 64 bit integer like tv_sec of *
- timeval / GTimeVal, to simplify code we'll use a utility function.. */
-static glong timestamp (const char *string)
-{
- GTimeVal timeval;
- g_time_val_from_iso8601 (string, &timeval);
- return timeval.tv_sec;
-}
- /*
-We will operate on an engine called ENGINE, all commands for sourcerank *
-operate on named isolated engines, the engines are created on demand. */
-
-#define ENGINE "sourcerank-README-test"
- /*
-Let's add some items that sourcerank keeps track of, sourcerank is designed to*
-be used with strings acting as unique identifiers, URIs are a good example of *
-such strings. *
- *
-The daemon for sourcerank is automatically started upon first use, changes are *
-batched up and saved periodically to a gzipped custom text file format. */
-
-int
-main (int argc, char **argv)
-{
-
- g_type_init (); /* must be done before initializing sourcerank */
- sr_init (); /* initialize sourcerank */
-
- /*
-Add a set of items to be managed, in two different sources for our engine. */
-
- sr_add_item (ENGINE, "http://some.blog/blog.rss",
- "http://some.blog/?14", timestamp ("2011-11-09T"));
- sr_add_item (ENGINE, "http://some.blog/blog.rss",
- "http://some.blog/?15", timestamp ("2011-10-08T"));
- sr_add_item (ENGINE, "http://some.blog/blog.rss",
- "http://some.blog/?16", timestamp ("2011-08-02T"));
- sr_add_item (ENGINE, "http://some.blog/blog.rss",
- "http://some.blog/?17", timestamp ("2011-08-01T"));
- sr_add_item (ENGINE, "http://other.blog/blog.rss",
- "http://other.blog/?12", timestamp ("2011-08-02T"));
- sr_add_item (ENGINE, "http://other.blog/blog.rss",
- "http://other.blog/?13", timestamp ("2011-08-02T"));
-
- /*
-You can make an item belong to multiple sources by doing multiple add calls. */
-
- sr_add_item (ENGINE, "http://aggregate.of.blogs/feed.rss",
- "http://some.blog/?16", timestamp ("2010-08-02T"));
-
- /*
-Let's define a macro to show the first few items in our list. */
-
-#define LIST_ITEMS(title, count) { \
- char **items; \
- g_print ("\n--------[%s]----------\n", title); \
- items = sr_list_items (ENGINE, count); \
- for (int i = 0; items && items[i]; i++) \
- g_print ("%s %s\n", sr_item_is_consumed (items[i])?" ":"NEW ",\
- items[i]); \
- g_strfreev (items); /* frees an array of string pointer and the array */ \
- }
-
- LIST_ITEMS("items added", 4); /*
-
---------[items added]----------
-NEW http://some.blog/?16
-NEW http://other.blog/?13
-NEW http://some.blog/?14
-NEW http://other.blog/?12 */
- /*
-This is a GList of allocated gchar * strings, the order and ratio of selection*
-from the various sources is altered/determined by the karma collected through *
-items. The first part, consisting of likable uncomsumed items is called the *
-"summary", following the summary is a "backlog" of both consumed and *
-unconsumed items. *
- *
-When an item is positively interacted with a little amount, perhaps hovering *
-it to expand or otherwise indicating interest in the item, a bit of karma can *
-be left on the item. */
-
- sr_add_karma ("http://some.blog/?16", 0.1); /* sources with no karma
- get high karma due to
- novelty, so lets add
- a little */
- sr_add_karma ("http://other.blog/?12", 1.0);
- /*
-When an item is opened for reading a bigger amount of positive karma is *
-appropriate. Karma for opening/consuming an item should be given before *
-calling sr_item_consume() to make the karma count for unconsumed sorting. */
-
-
- LIST_ITEMS("karma modified", 4); /*
- *
---------[karma modified]---------- *
-NEW http://other.blog/?13 *
-NEW http://other.blog/?12 *
-NEW http://some.blog/?16 *
-NEW http://some.blog/?14 */
-
-
-
- sr_item_consume ("http://some.blog/?16"); /* consume item */
- sr_add_karma ("http://other.blog/?12", 1.0);
- sr_item_consume ("http://other.blog/?12"); /* consume item */
-
- LIST_ITEMS("items consumed", 4); /*
--------[items consumed]---------- *
-NEW http://other.blog/?13 *
-NEW http://some.blog/?14 *
- http://other.blog/?12 *
- http://some.blog/?16 */
-
- g_print ("\n\n");
- /*
-When items that are already consumed are given karma, the karma is primarily *
-affecting the ordering/ratios in the backlog. */
- sr_add_karma ("http://some.blog/?15", 0.4);
-
- /*
-Karma is not tied to the items but is stored and relates to the various *
-sources, for some tasks adding karma directly on the sources is preferable. */
- sr_add_karma ("http://some.blog/feed.rss", 0.4);
-
- /*
-The behavior of sourcerank can be configured on a per engine basis, *
-Only the primary application consuming sourcerank sorted lists should be *
-tweaking the configuration to avoid it changing erratically, re-setting the *
-configuration at each launch is not a problem. *
- *
-The following reflects default engine configuration: *
- *
-how many percent of listed items should be summary items */
- sr_configure (ENGINE, "summary-ratio", 0.5);
-
- /*
-show at least one item from each should be summary items */
- sr_configure (ENGINE, "full-summary", 1.0);
- /*
-amount of mixin of consumed karma for unconsumed items */
- sr_configure (ENGINE, "consumed-mixin", 0.0);
- /*
-amount of mixin of unconsumed karma for consumed items, set this *
-and previous to 1.0 to remove distinction between consumed/unconsumed karma */
- sr_configure (ENGINE, "unconsumed-mixin", 0.0);
-
- /*
-value from 0.0-1.0 indicating how important scaling down far away times *
-in the day/week are. This enables sensing temporal context for time of day */
- sr_configure (ENGINE, "time-of-day-importance", 0.0);
- sr_configure (ENGINE, "time-of-week-importance", 0.0);
- /*
-How long data is kept in the system, items older than this are dropped from *
-the database. */
- sr_configure (ENGINE, "days-to-keep-items", 30.0);
- sr_configure (ENGINE, "days-to-keep-karma", 30.0);
- /*
-Automagic is designed to be used as an external tool for ordering the list of *
-unique item ids. It is however also possible to store string based key/value *
-pairs on items, allowing to use sourcerank as the persistent data store used *
-for an RSS reader/blog post engine. */
-
- sr_add_item (ENGINE, "foo", "id", 0);
- sr_item_set_key ("id", "key", "value");
-
- {
- char *value = sr_item_get_key ("id", "key");
- g_print ("id key = %s\n", value);
- g_free (value);
- g_print ("\n");
- }
-
- /*
-Free up all the test data we've added */
- sr_engine_remove (ENGINE);
- /*
-Look at src/sourcerank-dump.c which contains source to dump all item *
-data in all engines for how to use most of the rest of the API *
- */
- return 0;
-}
diff --git a/src/README.c b/src/README.c
new file mode 120000
index 0000000..59a23c4
--- /dev/null
+++ b/src/README.c
@@ -0,0 +1 @@
+../README
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]