Posts

Showing posts from June, 2013

How do I capitalize all text in a column of data in an Access Query while keeping the name of the field the same? -

how capitalize text in column of data in access query while keeping name of field same? i tried entering "spec: strconv([spec],3), error have circular argument (which, isn't surprising). how around this? is there totally different approach capitalizing in queries? given: have field named [spec]. problem: need query grab [spec] , convert caps, same field name added: call table holds field [spec], [tbltable] solution: need put in query builder following: spec: ucase([tbltable].[spec]) that way machine can figure out query.spec isn't same identifier tbltable.spec equivalently: select ucase([tblnames].[firstname]) firstname tblnames;

android - RecyclerView item touch to highlight -

i using recyclerview , not able see feedback when touch on item of recyclerview . how achieve it? i trying show feedback user when touching row of recyclerview . ripple effect. i want know how achieve in specific row of recyclerview . this recycler view's custom row layout. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="50dp" android:id="@+id/drawer_row" android:background="?android:attr/selectableitembackground" android:clickable="true"> <textview android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:layout_marginleft="30dp" android:layout_marg

android - getting value from two spinner into string variables -

i'm trying pass strings "año" , "artista" 2 spinners next activity , value "año" "artista" void. used method values in other activity , there works here, "artista" void. moreover, have tried switch method , without success. i hope helps me , tells me i'm doing wrong. read , information before ask help, this code, public class buscar extends activity implements onitemselectedlistener{ string año; string artista; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_buscar); buscar(); spinner spinnerbuscaraño = (spinner) findviewbyid(r.id.añospinner); string[] añobuscar = {"1995", "2000", "2005"}; spinnerbuscaraño.setadapter(new arrayadapter<string>(this, android.r.layout.simple_spinner_dropdown_item, añobuscar)); spinnerbuscaraño.seto

javascript - How to remove comma before special character using jquery -

my string :- var str = #805|6412,6413,#803|6392,6393,#802|6382,6383,6384,#96|622,623,#88|589,592,#810|6461,6462,6464 now want remove comma before every (#) sign ? try this. replace ,# # . removing , s before # character. var str = "#805|6412,6413,#803|6392,6393,#802|6382,6383,6384,#96|622,623,#88|589,592,#810|6461,6462,6464"; str = str.replace(/,#/g, '#');

performance - How to measure data transfer rate between two nodes on Linux Server ? Must ignore the effect of disk -

at first , use scp copy file node9 node10 .but method not satisfied purposes.cause scp affected disk.result in unexpected result.so , should ? ethernet 10gbit/s. two things... firstly, scp encrypted , takes time therefore encrypt, consider using nc or netcat installed on linux distros. secondly, can use /dev/zero generate data fast. so... generate data fast let's generate 10 gbytes of data /dev/zero , discard /dev/null check how fast can generate data: dd if=/dev/zero bs=1024k count=10000 > /dev/null 10000+0 records in 10000+0 records out 10485760000 bytes transferred in 0.573830 secs (18273282446 bytes/sec) none shabby @ 18 gbytes/sec. transfer across network now, on node10, prepare receive data listening on port 8000, , discarding received data: nc -l 8000 > /dev/null and on, on node9, send data , time it: dd if=/dev/zero bs=1024k count=10000 | nc node10 8000

android - CollapsingToolbarLayout with tablayout & image as collapsing with sticky toolbar -

Image
i want achieve view similar below images below screens have achieved through design support library in android please see layout file below <framelayout android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.design.widget.coordinatorlayout android:id="@+id/rootlayout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsingtoolbarlayout" android:layout_width="

testing - Test database isolation with Behat 3, Doctrine 2 and Symfony 2 -

i introducing functional behat tests on symfony2/doctrine2 application , deciding how handle database isolation , data fixtures. are there pitfalls setting separate test environment own separate mysql database gets populated dump import prior execution of behat test suite, , emptied after suite execution? i'm trying avoid using data fixtures unless need save time of manually writing foreign key relations , not. any guidance appreciated. as far symfony/doctrine/behat concerned , if want 1 of follows best practises then: you should isolate environment dev, test, prod, stag ... setting isolated environments symfony application base build folder structure header. you should isolate test database , use sqlite instead of mysql performance purposes. using multiple sqlite entity managers multiple bundles , databases in test environment , can use one. you should use fixtures give flexibility , rid of burden of manual processing. not try avoid using them! creating doct

jquery - Prevent CSS document from loading on mobile devices -

