Tuesday, February 24, 2015

PHP - Fatal error: Call to undefined function curl_init()

PHP – Fatal error: Call to undefined function curl_init()


On current versions of Debian and Ubuntu, you can likely solve this by installing the Curl extension for PHP, and restarting the webserver.


sudo apt-get install php5-curl


It’s possible you’ll need to install more:


sudo apt-get install curl libcurl3 libcurl3-dev;



PHP - Fatal error: Call to undefined function curl_init()

Monday, January 12, 2015

"Restart computer" failed when installing SQL Server 2012

“Restart computer” failed when installing SQL Server 2012


cd sql server folder

run

setup.exe /SkipRules=RebootRequiredCheck /ACTION=install



"Restart computer" failed when installing SQL Server 2012

Sunday, January 4, 2015

How to setting "Custom Naming Strategy" in grails project

How to setting “Custom Naming Strategy” in grails project


By default Grails uses Hibernate’s ImprovedNamingStrategy to convert domain class Class and field names to SQL table and column names by converting from camel-cased Strings to ones that use underscores as word separators. You can customize these on a per-class basis in the mapping closure but if there’s a consistent pattern you can specify a different NamingStrategy class to use.

Configure the class name to be used in grails-app/conf/DataSource.groovy in the hibernate section, e.g.


hibernate

cache.use_second_level_cache = true

cache.use_query_cache = false

cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'

naming_strategy = com.a5go.CustomNamingStrategy


You can use an existing class or write your own, for example one that prefixes table names and column names:

package com.a5go


import org.hibernate.cfg.ImprovedNamingStrategy

import org.hibernate.util.StringHelper


class CustomNamingStrategy extends ImprovedNamingStrategy


String classToTableName(String className)

"T_" + StringHelper.unqualify(className)




How to setting "Custom Naming Strategy" in grails project

Thursday, December 4, 2014

How to make System command calls in Groovy?

package ping

import java.io.*
import java.util.*

class PingController

def index()
def sout = new StringBuffer(), serr = new StringBuffer()
def proc = 'ping 127.0.0.1'.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println "out> $sout err> $serr"

def ping()
StringBuffer buf = new StringBuffer();
String s = "";
Process process;
try

process = Runtime.getRuntime().exec( "cmd /c " + "ping 8.8.8.8" );
BufferedReader br = new BufferedReader( new InputStreamReader(
process.getInputStream() ) );
while ( ( s = br.readLine() ) != null )

buf.append( s + "\r\n" );


process.waitFor();
System.out.println( buf );
catch ( Exception ex )

ex.printStackTrace();





How to make System command calls in Groovy?

Wednesday, November 26, 2014

svn: Can't open file '.svn/text-base/

root@debian:/var/www# svn update

svn: Can’t open file ‘.svn/text-base/details.html.svn-base': No such file or directory


How to solve:

TortoiseSVN -> Repo-Browser -> select file details.html -> Delete -> Commit

Re check-in details.html to svn



svn: Can't open file '.svn/text-base/

Enabling Server Side Includes (SSI) on Apache and Debian/Ubuntu

Enabling Server Side Includes (SSI) on Apache and Debian/Ubuntu


Enable the Include module


a2enmod include

or


ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled

Edit the config file

vim /etc/apache2/sites-available/default

add

AddType text/html .shtml

AddOutputFilter INCLUDES .shtml

and

Options Indexes FollowSymLinks MultiViews +Includes

the complete file like below:


 DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
#Order allow,deny
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Options Indexes FollowSymLinks MultiViews +Includes
</Directory>

Restart Apache


service apache2 restart

Test,create shtml file


<html>
<head>
<title>SSI Test Page</title>
</head>
<body>
<!--#config timefmt="%A %B %d, %Y" -->
Today is <!--#echo var="DATE_LOCAL" -->
</body>
</html>


Enabling Server Side Includes (SSI) on Apache and Debian/Ubuntu

Tuesday, November 18, 2014

How to remove BOM from UTF-8 using sed?

How to remove BOM from UTF-8 using sed?

fetch BOM files

grep -rIlo $’^\xEF\xBB\xBF’ ./


remove BOM files

grep -rIlo $’^\xEF\xBB\xBF’ . | xargs sed –in-place -e ‘s/\xef\xbb\xbf//’


exclude .svn dir

grep -rIlo –exclude-dir=”.svn” $’^\xEF\xBB\xBF’ . | xargs sed –in-place -e ‘s/\xef\xbb\xbf//’



How to remove BOM from UTF-8 using sed?