All the needed configuration parameters you can/have to to are linked below. In this entry i want to point out the use of setenv.sh.
With setenv.sh you don't have to edit the default startup script from the tomcat. This means you also can backup/store your settings on a well know place and then just create a link into the directory where your catalina.sh file is placed.
The catalina.sh script itself looks for a setenv.sh and reads it. Everything that is configured inside the setenv.sh script overwrites the default settings inside the catalina.sh.
links:
tomcate.apache.org
how to run a tomcat
how to configurate a tomcate
Saturday, 12. May 2012
howto - Apache Tomcat Configuration
Tuesday, 1. May 2012
web - Tizen 1.0 Larkspur SDK and Source Code Release
Today we are excited to announce Tizen 1.0 Larkspur, including the addition of new complimentary components, as well as source code that focuses on enhancing stability and performance. We believe that these updates and new offerings improve the experience for developers. We are also continuing to work on improvements and additions, and we will be doing frequent updates to the SDK and source code. There are a few additional components that we plan to add in the coming weeks, and we will continue to fix bugs and add additional features.
source
You want to start or take a deep look to the source code? Check out the source page.
Friday, 27. April 2012
tool - create php classes from a soap wsdl
Since i am working with a lot of soap services right now i searched for a tool that generates the soap classes for me. Thankts to propel and its "schema.xml" i am getting really lazy for doing such a task by hand
.
Fortunately, the internet is still a place where everything can be found, so the search engine of my choice scores and found the wsdl2phpgenerator provided by walle.
Simple WSDL to PHP classes converter. Takes a wsdl file and outputs class files ready to use.
Uses the MIT licence (http://www.opensource.org/licenses/mit-license.php)
Usage executable:
./wsdl2php -i input.wsdl -o /tmp/my/directory/wsdl
Just add -v to use the verbose mode and -n my\\namespace to add a preferred namespace.
Thursday, 19. April 2012
tool - vi moving arround
Apanding to the simple editing post i would like to add this time some hints for moving arround
- ctrl+F - scroll forward one screen
- ctrl+B - scroll backward one screen
- ctrl+D - scroll forward half a screen
- ctrl+U - scroll backward half a screen
- H - move to the home/top line of the screen
- M - move to the middle of the screen
- L - move to the last line of the screen
- + - move to the first character of the next line
- - - move to the first character of the previous line
- ? - search backward
- N - step search backward
Monday, 16. April 2012
tool - vi a little more basics for simple editing
I am using the vi since a few years. A few months ago i realized that i am just using a bit of the mighty power of the vi. Thats why O`Reilly's Learning the vi editor was welcomed in my house
.
I have just finised a small part of the book but found already some "new" stuff for me. Thats why this entry is a supplement to my vi knowledge. But maybe there is something for you out there too.
- :e! - returns you the last saved version of your file
- W - move forward from word by word without considering symbols and punctuation
- c2b - change two words backwards
- c$ - change to the end of the line
- cc - change the entire current line
- C - change characters from current cursor position to the end of the line
- s - substitute from current position
- S - same as cc
- R - puts you in "overwrite" mode
- ~ - change case of your letter (Upper- to Lowercase and other way)
- D - deletes from courrent position to the end of the line
- x - deletes current character
- X - deletes character before current position
- xp - delete current character ad put after curser
- y$ - yankes to the end of the line
- . - repeats last command
- O - opens blank line above curser
- J - joins two (or more) lines
- e - moves to the end of a word
Wow, after this list it is hard to believe that i am using the vi for years now, "we are absolute beginners" comes to my ears
.
Friday, 13. April 2012
linux - how is logged in?
Open a shell and try the following command:
who
The output shows you the user, the console he is using, the datetime when he logged in and so on.
Some usefull links:
lowfatlinux.com
thegeekstuff.com
Monday, 9. April 2012
php - debug soap client
If you are using the native php soap client, just enable the trace mechanims and use the build in methods.
array_push($options, array('trace' => 1));
$myPhpSoapClient = new SoapClient($urlToWSDL, $options);
- SoapClient::__getLastRequestHeaders
- SoapClient::__getLastRequest
- SoapClient::__getLastResponseHeaders
- SoapClient::__getLastResponse
Use a logger for the output or add it at least as hidden value in your output.
PHP independent works best with a sniffer tool like wireshark
Thursday, 5. April 2012
Interfaces and const definition
To make it short, if somebody ask you to define a const variable in an interface just say no.
Just put it in an [abstract] class and use it there.
Feel free to add you comment
.
Tuesday, 27. March 2012
php - create uuid in php
If you need a kind of unique id creation inside php (but can not or do not want to use your database for this job), here is a small function for this.
I have also implemented a md5 hash compare. You can replace your current md5 hash method with this one (if you are getting errors in your unittests for e.g.
).
?php
$generatedUUIDs = array();
$generatedMd5s = array();
for($i = 0;$i<10000;$i++) {
$generatedUUID = createUUID();
$generatedMd5 = md5($generatedUUID);
if (in_array($generatedUUID, $generatedUUIDs)) {
echo 'matching same uuid in run ' . $i . PHP_EOL;
exit();
} else {
$generatedUUIDs[] = $generatedUUID;
}
if (in_array($generatedMd5, $generatedMd5s)) {
echo 'matching same md5 in run ' . $i . PHP_EOL;
exit();
} else {
$generatedMd5s[] = $generatedMd5;
}
}
echo 'Run ' . $i . ' creations of UUIDs successfully.' . PHP_EOL;
function createUUID()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000,
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
Wednesday, 21. March 2012
tool.bazzline.net - what a user model should have
Even while i was working on my auth plugin for the zend framework, i tought it is right that the user db table needs to store the password.
![]()
Well, bad luck, i was wrong.
I wrestled with the fact that the password is stored in my user domain model. This leads to the fact that everywhere where use the user domain model the code can have access to the password - that sucks in the matter of security.
After a few minutes with a colleague we figured out that a password and even the loginname should be stored and managed by an auth class.
Even cooler, when you store this information in a central authentification you can use it everywhere (i mean other projects or modules as well).
![]()
Monday, 19. March 2012
tool - php 5.4
Since the PHP 5.3 update nightmare, i will wait a while before i update my version. But all in all there are three cool features inside, traits, short array syntax and DTrace.
Since DTrace is something for "when my development sever is ready to run", short array syntax and traits are ready to use.
Short array syntax is pretty nice.
$foobar = ['foo' => 'bar'];
And traits, well we will see if it is good to use ore not. I like the fact that you can easily define one method and use it where you want. So it is more or less an interface with implementation. I will spare you from the general Singleton example here
.
But i can recommend the following links if you want to know more.
Whats new in php 5.4.0
traits
Migration from 5.3.x to 5.4.x
Sunday, 18. March 2012
tool.bazzline.net - the long road to a php data mapper - part 1
I am working on the private project "tool.bazzline.net" to get away from social services and have a tool that fits perfectly to my own requirement.
Private projects always (should
) have the benefit of "no time preasure" that leads to "implement some cool features".
The first thing on this feature list is a data mapper.
Why a datamapper?
Well, won't you like to work with domain models and don't give a s*** about how and where the data is stored?
There is a wonderfull and short article created by Martin Fowler and i just have to recomend this one.
I found two datamapper projects for php on the web, pdodatamapper and phpdatamapper. To keep things short, a data mapper removes the logic of "how and where" to store the model data.
Both projects are still under heavy development and are not in a final state right now. I will not use them (but always take a look on how they have things done).
So what should my data mapper do?
All in all, it should hide all the database tables from the developer - even the orm if used. I just want to create a domain model and use it to store and get data from a persistent storage.
My data mapper must be smart enough to figure out which rowset on which storage/database table he has to update (or create).
The data mapper should have a lazy loading/storing mechanism, this should be done by a propertieset that knows which propertie is stored on which storage/database table.
My data mapper should support a very simple/limited filter mechanism that prevents me to blow up my data mapper class with to many "loadModelWhenItFitsToTheFollowingCircumstances"-methods.
This data mapper should also support to create a domain model by the upper called filter mechanism.
I decided that the general data mapper methods "insert()", "update" and "delete" are not perfect in the matter of sense to fit on my requirements. Thats why this data mapper will have the methods "load($model, $filters)", "save($model)" and "delete($model)". You can adapt each data mapper by adding own load methods with pre defined filters.
Filter what?
All this filtering leads to a filter class. This is a simple and straight forward one with the properties "criteria", "name" and "value".
The filter class has to be independent from the real storage implementation, thats why i will use an aditional filterMapper class.
This filterMapper is used from the data mapper and prevents to write doublicated storage dependent code. He is responsible to transform the general filterset to the a storage dependant model - means you throw the filter and the storage model inside and get the storage model with added storageFilter back.
That filter and filterMapper can communicate with each other by using a criteria class.
The criteria class will define what "like" or "greater then" is so that the filterMapper can map this to the storage model.
After the trip to the filtering adventure, we are back to the data mapper itself.
The real domainModelDataMapper will use a general propertieSet class. This propertieSet class is the only real connection between the domainModelProperties and the (maybe more the one) storage models - so the theorie currently
.
I must admit, i have made no decision if the real domainModelDataMapper is a decorator of the dataMapper, or if the dataMapper class is implemented as abstract class.
Since the whole project is a "learning by doing", i will figure out what will work - final in the phase of implementation (have i remarked that i never ever have worked with a data mapper for real?
).
![]()
Lets see what is next.
Friday, 16. March 2012
tool - php 5.3 - some new functions
Since php 5.4. throws his shadow i finally had some time to check the release notes of 5.3. Here are some changes that are made in PHP 5.3, i just picked up my favorits (as expected
).
New Global Constants
__DIR__
__NAMESPACE__
New Functions
array_replace: replaces elements from passed arrays into the first array
array_replace_recursive: replaces elements from passed arrays into the first array recursively
class_alias: rreates an alias for a class
header_remove: remove previously set headers
I have not used one of this functions but since i am a developer i knew a lot of situations where this functons could have saved time.
other changes to extensions
cURL: cURL now supports SSH
OpenSSL: OpenSSL digest and cipher functions are now supported.
Session: Sessions will no longer store session-files in "/tmp" when open_basedir restrictions apply, unless "/tmp" is explicitly added to the list of allowed paths.
new methods
DateTime::add(): Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object
DateTime::diff(): Returns the difference between two DateTime objects.
DateTime::sub(): Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object.
Tuesday, 13. March 2012
web - Zend Framework 2.0.0beta3 Released!
The Zend Framework community is pleased to announce the immediate availability of Zend Framework 2.0.0beta3. Packages and installation instructions are available at:
http://packages.zendframework.com/
[...]
Featured components and functionality of 2.0.0beta3 include:
Refactored Config component
All configuration readers have been moved under the Zend\Config\Reader namespace
A Zend\Config\Factory has been added to simplify retrieving a config object from a config file
Supported configuration formats now support importing additional configuration files
All constant processing has been moved to a Zend\Config\Processor namespace, and expanded to be more powerful
Work was provided by Ben Scholzen, Artur Bodera, Enrico Zimuel, and Evan Coury
New View layer
New subcomponents include Zend\View\Model, Zend\View\Resolver, Zend\View\Renderer, and Zend\View\Strategy
The old Zend_View class has been moved to Zend\View\Renderer\PhpRenderer, and rewritten to move most of its responsibilities into collaborators, greatly simplifying its design while simultaneously giving it more capabilities.
A new class, Zend\View\View, allows selecting rendering strategies on a per-template basis, based on arbitrary criteria, and optionally injecting rendering results into a Response object
MVC integration streamlines common use cases, including View Model creation and injection, 404 and error page creation, and more.
Work was provided by Matthew Weier O'Phinney, with copious feedback from Rob Allen.
Rewritten DB layer
New architecture features low-level drivers, which also provide access to the PHP resource being consumed; adapters, which provide basic abstraction for common CRUD operations; new SQL abstraction layer, with full predicate support; abstraction for ResultSet's, with the ability to cast rows to specific object types; abstraction for SQL metadata; and a revised Table and Row Data Gateway.
Work was provided by Ralph Schindler
New AgileZen component
Support for the full AgileZen API
Developed for use with our planning board
Work was provided by Enrico Zimuel
PHP 5.4 Support
A number of issues when running ZF2 under PHP 5.4 were identified and corrected.
source
I am happy the team managed to finished the view layer, the database support and the config
.
Sunday, 11. March 2012
tool - Bazzline_Controller_Plugin_Auth - Zend Framework Controller Plugin - now on github.com
I just released my first project on github.com.
As mention in the headline, it is called Bazzline_Controller_Plugin_Auth.
It is a simple plugin which tests if the called url is a "logged in user" only url or not. If it is "logged in only", the user is redirected to the login. The previously called url is saved in the session. After a successfull login, the user gets redirected to this saved url.
All can be configured in a config file.
This plugin is only for simple access controll by "user is logged in" or "user is not logged in". The ACL stuff is still in the pipeline and should not - to follow the KISS principle - be inside an auth plugin.
While setting up this project on github, i had some problems while getting a valid connection to github.
I followed the howto but not "pressed enter" when asked for a file to store the key.
Thats why:
ssh -T git@github.com
failed.
But when i added the -i option like:
ssh -T git@github.com -i path/to/my/private/key
everything runs smoothly.
After a short term of searching, i found the ssh issues page on gitub.com.
The simple solution is:
Create or open the file at ~/.ssh/config Add the following lines:
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile /path/to/my/private/key
After that, the
git push -u origin masterruns without any errors.
Wednesday, 29. February 2012
tool - zend framework zf cli aka zend tool
Just a quick entry for the zend framework comand line tool (available for *nix and windows).
I tought it would be a good idea to use it and create the general files or directory layout. But it is not perfect at all. Creating modules and layouts is quick nice. But a
zf create controller myModuleNamedoes not what i have expected. An controller was created below the general controller directory and not inside the module "myModuleName". Lets see if i like the tool at all. I will stick on it for this project and fill up the links in the following section when i find some usefull one.
I can give one hint so far, the zend tool can only create, not delete anything. If you want to delete something, you have to do it manualy (remember the zfproject.xml file).
available parameters for application.ini
official zend tool manual
using the cli tool
create a layout
zend tool in phpstorm
zend framework as cli application
tutorial from akrabat
Proposed Q&A site for PHP developers using Zend Framework 1 and Zend Framework 2
Sunday, 26. February 2012
callbacks, anonymous or lambda functions - the differences
It just took me a while to really understand the differences between this three. But hopefully (never say never ;-), now i got it.
A callback simple describes, that a function awaits another function as parameter. This functions can be an existing one or a "on the fly created on" with the power of create_function.
A lambda function is a function without a function name. The reference is stored in a variable. You can use this variable to handle it over to methods like usort.
As everybody i will use a sorting lambda function for showing what i mean.
/**
* Returns 0 if strings are equal, -1 if $stringTwo or 1 of $stringOne is greater
*
* @author artodeto.bazzline.net
* @param string $stringOne
* @param string $stringTwo
* @return int $sorter
* @since 2012-02-26
*/
$mySorter = function($stringOne, $stringTwo)
{
$sorter = 0;
$lengthOfStringOne = strlen($stringOne);
$lengthOfStringTwo = strlen($stringTwo);
if ($lengthOfStringOne > $lengthOfStringTwo) {
$sorter = 1;
} elseif ($lengthOfStringOne < $lengthOfStringTwo) {
$sorter = -1;
}
return $sorter;
};
$names = array(
'Brian W. Kernighan',
'Dennis Ritchie'
);
usort($names, $mySorter);
echo xdebug_var_dump($names);
?>
It is also possible to define the $mySorter directly in unsort as second parameter like
usort($names, function($stringOne, $stringTwo { ... });
if you like that.
A closure is a function that surrounds (i do not want to use the word enclose
) the lambda function.
That has the sideeffect that the closure itself conserves their own context. An easy example is a simple logger.
/**
* Closure function for logging. Returns true if message could be stored
* Available types are "info" and "error"
*
* @author artodeto.bazzline.net
* @param string $type
* @return boolean
* @since 2012-02-26
*/
function myClosureLogger($type)
{
return function($message) use ($type)
{
$status = false;
switch ($type) {
case 'info':
$myDatabaseInfoLogTable = new DatabaseInfoLogTable();
$myDatabaseInfoLogTable->setMessage($message);
$myDatabaseInfoLogTable->setTimestamp(mktime());
$status = $myDatabaseInfoLogTable->save();
break;
case 'error':
$myFileErrorLog = new ErrorLog();
$myFileErrorLog->addMessage(mktime() . "\t" . $message);
$status = $myFileErrorLog->save();
break;
}
return $status;
};
}
$infoLogger = myClosureLogger('info');
$errorLogger = myClosureLogger('error');
$infoLogger('This is a info log');
$errorLogger('This is an error log');
?>
The positiv thing about closures is, that the code footprint can be reduced (you even can use closures inside objects - even as static if you do not need to access on the object itself with $this).
The negativ thing is, that you can not use interfaces which implies a lose of security.
Wednesday, 15. February 2012
howto - windows 7 service windows-audio could not start - error 1079
Do you ever had the problem that you have no sound on your windows 7?
I have and it was hard to find the problem, since windows is acting so ... well not expected
.
So you want to adjust the volume and an "here is a problem, let me search on the internat for a solution" windows is popping up.
After you opened the service management and take a look at the dependencies, you started all needed service but getting the error 1079 again. What to do?
Rightclick on the "windows-audio" entry and open properties ("einstellungen"). Click to tab login ("Anmeldung"), select "this account" option and enter "LocalService" as username and "0000" as password. Click Apply and try to start the service. Now everything should work smoothly.
Thanks to windows-7-forum.net to show me the way i have to look.
Wednesday, 8. February 2012
howto - phpcs set default code style standard
I know it is easy but nevertheless it is good to have it on one place.
This howto shows how you set up a default coding standard in phpcs.
First you have to create or download a code style standard.
If you want to create one, try this howto.
If you already have a standard, try to untar it to:
/usr/share/php/PHP/CodeSniffer/Standards/
You can check if phpcs founds you standard by using:
phpcs -i
Next you just want to define it as your default standard by using:
phpcs --config-set default_standard $artodetoStyleGuide
Thats it, have fun.
Thursday, 2. February 2012
howto - stop bugging me google-analytics
Don't want to be tracked with google-analytics.com (and never want to use it)?
Just add a few lines to your hosts file (unix: /etc/hosts, windows c:\windows\system32\drivers\etc\hosts).
127.0.0.1 www.google-analytics.com
127.0.0.1 google-analytics.com
127.0.0.1 ssl.google-analytics.com
Thats it, use and extend it at your own risk. The trick (if you can call it like that) is simple but works quite well.
P.S.: For the mozilla firefox webbrowser i can suggest the extension ghostery.
Thursday, 19. January 2012
Howto - php array_filter anonymous function
Every day something new
. This day i finally had time to deal with anonymous functions.
Since it is the first time, also after solving the problems, working with anonymous functions is feeling a bit strange. But now i have done it, so it feels better then before where i have never dealt with them.
Here is my example code.
<?php
$nl = '<br>' . PHP_EOL;
$array = array(
0 => array(
'level' => 0,
'label' => 'zero',
),
1 => array(
'level' => 1,
'label' => 'one'
),
2 => array(
'level' => 0,
'label' => 'two',
),
3 => array(
'level' => 2,
'label' => 'three',
),
);
$levelToFilter = 1;
$array2 = array_filter($array, function ($arrayItem) use ($levelToFilter) {
return ($arrayItem['level'] !== $levelToFilter);
});
echo 'array::' . $nl;
echo xdebug_var_dump($array);
echo 'array2::' . $nl;
echo xdebug_var_dump($array2);
Feel free to play around with it. I guess $levelToFilter is the variable you should change
Sunday, 15. January 2012
Howto - php smarty hints
Just while you have to work with smarty, you need some small "how can i do this" hints.
- php: if (is_a($object, 'myClass') | smarty: {if $object|is_a:'myClass'}
- php: var_dump($item) | smary: {$item|@var_dump} - use "@" to make smarty run the modifier against the whole $item, otherwise it would use it for each element.
- php: print_r($item) | smary: {$item|@print_r} - use "@" to make smarty run the modifier against the whole $item, otherwise it would use it for each element.
smarty.net functions
Saturday, 14. January 2012
tool - Linux and pdf
To deal with pdf files while using linux can be exciting. But everything is solveable if you know the right tools, so here are tools i found by searching for them.
Thanks to unixcraft to attract me on the right track.




