Posts

Showing posts from May, 2010

What is the proper way to use descendant in XPath -

i trying find div elements have attribute widget-name , descendant span tag have title attribute. this trying. //div[@widget-name , descendant::span[@title]]" this seems work missing 1 element in nodes collection returns. never mind. this needed: //div[@widget-name , descendant::span[@class='title']] ok - take back. not complete answer. trying tweak returns except title not equal text: //div[@widget-name , descendant::span[@class='title' , [text()[contains(., '{sometexttokeep}' anyone see why invalid xpath? final answer is: //div[@widget-name , descendant::span[@class='title' , text()[not(contains(., 'sometexttokeep'))]]]"

Android listview getView checkBox -

something strange happening, when click row in list corresponding checkbox selected. right, strange thing that, automatically every 7 rows checkbox setcheked true. what's problem? help listadapter adapter = new arrayadapter<dettaglio1> (this, r.layout.deteails_list_pdf, r.id.tv_nome_categoria, dettagli1) { @override public view getview(final int position, view convertview, viewgroup parent) { view row = super.getview(position, convertview, parent); ... ... list.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { final dettaglio1 d1 = dettagli1.get(position); d1.setchecked(!d1.ischecked()); checkbox checkbox = (checkbox) view.findviewbyid(r.id.checkbox2); checkbox.setchecked(d1.ischecked()); }

android detect when view is over another view -

Image
i have layout: what want when move view of detect if view on view and, if so, call swap method. i want when on over half of second view in example: all code complete, want detect when view on half view right or left. xml code: <relativelayout android:id="@+id/mmmm" android:layout_width="match_parent" android:layout_height="match_parent" android:animatelayoutchanges="false" android:layout_gravity="center"> <!-- first view --> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_alignparenttop="true" android:layout_alignparentright="true"> <customfonts.roundedimageview android:layout_width="wrap_conten

Calling SQL Server's stored procedure from MySQL -

in sql server database has stored procedure dbo.usp_addsum. need execute trigger in mysql database. possible? know linked server mysql vice-versa? got solution this post , it's fine me. consists in wrap stored procedure in php function , call function mysql external application: delimiter @@ create trigger test_trigger after insert on mytable each row begin declare cmd char(255); declare result int(10); set cmd=concat('/usr/bin/php ', 'home/sync/send_to_sql_server.php f1=', new.f1, ' f2=', new.f2); set result = sys_exec(cmd); end; @@ delimiter ;

xml - Improper UTF-8 and LibXML::Reader -

