Calabash 2.0 tap issue - calabash

I'm trying to test a hybrid webView application and having an issue with the tap method on an iPhone 6 simulator. Touch works fine in the same app with calabash-cucumber.
Xcode: Version 7.0.1 (7A1001)
OS: OSX Yosemite 10.10.5 (14F27)
calabash-cucumber (0.16.4):
irb(main):002:0> query "webView css:'.ion-navicon'"
[
[0] {
"center" => {
"X" => 348.046875,
"Y" => 53.90625000000001
},
"webView" => "<UIWebView: 0x7f8761935e60; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x7f8761921320>>",
"nodeName" => "BUTTON",
"id" => "",
"textContent" => "\n\t\t\t",
"class" => "button button-icon button-clear ion-navicon",
"rect" => {
"x" => 348.0469,
"height" => 42,
"y" => 53.90625,
"width" => 35,
"left" => 280,
"top" => 25,
"center_y" => 53.90625,
"center_x" => 348.0469
},
"nodeType" => "ELEMENT_NODE"
}
]
irb(main):004:0> touch "webView css:'.ion-navicon'"
[
[0] {
"center" => {
"X" => 348.046875,
"Y" => 53.90625000000001
},
"webView" => "<UIWebView: 0x7f8761935e60; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x7f8761921320>>",
"nodeName" => "BUTTON",
"id" => "",
"textContent" => "\n\t\t\t",
"class" => "button button-icon button-clear ion-navicon",
"rect" => {
"x" => 348.0469,
"height" => 42,
"y" => 53.90625,
"width" => 35,
"left" => 280,
"top" => 25,
"center_y" => 53.90625,
"center_x" => 348.0469
},
"nodeType" => "ELEMENT_NODE"
}
]
That works great.
Calabash 2.0 hangs for a while on tap, and eventually spits out an error.
calabash (2.0.0.pre4):
irb(main):030:0> query "webView css:'.ion-navicon'"
Getting: http://127.0.0.1:37265/map {}
[
[0] {
"center" => {
"X" => 348.046875,
"Y" => 53.90625000000001
},
"webView" => "<UIWebView: 0x7f8310705f10; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x7f83107303e0>>",
"nodeName" => "BUTTON",
"id" => "",
"textContent" => "\n\t\t\t",
"class" => "button button-icon button-clear ion-navicon",
"rect" => {
"x" => 348.0469,
"height" => 42,
"y" => 53.90625,
"width" => 35,
"left" => 280,
"top" => 25,
"center_y" => 53.90625,
"center_x" => 348.0469
},
"nodeType" => "ELEMENT_NODE"
}
]
irb(main):027:0> tap "webView css:'.ion-navicon'"
Getting: http://127.0.0.1:37265/map {}
Getting: http://127.0.0.1:37265/uia {}
RuntimeError: Expected '' to be an array.
from /Users/szoradm/.rvm/gems/ruby-2.0.0-p643/gems/calabash-2.0.0.pre4/lib/calabash/ios/device/routes/uia_route_mixin.rb:138:in `expect_uia_results_is_array'
from /Users/szoradm/.rvm/gems/ruby-2.0.0-p643/gems/calabash-2.0.0.pre4/lib/calabash/ios/device/routes/uia_route_mixin.rb:115:in `handle_uia_results'
from /Users/szoradm/.rvm/gems/ruby-2.0.0-p643/gems/calabash-2.0.0.pre4/lib/calabash/ios/device/routes/uia_route_mixin.rb:105:in `uia_over_http'
from /Users/szoradm/.rvm/gems/ruby-2.0.0-p643/gems/calabash-2.0.0.pre4/lib/calabash/ios/device/routes/uia_route_mixin.rb:43:in `uia_route'
from /Users/szoradm/.rvm/gems/ruby-2.0.0-p643/gems/calabash-2.0.0.pre4/lib/calabash/ios/device/routes/uia_route_mixin.rb:56:in `uia_serialize_and_call'
from /Users/szoradm/.rvm/gems/ruby-2.0.0-p643/gems/calabash-2.0.0.pre4/lib/calabash/ios/device/gestures_mixin.rb:107:in `_tap'
from /Users/szoradm/.rvm/gems/ruby-2.0.0-p643/gems/calabash-2.0.0.pre4/lib/calabash/device.rb:145:in `tap'
from /Users/szoradm/.rvm/gems/ruby-2.0.0-p643/gems/calabash-2.0.0.pre4/lib/calabash/gestures.rb:50:in `tap'
from (irb):27
from /Users/szoradm/.rvm/rubies/ruby-2.0.0-p643/bin/irb:12:in `<main>'
Any suggestions?

Looks like a bug:
2.0.0.pre4/lib/calabash/ios/device/routes/uia_route_mixin.rb:138:
in `expect_uia_results_is_array'
The server is returning some unexpected output. Can you create an issue?
In the report, please note the Calabash iOS Server version. Thanks.
https://github.com/calabash/calabash

