วันพฤหัสบดีที่ 30 กรกฎาคม พ.ศ. 2558

Broadcom wifi

http://www.broadcom.com/support/?gid=1
http://community.linuxmint.com/tutorial/view/379

วันพุธที่ 29 กรกฎาคม พ.ศ. 2558

AAAR

http://fcorti.com/2014/01/03/how-to-install-pentaho-data-integration-5-kettle/

How to install Pentaho Data Integration 5 (aka Kettle)


http://fcorti.com/alfresco-audit-analysis-reporting/aaar-how-to-install/aaar-prerequites/

A.A.A.R. – Prerequisites

How to install Pentaho Business Analytics platform 5

http://fcorti.com/2014/01/07/how-to-install-pentaho-business-analytics-platform-5/

http://fcorti.com/alfresco-audit-analysis-reporting/aaar-description-of-the-solution/aaar-alfresco/


วันอาทิตย์ที่ 26 กรกฎาคม พ.ศ. 2558

Concrete5

Converting an HTML Template to a concrete5 Theme
https://www.youtube.com/watch?v=vQm1QXN9OfI

Multilingual concrete5
https://www.youtube.com/watch?v=gzZs3m-PSVA
https://www.youtube.com/watch?v=bZIqxGAS1FE

วันศุกร์ที่ 24 กรกฎาคม พ.ศ. 2558

How To Set Up Mod_Rewrite from https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite


How To Set Up Mod_Rewrite

Tags: Apache Distribution: Ubuntu

About Mod_Rewrite

Think about the last time you visited some shopping website, looking for that one specific thing you needed to buy. When you finally reached the page, the URL most likely looked something like this:
gizmo.com/latest_and_greatest/specific_gadgets/exactly_what_youre_looking_for
This is not because this website took the time to set up every single directory you would need to make your purchase, but because of a handy module called Mod_Rewrite. Mod_Rewrite allows you to make custom and simplified URLs as needed. In reality, the actual URL may have looked closer to this:
http://www.gizmo.com/gp/itemB004RYVI0Q/ref=as_li_ss_tl?
This tutorial will go over Activating Mod_Rewrite, Creating and Using the required .htaccess page, and setting up the URL rewrites.

Contents

  1. How to Activate Mod_Rewrite
  2. How to Create and Allow the Use of the .htaccess file
  3. How to Use Rewrite Rules
  4. How to Use the Rewrite Cond Directive
  5. Resources

Setup

The steps in this tutorial require the user to have root privileges. You can see how to set that up on Ubuntuhere, in steps 3 and 4.
Additionally, you need to have apache installed on your server. If you do not have it, you can download it for Ubuntu with this command:
sudo apt-get install apache2

Section 1—How to Activate Mod_Rewrites

Before we begin generating the actual URL rewrites, we need to activate the apache mod_rewrite module that controls them. This is simple:
sudo a2enmod rewrite
The command activates the module or—if it is already activated, displays the words, "Module rewrite already enabled"

Section 2—About the .htaccess File:

Once the module has been activated, you can set up your URL rewrites by creating an .htaccess file in your website directory.
An .htaccess file is a way to configure the details of your website without needed to alter the server config files. The period that starts the file name will keep the file hidden within the folder.
Additionally the placement of the .htaccess file is important. The configurations in that file will affect everything in its directory and the directories under it.
You can create the .htaccess file in a text editor (make sure to name it only .htaccess without any other extension or name) and then upload it to your site through an ftp client.
Alternatively you can use this command, replacing the example.com with the name of your site, to create your .htaccess file in terminal.
sudo nano /var/www/example.com/.htaccess

How to permit changes in the .htaccess file:

To allow the .htaccess file to override standard website configs, start by opening up the configuration file. NB: You will need sudo privileges for this step.
sudo nano /etc/apache2/sites-available/default
Once inside that file, find the following section, and change the line that says AllowOverride from None to All. The section should now look like this:
 
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
 
After you save and exit that file, restart apache. .htacess files will now be available for all of your sites.
sudo service apache2 restart
Now you are all set up to rewrite your site’s URLs.

Section 3—How to Rewrite URLS

The entire URL rewriting operation takes place within the .htaccess file.
Overall, all of the URL rewrite commands follow the same pattern:
 RewriteRule Pattern Substitution [OptionalFlags]
Here is a short explanation of each part:
  • RewriteRule: This is the section in which you can write in the name of the the mod_rewrite directive that you want to use.
  • Pattern: This section is dedicated to interpreting the requested URL, using regular expressions. This tutorial does not include a discussion of regular expressions, but you can find a useful tutorial on the subject here.
  • Substitution: This is the actual URL of the page with the information we want to display. It may be hard to remember or confusing because of php paremeters or long strings of numbers. eg. www.cityzoo.com/animals.php?mammals=seals
  • Optional Flags: A flag is a tag at the end of the Rewrite Rule directive that may change the behavior of of the expression. Some common flags include [F], making the URL forbidden, [NC], forcing the rule to disregard capitalization, [R=301] or [R=302], controlling the redirect code you want to use, [L] indicating that this is the last rule in a series.