trying increase loading speed mobile devices, , there @ least 1 css document don't want loaded on mobile. i have prevented script loading, css document kinda different. here example of don't want loaded on mobile devices: <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/animations.css"> do have working solution? not sure tags correct, done css in beginning of document, or jquery or html. since have javascript-based mobile detection (you should have noted in op important), can use javascript load css. simple as: <script> if(!ismobile.any()) { document.write('<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/animations.css">'); } </script> this simple approach. might better use dom manipulation insert link. check out answer more thoughts on how can - how load css files using javascript?

ios - Parse & Swift- No results matched the query -

i seem have different problem previous askers. i trying retrieve object parse in swift, use code var query = pfquery(classname:"gamescore") query.getobjectinbackgroundwithid("mlwvjlh7pa") { (gamescore: pfobject?, error: nserror?) -> void in if error == nil && gamescore != nil { println(gamescore) } else { println(error) } } ignore fact left gamescore same... anyway's here image of parse data, proof objectid exists. http://i.stack.imgur.com/xefhh.jpg this error in console when running simulator. 2015-07-21 11:10:39.496 parsestarterproject[959:19643] [error]: no results matched query. (code: 101, version: 1.7.5) optional(error domain=parse code=101 "no results matched query." userinfo=0x7fdeaadb1200 {error=no results matched query., nslocalizeddescription=no results matched query., code=101}) why getting error "no results matched query" when objectid indeed exist? you have make sure &q

excel - combine dates into 1 and combine other cells (amounts) into 1 cell in Google Sheets -

i have question use google sheets , data api sheets uploads orders date of order , amount of order. now if 10 orders 10 rows of (21-7-2015) , amount i want automated process combines these order dates , amounts if 10 orders 1 euro on 27-7-2015 should have 1 row of 21-7-2015 in a1 date colum , g5 ( in case should have total amount of 10) 10x 1 euro combined now trick . not sure if getting 5 orders per day or 10 should combine if dates same i hope can make myself clear do. please see layout here https://docs.google.com/spreadsheets/d/1cj6fjrzt9tmykkk41crsza4cl8dbhoiepi52rejzk8s/edit?usp=sharing its (colum colum g) it looks you've made list of unique dates in column , want automatically fill in column j. can use sumif. j3 be. =sumif(a:a, i3, b:b) this says, of rows in column contain value in j:3. add corresponding values column b.

powershell - Send pop up message to specific RDP users who have not logged off -

i using function get-loggedonuser microsoft technet script center repository: get-loggedonuser i'm invoking "msg" command (net send) on rdp server send pop message user has not logged out overnight. i don't want broadcast message users on server; send notification individual users have been logged in since before midnight previous night. want message show username , logon time , remind them log out. $yesterday = [datetime]::today.tostring('m/d/yyyy hh:mm ') $notloggedout = get-loggedonuser -computername computername | where-object {$_.logontime -lt $yesterday} $script={param($command, $users, $computername, $logontime); write-host $command; &cmd /c "$command"} $command = foreach($user in $notloggedout){write-host "dear " $user.username "the system shows have been logged on since " $user.logontime "reminder: must log off @ end of everyday"} invoke-command -computername computername -scriptblock $sc

javascript - Why won't my images load up from my java servlet? -

i'm connecting ip cam via python , running script in java servlet. loading each image in java , converting byte array base64 encoding. lastly ask data via ajax through json object. don't receive errors images don't appear either. javascript: $().ready(calltoserver); function calltoserver(){ $.ajax({ type:"get", url:"droneservlet.do", async:true, data: null, datatype:"json", success: drawimage,//function success error: badrequest//function error }); settimeout(calltoserver,5000); } function toarray(str){ var i; var bytes=[]; for(i=0;i<str.length;i++) { bytes.push(str.charat(i)); } return bytes; } function badrequest(){ console.log("failed");

c# - wpf mvvm treeview contexmenu -

i'm learning wpf/mvvm , got stuck on following... code below working <listbox x:name="listbox" dockpanel.dock="top" itemssource="{binding items}" displaymemberpath="name" > <listbox.contextmenu> <contextmenu datacontext="{binding path=placementtarget, relativesource={relativesource self}}"> <menuitem header="show selected" command="{binding path=datacontext.showselectedcommand}" commandparameter="{binding path=selecteditems}"/> </contextmenu> </listbox.contextmenu> </listbox> but when i've replaced listbox on treeview, such <treeview x:name="tview" dockpanel.dock="top" displaymemberpath="name" tag="{binding datacontext, relativesource={relativesource self}}" itemssource="{binding items}" > <treeview.contextmenu>

python 3.x - Poor predictive performance for RandomForest in Spark -