Related

Set values for default address fields in Drupal 8

I need to set values for default address fields(langcode, country_code, administrative_area, address_locality ect.) when I create a node. I used below code in the submitForm function of a Form class which is extends by Drupal\Core\Form\FormBase class. But it not works for me.
$venueNode = Node::create([
'type' => 'venue',
'title' => 'Venue',
'field_address' => [
'country_code' => 'US',
'address_line1' => '1098 Alta Ave',
'locality' => 'Mountain View',
'administrative_area' => 'US-CA',
'postal_code' => '94043',
],
]);
$venueNode->save();
I made a mistake here. There should be a 0 index for field_address. Therefore the code should be like below.
$venueNode = Node::create([
'type' => 'venue',
'title' => 'Venue',
'field_address' => [
0 => [
'country_code' => 'US',
'address_line1' => '1098 Alta Ave',
'locality' => 'Mountain View',
'administrative_area' => 'US-CA',
'postal_code' => '94043',
],
],
]);
$venueNode->save();

SimpleSAMLphp missing some configuration. What is missing?

I am trying to use SimpleSAMLphp in AWS ubuntu instance but for some reason I can make it run correctly. I am using AWS-LoadBalancer for https, I do not know if it affect the configuration.
config.php
$config = array(
'baseurlpath' => 'simplesaml/',
'certdir' => 'cert/',
'loggingdir' => 'log/',
'datadir' => 'data/',
'tempdir' => '/tmp/simplesaml',
'technicalcontact_name' => 'David Pacheco',
'technicalcontact_email' => 'dpacheco#lumstons.com',
'timezone' => 'America/Mexico_City',
'secretsalt' => '6ogT+0kPWJAO6FbKThWcI1spujbVVdmFEsPVRiPKEWw=',
'auth.adminpassword' => 'david',
'admin.protectindexpage' => false,
'admin.protectmetadata' => false,
'admin.checkforupdates' => true,
'trusted.url.domains' => array(),
'trusted.url.regex' => false,
'enable.http_post' => false,
'debug' => array(
'saml' => false,
'backtraces' => true,
'validatexml' => false,
),
'showerrors' => true,
'errorreporting' => true,
'logging.level' => SimpleSAML\Logger::NOTICE,
'logging.handler' => 'syslog',
'logging.facility' => defined('LOG_LOCAL5') ? constant('LOG_LOCAL5') : LOG_USER,
'logging.processname' => 'simplesamlphp',
'logging.logfile' => 'simplesamlphp.log',
'statistics.out' => array(
),
'proxy' => null,
'database.dsn' => 'mysql:host=localhost;dbname=saml',
'database.username' => 'simplesamlphp',
'database.password' => 'secret',
'database.options' => array(),
'database.prefix' => '',
'database.persistent' => false,
'database.slaves' => array(
),
'enable.saml20-idp' => false,
'enable.shib13-idp' => false,
'enable.adfs-idp' => false,
'enable.wsfed-sp' => false,
'enable.authmemcookie' => false,
'default-wsfed-idp' => 'urn:federation:pingfederate:localhost',
'shib13.signresponse' => true,
'session.duration' => 8 * (60 * 60),
'session.datastore.timeout' => (4 * 60 * 60),
'session.state.timeout' => (60 * 60),
'session.cookie.name' => 'SimpleSAMLSessionID',
'session.cookie.lifetime' => 0,
'session.cookie.path' => '/',
'session.cookie.domain' => null,
'session.cookie.secure' => false,
'session.phpsession.cookiename' => 'SimpleSAML',
'session.phpsession.savepath' => null,
'session.phpsession.httponly' => true,
'session.authtoken.cookiename' => 'SimpleSAMLAuthToken',
'session.rememberme.enable' => false,
'session.rememberme.checked' => false,
'session.rememberme.lifetime' => (14 * 86400),
'memcache_store.servers' => array(
array(
array('hostname' => 'localhost'),
),
),
'memcache_store.prefix' => '',
'memcache_store.expires' => 36 * (60 * 60),
'language' => array(
'priorities' => array(
'no' => array('nb', 'nn', 'en', 'se'),
'nb' => array('no', 'nn', 'en', 'se'),
'nn' => array('no', 'nb', 'en', 'se'),
'se' => array('nb', 'no', 'nn', 'en'),
),
),
'language.available' => array(
'en', 'no', 'nn', 'se', 'da', 'de', 'sv', 'fi', 'es', 'ca', 'fr', 'it', 'nl', 'lb',
'cs', 'sl', 'lt', 'hr', 'hu', 'pl', 'pt', 'pt-br', 'tr', 'ja', 'zh', 'zh-tw', 'ru',
'et', 'he', 'id', 'sr', 'lv', 'ro', 'eu', 'el', 'af'
),
'language.rtl' => array('ar', 'dv', 'fa', 'ur', 'he'),
'language.default' => 'en',
'language.parameter.name' => 'language',
'language.parameter.setcookie' => true,
'language.cookie.name' => 'language',
'language.cookie.domain' => null,
'language.cookie.path' => '/',
'language.cookie.secure' => false,
'language.cookie.httponly' => false,
'language.cookie.lifetime' => (60 * 60 * 24 * 900),
'language.i18n.backend' => 'SimpleSAMLphp',
'attributes.extradictionary' => null,
'theme.use' => 'default',
'template.auto_reload' => false,
'production' => true,
'idpdisco.enableremember' => true,
'idpdisco.rememberchecked' => true,
'idpdisco.validate' => true,
'idpdisco.extDiscoveryStorage' => null,
'idpdisco.layout' => 'dropdown',
'authproc.idp' => array(
30 => 'core:LanguageAdaptor',
45 => array(
'class' => 'core:StatisticsWithAttribute',
'attributename' => 'realm',
'type' => 'saml20-idp-SSO',
),
50 => 'core:AttributeLimit',
99 => 'core:LanguageAdaptor',
),
'authproc.sp' => array(
90 => 'core:LanguageAdaptor',
),
'metadata.sources' => array(
array('type' => 'flatfile'),
),
'metadata.sign.enable' => false,
'metadata.sign.privatekey' => null,
'metadata.sign.privatekey_pass' => null,
'metadata.sign.certificate' => null,
'metadata.sign.algorithm' => null,
'store.type' => 'phpsession',
'store.sql.dsn' => 'sqlite:/path/to/sqlitedatabase.sq3',
'store.sql.username' => null,
'store.sql.password' => null,
'store.sql.prefix' => 'SimpleSAMLphp',
'store.redis.host' => 'localhost',
'store.redis.port' => 6379,
'store.redis.prefix' => 'SimpleSAMLphp',
);
Apache 2 site config:
<VirtualHost *:80>
ServerName saml.veptec.mx
DocumentRoot /var/www/html
Alias /simplesaml /var/simplesamlphp/www
<Directory /var/simplesamlphp/www>
Require all granted
</Directory>
</VirtualHost>
The https://saml.dominian.com/simplesaml is redirected to https://saml.dominian.com/simplesaml/module.php/core/frontpage_welcome.php but that file return HTTP ERROR 500, I try to track down the error and I fond out that is problem with the config file.
Any ideas?
I found the answer, the location it was not initializing. It was a bug.
In the ./lib/SimpleSAML/Locale/Localization.php file I only call this method:
$this->setupTranslator();
in the end of the constructor and it works correctly.