i have large xml file remote source, says 'utf8', file shows us-ascii. <?xml version="1.0" encoding="utf-8"?>... file -bi <file> indicates application/xml; charset=us-ascii encode::guess indicates utf8 edit: there code reads in file, output lwp get...i have try force encoding here, other errors wide chars. my $fh = io::file->new; $fh->open( '<' . $filename ) $content = join '', <$fh>; i using xml::reader my $reader = xml::libxml::reader->new(string => $content) or die qq(cannot read content: $!); while ($reader->nextelement($template->{ 'item' } )) { $copy = $reader->copycurrentnode(1); $test = $copy->findvalue( 'description' ) ...# other stuff $copy this works fine through of contents. however, there looks invalid utf-8 or malformed data gives error half way through.. (note, in xml::bare whole xml processed 'fine' more forgiving, file on limit of

Phalcon PhP - how to disable the main layout for an action -

i'm creating action in 1 of phalcon controller used generate print version of page. here print.volt layout: <!doctype html> <html lang="en"> <head> <title>print</title> </head> <body> <!-- begin page content --> <div class="container"> {% block content %}{% endblock %} </div> </body> </html> and view: {% extends "layouts/print.volt" %} {% block content %} here <script type="text/javascript"> window.print(); </script> {% endblock %} it working, problem content generated inserted inside layout has {{ content() }} tag. @ end o page website menus, print.volt , view. know how can view inserted inside print.volt, without master layout. how can disable behavior? thanks help! two options come mind. 1) use simple view, can render template without layout: $view = new \phalcon\mvc\view\simple(); $view->setviewsd

c# - Set the size of frame -

i supossed display pictures library on web browser. have 2 html frames. 1 should display menu, , second 1 - content itself. now, because size of pics can large, need limit (=max size) them content frame size. (the resolution of screen changes 1 pc another, width/height information code behind). when tried make - frame "style" attribute, when page loaded, got style empty string: <frame src="http://localhost/display_media/default.aspx" style =<%# "width:" + eval("scrwidth") + ";" + "height:" + eval("scrheight") + ";" %> name=content scrolling=yes > where wrong? , if has idea - maybe can code behind ?.. make 'width' , 'height' attribute instead of writing 'style' attribute. this: <frame src="http://localhost/display_media/default.aspx" width="<%# eval("scrwidth"); %>" height="<%# eval("sc

c# - Mouse and Keyboard hooking in UWP : Raw input VS KeyEvents VS Global Hook -

i'd hook mouse , keyboard in uwp app, , i'm wondering best between raw input , global hook , simple xaml key events. put simple, i'm developing uwp application streams game (rendered using cloud server, nvidia grid) , i'd hook user events (keyboard , mouse) tell server user moving in game (for example). i thought several approaches: creating windows runtime component in c++/cx consumed universal app in c#. component use either raw input or global hook raise mouse or keyboard event , send uwp app. simply use key events, keydown , pointermoved events on grid or ui element , listen it. the output sent server using socket connection. what best solution performance , simplicity? it seems key events allowed hook input in uwp.

swift - UITableView row won't removed after being deleted -

i'm having problem after had deleted tableview row, row won't removed, here code, had follow tutorial online, , delete data model, won't dismiss deleted row unless unwind previous screen , view, why it? : func tableview(tableview: uitableview, caneditrowatindexpath indexpath: nsindexpath) -> bool { return true } func tableview(tableview: uitableview, commiteditingstyle editingstyle: uitableviewcelleditingstyle, forrowatindexpath indexpath: nsindexpath) { if (editingstyle == uitableviewcelleditingstyle.delete) { let product = frc.objectatindexpath(indexpath) as! product let productname = product.name let message = (mclocalization.sharedinstance.stringforkey("cart_remove_one_item_message", replacements: ["%s" : productname!])) let alert = uialertcontroller(title: (mclocalization.sharedinstance.stringforkey("cart_remove_title")), message: message, preferredstyle: uialertcontrollerstyle.alert)

json - parse JIRA REST API response using php -

Image
i tried several times , several methods parse long json data in jira rest api response. couldn't i want parse json using php. used pure php , curl couldn’t. please me solve this. i'm new in rest api , php-curl here jira rest response https://jira.atlassian.com/rest/api/latest/issue/jra-9 here sample php-curl code <?php $ch = curl_init(); curl_setopt($ch, curlopt_url, "https://jira.atlassian.com/rest/api/latest/issue/jra-9"); curl_exec($ch); curl_close($ch); ?> finally. solve that.i have enable curl extension first on local server(wamp or xampp) issue

javascript - Remove one line in txt file ( NODE.js) -

i make text file "foo\nbar\nbas" when append coke(with adding \n), file "foo\nbar\nbas\ncoke" i want remove foo. help me! fo use case have provided, simple answer split on \n, remove first item, add new item end, , join array form new string. var parts = "foo\nbar\nbas".split("\n").slice(1); parts.push("coke"); var updated = parts.join("\n"); other option use indexof find first occurrence of \n , substring select portion of string, simple concatenation. var str = "foo\nbar\nbas"; var position = str.indexof("\n")+1; var updated = str.substring(position) + "\ncoke";

java - JSON Parser: Error parsing data org.json.,AndroidRuntime: FATAL EXCEPTION: AsyncTask #3 -

Image
it says window licked package com.example.dd_02.addon; here .java file please answer public class mainactivity extends activity{ button register; edittext text_name; private progressdialog pdialog; jsonparser jparser = new jsonparser(); int status; string message; private static string url_register = "http://10.0.2.2/apartment/apartment_register.php"; private static final string tag_success = "success"; private static final string tag_message = "message"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); text_name = (edittext) findviewbyid(r.id.txt_apartment_name); register = (button) findviewbyid(r.id.btn_register); register.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { new apartmentregister().execute(); } }); } {json} class apartmentr

android - How to display data? -