Three URL Rewrite Examples:

Example 1: Go to Page A, find page B:
This is the most basic example for a URL rewrite: a visitor to the site types one URL into the browser but is redirected to another. Here is how to set it up.
Lets go ahead and make two separate pages on for a site—say, one for Apples (apples.html) and one for Oranges (oranges.html):
Copy the code into the Apple page:

  
    Apples
  
  
    

This page is about Apples

After that, can make the orange page, substituting all the fruit names to refer to the appropriate one.
Now open up the .htaccess file.
sudo nano /var/www/example.com/.htaccess
Add the following URL rewrite commands to the file:
RewriteEngine on
RewriteRule ^oranges.html$ apples.html
Save and exit.
Once everything is in place, visit the site ending in "/oranges.html"— all of the information displayed will come from the "/apple.html" site.
Now for an explanation:
  • ^oranges.html: this refers to how the page starts. The caret (^) signifies the beginning of a string. In other words-- if the page whose URL we wanted to rewrite began with anything but oranges (eg.navel_oranges.html), it would not be recognized by the rewrite rule, and it would not redirect to apples.html.
  • $: the dollars sign refers to the URL's end. If there is anything else after the last characters in the string, the web page would be equally unrecognizable by the rewrite rule.
  • apples.html: this is where the browser is actually directing traffic.
Example 2: The website has a parameter in its URL. How to make it look like a subdirectory.
The first example referred to a site that simply needed to be substituted with another one. The instance below, however, addresses a common scenario that can be seen when there is a parameter in the url.
Check out this URL:
http://example.com/results.php?products=apple
It would be much clearer displayed as:
 http://example.com/products/apple
The lines within the .htaccess file would look like this:
RewriteEngine on
RewriteRule ^products/([A-Za-z0-9-]+)/?$ results.php?products=$1 [NC]
Now for an explanation:
  • ^products: In order to be caught and rerouted, the URL must start with products (keep in mind that this only refers to the text after the domain name). Should it begin with anything else, the rule will not apply and the URL will stay the same.
  • ([A-Za-z0-9-]+): The content within the parentheses refers to any information that could be typed into the URL. In other words, the URL will be rewritten to reflect whatever a visitor to the site inputs after /products/.
  • +: The plus sign indicates what is in the brackets can be one or more characters (as opposed to, say, a single character that is either a letter or a number).
  • /?$: the dollar sign points out the end of the string. The question mark allows the last character in the string to be a forward slash (although it does not require it).
  • results.php?products=$1: the $1 indicates where the string from the pattern should go. In other words, it will put in the information captured from whatever people wrote in the "([A-Za-z0-9-]+):" part. After the process completes, the browser will display the information from the second URL
  • [NC]: this is a flag at the end of the phrase, indicating that the rule should ignore the cases of all of the characters in the string.
Example 3: The site has an unwieldy URL. How to clean it up
This sort of situation can arise when URLs are long and complex.
Take the URL below as an example:
http://example.com/results.php?products=produce&type=fruit&species=apple
As effective as the URL is in delivering the correct content, it is not very memorable for the consumer. URL rewrites would allow you to convert the URL to something simpler and clearer:
http://example.com/produce/fruit/apple
In order to accomplish this, we would need the following lines in our .htaccess file (you can add as many section as needed in the .htaccess file):
RewriteEngine on
RewriteRule ^(meat|produce|dairy)/([^/.]+)/([^/.]+)$ results.php?products=$1&type=$2&species=$3
Now for an explanation:
  • First the ^(caret) starts the expression.
  • (meat|produce|dairy): If we want to limit the options that can be typed in, we can specify the only values we will accept: in this case the variety of groceries. If anything besides one of those three 3 keywords is typed in, the URL rewrite will not take place.
  • The ([^/.]+) indicates that anything can be written between the forward slash besides the characters following the caret, in this case, the forward slash or period.
  • results.php?products=$1&type=$2&species=$3: Each value in the parentheses will be extracted and then applied to the longer URL in the substitution part of the expression. $1 indicates the first parantheses, $2, the second, $3, the third.

Rewrite Conditions

