Tuesday, June 11, 2013
on Composer
add directory to autoloader search path
$loader = require '../vendor/autoload.php';
$loader->add('Vendor\Package', __DIR__);
use custom svn repository
as example, vendor=jchk
, package=webservice
repo layout:
trunk
+- JChk
+- WebService
+- composer.json
server composer.json:
{
"name": "jchk/webservice",
"description": "webservice class",
"license": "proprietary",
"authors": [
{
"name": "",
"email": ""
}
],
"require": {
"php": ">=5.3.3"
},
"autoload": {
"psr-0": {
"JChk\\WebService\\": ""
}
},
"target-dir": "JChk/WebService"
}
note: use target-dir
to set installation path on client side
client composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "http://my.svn.repo/Composer/",
"package-path": "JChk/WebService"
}
],
"require": {
"jchk/webservice": "dev-trunk",
}
}
note: use package-path
to force composer to check trunk/JChk/WebService/composer.json
instead of trunk/composer.json
Wednesday, June 19, 2013
tried redhat's openshift paas, deploy by rhc
(ruby), just like heroku and appfog, very easy. and it seems a bit faster than appfog. the best thing of openshift is, it supports dance, a sinatra-like perl framework, i couldn't find any hosting supports it until openshift.
Tuesday, June 25, 2013
PHP 5.5 is released. sad that it doesn't support Windows XP anymore. I managed having it installed under cygwin, and here's a quick tests of new features
$pass = "meee";
$hash = password_hash($pass, PASSWORD_DEFAULT);
if (password_verify($pass, $hash)) {
print "pass\n";
}
$pass2 = "chiii";
$hash = password_hash($pass2, PASSWORD_BCRYPT, array('cost' => 5, 'salt' => '1982734k2j3kljflk23f89723fj23klfj23klf32az'));
if (password_verify($pass2, $hash)) {
print "pass2\n";
}
$lines = [
'one' => ['123', 'ott'],
'two' => ['456', 'ffs']
];
foreach($lines as $key => list($subkey, $subvalue)) {
print $key. ":" . $subkey . "-" . $subvalue . "\n";
}
var_dump("string"[1]);
var_dump([1,2,3][1]);
var_dump([['foo','bar'], [1, 2]][0][1]);
Wednesday, June 26, 2013
reading Practical Object-Oriented Design in Ruby, quite good. on setting default values to arguments, it goes from
def initialize(args)
@foo = args[:foo] || "foo"
end
to
def initialize(args)
@foo = args.fetch(:foo, "foo")
end
to
def initialize(args)
args = defaults.merge(args)
@foo = args[:foo]
end
def defaults
{ :foo => "foo }
end
using merge
is a very good suggestion.
Blog Archive
- Newer Entries
- 2013 July
- 2013 October
- 2013 December
- 2014 January
- 2014 February
- 2014 March
- 2014 August
- 2014 September
- 2014 October
- 2014 November
- 2014 December
- 2015 January
- 2015 February
- 2015 March
- 2015 April
- 2015 May
- 2015 June
- 2015 July
- 2015 August
- 2015 September
- 2015 October
- 2015 November
- 2015 December
- 2016 January
- 2016 February
- 2016 March
- 2016 April
- 2016 May
- 2016 June
- 2016 July
- 2016 August
- 2016 September
- 2016 October
- 2016 November
- 2016 December
- 2017 January
- 2017 February
- 2017 March
- 2017 April
- 2017 May
- 2017 June
- 2017 July
- 2017 August
- 2017 September
- 2017 October
- 2017 November
- 2017 December
- 2018 January
- 2018 February
- 2018 March
- 2018 April
- 2018 May
- 2018 June
- 2018 July
- 2018 August
- 2018 September
- 2018 October
- 2018 November
- 2018 December
- 2019 January
- 2019 February
- 2019 March
- 2019 April
- 2019 May
- 2019 July
- 2019 October
- 2019 November
- 2019 December
- 2020 August
- 2020 September
- 2020 October
- 2020 November
- 2020 December
- 2021 January
- 2021 February
- 2021 March
- 2021 April
- 2021 May
- 2021 June
- 2021 August
- 2021 September
- 2021 December
- 2022 March
- 2022 April
- 2022 May
- 2022 June
- 2022 July
- 2022 August
- 2022 September
- 2022 October
- 2022 November
- 2022 December
- 2023 January
- 2023 February
- 2023 March
- 2023 April
- 2023 July
- 2023 August
- 2023 September
- 2023 October
- 2023 November
- 2023 December
- 2024 January
- 2024 February
- 2024 March
- 2024 April
- 2024 May
- 2024 June
- 2024 August
- 2024 September
- 2024 October
- 2024 November