this might long shot, has run poor predictive performance using randomforest mllib? here i'm doing: spark 1.4.1 pyspark python 3.4.2 ~30,000 tweets of text 12289 1s , 15956 0s whitespace tokenization , hashing trick feature selection using 10,000 features run rf 100 trees , maxdepth of 4 , predict using features 1s observations. so in theory, should predictions of close 12289 1s (especially if model overfits). i'm getting 0 1s, sounds ludicrous me , makes me suspect wrong code or i'm missing something. notice similar behavior (although not extreme) if play around settings. i'm getting normal behavior other classifiers, don't think it's setup that's problem. for example: >>> lrm = logisticregressionwithsgd.train(lp, iterations=10) >>> logit_predict = lrm.predict(predict_feat) >>> logit_predict.sum() 9077 >>> nb = naivebayes.train(lp) >>> nb_predict = nb.predict(predict_feat) >>> n

django - Options to map new URL Patterns to Existing Code -

i have new caller can call application in specific new url pattern:- applicationpath?send=n&msg=<messagecontent>&dest=<phone>&stime=mm/dd/yy hh:mm:ss pm/am&operator=p&circle=q my existing urlconf calls different methods based on message text:- (('api/(?p<phone>\w+)/messagea', handle_a_message), ('api/(?p<phone>\w+)/messageb', handle_b_message), ...) i can think of writing urlconf redirects these methods along these lines:- (('applicationpath?send=n&msg=messagea&dest=(?p<phone>\w+)/\w+', handle_a_message), ('applicationpath?send=n&msg=messageb&dest=(?p<phone>\w+)/\w+', handle_b_message), ...) are there simpler recommended alternatives missing? redirection best alternative?

How to format pdf or excel with itextsharper from Asp.net Control -