The three examples on the previous page showed how to rewrite URLs to make sites easier to access and remember.
Rewrite Rules can also have conditions to make sure that the rewrites only take place under specific circumstances.
Example 1: How To Prevent Hotlinking
Hotlinking is the process of using an image or object from one server on another one. This action drains bandwidth from the victim's server and denies the creator of the object any additional visitors to their site that they might have gained otherwise.
You can prevent hotlinking by redirecting all the links to an object on your site to some other less pleasant image, or by forbidding the operation altogether.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/.*$ [NC]
RewriteRule .*\.(gif|jpeg|png)$ http://www.example.com/unpleasantness.jpg [R,NC,L]
Now for an explanation:
  • %{HTTP_REFERER}: this refers to where the traffic is coming from. The percent sign indicates that it is an apache variable.
  • !: the exclamation mark negates the pattern following it. In effect, this points out that whatever follows it does not fall under the conditions required to be affected by the rewrite rule.
  • ^$: As mentioned earlier, the caret stands for the beginning of a string and dollar sign for the end of it. In this case, there is nothing between them and therefore the referrer does not exist. In other words, this line states that direct links are not affected by the rewrite rule.
  • The second condition references the referrer once again.
  • !^http://(www\.)?example\.com/.*$: the exclamation point states that the referrer should not be the our own site
  • Finally we get to the rewrite rule itself which states that any link to a file ending with the extensions gif, jpeg, or png will be rerouted to some unpleasant picture to teach hotlinker a lesson. If we simply wanted to forbid them from accessing any image at all, we can make a small edit to the RewriteRule in the last line. Instead of providing an alternative destination, as this line does, you can instead just send the rewrite to a forbidden page:
    RewriteRule .*\.(gif|jpeg|png)$ - [F]
Example 2: How to add www to a URL
Another useful trick that mod_rewrite can do is add www to a domain. Although it’s easy for a person to see that example.com and www.example.com are the same site, search engines register them as duplicates, hurting their rankings.
To resolve the issue you can choose to either consistently remove the www or always have it added to the URL. This example will show how to be sure that the www is always attached.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301]
Now for an explanation:
  • %{HTTP_HOST}: this refers the website in the requested URL
  • ^example.com$: explains that the requested page needs to be example.com
  • ^(.*)$ :The rewrite rule says that any text after can follow the domain.
  • [R=301]: The flag denotes that the URL as being redirected, and the 301 points out that this is a permanent redirect. A temporary one is designated with the number 302.
Everything will then convert from example.com to www.example.com
Example 3: Blocking a Specific IP Address
This a useful tool to prevent, for example, malicious parties at specific IP addresses from accessing a site.
RewriteCond %{REMOTE_ADDR} ^(12\.34\.56\.789)$
RewriteRule (.*) - [F,L]
Now for an explanation:
  • %{REMOTE_ADDR}: This stands for the IP address from which our site is being accessed and which we want to block.
  • ^(12\.34\.56\.789)$: You can use this section to type in the malicious IP address. Keep in mind that the backslashes are very important. They designate the periods as punctuation, instead of their standard regular expression use as wildcards.
  • (.*): This signifies that any text from the blocked IP will result in the rewrite rule being completed.
  • [F,L]: the flags finish off the rule. [F] forbids access and [L] stops any other rules from applying, making it the last rule.

Resources

The previous sections have been a basic overview of the capabilities of Mod_Rewrite.
The topic is quite expansive and has many nuances that can make it a very useful and flexible tool.
Here are some links for further information about Mod_Rewrite:

วันพฤหัสบดีที่ 23 กรกฎาคม พ.ศ. 2558

odoo port 8069

https://www.odoo.com/forum/help-1/question/how-to-change-port-8069-to-another-port-in-openerp-6-1-geoengine-34721
If you want to access on port 80 or 443 (SSL) to avoid the port numbers entirely, you may want to take a different approach. Port 80 can be done by leaving OpenERP running at 8069, then adding in an iptables rule to forward traffic from 80 to 8069. This bash script does the trick for me, just make sure you change eth0 if needed:
#!/bin/bash
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8069
iptables-save
If you want to run on HTTPS using port 443, I'd recommend a reverse proxy running outside of OpenERP for that. This is a pretty solid guide that I've used to set that up: http://www.vionblog.com/openerp-reverse-proxy-using-nginx-server/

iptables rules


http://ubuntuforums.org/showthread.php?t=1164682

For example if you wanted to save the rules to /etc/iptables.rules then you would type this:
Code:
sudo iptables-save > /etc/iptables.rules
If you want to restore that file you just have it do the reverse like this:
Code:
sudo iptables-restore < /etc/iptables.rules

วันจันทร์ที่ 6 กรกฎาคม พ.ศ. 2558

Alfresco portforwarding

1.Alfresco: redirect to HTTP port 80

https://capens.net/content/alfresco-redirect-http-port-80


