Skip to main content

Posts

Showing posts from December, 2011

site-wide bbPress forum for buddyPress

BuddyPress claims to be able to offer site-wide forums without being group-specific. However, when I install site-wide forums, nothing on my site changes. The “Forums” link doesn’t appear, and if I navigate to /forums, there’s nothing available. In the bbPress settings, the “forums base” is set at “forums”, which then gives a message of “Possible BuddyPress conflict: Forums page”. This is how it is with a fresh install of bbPress and buddyPress and without changing any options. To solve the problem, do the following.  go to your settings | forums (on the bottom) You’ll see archive slug and Single Slugs. rename both "forum base" and "forum slug". Because they are actually conflict with the sitewide forum. Go to "Forums" and make a new forum. Copy the forum's link. Suppose the link is  http://buddy.i88.ca/bbs/bbs-slug/general-discussion Go to the Appearance | Menus section.  Create a custom menu.  In this custom menu, add a custom link to it. This custom link li…

Chitika pays you to use its Maps

Mark it. May use it if I need it in the future.

From
Chitika's website:
We’ll Pay You to Use Our Maps. Chitika provides a profitable solution for publishers looking for alternative map providers. Users can opt to include ads within the map units, helping to further monetize traffic on their site. Chitika Maps gives you the opportunity to tap into a new revenue stream!Our maps include a variety of features not available with other map services, including:Ability to monetize your map with integrated ad pinsUnlimited UsageHourly Location UpdatesDirections (coming soon!)

FACELETS_SKIP_COMMENTS "trick" in NetBeans JSF project

When we create a JSF application in NetBeans, .FACELETS_SKIP_COMMENTS is
false.
This will execute those comments in your facelets.
If this is not what you want, set it to true in web.xml:<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>

Google analytic profile id usage example

For OLD VERSION analytics page, the ID=xxxxxxxx is the profile ID
https://www.google.com/analytics/reporting/?reset=1&id=XXXXXXXX&pdr=20110702-20110801

For the NEW VERSION analytic page it is the number at the end of the ERL starting with p
https://www.google.com/analytics/web/#home/a11345062w43527078pXXXXXXXX/

An example to use the profile Id in the Analytics API:

//Building an API query
        Get apiQuery = analytics.data().ga().get(
                "ga:54014919",//TABLE_ID, // "ga:" + Profile Id.
                "2011-09-01", // Start date.
                "2011-09-30", // End date.
                "ga:visits,ga:pageviews");      // Metrics.

        apiQuery.setDimensions("ga:source,ga:medium");
        apiQuery.setFilters("ga:medium==referral");
        apiQuery.setSort("-ga:visits");
        apiQuery.setSegment("…

Using property file with GlassFish

One way:URL url = this.getClass().getResource("/api.properties");
Properties p = new Properties();
p.load(new FileInputStream(new File(url.getFile())));The other way:InputStream in =
this.getClass().getClassLoader().getResourceAsStream("/api.properties");
Properties properties = new Properties();
properties.load(in);I put the property file api.properties under the resource folder in
NetBean web application project.

Email campaign with Google Analytics Example

First step: create a web page as a destination web page. put your Google Analytics tracking code in that page.


use Tool: URL Builder to tag the url


redirect the root path to sub directory using Apache redirect

The following shows how I redirect the root path to sub directory using Apache redirect
Put the following under your html root folder's .htaccess file
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?i88.ca$
RewriteCond %{REQUEST_URI} !^/yourSubDirectory1/yourSubDirectory2/
# The following does not redirect on existing file and directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# It defaults to temporary if you don't specify permanent
RewriteRule ^(.*)$ /yourSubDirectory1/yourSubDirectory2/$1 [R=permanent,L]
RewriteCond %{HTTP_HOST} ^(www.)?i88.ca$
RewriteRule ^(/)?$ yourSubDirectory1/yourSubDirectory2/index.php [L]

Wordpress installation: multi language support

To install Wordpress with multi-language support, we need to set up wordpress database to support multi-language.
So before Openwp-admin/install.phpin your browser,  make sure your wp-config.php has the following setting:

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', 'utf8_general_ci');

Search the following:
define ('WPLANG', '');
    Edit this line according to the .mo file you've just downloaded, e.g. for the Portuguese spoken in Brazil you must add:

define ('WPLANG', 'pt_BR'); For simplified Chinese, it is:
define ('WPLANG', 'zh_CN');
Openwp-admin/install.phpin your browser.

WHAT IS THE DIFFERENCE BETWEEN A PARKED DOMAIN AND AN ADD-ON DOMAIN?

Parked Domain You have two domainsmysite.comandmy-other-site.com.mysite.comis the domain of your website and you want to addmy-other-site.com.You want them both to go to thesame place. In other words, when someone types eitherwww.mysite.comorwww.my-other-site.comthey will go to thesamepage(s) on your website.Add-On Domains You have two domainsmysite.comandmy-other-site.com.You want the two domains to betotally separate/independentwebsites.For one account, multiple domains, if mysite.com is your main domain. my-other-site.com can be setup on public_html/marrycomhomefolder or any other folder name. While setting up an Addon domain, you can specify the folder name, folder location. If user visits mysite.com/my-other-site-folder directly then it will show the same site too. We can use .htaccess file to allow only my-other-site to visit its folder.edit .htaccess file in your my-other-site-root-folderRewriteEngine On
RewriteCond %{HTTP_HOST} !=my-other-site.com
Rewrite…

Path in Java 7

with Java 7 : Path path =FileSystems.getDefault().getPath(".", "tweet.txt"); To make the migration from earlier Java version easier, the File class has a new method toPath() that allows you to transform File to Path : Path path =newFile(