How to use doctrine in SlimPHP with DB2?

I am trying use Doctrine within Slim to connect to a DB2 db. I am getting no errors. But, my app is not connecting to the database. I am using (likely incorrectly) this package for the driver: alanseiden/doctrine-dbal-ibmi
Here is the pertinent bit from my DIC:
// Doctrine
$container['db'] = function ($c) {
$settings = $c->get('settings');
$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(
$settings['doctrine']['meta']['entity_path'],
$settings['doctrine']['meta']['auto_generate_proxies'],
$settings['doctrine']['meta']['proxy_dir'],
$settings['doctrine']['meta']['cache'],
false
);
return \Doctrine\ORM\EntityManager::create($settings['doctrine']['connection'], $config);
};
And, the referenced settings:
// doctrine settings
'doctrine' => [
'meta' => [
'entity_path' => [
'app/src/Entity'
],
'auto_generate_proxies' => true,
'proxy_dir' => __DIR__.'/../cache/proxies',
'cache' => null,
],
'connection' => [
'Description' => 'IBM i Access ODBC Driver 64-bit',
'driver' => '\DoctrineDbalIbmi\Driver\DB2Driver::class',
'System' => 'xx.xx.xx.xx',
'UserID' => '*****',
'Password' => '*****',
'Naming' => 0,
'DefaultLibraries' => 'QGPL',
'ConnectionType' => 0,
'CommitMode' => 2,
'ExtendedDynamic' => 1,
'DefaultPkgLibrary' => 'QGPL',
'DefaultPackage' => 'A/DEFAULT(IBM),2,0,1,0,512',
'AllowDataCompression' => 1,
'MaxFieldLength' => 32,
'BlockFetch' => 1,
'BlockSizeKB' => 128,
'ExtendedColInfo' => 0,
'LibraryView' => 'ENU',
'AllowUnsupportedChar' => 0,
'ForceTranslation' => 0,
'Trace' => 0
]
]
],
];
I appreciate any help or direction.

How would you use map reduce on this document structure?