By default, Alfresco or any other Tomcat application will run on HTTP port 8080. Because of this, users would need to go to, for example, http://alfresco:8080/share to reach the Alfresco Share website.
We can make this easier by configuring Apache proxy_ajp which will redirect port 80 to Tomcat and will make the "/share" path optional.
Install Apache and enable the necessary modules:
apt-get install apache2
a2enmod proxy_ajp rewrite
Create a virtualhost configuration file at /etc/apache2/sites-available/alfresco-reverse-proxy with the following content:
 *:80>
    ServerName alfresco

    ErrorLog "/var/log/apache2/alfresco-error.log"
    CustomLog "/var/log/apache2/alfresco-access.log" common

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/alfresco*
    RewriteCond %{REQUEST_URI} !^/share*
    RewriteRule /(.*)$ /share$0 [R]

    ProxyPass /alfresco ajp://localhost:8009/alfresco
    ProxyPassReverse /alfresco ajp://localhost:8009/alfresco

    ProxyPass /share ajp://localhost:8009/share
    ProxyPassReverse /share ajp://localhost:8009/share
Disable the default website (if necessary), enable the proxy and restart Apache:
a2dissite 000-default
a2ensite alfresco-reverse-proxy
/etc/init.d/apache2 restart
That's it! Users can now simply type "alfresco" in their browser's address bar and will automatically be redirected to Alfresco Share.
Alfresco will still create links which point to port 8080 though (for example in e-mail notifications), so you should edit /opt/alfresco-4.2.b/tomcat/shared/classes/alfresco-global.properties and set:
alfresco.port=80
share.port=80
Note that administrators can still manage Tomcat using http://alfresco:8080
Finally, you should edit /opt/alfresco-4.2.b/tomcat/conf/server.xml and enable UTF-8 encoding on the AJP connector as following:

 port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" />
Without this, special characters (non-ascii characters such as é and â) will get mangled in the search forms.

2.  Register  your internal ip address with no.ip.com
Mapping "ranotech.ddns.net"  to your  dynamic ip address from the provider say "134.xxx.xxx.xxx"

alfresco-reverse-proxy.conf

    ServerName alfresco
    ErrorLog "/var/log/apache2/alfresco-error.log"
    CustomLog "/var/log/apache2/alfresco-access.log" common
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/alfresco*
    RewriteCond %{REQUEST_URI} !^/share*
    RewriteRule /(.*)$ /share$0 [R]
    ProxyPass /alfresco ajp://localhost:8009/alfresco
    ProxyPassReverse /alfresco ajp://localhost:8009/alfresco
    ProxyPass /share ajp://localhost:8009/share
    ProxyPassReverse /share ajp://localhost:8009/share


global-properties
###############################
## Common Alfresco Properties #
###############################

dir.root=/var/www/html/alfresco/alf_data

alfresco.context=alfresco
alfresco.host=ranotech.ddns.net
alfresco.port=80
alfresco.protocol=http

share.context=share
share.host=ranotech.ddns.net
share.port=80
share.protocol=http

### database connection properties ###
db.driver=org.postgresql.Driver
db.username=alfresco
db.password=1234
db.name=alfresco
db.url=jdbc:postgresql://localhost:5433/${db.name}
# Note: your database must also be able to accept at least this many connections.  Please see your database documentation for instructions on how to configure this.
db.pool.max=275
db.pool.validate.query=SELECT 1

# The server mode. Set value here
# UNKNOWN | TEST | BACKUP | PRODUCTION
system.serverMode=UNKNOWN

### FTP Server Configuration ###
ftp.port=21

### RMI registry port for JMX ###
alfresco.rmi.services.port=50500

### External executable locations ###
ooo.exe=/var/www/html/alfresco/libreoffice/program/soffice
ooo.enabled=true
ooo.port=8100
img.root=/var/www/html/alfresco/common
img.dyn=${img.root}/lib
img.exe=${img.root}/bin/convert
swf.exe=/var/www/html/alfresco/common/bin/pdf2swf
swf.languagedir=/var/www/html/alfresco/common/japanese

jodconverter.enabled=false
jodconverter.officeHome=/var/www/html/alfresco/libreoffice
jodconverter.portNumbers=8100

### Initial admin password ###
alfresco_user_store.adminpassword=7ce21f17c0aee7fb9ceba532d0546ad6

### E-mail site invitation setting ###
notification.email.siteinvite=true

# Sample Gmail settings
mail.host=smtp.gmail.com
mail.port=465
mail.username=somsakvrp@gmail.com
mail.password=2veeraphan
mail.protocol=smtps
mail.smtps.starttls.enable=true
mail.smtps.auth=true

### License location ###
dir.license.external=/var/www/html/alfresco



### Solr indexing ###
index.subsystem.name=solr4
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443

### BPM Engine ###
system.workflow.engine.jbpm.enabled=false

### Allow extended ResultSet processing
security.anyDenyDenies=false