Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ on Zend Framework

Error :
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’

the solution is change the following lines

ubuntu@ip-10-128-138-137:~$ cat /srv/www/xxx/application/configs/application.ini | grep resources.db
resources.db.adapter         = "PDO_MYSQL"
resources.db.params.host     = "localhost"
resources.db.params.username = "xxx"
resources.db.params.password = "xxxpass"
resources.db.params.dbname   = "xxxdb"
resources.db.params.profiler.enabled = true
resources.db.params.profiler.class = Zend_Db_Profiler_Firebug
resources.db.params.driver_options.1002 = "SET NAMES utf8"

into

ubuntu@ip-10-128-138-137:~$ cat /srv/www/xxx/application/configs/application.ini | grep resources.db
resources.db.adapter         = "PDO_MYSQL"
resources.db.params.host     = "127.0.0.1"
resources.db.params.username = "xxx"
resources.db.params.password = "xxxpass"
resources.db.params.dbname   = "xxxdb"
resources.db.params.profiler.enabled = true
resources.db.params.profiler.class = Zend_Db_Profiler_Firebug
resources.db.params.driver_options.1002 = "SET NAMES utf8"
Advertisements

Using NURBS library in Matlab

  1. Get the NURBS library from here
  2. Extract the files to your hardisk, for example, C:\Matlab
  3. So, your NURBS lib folder will be on C:\Matlab\nurbs-1.3.1 folder,
  4. Create new m-file, TestNURBSlib.m, the control points data are taken from An Introduction to NURBS: With Historical Perspective book, pp. 215
    Continue reading

Installing GLUI using CodeBlocks on windows

Here is another way to installing GLUI on windows. Before going to install the glui, please ensure that the glut is installed properly.

  1. Download glui library from http://glui.sourceforge.net/ in the files section u will find the latest release version of glui.
  2. Extract the zip file somewhere in ur disk, Open Code::Blocks, Click File -> Import Projects -> MS Visual Studio Solution ..

    Importing the VS GLUI Project

    Importing the VS GLUI Project

  3. Then open the glui-2.36 directory (i use glui-2.36 version) under src directory u will find msvc directory, then open glui.sln file. Next, Click yes to convert the VS solution into Code::Block projects (All)

    Confirmation box

    Confirmation box

  4. Continue reading

Preventing matlab to display distorted graphics/Displaying real objects

Usually matlab will displaying our graph in different aspect ratio

to manage put the following code after your draw your object

set(gca,'DataAspectRatio',[1 1 1]);

Here one example of distorted 3D plot

A distorted 3D plot

A distorted 3D plot

and here the 3D plot example of the object

Surface Result

Surface Result

Easy right!!??? :D :D

Actually, it took me 4 months for searching this code :), and finally i found it :D

Reference : http://www.mathworks.com/access/helpdesk/help/techdoc/visualize/f4-48363.html

My NURBS Surface Viewer using GLUT and GLUI

Ohhh no!!! its 2 pm already… and i still stuck with this genetic algorithm stuff. However, here my NURBS viewer. Since the gluNurbsSurface has failed when dealing with large number of knots/control points (its took a long time to render), so i decided to build my own Nurbs Surface viewer.

NURBS surface

NURBS surface

A ship hull

A ship hull

And here partial of the configuration file:

! Conventional Skinning Surface
! Num of Points on v direction
17
! Num of Points on u direction
38
! Num of Knots on v direction
21
! Num of Knots on u direction
42
! Num of ?? on v direction
4
! Num of ?? on u direction
40
! Order on v direction
4
! Order on u direction
4
! Knot on V direction
0 0 0 0 0.125 0.1875 0.25 0.3125 0.375 0.4375 0.5 0.5625 0.625 0.6875 0.75 0.8125 0.875 1 1 1 1

! Knot on U direction
0 0 0 0 0.3204168 0.3330365 0.3386205 0.3615613 0.3640918 0.3996359 0.4230176 0.4400723 0.4703173 0.4771228 0.4806252 0.4995547 0.5038797 0.5067325 0.5071404 0.5266452 0.5291815 0.533802 0.5355079 0.5368688 0.5375204 0.54007 0.5779993 0.5956679 0.6181809 0.6400152 0.6523381 0.6688393 0.6768478 0.6881943 0.6948065 0.6951187 0.6983484 0.6992325 1 1 1 1

! Cross Section Control Points (U) : 0
0.0000000 0.0000000 0.0000000 1.0
0.6666667 0.0000000 0.0000000 1.0
1.6666667 0.0000000 0.0000000 1.0
3.0000000 0.0000000 0.0000000 1.0
4.0000000 0.0000000 0.0000000 1.0
5.0000000 0.0000000 0.0000000 1.0
6.0000000 0.0000000 0.0000000 1.0
7.0000000 0.0000000 0.0000000 1.0
8.0000000 0.0000000 0.0000000 1.0
9.0000000 0.0000000 0.0000000 1.0
10.0000000 0.0000000 0.0000000 1.0
11.0000000 0.0000000 0.0000000 1.0
12.0000000 0.0000000 0.0000000 1.0
13.0000000 0.0000000 0.0000000 1.0
14.3333333 0.0000000 0.0000000 1.0
15.3333333 0.0000000 0.0000000 1.0
16.0000000 0.0000000 0.0000000 1.0

! Cross Section Control Points (U) : 1
0.0000000 0.0000000 0.1183558 1.0
0.6669870 0.0204567 0.1144623 1.0
1.6668257 0.0823568 0.1066065 1.0
3.0001828 0.1567253 0.0830420 1.0
4.0009233 0.2080720 0.0705577 1.0
4.9990463 0.3250287 0.0400466 1.0
5.9999298 0.3737906 0.0322105 1.0
6.9998674 0.4348038 0.0182866 1.0
7.9994083 0.5059588 0.0020279 1.0
8.9999562 0.5055757 0.0006495 1.0
10.0002874 0.5222002 -0.0016813 1.0
11.0009609 0.4849985 0.0049546 1.0
12.0012907 0.4111537 0.0210627 1.0
12.9993008 0.2804071 0.0513682 1.0
14.3343042 0.1803885 0.0684193 1.0
15.3320223 0.0418953 0.1172258 1.0
16.0000000 0.0000000 0.1137902 1.0

...

error C2679: binary ‘>>’ : no operator found … (VS2008)

When u compiling a source code that was developed on linux using gcc compiler with no success and got an error below,

1>d:\research\nurbssurface\main.cpp(4180) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

1> c:\program files\microsoft visual studio 9.0\vc\include\istream(1144): could be 'std::basic_istream &std::operator >><std::char_traits>(std::basic_istream &,signed char *)'

So, here, the solution, change the #include <string.h> into #include <string>