i want generate report in pdf,excel format. have used asp.net repeater control data binding. using itextsharp. rendered, page control pdf , excel format. code: stringwriter sw2 = new stringwriter(); htmltextwriter hw2 = new htmltextwriter(sw2); this.rptbillreport.rendercontrol(hw2); paragraph report = new paragraph(); using (stringreader sr2 = new stringreader(sw2.tostring())) { //parse , collection of elements list<ielement> elements2 = itextsharp.text.html.simpleparser.htmlworker.parsetolist(sr2, null); foreach (ielement val2 in elements2) { //add elements paragraph report.add(val2); } } document pdfdoc = new document(itextsharp.text.pagesize.a4, 30f, 30f, 30f, 0.0f); pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); //htmlparser.parse(sr); pdfdoc.add(report); pdfdoc.close(); response.write(pdfdoc); response.end(); my question here is: how format report, adding border , other style i

java - How to hide index.jsp in url -

in java ee project mapped welcome page <welcome-file-list> <welcome-file>login.jsp</welcome-file> </welcome-file-list> after login correctly go index.jsp . home. need hide index.jsp in url. localhost://ems . usually doesn't show index.jsp in url. press arrow key go http://localhost:8080/ems/index.jsp is there way hide that? i'm not using java related frameworks @ moment. use apache tomcat. yes, using: <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> see " configuring welcome files ". at beginning of index.jsp , need check whether user logged in. if not, redirect login.jsp . if don't want user see login.jsp in url, need include jsp instead . if want make sure user never sees index.jsp , need check request url , redirect / when url ends /index.jsp using response.sendredirect() .

dealing with trailing slashes in angularjs -

i have function looks this: $scope.deletetodo = function(id) { var url = '/musicians/' + id; console.log("url" + url); $http.delete(url, { 'id': id}) .success(function(data) { $scope.todos = data; console.log(data); }) .error(function(data) { console.log('error: ' + data); }); }; if id 123, /musicians123 however, expecting /musicians/123 . i straightaway error , not print console.log statement. since it before $http.delete, believe should have been printed not. i have tried escaping / using \\/ did not help. also, tried configure with: .config(['$resourceprovider', function($resourceprovider) { // don't strip trailing slashes calculated urls $resourceprovider.defaults.striptrailingslashes = false; }]); stacktrace: delete http://localhost:3000/musicians55accbce27e2cd2802de4894 404 (not fo

python 2.7 - How to eliminate duplicate products in odoo purchase order product line? -

while creating purchase order, if add same products twice , creates 2 different product lines instead of updating quantities of same product. please me this. you can create model inherits purchase.order.line , override create function way: class purchase_order_line(models.model): _inherits = 'purchase.order.line' @api.one def create(self, vals): same_line = self.search([('product_id', '=', vals.get('product_id', false)), ('order_id', '=', vals.get('order_id', false))]) if same_line: total_qty = same_line.product_qty + vals.get('product_qty', 0) vals.update({ 'product_qty': total_qty, }) same_line.write(vals) return same_line else: return super(purchase_order_line, self).create(vals)

Insert into database from android using PHP -

i'm trying insert data android application database using php , tried below script error fail 3﹕ org.json.jsonexception: end of input @ character 0 of php script <?php $servername = ""; $username = ""; $password = ""; $dbname = ""; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } // insert values table $name=$_request['name']; $email=$_request['email']; $message=$_request['message']; $sql = "insert user_message (`nm_id_mes`, `nm_mail`, `nm_content`, `nm_datetime`, `nm_name`) values (null,$email,$message,now()+ interval 7 hour,$name)"; $flag['code']=0; if ($conn->query($

codeigniter update root directory -

Image
when trying reference function in controller, following error. it's missing "/angular/" in path. how can update root path include angular directory? remove / @ beginning of wherever trying call function, placing ./ might work.

jquery - Navigation bar doesn't respond on mobile devices -

i'm trying find out why doesn't work on iphone works great on desktop. tried @ crossbrowsertesting.com , works fine on android phones.. not on iphone. http://codepen.io/marcray/pen/vmjbn // sticky header $(window).scroll(function() { if ($(window).scrolltop() > 100) { $('.main_h').addclass('sticky'); } else { $('.main_h').removeclass('sticky'); } }); // mobile navigation $('.mobile-toggle').click(function() { if ($('.main_h').hasclass('open-nav')) { $('.main_h').removeclass('open-nav'); } else { $('.main_h').addclass('open-nav'); } }); $('.main_h li a').click(function() { if ($('.main_h').hasclass('open-nav')) { $('.navigation').removeclass('open-nav'); $('.main_h').removeclass('open-nav'); } }); // navigation scroll lijepo radi materem $(&

Powershell & XML: Save data to a certain node of xml-file -

i have powershell script loads data xml. xml looks like: <meta> <log> <path>d:\logs\l1.log</path> <lastwrite>01/30/2015 13:01:00</lastwrite> <num>23</num> </log> <log> <path>d:\log\l2.log</path> <lastwrite>02/30/2015 14:02:00</lastwrite> <num>67</num> </log> </meta> what change value in xml. first load data: [xml]$xml = get-content "d:\config.xml" my problem is, how can address log-node in xml? i'm searching this: $xml.meta.log.path | path = "d:\log\l2.log" and set new value , save xml-file. maybe sb can me, have idea how search, i'm sure there's way. use ids within log-tags not solution, because have address nodes paths. you there. instead of = use -eq condition. have use curly brackets , access current value using $_ : $xml.meta.log.path | { $_ -eq 'd:\log\l2.log' } alternative, can

javascript - Post form using values filled by jquery in Angular -

i have form drop downs this: <select id="relevance" class="form-control input-lg" ng-model="formdata.relevance"></select> i can fill these dropdowns using jquery maps json data appropriate dropdown this: $.getjson("url/to/the/json", function(data) { // values database var rel_val = data[0].relevance; // set fields using jquery $("#relevance").val(rel_val); this works great, if click on form submit button: <button type="submit" id="submit_button" class="btn btn-primary btn-lg btn-block" ng-click="createtodo();">save changes</button> it not write database (postgres). know "createtodo()" works because if manually make changes dropdowns (so set me, not jquery) form submit data properly. my "createtodo" looks this: // create new todo $scope.createtodo = function(todoid) { $http.post('/api/v1/todos', $scope.formdata)

node.js - Cannot npm install 'mean-cli' module on Mac OS X -

update: apparently, bad practice use sudo install node modules. instead, changing folder permissions solve issue. see answer here: https://stackoverflow.com/a/31546496/2859315 original post: currently, have installed node (version v0.12.7) , npm. trying install mean-cli package npm. i following installation instructions found here: https://github.com/linnovate/mean#installation also, taking mean stack development course on udemy. here lecture: https://www.udemy.com/mean-stack-for-beginners/#/lecture/2697540 so far, have installed both prerequisite packages, gulp , bower: $ npm install -g gulp // , bower $ npm install -g bower firstly, tried installing using npm install -g mean-cli threw permission errors without using sudo . then, using sudo not work. secondly, tried updating , reinstalling node , npm. still have same issue. when type command sudo npm install -g mean-cli , i response: > mean-cli@0.10.14 preinstall /usr/local/lib/node_modules/mea

Loop over multiple .csv files python/pandas -

i have 2 folders contain +50 .csv files, want process al files in python code pandas. @ beginning of code load 2 different .csv files: location1 = path\tasks_01.csv' location2 = path\resource_01.csv' dftask = pd.read_csv(location1) dfresource = pd.read_csv(location2) in middle kind of different operations structure data etc. @ end save both .csv files new .csv file: dftask.to_csv(path\tasks_new.csv') dfresource.to_csv(path\resource_new.csv') since have 2 folders, 1 containts task.csv files , other resource.csv files how can edit code in such way can loop on files? , save them under original name? hope can me out! create list of files in each folder , zip through both of them. import os files_in_folder_1 = [os.path.join(path1, f) f in os.listdir(path1) if os.path.isfile(os.path.join(path1, f))] files_in_folder_2 = [os.path.join(path2, f) f in os.listdir(path2) if os.path.isfile(os.path.join(path2, f))] file1, file2 in zip(

animation in Jquery : re-arranging list item using eq? -

is there possibility of animation in re-arranging list items . i have 5 list items a,b,c,d,e now on click wanted animate clicked list item come nicely in middle , other move accordingly. order not change if user click on done in 3 step animation 1) a,b,c,d,e initial 2) e,a,b,c,d first step 3) d,e,a,b,c in center so no mater how many step perform clicked item in center should smooth animation. changing position in list done can't perform animation effect on it. can manage order change in children animation? the code show below based on left position not changing order change css , animate not actual order here fiddle test $('.horizontal li').on ('click',function (e) { $(this).animate({ left: 150 }, 'slow'); $(this).addclass('active').siblings().removeclass('active'); i added class 'active' make center element highlighted on click, can't smoothly animate list items wh

How to hook 'send email' of IBM Lotus Notes -

i'm working on plugin ibm lotus notes. need change content of email right after user clicks 'send email' button, before email sent. have searched apis of lotus notes can't find workaround. there library named com.ibm.notes.mailsend in folder /opt/ibm/lotus/notes/framework/shared/eclipse/plugins. can't find document related on internet, , have no idea how capture event sending email. know how implement function need? thanks. update: richard. i've figured out how hook email sending. need make option user can set differently each individual email. understanding, email known message stored in mail file database before being sent. how 'add flag' message? thanks. the way hook events in lotus notes notes c api's extension manager routines. general strategy hooking mail send operations set hook on em_nsfnoteupdatemailbox. can done on either notes client or domino server. on server side, if processing non-trivial, run risk of slowing down domin

java - WebObjects: Using WOConditional inside <div> -

i in situation "class" attribute of div tag should dependent on value of java binding. can done moving associated logic java class, @ moment not allowed change @ java component. i trying out following resolve problem (using woognl): <div class="<wo:woconditional condition = \"[cssclassdecider]\">classtouse</wo:woconditiona>" > html static content </div> as can seen, trying use value of "cssclassdecider" set class. can tell if has solved similar problem or 1 available @ wo. it's not clear me whether cssclassdecider providing string content class attribute, or boolean drive conditional. in case, usual pattern be: <wo:wogenericcontainer elementname="div" class="$methodreturningclassnames"> ... </wo:wogenericcontainer> if cssclassdecider returns conditional, this: <wo:woconditional condition="$cssclassdecider"> <div class="classwhent

android - Pass a parent activity object into AsyncTask -

i want pass parent activity called asynctask asynctask.. below part of code want use activity object in doinbackground parameters instead of string cant because ab unable it.. please explain how it.. public class backgroundtask extends asynctask<string, void, string> { alertdialog alertdialog; alertdialog alertdialog2; context ctx; userlocalstore userlocalstore; string res_name , res_username , res_dob , res_email , res_id , res_pass; backgroundtask(context ctx) { this.ctx =ctx; } @override protected void onpreexecute() { alertdialog = new alertdialog.builder(ctx).create(); alertdialog.settitle("login information...."); alertdialog2 = new alertdialog.builder(ctx).create(); alertdialog2.settitle("apologies"); } @override protected string doinbackground(string... params) { string

Is it possible to send file to Azure Event Hubs? -

i want send .zip files event hubs , listen event hub console application , receive file unzip it. event hubs correct solution ? i need relaible solution because there thousands of clients send .zip files event hub. it possible send files event hubs sending file contents byte array not recommended because maximum size of event data 256kb . better approach upload zip files in blob storage , send link blobs event data. on client side when fetch event data, extract blob url , download blobs.

How to copy a topic from a kafka cluster to another kafka cluster? -

one way kafka documentation shows through kafka.tools.mirrormaker can trick. however, need copy topic (say test 1 partition) (its content , meta data) production environment development environment connectivity not there. simple file transfer between environments though. question: if move *.log , .index folder test-0 destination kafka cluster, enough? or there more need meta data , zookeeper-related data need move too? just copying log , indexes not suffice - kafka stores offsets , topic meta data in zookeeper. mirrormaker quite simple tool, spawns consumers source topic producers target topic , runs until consumers consumed source queue. can't find simpler process migrate topic.

mysql - Options for speeding up slow SQL queries -

we're having issues few queries - relatively simple queries - take long processing. 3 000ms 30 000ms. using php 5.5 , mysql 5.5.28-29.1. we have few options, posting here see if has experience on each of them: currently accessing views our data, done move processing load php mysql. accessing tables directly improve query processing speed? i'm thinking not, cause lead lot more queries, due fact views collations of data. if install cache db, such sqlite3, cache locally, sync rdbms, how that? , speed improve? thinking nodejs version well, using node webkit. far can understand there npm packages out there can act cache or db connection, rule out need php. how speed? another option set dedicated server environment (we're using virtual server environment moment). speed parts of up. if mysql still slow on server - it's kind of wasted. these alternatives can think of @ moment. suggestions appreciated. (i can post slow sql queries if need be, see if has our opti

android - Options for endlessly repeating function GUI calls while remaining responsive -

i've got animation perform consists of arrow heads aligned horizontally alpha values of arrows change achieve animation effect (i.e. first arrow has alpha 1.0, second value 1.0 etc.). so if have function this: void highlightfirstarrow() { marrow1.setalpha(1.0f); marrow2.setalpha(0.75f); marrow3.setalpha(0.50f); marrow4.setalpha(0.20f); } then i'd want start, repeat numerous times, stop function such this: void animatearrows() { highlightfirstarray(); pause; highlightsecondarray(); pause; etc. } obviously lock gui thread if performed in example. options achieving desired animiation: - run loop in separate thread - don't use loop, instead execute functions individually via timer - use built in specific android animation mechanisms. if appropriate? animatorset() scenario, or else you shouldn't use loops or timers. there're lots of built in classes animate views. instance can use valueanimator : val

c++ - Overloading operator= or operator[] using const char* and/or string -

i've been scouring google , stackoverflow so-far no clear answer this, i'm asking directly... i made bitmap font class , i'd use assignment operator: operator=(const char*) assign string literal text of class. note: i'd assign using string, string* , char*... example: class bitmaptext{ private: std::string _text; public: void operator=(const char* _t){ _text = _t; } /*i've tried iteration of operator using bitmaptext& operator=(const char* _t){ _text = _t; return *this; } */ bitmaptext(){} ~bitmaptext(){} }; bitmaptext* t1 = new bitmaptext(); t1 = "hello world" assigning char string bitmaptext object yields following: assigning 'bitmaptext*' 'const char[12]' incompatible type. i'm sure there's reason this. can done string class. looked string class , typedef'd from: typedef basic_string<char, char_traits<char>, allocator<char> > s

ios - Changing UINavigationController Back Button Image Issue -

Image
i trying change navigation controller button, facing problems image not being inline. have removed text clicking on navigation item in view controllers , changing button text single space " ". then change navigation bar image custom 1 in navigation controller scene. but image not inline. does know why or best practises change button image. id suggest take @ image , make sure arrow correctly positioned in image. may causing push upwards. alternatively, use: [[uinavigationbar appearance] settitleverticalpositionadjustment:(float)0.0 forbarmetrics:uibarmetricsdefault]; which change vertical positioning of title match image. however, may make rightbarbuttonitem out of place.

asp.net - executionTimeout to send response -

when set httpruntime executiontimeout, cut off response has been partially sent client? i've noticed in iis request queue there requests run lot longer our executiontimeout setting , state sendresponse in iis web core module. executiontimeout include time takes send response client? the documentation find on following page in snip, 2003 older versions of iis: https://msdn.microsoft.com/en-us/library/ms972959.aspx request execution time. number of milliseconds taken execute last request. in version 1.0 of framework, execution time begins when worker process receives request, , stops when asp.net isapi sends hse_req_done_with_session iis. iis version 5, includes time taken write response client, iis version 6, response buffers sent asynchronously, , time taken write response client not included. the iis version 7.5 on windows server 2008 r2 running asp.net 4.5 web application , debug set false. i apologize not addressing question directly, there might proble

javascript - Dispatch on select element without eval or copy & paste -

edit: question duplicate of "how call javascript function when have string containing name". dom interaction distraction. i call 1 of n distinct javascript functions when user chooses option html select element. i'd without repeating myself or regressing eval(). revision 1 stored strings in option's value field, used these indexes dictionary. <body> <select onchange="dispatch(this)"> <option value="first_function_name">one</option> <option value="second_function_name">two</option> </select> </body> <script> function first_function() {console.log("there can one");} function second_function() {console.log("except when there two");} function dispatch(selection) { var name = selection.value; var lookup_table = { first_function_name: first_function, second_function_name: second_function }; (lookup_table[name])(); } </script> revision 2

objective c - Swift override property set hidden like ObjectiveC -

in objectivec use sethidden invalidate intrinsic size - (void)sethidden:(bool)hidden { super.hidden = hidden; [self invalidateintrinsiccontentsize]; } and call on view like view.hidden = yes; but can't find how same on swift in swift it's easy, if meant class mycustomview : uiview{ override var hidden: bool { { return super.hidden } set(v) { super.hidden = v someotherfunction() } } } var view = mycustomview() view.hidden = true

javascript - Option not selecting automatically when going back -

i apologize if has been answered. i'm still kind of learning go. have searched , been unable find solution works me. had found one: firefox ignores option selected="selected" but adding autocomplete="off" did not work me. users should able choose option, submit, , when go have selected option available. working in safari, chrome, , opera not working in firefox or ie. select works fine, doesn't automatically select choice when go back. i have select on same page doesn't appear have same issue. here html: <div class="col-sm-2 col-md-2"> <div class="form-group"> <label for="custom_1_units">units</label> <select class="form-control" id="custom_1_units" name="custom_1_units" value="<?php echo"_session['custom']['custom_1_units'];" ?>" autocomplete="off"> <option value="

boost - R BH package not showing "asio" directory -

after installing bh package, including following in .cpp file: #include <rcpp.h> #include <boost/asio/ip/address_v4.hpp> sourcing cpp file sourcecpp(".cpp file") giving : fatal error: boost/asio/ip/address_v4.hpp: no such file or directory compilation terminated. in bh/boost directory there no asio directory. we never said boost asio part of bh. quoting the description highlighting in italics below: description: boost provides free peer-reviewed portable c++ source libraries. a large part of boost provided c++ template code resolved entirely @ compile-time without linking. package aims provide useful subset of boost libraries template use among cran package. placing these libraries in package, offer more efficient distribution system cran replication of code in sources of other packages is avoided. asio, thread, ... , few others require linking , can never part of bh.

sql - Grouping and counting issue -

i have table this: id,code, (some more columns) 1, c 1, 1, b 1, b 1, b 2, -- desired row 3, b 3, c 3, 3, i want 1 id (or all) have been associated 'a' , not 'b' , 'c'. how do ? what tried now: select * ( select id, count(case when code='a' 0 else 1 end) c tbl group id ) c = 0 why not work ? this list of id values associated codes of 'a' . select id tbl group id having max(case when code='a' 0 else 1 end) = 0 see fiddle live demo.

ruby - Receive UDP datagram on raw socket? -

i'm trying write own implementation of udp in ruby educational purposes using raw sockets. here's have far: require 'socket' addr = socket.pack_sockaddr_in(4567, '127.0.0.1') socket = socket.new( socket::pf_inet, socket::sock_raw, socket::ipproto_raw ) socket.bind(addr) socket.recvfrom(1024) i testing so: require 'socket' udp = udpsocket.new udp.send "hello world", 0, "127.0.0.1", 4567 but call recvfrom blocking indefinitely. if change this: socket = socket.new( socket::pf_inet, socket::sock_dgram, socket::ipproto_udp ) it of course works because system-level way accept udp packets. how can receive udp packets on raw socket? clear: want handle actual udp protocol (decoding datagram & doing checksum) myself! raw sockets work @ ip level. cannot bind raw socket port. can bind local address bind or interface setting proper socket options (i don't know how in ruby, in c call setsocko

excel - How to get full height and width of range, including borders? -

i can't seem find answer anywhere. in vba, given dim r range: set r = range("c20:c21") can r.height , r.width , former combined height of cells c20 , c21 doesn't include size of borders in between them. is there reliable method of obtaining full combined height , width (e.g.: height , width of cells + size of borders in between cells) ? thanks. i think calculation should testcb.top = testcb.top + ((r.height - testcb.height) / 2)) or rather (not sure version means) testcb.top = r.top + ((r.height - testcb.height) / 2))

html - Reformatting column width when using pandas dataframe.to_html() -

Image
i have pandas dataframe want display table in html template. works part, of strings in dataframe being truncated. using to_html() convert pandas dataframe html friendly table , tried using col_space argument didn't seem have affect. the python code : options = dbi.getdbtables() #returns list of names of available tables table_headers = [] table_name in options: table_name = str(table_name) df = dbi.selectdf("select * %s limit 1" % table_name) #gets actual dataframe each table name header = df.columns.values header = "<br>".join(header) table_headers.append(header) header_dict = dict(zip(options,table_headers)) table_options = pandas.dataframe(header_dict,index=[0]) table_options = table_options.to_html(classes=["table table-hover"],index=false,escape=false,col_space=400) #changing col_space nothing. search_dict = {'table_names':table_options} the html code : <div class="table-responsive&qu

javascript - Node.js - Diagnose "(node) warning: Recursive process.nextTick detected." -

my application has situation in operation takes long time complete, , couple hundred instances of following message printed: (node) warning: recursive process.nexttick detected. break in next version of node. please use setimmediate recursive deferral. and application crashes with: rangeerror: maximum call stack size exceeded no stack trace. how diagnose such errors? i'd know, instance, function call preceded rangeerror . to replicate error, run node foo.js on file foo.js following contents: var foo = function () { process.nexttick(foo); }; foo(); i not interested in particular cause of problem in application in knowing how diagnose type of problem in node. node version v0.10.39 . you can replace process.nexttick print sort of useful information – along lines of: var _nexttick = process.nexttick; var alreadylogged = new set(); process.nexttick = function nexttick(f) { if (!alreadylogged.has(f)) { alreadylogged.add(f); pr

javascript - ES6 Arrow Notation with Loops -

consider following bit of code: f=(m,c)=>{m?c()&f(--m,c):0} (thanks zzzzbov little nugget) which "for"-less loop and following: a=b=>b+1 given these 2 snippets, , fact that: z = 0; f(10,a(z)); which expect result in z equating 10, instead returns in javascript console following "typeerror: c not function" , how 1 go altering code ensure loop goes ahead, without having resort while or for loop? i'm asking matter of education purposes... can insight can done... the function f taking 2 arguments: m , number iterate, , c , function called m times. means second argument, c should function. example: f=(m,c)=>{m?c()&f(--m,c):0} f(15, function() { console.log("hello") }) this iterate through c function 15 times, calling console.log 15 times. of course, achieve wanted in second bit, use this: z=0, f(10,()=>z++) this regular arrow function increase z 1 take @ code on babel hope help!

angularjs - What is the "Angular" way to handle form validation? -

so, i'm looking @ piece of code: function checkformelements(field) { if ($scope.options === undefined || $scope.optionsform.$error[field] === undefined ) { return false; } var result = false; $.each($scope.optionsform.$error[field], function(index, value) { // todo: there *has* better way element. angular must know form control, whether it's named or not. var element = $('[name=' + value.$name + ']'); if (!element.prop('disabled')) { result = true; } }); return result; } $scope.formisinvalid = function() { return checkformelements("pattern"); }; $scope.fieldisempty = function() { if ($scope.options === undefined || $scope.formisinvalid()) { return false; } return checkformelements("required"); }; and i'd quite clean todo. the form elements generated in directive by: template: '\ <input class="ou

java - Kill MapReduce job if driver program crashes -

i have driver program launches mapreduce job org.apache.hadoop.mapreduce.job.waitforcompletion(boolean) on hadoop 2.4.0. problem have if driver program crashes in middle of job, job continue running. there way kill launched mapreduce job if driver program crashes? whether or not driver program crashes not under control. i'm guessing require client , job periodically poll each other. there setting or method in api this? you can find applicationid (jobid) listed in yarn webui or can type yarn application -list in yarn resource manager node of cluster. can kill applicationid using kill command as: yarn application -kill <applicationid> . guess solve problem.

c# - Rotate and flip an image -

i want flip image horizontally. occur when user clicks button. creating image in c# this: image newimage = new image(); i tried: scaletransform transform = new scaletransform(); transform.scaley = -1; selectedimage.rendertransform = transform; //where selectedimage image want rotate. to flip it, nothing flip it. how can accomplish this? something should work, based on use in universal windows platform app i'm working on, works me: newimage.rendertransformorigin = new point { x = 0.5, y = 0.5 }; newimage.rendertransform = new scaletransform() { scaley = -1 }; newimage.updatelayout(); i think updatelayout key part here work think had same issue not updating , might have resolved it

dynamics crm - Create Parent and Child Records Through Dialogs -

i'm trying create dialog following: the dialog run when want copy entity (submission). so, first step copy parent record (submission); after that, want copy child records (claims) , associate children copied entity (submission). so far can copy submission, can't copy claims , associate them new submission. do guys know how can that? thank you!!! you need write code this, custom workflow activity option.

c# - How do you use RoutingState.NavigateCommandFor<T> properly -

i trying follow view model navigation pattern established in xamforms playground ran troubles getting work properly. given following code, can see problem is: // router = new routingstate(); // navigate = router.navigatecommandfor<myviewmodel>(); this.whenanyvalue(x => x.viewmodel.navigate) //.do(x => x.canexecuteobservable.subscribe()) .bindto(this, x => x.navigatebutton.command); this.whenanyvalue(x => x.viewmodel.router) .bindto(this, x => x.viewhost.router); if bind navigate command button's command object, it's initial canexecute state false , there never adjustment initial state. if uncomment do code above force initial state computed , button enables appropriately. obviously, not correct me, expect initial canexecute state true (at least after ui loaded). what worse, appears heisenbug because if ever check canexecute state of routingstate.navigate or myviewmodel.navigate commands (with canexecute(null) ), retur