If I wanted to count foobar.relationships.friend.count, how would I use map/reduce against this document structure so the count will equal 22.
[
[0] {
"rank" => nil,
"profile_id" => 3,
"20130913" => {
"foobar" => {
"relationships" => {
"acquaintance" => {
"count" => 0
},
"friend" => {
"males_count" => 0,
"ids" => [],
"females_count" => 0,
"count" => 10
}
}
}
},
"20130912" => {
"foobar" => {
"relationships" => {
"acquaintance" => {
"count" => 0
},
"friend" => {
"males_count" => 0,
"ids" => [
[0] 77,
[1] 78,
[2] 79
],
"females_count" => 0,
"count" => 12
}
}
}
}
}
]
In JavaScript this query get you the result you expect
r.db('test').table('test').get(3).do( function(doc) {
return doc.keys().map(function(key) {
return r.branch(
doc(key).typeOf().eq('OBJECT'),
doc(key)("foobar")("relationships")("friend")("count").default(0),
0
)
}).reduce( function(left, right) {
return left.add(right)
})
})
In Ruby, it should be
r.db('test').table('test').get(3).do{ |doc|
doc.keys().map{ |key|
r.branch(
doc.get_field(key).typeOf().eq('OBJECT'),
doc.get_field(key)["foobar"]["relationships"]["friend"]["count"].default(0),
0
)
}.reduce{ |left, right|
left+right
}
}
I would also tend to think that the schema you use is not really adapted, it would be better to use something like
{
rank: null
profile_id: 3
people: [
{
id: 20130913,
foobar: { ... }
},
{
id: 20130912,
foobar: { ... }
}
]
}
Edit: A simpler way to do it without using r.branch is just to remove the fields that are not objects with the without command.
Ex:
r.db('test').table('test').get(3).without('rank', 'profile_id').do{ |doc|
doc.keys().map{ |key|
doc.get_field(key)["foobar"]["relationships"]["friend"]["count"].default(0)
}.reduce{ |left, right|
left+right
}
}.run
I think you will need your own inputreader. This site gives you a tutorial how it can be done: http://bigdatacircus.com/2012/08/01/wordcount-with-custom-record-reader-of-textinputformat/
Then you run mapreduce with a mapper
Mapper<LongWritable, ClassRepresentingMyRecords, Text, IntWritable>
In your map function you extract the value for count and emit this is the value. Not sure if you need a key?
In the reducer you add together all the elements with the same key (='count' in your case).
This should get you on your way I think.

Kendo UI Grid Row Template

I had a problem on how to apply row Template data binding into it. I not sure what is the syntax to do so. I am using server binding mode. Below is my code
#(Html.Kendo().Grid((IEnumerable<IcmsViewModel.LookupView>)ViewData["LookupView"]) // Bind the grid to the Model property of the view
.Name("Grid")
.CellAction(cell =>
{
if (cell.DataItem.Active == false)
{
cell.HtmlAttributes["style"] = "background-color: red";
}
}
)
.Columns(columns =>
{
columns.Bound(p => p.LookupValue).ClientTemplate(" ").Title("Short Name").Width(300);
columns.Bound(p => p.Description).Width(300);
columns.Bound(p => p.Active).Width(300);
columns.Command(command => { command.Edit(); command.Destroy(); });
})
**.RowTemplate(rows =>
"<tr><td>Testing</td>" +
"<td colspan=\"2\"><input type=\"button\" name=\"ClickMe\" value=\"ClickMe\" onclick=\"javascript:window.open(('/Test/ViewTest'), 'ViewTest', 'height=' + (window.screen.height - 100) + ',width=200,left=' + (window.screen.width - 250) + ',top=10,status=no,toolbar=no,resizable=yes,scrollbars=yes');\"/></td>" +
"<td>Name</td></tr>"
)**
.ToolBar(commands => commands.Create())
.Groupable()
.Pageable()
.Sortable()
//.Filterable()
.Scrollable(x => x.Height(600))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Server()
.Model(model => { model.Id(p => p.Id); model.Field(p => p.Id).Editable(false); })
.Create(create => create.Action("CreateLookup", "Icms"))
.Read(read => read.Action("Lookup", "Icms"))
.Update(update => update.Action("UpdateLookup", "Icms"))
.Destroy(destroy => destroy.Action("Destroy", "Sample"))
)
)
Currently I hard code the value in the row template, how can I bind it with the data in database, if i want to apply the row template.
Example
.RowTemplate(rows =>
"p.LookupValue" +
"" +
"p.Description"
)
Please help me on this as I am new to kendo UI. Thanks a lot.
Why don't you use Template on the column definition :
.Columns(columns =>
{
columns.Bound(p => p.LookupValue)
.Template(#<text>#item.LookupValue #item.Description</text>).Title("Short Name").Width(300);
columns.Bound(p => p.Active).Width(300);
columns.Command(command => { command.Edit(); command.Destroy(); });
})