i using method call service in application. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.next); string url = "url"; aquery maquery = new aquery(next.this); maquery.ajax(url, string.class, new ajaxcallback<string>() { @override public void callback(string url, string data, ajaxstatus status) { super.callback(url, data, status); if (buildconfig.debug) { log.d("###$request url", url + ""); log.d("###$response ", data + ""); log.d("###$status message : ", status.getmessage() + ""); log.d("###$status code : ", status.getcode() + ""); } if (null != data && status.getcode() != -101) { string stringdata = "" + data; try {

Are there problems with using GUID's as indexed fields in SQL Server? -

i've read lot of articles mention using guid clustered indexed (or primary key) in sql server cause performance issues. however, due design decisions, need field guid in each line of 1 table. if define primary key of table autoincrement integer, , add guid normal column indexed, have performance issues similar having guid primary key? edit: side note, know guid primary key bad idea, asking if have performance issues if set indexed (non clustered) field what type of index want use guid field? clustered? unique? if unique, guid not differ other unique field. can use without doubt. in case of clustered index affect performance. can use sequential guid . can solve performance issues. generating of guid on client-side can improve performance.

sql server - Join TSQL Tables in same DB -

i want simple join of 2 tables in same db. the expected result is: node_id's table t_tree same tree_category table t_documents my t_documents tabel: +--------+----------------+---------------------+ | doc_id | treee_category | desc | +--------+----------------+---------------------+ | 89893 | 1363 | test | | 89894 | 1364 | tab or 4 spa | +--------+----------------+---------------------+ t_tree tabel +----------+-------+ | node_id | name | +----------+-------+ | 89893 | hallo | | 89894 | bb | +----------+-------+ doc_id primary key in t_documents table , tree_category foreign key node_id primary key in t_tree tabel select dbname.dbo.t_tree.node_id dbname.dbo.t_documents inner join tree_category on t_documents.tree_category = dbname.dbo.t_tree.node_id i can not figure out how correctly .. right approach ? you close. try this: select t2.node_id dbname.dbo.t_documents t1 inner join dbname.

git - GitHub commit with "invalid email" -

Image
i need change author's email of old commits on github. found script on github allows change author email old (wrong one) new article link , in case,i don't know email did use push commits. there anyway find out "invalid email" , correct it? . on blue circle (as per screenshot) asking me correct email on github correct how resolve issue old commits? appreciated. [ on far right side can see commit hash used commit in question. use $ git show <commit> and @ author line. there should see name , email address . keep in mind, rewriting commits new email address rewrite history of every commit there on (because parent hashes change too).

c++ - Decision trees / stumps with Adaboost -

i started learning decision trees adaboost , trying out on opencv , have questions. boosted decision trees i understand when use adaboost decision trees, continuously fit decision trees reweighted version of training data. classification done weighted majority vote can instead use bootstrapping when training decision trees adaboost ? i.e. select subsets of our dataset , train tree on each subset before feeding classifiers adaboost. boosted decision stumps do use same technique decision stumps ? or can instead create stumps equal number of features ? i.e. if have 2 classes 10 features, create total of of 10 decision stumps each feature before feeding classifiers adaboost. adaboost not trains classifier on different subsets, adjusts weights of dataset elements depending on assemble performance reached. detailed description may found here . yes, can use same technique train decision stumps. algorithm approximately following: train decision stump on initial data

Varnish cache - cannot handle 4000 concurrent users -

Image
experiencing issue when loading ~ 4000 concurrent users on wp site. here configuration have: f5 loadbalancer ---> varnish 4 8 cores, 32 gb ram ---> 9 backends 4 cores, 16 ram each, running wp site. while load ~ 2500-3000 users going fine, without errors, when users reaching 4k, varnish stops responding until compute queued requests, plus see many 502 errors. have 2 pools, 5000 threads each; malloc=30g additionaly added somaxconn , tcp_max_syn_backlog sysctl here vcl: vcl 4.0; import directors; import std; backend qa2 { .host = "xxx"; .port = "80"; } backend qa3 { .host = "xxx"; .port = "80"; } backend qa4 { .host = "xxx"; .port = "80"; } backend qa5 { .host = "xxx"; .port = "80"; } backend qa6 { .host = "xxx"; .port = "80"; } backend qa7 { .host = "xxx"; .port = "80"; } backend qa8 { .host = "xxx"; .port = "80"; } backend q

visual studio 2015 - Xamarin - Can't create and run a blank cross platform application -

Image
i new xamarin. have installed visual studio 2015 xamarin , trying build new blank cross platform app. when build it, builds successfully. however, when try run in emulator, launches can't see output on screen. takes long time launch. has faced issue too? maybe try visual studio emulator android or xamarin android player . when create new project, try updating xamarin.forms , other library in nuget.

ssh - How to open a shell without SSHD on the receiving end? -

i have machine without sshd , want open bash shell on machine remote machine (that can control). since have ssh on limited machine, configured reverse proxy: $ ssh -r 19999:localhost:22 remoteuser@remotemachine now have connection on port 19999 "fully control" machine "limited" machine. how open shell setup? you can pipe input port directly bash . common practice when misusing various bugs in software. example, run on full-access machine: nc -lvp 9999 and on limited machine /bin/bash -i >& /dev/tcp/192.168.122.1/9999 0>&1 where 192.168.122.1 ip of full-control machine. this give shell of second machine in first one. note connection not encrypted. if want encryption, need add tcp forwarding step (similar propose above).

Fabric Digits oauth authentication in PHP/Lravel -

using digits api calling oauth verification getting wrong response sdk. below code in curl script. $curl = curl_init(); curl_setopt($curl,curlopt_url, $xauthserviceprovider); curl_setopt($curl,curlopt_httpheader, array( 'content-length: 0', 'content-type: application/json', 'authorization: '.$xverifycredentialsauthorization, )); curl_setopt($curl, curlopt_returntransfer, true); $content = curl_exec($curl); $info = curl_getinfo($curl); curl_close($curl); $obj = json_decode($content, true); response {"url":"https:\/\/api.digits.com\/1.1\/sdk\/account.json","content_type":null,"http_code":0,"header_size":0,"request_size":0,"filetime":-1,"ssl_verify_result":1,"redirect_count":0,"total_time":0.375,"namelookup_time":0.016,"connect_time":0.234,"pretransfer_time":0,"size_upload":0,"size_download":

java - Special characters ("\") in .properties-file -

i'm developing java application executes on windows. have several backslashes ("\") in .properties-file. file looks like: dir=\\127.0.0.1\d$\dir\dir2\dir3 i read property dir using spring annotation value : @value("${dir}") protected string dir; this results in string 127.0.0.1d$dirdir2dir3 when property dir used in code. i have tried unicode escapes this: dir=\u005c\u005c127.0.0.1\u005cd$\u005cdir\u005cdir2\u005cdir3 i have tried backslash escape this: dir=\\\\127.0.0.1\\d$\\dir\\dir2\\dir3 both of tries above results in string \\127.0.0.1d$dirdir2dir3 when property dir used in code. i want property dir set \\127.0.0.1\d$\dir\dir2\dir3 when property used in code. shall .properties-file result? you can use forward slashes, beyond reason works on windows

C# - Login system doesen't work -

i'm not means @ developing in c#, , i've installed vs15 , i've tried little more advanced me password required enter actual core program. here's code: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace consoleapplication1 { class program { static void main(string[] args) { console.writeline("enter password:"); string input = console.readline; if input = rekt(); console.writeline("you entered correct password!"); else console.writeline("you entered incorrect password!"); } } } can me fix it? trouble @ "if" part, tbh don't know how end line itself. can please guide me newbie? did not mean make angry or annoyed, please. answers. know guys busy. assuming rekt() method returns string containing correct password, correct cod

javascript - Open close buttons function bootstrap -

i using bootstrap collapse hide , show content on page , change bit. here example bootply . <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <div class="container"> <div class="row"> <div class="col-md-6 col-lg-6"> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#first">first</button> <div id="first" class="collapse"> lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </div> </div> <div class="col-md-6 col-lg-6"> <button type="button" class="btn btn

javascript - After post response reload data in angularjs -

Image
question after post data have small html table shows data data doesn't show until reload page getting automatically show data after submit appreciated. here angular_stuff var dim = angular.module('dim', ['ngresource']); dim.config(['$httpprovider', function($httpprovider) { $httpprovider.defaults.xsrfcookiename = 'csrftoken'; $httpprovider.defaults.xsrfheadername = 'x-csrftoken'; $httpprovider.defaults.headers.post['content-type'] = 'application/x-www-form-urlencoded'; }]); dim.config(function ($interpolateprovider) { $interpolateprovider.startsymbol('{[{'); $interpolateprovider.endsymbol('}]}'); }); dim.factory("dim", function ($resource) { return $resource("_dims.html", { pk: 'pk' }, { index: { method: 'get', isarray: true, responsetype: 'json' }, update: { method: 'post', responsetype: '

php - PEAR Dont see XML_Parser -

i install xml/rss package prar. , see ls -la /usr/share/php/xml/ итого 84 drwxr-xr-x 4 root root 4096 авг 8 14:19 . drwxr-xr-x 19 root root 4096 авг 8 14:10 .. drwxr-xr-x 2 root root 4096 авг 5 11:49 parser -rw-rw-r-- 1 root root 20928 авг 8 14:19 parser.php drwxr-xr-x 5 root root 4096 авг 8 13:32 rpc2 -rw-rw-r-- 1 root root 10457 авг 8 14:04 rss.php -rw-r--r-- 1 root root 30531 авг 8 14:08 util.php but when try use rss parser have error: php message: php fatal error: call undefined method pear::xml_parser() in /usr/share/php/pear.php on line 218" while reading response header upstream, client: 192.168.1.1, server: www.example.org, request: "get /team/cron http/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "example.org"

Google maps shows wrong location on old Android versions -

my app has tab opens google maps , shows markers of sightseeings around user. when open tab should show user's current location. show on android 6.0.1 correctly, when try on 4.2.2 or 4.4.2 example shows users location around 30km (18miles) longitude difference north (the latitude fine). of phones have location , wi-fi turned on , connected same wi-fi network. in mapready have set setmylocationenabled true, should working, it's not. suggestions what's causing this? @override public void onmapready(googlemap googlemap) { mmap = googlemap; mmap.setmaptype(googlemap.map_type_normal); mmap.setmylocationenabled(true); i don't think os version of phone or code issue. have used samsung duos , other phones using 4.4.2 , lower , haven't had issues location. when in high accuracy mode phones can fetch data through wifi or mobile networks not accurate. there have been instances location shown incorrectly when wifi router has been moved. examp

javascript - Underscore.js, why does `isFunction` use `|| false`? -

the optional override isfunction(object) in underscore.js ( repo link definition ), reads follows: // optimize `isfunction` if appropriate. work around typeof bugs in old v8, // ie 11 (#1621), safari 8 (#1929), , phantomjs (#2236). var nodelist = root.document && root.document.childnodes; if (typeof /./ != 'function' && typeof int8array != 'object' && typeof nodelist != 'function') { _.isfunction = function(obj) { return typeof obj == 'function' || false; }; } what i'm confused || false , why necessary after string comparison? since typeof returns string there should no ambiguity? comment states override fixes typeof bugs, there cases on listed platforms when typeof doesn't return string? see issues covered in comments, #1621 , #1929 , #2236 . shortly put, platforms have bug typeof isn't string unless store in variable. || false fixes issue without introducing variable. t

javascript - Pass variable to php script with AJAX -

i'm not sure understand how ajax works though read lot it. want run following php if button clicked, without loading page: unset($checkout_fields['billing']['billing_postcode']); so put following: jquery(document).ready(function($) { $('.keep-buying-wrapper').click(function(){ $.ajax({ url: "url-to-the-script.php", method: "post", data: {'checked': checked}, success: alert('success!'), }); }); }); and in php script: if( $_post['checked'] == 'checked' ){ unset($checkout_fields['billing']['billing_postcode']); } however nothing happen. though success alert popping, post['checked'] null. is ajax supposes trigger php script? if want send variable functions.php ? the problem need serialize post data first . html code (the id , name of checkbox "billing_postcode" ):

Spark-submit master url and SparkSession master url in the main class, what is difference? -

when submitting job spark-submit set master url , give him main class, ex: spark-submit --class wordcount --master spark://spark:7077 my.jar but inside main class spark context define master url : sparksession.builder().appname("word2vec").master("local"). this me confused, happens if send job spark-submit master of standalone cluster ( spark://spark:7077 ) start sparksession local master ? should sparksession master url same spark-submit url when executed on cluster ? there no difference between these properties. if set both, properties set directly in application take precedence. quote documentation : any values specified flags or in properties file passed on application , merged specified through sparkconf. properties set directly on sparkconf take highest precedence, flags passed spark-submit or spark-shell, options in spark-defaults.conf file. few configuration keys have been renamed since earlier versions of spark; in such case

swift - Why i am not able to pass optional value ( ? ) for getting image url? -

self.imgview .sd_setimagewithurl(nsurl(string: dictdata["image"] as? string)) hello using swift , want image url dictdata when write line dictdata["image"] as? string it's giving error value of optional type 'string?' not unwrapped; did mean use '!' or '?'? , when click on error improve line of code this dictdata["image"] as! string why happened? want know reason behind that. that means dictdata["image"] as? string optional. , nsurl(string) takes non optional parameter. in order have unwrap optional. dictdata["image"] as! string force unwrapping means, if dictdata["image"] nil or if fails cast string app crash. encourage use following code if let image = dictdata["image"] as? string { self.imgview .sd_setimagewithurl(nsurl(string: image)) } else { print("failed cast string") }

truncate - Limit csv column length using PowerShell -

i'm trying adjust tab-delimited textfile without headers using powershell , have write output same tab-delimited textfile. source data follows; aaa \t bbbbbb \t ccccccccccc aaaa \t bbbb \t aaaabbbbbccccccc now column number 3 should limited first 5 characters only, making output follows; aaa \t bbbbbb \t ccccc aaaa \t bbbb \t aaaab how can accomplish this? the following code import csv file using import-csv , loop through lines, creating substring (5 in length) of 3rd column before writing line new csv file. $oldcsv = "t:\old.csv" $newcsv = "t:\new.csv" import-csv -delimiter "`t" -path $oldcsv -header "1","2","3" | foreach-object { "{0}`t{1}`t{2}" -f $_.1,$_.2,($_.3).substring(0,[math]::min(5,($_.3).length)) >> $newcsv }

python - Create set and lists with the positions in the set efficently -

i need create set of ids of messages, , positions in original list. code used sort messages later handle them according id. the following works, readable, slow. import numpy np ids=np.array([354,45,45,34,354])#example, actual array huge dict={} counter in xrange(len(ids)): try: dict[ids[counter]].append(counter) except: dict[ids[counter]]=[counter] print(dict) #{354: [0, 4], 34: [3], 45: [1, 2]} any ideas how speed up? there no need lists sorted. later in code used follows, , after dict discarded for item in dict.values(): position_of_id=position[np.array(item)] ... try use defaultdict , enumerate : from collections import defaultdict dict = defaultdict(list) i,id in enumerate(ids): dict[id].append(i) (using try , except bad idea if exceptions aren't rare )

How to copy and create test case from JIRA? -

how copy , create test case jira. creating test case create-->project(xxx)-->issue type(test) .in way have created test case 8 test steps.now need create new test case copying previous test steps.how can do? you should able clone issue. menu item under 'more' menu in issue details screen. if can't see more->clone possible user not have sufficient privileges operation.

ios - insertRowsAtIndexPaths UITableview issue -

i having table 3 rows right arrow button tag values 0,1,2.while clicking right arrow in first row,it display 2 more rows dropdown.i inserted 2 rows using following code.but how change tag values after insertion of rows 0,1,2,3,4.i have done table reload also.but want show down arrow(previously selected button).so not working. tableview.insertrowsatindexpaths(indexpaths, withrowanimation: .left) this how handled click action of button. func cellexpandaction(sender: anyobject){ let prod = dataarray[sender.tag] let indexpath = nsindexpath(forrow: sender.tag, insection: 1) let selectedcell:othercell = tblmenu.cellforrowatindexpath(indexpath) as! othercell if(prod.canbeexpanded) { if(prod.isexpanded){ self.collapsecellsfromindexof(prod, indexpath: indexpath, tableview: tblmenu) selectedcell.btnarrow.selected = false } else{ selectedcell.btnarrow.selected = true

angularjs - bundle.js: Uncaught Error: Bootstrap's JavaScript requires jQuery -

i getting error after have called jquery file befre bootstrap.js. anyone, kindly suggest? working node , angularr , webpack. my declerations goes this. require('jquery/dist/jquery.min.js'); require('bootstrap/dist/css/bootstrap.css'); require('bootstrap/dist/js/bootstrap.js'); require('./content/common.css'); require('angular'); pls suggest cause here! thanks, may try loading jquery below : window.$ = window.jquery = require('jquery/dist/jquery.js'); and then, var bootstrap = require('bootstrap/dist/js/bootstrap.js');

javascript - Why Date.parse() methods works for invalid string "foo 01.01.01" -

i have doubt regarding javascript date.parse method, below code example var datestring = "foo 01.01.01"; date.parse(datestring) this returns value (978287400000) expect nan can perform invalid date check below. isnan(datestring.gettime()) my question how above string valid date string? per mdn link below should return nan. https://developer.mozilla.org/en/docs/web/javascript/reference/global_objects/date/parse thanks, michael from page link to: a string representing rfc2822 or iso 8601 date ( other formats may used , results may unexpected). from the spec page links to : if string not conform format function may fall implementation-specific heuristics or implementation-specific date formats.

ios - Running actions in sequence SpriteKit -

in ios app i'm trying animate distribution of cards of players. however, when try run action sequence, none of cards move. doing wrong? override func didmovetoview(view: skview) { /* setup scene here */ var actions = [skaction]() let cards = makedeck() c in cards { let card = card(key: c) card.position = cgpointmake(300, 300) addchild(card) actions.append(skaction.moveto(givecardtoplayer(cards.indexof(c)!), duration: 2.0)) } self.runaction(skaction.sequence(actions)) } change self.runaction(skaction.sequence(actions)) to cards.runaction(skaction.sequence(actions)) currently, running sequence of actions on scene rather cards. without seeing of other code i'd assume correct, if doesn't suggest posting code givecardtoplayer

hive - Partition and Bucket ORC Tables -

i understand when create orc tables, improve speed dramatically. however, can improve further partitioning , bucketing orc table? if so, how partitioning , bucketing in existing orc table? you can bucket , partition orc table. partitions directly mapped directories in hdfs. can alter table , add partition. you'd have partition recovery after thou. explained here: https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#languagemanualddl-alterpartition . personally i'd create new table wih dynamic partitioning , copy data new table.

java - Pass input from FXML text field to BCrypt.checkpassword -

i having first crack @ both fxml , bcrypt learning exercise. i have 2 text fields in fxml , plan concatinate them in string compare hash bcrypt. this example.fxml <textfield fx:id="userid" layoutx="103.0" layouty="56.0" onaction="#loginpressed"/> <passwordfield fx:id="passwordfield" layoutx="103.0" layouty="111.0" onaction="#loginpressed"/> this loginpage.java private void loginpressed(actionevent event) { if (bcrypt.checkpw((unpwfield), passwordhash)) system.out.println("accepted"); else system.out.println("denied"); } i thought answer be private string unpwfield = userid+passwordfield; but doesnt work. (the operator + undefined argument type(s) javafx.scene.control.textfield, javafx.scene.control.textfield) why? edit i have tried following gives nullpointer string unpwfield; unpwfield = userid.gettext()+passwordfi

Creating Animation in Scilab -

i able plot point using x , y coordinates using following code. figure(1); plot(x(1),y(1),'o'); h_compound = gce(); h_compound.children.mark_size = 20; h_compound.children.mark_background = 2; h_axes = gca(); h_axes.data_bounds = [0,0;100,100]; my program contains loop keeps on refreshing coordinate values. every time loop executed point plotted in same graphic, such new points overlap older ones. how make old points disappear new points plotted animation-like sequence generated? scf(1);clf; x=linspace(0,10,100); y=sin(x); plot(x(1),y(1),"o") h_compound = gce(); h_point=h_compound.children h_point.mark_size = 20; h_point.mark_background = 2; h_axes = gca(); h_axes.data_bounds = [0,-1;10,1]; realtimeinit(0.1); i=1:100 realtime(i);//wait 0.1 second before drawing new position h_point.data=[x(i),y(i)]; end

javascript - prevent @ to be entered into input field? -

i want prevent @ entered input . doesn't work, idea why? $(function() { $(document).on('keyup', '[placeholder="x"]', function() { if (event.keycode === 64) { event.preventdefault(); } }); }) https://jsfiddle.net/r82wtea3/2/ you need pass parameter event function: $(document).on('keypress', '[placeholder="x"]', function(event) { /*...*/ }); i suggest use event.which instead of event.keycode better compatibility. here's updated fiddle . have used keypress event instead of keyup .

graph - ArangoDB: Get all links out of an array of nodes -

following after this question , excellent answer codemanx , ask how use previous result (an array of returned nodes) query out of links in collection. basically intended use result of for v in 0..100 "entity/node_id" entityrelation options {uniquevertices: "global"} return v._key for query links: "for c in entityrelation filter c._from==" + "\"" + node._id + "\"" + " or c._to==" + "\"" + node._id + "\"" + " return c"; how should approach it? i'm not sure want achieve exactly, here 2 possible solutions: for v in 0..100 "entity/node_id" entityrelation options {uniquevertices: "global"} vv, c in v entityrelation return c above query uses nested for-loop (actually traversal) perform traversal each node returned outer traversal, using v start vertex , ignoring direction of edges. entire edge documents of inner trave

regex - jQuery get substring from string having start and end substrings of substring -

Image
so have string, lets one: the quick brown fox jumps on lazy dog and lets there jumping animal, not fox, string different. , need part of it, lets one brown fox jumps i know string starts "brown" , ends "jumps" suppose need regex solve this. i thankful if explain structure of writing regex me, because far don't it. just select word in between easiest one. /(brown.*jumps)/i regex tester or if select animal single word too: /(brown (.*) jumps)/i regex tester

sip - Freeswitch spandsp.conf.xml Tone settings -

i'm using spandsp tone detection, i'm looking guidance in configuring sit, reorder , busy tone in spandsp.conf.xml brazil. frequency ( freq1/freq2 ) params in hz understandable, , min/max params seems tone duration. can find these values brazil? this sample: <descriptor name="1"> <tone name="ced_tone"> <element freq1="2100" freq2="0" min="700" max="0"/> </tone> <tone name="sit"> <element freq1="950" freq2="0" min="256" max="400"/> <element freq1="1400" freq2="0" min="256" max="400"/> <element freq1="1800" freq2="0" min="256" max="400"/> </tone> <tone name="ring_tone" description="north america ring"> <element freq1=&q

r - How do I work on a list using other list -

i have list containing 15 data frames. > head(forecast_ucmseasonality) $us_month_businessconfidence [1] 52.45713 53.49713 52.97712 53.15715 52.81716 52.75717 52.48875 53.00550 52.97213 52.77213 [11] 52.03886 52.33882 $us_month_chainstoresales [1] 4099.952 4592.386 4195.608 4518.860 6230.274 9649.281 3373.654 3837.009 4417.476 4421.007 [11] 4857.800 4181.440 $us_month_cpi [1] 235.905 236.223 236.575 237.335 237.890 238.772 239.448 239.241 239.313 239.363 239.250 [12] 239.159 this list ucm result on list. have applied condition reduce large input values train_dataucm <- lapply(train_data, transform, value = ifelse(value > 50000 , value/100000 , value )) #reducing large values in order ucm function work ucm_trainseasonality <- lapply(train_dataucm, function(x) ucm(value~0,data = x , level=t, irregular=t,slope=t,season=t,season.length=12)) forecast_ucmseasonality <- lapply(ucm_trainseasonality, function(x) predict(x, n.ahead = 12)) the initial list looks :

point cloud library - CMake Warning at CMakeLists.txt (add_executable) -

i'm using point cloud library own project , links pcl project cmakelists.txt described below : project(scanmatching) cmake_minimum_required(version 2.8) find_package(pcl 1.8 required) include_directories(${pcl_include_dirs}) link_directories(${pcl_library_dirs}) add_definitions(${pcl_definitions}) add_executable(modeling main.cpp custom.hpp) target_link_libraries(modeling ${pcl_libraries}) it used work after mistakenly typed sudo apt-get autoremove (not apt autoremove) i following cmakeerrors (snippet of cmake result) : cmake warning @ cmakelists.txt:11 (add_executable): cannot generate safe linker search path target modeling because files in directories may conflict libraries in implicit directories: link library [libpcl_common.so] in /usr/lib may hidden files in: /usr/local/lib link library [libpcl_kdtree.so] in /usr/lib may hidden files in: /usr/local/lib link library [libpcl_octree.so] in /usr/lib may hidden files in: /usr/local/lib link library [li

WPF - The buttons next to each other -

Image
i have button , under him text , these buttons next each other served under him. code: userview.xaml: <wrappanel orientation="horizontal" horizontalalignment = "left"> <itemscontrol itemssource = "{binding path = users}"> <itemscontrol.itemtemplate> <datatemplate> <stackpanel orientation = "vertical"> <button style="{staticresource userbutton}" content="{binding name}"></button> <rectangle style="{staticresource userbuttonstatus}" fill="{binding color}" tooltip="{binding tooltip}"/> </stackpanel> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </wrappanel> mainwindow.xaml: <stackpanel grid.ro

javascript - Chrome canvas 2d context measureText giving me weird results -

here's compact version of problem let canvas = document.createelement('canvas') let ctx = canvas.getcontext('2d') ctx.font = '11pt calibri' ctx.fillstyle = '#000000' let temp = ctx.font console.log(ctx.font) console.log(ctx.measuretext('m').width) ctx.font = 'bold ' + ctx.font console.log(ctx.font) console.log(ctx.measuretext('m').width) ctx.font = 'italic ' + ctx.font console.log(ctx.font) console.log(ctx.measuretext('m').width) ctx.font = temp console.log(ctx.font) console.log(ctx.measuretext('m').width) running code in chrome produces incorrect numbers, @ least @ end. first i'm setting font '11pt calibri', chrome changes '15px calibri' reason, , because of it's producing text that's bigger correct. read canvas runs @ 96dpi correct px should 14.6. after that, i'm measuring width of text m, comes out @ 12.53401184 me, number important.

Order of execution of Servlet and Listener class in java -

as part of application development, 2 things need take care: read configuration properties file load on startup using servlet load on application need start listener start thread pool using specified pool size , getting properties file note: listener dependent on servlet , in order configured values. here concern , if both start parallel , in case may chance of listener starts before servlet , hence configured value not available time. how resolve .. ?

javascript - how to show the effect of the focus with the border radius..i have tried . i want it to zoom out -

insert image inside tag , run it may full understand clearly .focus { -webkit-transition: 1s ease; -moz-transition: 1s ease; -o-transition: 1s ease; -ms-transition: 1s ease; } .focus:hover { border: 70px solid #000; border-radius: 50%; } <div class="focus pic"><img src=" " ></div> first set default values of element on should when zooming out. second set transition effect 0 in :hover condition. .focus { -webkit-transition: 1s ease; -moz-transition: 1s ease; -o-transition: 1s ease; -ms-transition: 1s ease; border: 0px solid #000; border-radius: 0; } .focus:hover { -webkit-transition: 0s ease; -moz-transition: 0s ease; -o-transition: 0s ease; -ms-transition: 0s ease; border: 70px solid #000; border-radius: 50%; } <div class="focus pic"> <img src="http://www.w3schools.com/html/pic_mountain.jpg"> </div>

python - SQLAlchemy raises QueuePool limit of size 10 overflow 10 reached, connection timed out after some time -

while using flask-sqlalchemy error 'queuepool limit of size 10 overflow 10 reached, connection timed out' consistently, after time. tried increase connection pool size, deferred problem. def create_app(config_name): app = flask(__name__) app.config.from_object(config[config_name]) config[config_name].init_app(app) initialize_db(app) db = sqlalchemy() def initialize_db(app): db.init_app(app) sqlalchemy_pool_size = 100 i figured out problem. issue database connection going lost state, causing pool size exhausted after interval. fix issue made mysql server configuration change query timeout , made 1 second. after 1 second if query didn't respond throw exception , added except block in code query invoked(in case query). in except block, issued rollback command.

java - Deregister delegated class -

i have decided use composition extend functionality of several service classes have in project adding security layer prevent calling method. fine until found class registers listener service , see i'll need extend method called in listener. listener registered in init method of class thought 'de-register' delegated class after init method has been called , register instead composited class feel it's bit dirty... know think approach or how solve this. maybe can have better idea looking @ example of classes have: public abstract class serviceabs { protected void init(); } public interface oldclassif { public void amethod(); } public myoldclass extends serviceabs implements oldclassif, listenerif { protected void init() { observer.addlistener(this); //other stuff needed } public void onlistener() { } @override public void amethod() { } } public mynewclass extends serviceabs implements oldclassif, listenerif {

Python insert value to foreign key attribute (MYSQL) -

i created 2 table in mysql database staff table: +----+-----------+------------- | id | name | +----+-----------+------------- | no data available in table | +----+-----------+------------- qualification table: +----+----------+--------------+ | id | title | staff_id | +----+----------+--------------+ | no data available in table | +----+--------------+----------- id of both table primary key , staff_id of qualification table foreign key. python code like con=pymysql.connect(host='localhost',port=3306,user='root',password='admin',db='mydb') cursor=con.cursor() cursor.execute("insert staff (id,name)values (%s,%s)",(1001,"mr tan")) cursor.execute("insert qualification values (%s,%s,%s)",(2001,"professor","select id staff id=1001")) con.commit() cursor.close() con.close() i try insert value foreign key attribute "typeerror: not arguments conver

Why Wordpress cron not running without the interaction with the website? -

i using cron job in wordpress plugin cron not run without user interaction wordpress website. there solution can run cron after 5 minutes without failure. if using script @ schedule action wp_schedule_single_event(time(),'your_function_name',array('arguments')); then function run if access page. if want run cron job @ interval of time try setup job cpanel , in command prompt write complete path function access. class example_cron { public function __construct() { $this->your_function_name(); } function your_function_name() { // write script here } } $objct = new example_cron(); setup cron path file.it run automatically. command setup cron: php/usr/bin <file path>// example opt/lammp/htdocs/wp-content/plugins/<your plugin name>/<your fine name> thanks