Posts

Showing posts from July, 2012

javascript - Regex for determining if Alphanumeric code is in range -

i'm working on icd10 diagnosis code application. need determine if 1 icd10 code falls in range. example: code: 4a1h7ez range: 4a1h7cz - 4a1h7hz this should return ' true '. i've tried converting alpha characters numbers (a=0, b=1 etc) resulting number conflicts other ranges/codes. regex isn't strong point, suggestions appreciated. do have use regex? seen here in comparing 2 strings alphabetically sorting purposes javascript auto compares strings. so "4a1h7ez" > "4a1h7cz" && "4a1h7ez" < "4a1h7hz" return true

Have trouble when using Yii2 multilang behavior -

Image
i'm using multilang-behavior but, when clicking on update button view data, data returning id = 1 . this code in controller: public function actionupdate($id) { $model = post::find()->multilingual()->one(); //$model = post::findone($id); if ($model->load(yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', [ 'model' => $model, ]); } } this form view data: <?php $form = activeform::begin(); ?> <?= $form->field($model, 'title')->textinput() ?> <?= $form->field($model, 'title_vi')->textinput() ?> <?= $form->field($model, 'title_en')->textinput() ?> <?= $form->field($model, 'created_at')->textinput() ?> <?= $form->field($model, 'updated_at')->textinput

python - list indices must be integers, not str error -

with little function here, trying change 10 digit integer phone number word form. gives me error. def getwordform(phone_num): cake=list(phone_num) print(cake) v in cake: if cake[v] == 0: cake[v] = "zero " elif cake[v] == 1: cake[v] = "one " elif cake[v] == 2: cake[v] = "two " elif cake[v] == 3: cake[v] = "three " elif cake[v] == 4: cake[v] = "four " elif cake[v] == 5: cake[v] = "five " elif cake[v] == 6: cake[v] = "six " elif cake[v] == 7: cake[v] = "seven " elif cake[v] == 8: cake[v] = "eight " elif cake[v] == 9: cake[v] = "nine " thanks everyone. you're iterating on list of 1-character strings, , trying find out if list 's element @ string in

Dgrid + Selection Issue -

still trying work dgrid (0.4) , dojo (1.10), have issue selection. my web page contain dialog opened when click on button. inside dialog, have following code display grid data coming database through json http page. working fine, sorting , query filtering. what want know allow user double click on row, selected row id contains in first column update form in main page. use dgrid/selection this. however, return last row of grid instead of 1 user selected. the selection code based on : http://dgrid.io/tutorials/0.4/hello_dgrid/ any idea? thanks <script language="javascript"> require ( [ "dojo/_base/declare", "dojo/_base/array", "dgrid/ondemandlist", "dgrid/ondemandgrid", "dgrid/keyboard", "dgrid/selection", "dgrid/editor",

c# - Embed metadata in wave-files saved with NAudio -

i working on software able generate "single cycle waveforms" based on basic waveforms, , operations performed on these (simplified). of have added abillity import wavefiles (as "hand-drawn" waveform) , simple play-back feature (using naudio), let user listen waveforms being generated. the purpose of generating these waveforms, export them external/separate wavefiles ("single cycle waveforms" and/or wave-tables), can loaded synthesizers/samplers , used music-production. however beside raw-data (the waveforms) embed loop-markers (loop-start/end) along root-key , on. know if possible naudio, , if how? wave files consist of series of riff chunks. there 2 must present - format chunk , data chunk, more can added, , there standard ones might suit needs. naudio doesn't have built in support writing arbitrary chunks, wavefilewriter can overridden include writing custom chunks. example of cuewavefilewriter class might useful loop markers. an

How to get autocompletion data in chrome developer console by javascript? -

Image
hello. i want of auto-completion data above picture javascript. for example, console.log(data) // data auto-completion data ["a[0]", "__definegetter__", "__definesetter__", ...] // result of above command any ideas autocompletion data? thank you. you want properties (even non enumerated) of object present prototype chain (e.g. using __proto__ ). e.g. : a = new array(10); a[0] = 1; console.log(object.getownpropertynames(a).concat(object.getownpropertynames(a.__proto__)).concat(object.getownpropertynames(a.__proto__.__proto__))); will print: ["0", "length", "length", "constructor", "tostring", "tolocalestring", "join", "pop", "push", "concat", "reverse", "shift", "unshift", "slice", "splice", "sort", "filter", "foreach", "some", "ev

php - How to host a site made with laravel 5 on a actual server? -

i have made site using laravel 5 framework, have made site on local server(localhost). want host site other sites host on server, when uploaded files server, didn't work, giving me error. i have searched on google didn't find perfect solution this. think changes need done in .env file or other file. can tell me changes have make can run site in local server? , 1 more thing: have install composer , laravel on hosting server run files or not? 1.- setup project laravel 5 in localhost correctly configured 2.- double check server configuration of php 5.4 (this because every little change on .htaccess file may change config) 3.- create directory in same level of public_html , put project inside of folder. 4.- put content of public (l5) directly on public_html (be aware of don't overwrite .htaccess file accidentally) now... "tricky part"... structure mail perl5 php public_html [framework-folder] ssl inside of public_html u can see

php - PHPMailer attachment, doing it without a physical file -

so: // setup mail class, recipients , body $mailer->addattachment('/home/mywebsite/public_html/file.zip', 'file.zip'); addattachment function has 4 arguments: addattachment(path_to_file, filename, encoding, header_type) i used use xmail() , when added attachment here, passed filename , content, should in it. like this: $xmail->addattachment('myamazingfile.pdf', $content); how can make work same way, when call addattachment() phpmailer class, can either pass same or it, dont need have actual file on server send? addstringattachment($string,$filename,$encoding,$type) eg $mail = new phpmailer(); $mail->addstringattachment($string,$filename,$encoding,$type); http://phpmailer.worxware.com/index.php?pg=tutorial#3

delphi - Printout special symbols on thermal printer -

i have trouble printing special symbols(€, £, ¥, ý) on epson tm-t88v thermal printer on esc/pos commands. here part of code: fprintoutlines := tstringlist.create; try fprintoutlines.add(#$1b'@'); fprintoutlines.add(#$1b't'#16); fprintoutlines.add('€, £, ¥, ý'+#$a); print fprintoutlines.free; end; on windows xp have correct printout symbols, problem windows 7 , 8. i build stringlist commands, send line line printer. works other symbols , images not special symbols. can me, how can print symbols windows? here code prints lines: var vcurrentline : ansistring; begin ... := 0 fprintoutlines.count - 1 begin vcurrentline := ansistring(fprintoutlines[i]); if (printrawdata(hprn, pansichar(vcurrentline), length(vcurrentline)) < 0) begin log('printrawdata error', 'nativeprint'); endrawprintpage(hprn); endrawprintjob(hprn); exit; end; end; i have found way. here function convert string befor

rotation - 3D projection to screen PHP -

i trying 3d object position on screen. i have studied wiki atricle https://en.wikipedia.org/wiki/3d_projection (and many others) seems getting incorrect answers. $center =array(0,0,0); $point = array(0, 30, 30); $rot = array(90,0,0); $a=array( array( 1, 0, 0), array( 0, cos($rot[0]), sin($rot[0])), array( 0, -sin($rot[0]), cos($rot[0])) ); $b=array( array( cos($rot[1]), 0, -sin($rot[1])), array( 0, 1, 0), array( sin($rot[1]), 0, cos($rot[1])) ); $c=array( array( cos($rot[2]), sin($rot[2]), 0), array( -sin($rot[2]), cos($rot[2]), 0), array( 0, 0, 1) ); $a=array( array($point[0]), array($point[1]), array($point[2]) ); $help = matrixmult(matrixmult($a,$b),$c); $c = matrixmult($help, $a); var_dump($c); function matrixmult($m1,$m2){ $r=count($m

ios - Custom Keyboard ViewDidLoad method not printing to console -

Image
i've got simple keyboard, try print console won't show up... ideas? done within folder keybaord target, here's code: import uikit class keyboardviewcontroller: uiinputviewcontroller, uicollectionviewdelegate, uicollectionviewdatasource, uicollectionviewdelegateflowlayout { @iboutlet var nextkeyboardbutton: uibutton! @iboutlet var collectionview: uicollectionview! override func updateviewconstraints() { super.updateviewconstraints() // add custom view sizing constraints here } override func viewdidload() { super.viewdidload() print("keyboard view loaded") //keyboard nib setup let nib = uinib(nibname: "keyboardview", bundle: nil) let objects = nib.instantiatewithowner(self, options: nil) view = objects[0] as! uiview //cell setup collectionview.registernib(uinib(nibname: "customcell", bundle: nil), forcellwithreuseidentifier: "myce

java - Can't understand purpose of a = b = 0; -

i'm reading java beginners guide , in points of book there piece of code confuses me can't find explanation of does. int a; int b; = b = 0; //this line don't understand. what understand value of 0 copied b , b copied don't understand point of be. example be: queue(int size) { char q[]; putloc = getloc = 0; } my question is, point of piece of code if you're trying create first in first out queue or line using array? it's shortcut same this: a = 0; b = 0; why a = b = 0; works? because assignment operation expression associates right left, b = 0 executes first, assigning 0 b , value in b assigned a , this: a = b . being explicit association order, what's happening: (a = (b = 0)); ^ ^ | | | executes first executes second and why this? well, make explicit both variables have same value (and save few keystrokes), sacrificing readability in process. think it's more clear declare , assign each variabl

c# - What are the differences among Top Level Window, Child window, Dialog(modal) window and non-dialog (modeless) windows? -

can body please tell me how distinguish among them? i have difficulty in understanding distinguishing factors top level child windows vs dialog/non-dialog window? can top level window dialog/non-dialog window? can child window dialog/non-dialog window? top-level forms owned desktop, whereas child forms belong form; means closing or minimising owning form affect child form. modal forms/dialogs block calling thread until form closed, whereas modeless forms allow interact other forms in application while shown. form can modal/modeless, regardless of whether top-level or child form - default behaviour modal dialogs owned form caused them shown.

spring - RestTemplate getForObject to POJO -

i'm using resttemplate.getforobject() retrieve json includes couple of objects , arrays, want convert 1 of objects inside json pojo, don't care other objects inside json. what proper way approach this? edit: another approach accepted answer, can use jacksons objectmapper @autowired private objectmapper jacksonobjectmapper; then linkedhashmap obj1 = resttemplate.getforobject(uri, linkedhashmap.class, params); linkedhashmap obj2 = (linkedhashmap)test.get("flightstatuses"); flight flight = jacksonobjectmapper.convertvalue(obj2, flight.class); you idea, generic datatype json structure use objectmapper convert class need. one solution create wrapper class, includes pojo want deserialize , ignore other properties using @jsonignoreproperties . retrieve wrapper object , pojo it. @jsonignoreproperties(ignoreunknown=true) public class wrapper { private mypojo mypojo; } mypojo mypojo = resttemplate.getforobject("url", wrapper.cla

JBoss Fuse +JPA/Hibernate -

i have osgi bundle in jboss fuse 6.2 imports jar entities , dao classes. jar contains: spring.xml <?xml version="1.0" encoding="utf-8"?> <!-- configures camel context--> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd

Cucumber rails test result -

i learning cucumber / capybara on rails. working on scenario expects display sorted data table. cannot figure out message: pending # express regexp above code wish had i have table: | title | rating | release_date | | aladdin | g | 25-nov-1992 | | terminator | r | 26-oct-1984 | | when harry met sally | r | 21-jul-1989 | | | pg-13 | 10-aug-2011 | | chocolat | pg-13 | 5-jan-2001 | | amelie | r | 25-apr-2001 | | 2001: space odyssey | g | 6-apr-1968 | | incredibles | pg | 5-nov-2004 | | raiders of lost ark | pg | 12-jun-1981 | | chicken run | g | 21-jun-2000 | below step definition: when(/^i clicked "(.*?)"$/) |arg1| if arg1 == "movie title" click_link ("title_header") end end then(/^i expect "(.*)" before "(.*)"$/) |arg1, arg2| as

python - How to feed caffe multi label data in HDF5 format? -

Image
i want use caffe vector label, not integer. have checked answers, , seems hdf5 better way. i'm stucked error like: accuracy_layer.cpp:34] check failed: outer_num_ * inner_num_ == bottom[1]->count() (50 vs. 200) number of labels must match number of predictions; e.g., if label axis == 1 , prediction shape (n, c, h, w), label count (number of labels) must n*h*w , integer values in {0, 1, ..., c-1}. with hdf5 created as: f = h5py.file('train.h5', 'w') f.create_dataset('data', (1200, 128), dtype='f8') f.create_dataset('label', (1200, 4), dtype='f4') my network generated by: def net(hdf5, batch_size): n = caffe.netspec() n.data, n.label = l.hdf5data(batch_size=batch_size, source=hdf5, ntop=2) n.ip1 = l.innerproduct(n.data, num_output=50, weight_filler=dict(type='xavier')) n.relu1 = l.relu(n.ip1, in_place=true) n.ip2 = l.innerproduct(n.relu1, num_output=50, weight_filler=dict(type='xavie

vb.net - How do I enable a Calculate button in visual basic when i need 2 radio buttons selected and text in a text box -

alright i'm writing program converts celsius kelvin , fahrenheit. default have calculate button disabled until user puts in temperature , selects radio button corresponding temperature , temperature being converted to. having great deal of issues trying enable calculate button. i'm not sure since nested if statements in calculate area not working. here have far: option strict on option explicit on public class fmmain 'yes understand program easy break private sub btncalc_click(sender object, e eventargs) handles btncalc.click try dim num1 decimal dim num2 decimal dim answer decimal dim flag integer dim flag2 integer dim t1 string 'this i'm trying enable calculate button if txtnum1.text <> "" if radc1.checked or radf1.checked or radk1.checked if radc2.checked or radf2.checked or radk2.checked

sql - Import .csv file to SAS, clean NULLs -

i'm importing .csv files sas using proc import works fine. however, of quantitative columns have nulls generated .csv files exporting sql. when sas goes through columns, classifies these columns character if 1 of 1000 entries null (which sas thinks string). is there way tell sas null represents missing value , should taken care of accordingly? thanks not proc import. pre-process file , convert string 'null' actual empty space. data _null_; infile 'my.csv' dsd truncover length=ll column=cc ; outfile 'new.csv' dsd ; length cell $5000 ; while (cc < ll); input cell @; if cell='null' cell=' '; put cell @; end; put; run; or read file using data step , create user defined informat converts 'null' missing. proc format ; invalue nulls 'null'=. ; run; data _null_ ; infile 'my.csv' dsd ; informat mynumber nulls. ; input mynumber ; run;

apache camel - DirectConsumerNotAvailableException using endpointUri -

org.apache.camel.component.direct.directconsumernotavailableexception: no consumers available on endpoint: endpoint[direct://start] i error above when try following code. public static void main(string args[]) throws exception { camelcontext context = new defaultcamelcontext(); producertemplate template = context.createproducertemplate(); consumertemplate consumer = context.createconsumertemplate(); consumer.start(); string response = ioutils.tostring(new fileinputstream(args[0])); template.sendbody("direct:start", response); exchange out = consumer.receive("direct:start"); thread.sleep(10000); consumer.stop(); } but works when tried below public static void main(string args[]) throws exception { camelcontext context = new defaultcamelcontext(); final dataformat dataformat = new bindycsvdataformat(ttlabsresponse.class); routebuilder rb = new routebuilder() { public void configure() {

import - Package com.cedarsoftware does not exist! Java -

i had implement jsonwriter today , when im trying working import need not work. im baffled, dont know how fix it. the way im importing right import com.cedarsoftware.*; , tells me doesnt exist. had added classpath , added .jar lib directory in folder. any ideas of why isnt working? i supossed using json-io library github . if using maven, put code proyect config <dependency> <groupid>com.cedarsoftware</groupid> <artifactid>json-io</artifactid> <version>4.1.8</version> </dependency> if not, create al directories of com/cedarsoftware/util/io , put source file code there. , use: import com.cedarsoftware.util.io.jsonwriter;

javascript - JS Codecademy exercise NS_ERROR_NOT_AVAILABLE: -

i coding newbie. learning js on codecademy , keep getting error : ns_error_not_available . doing wrong in following code? prompt ("are ready play"); confirm ("i ready play!"); var age = prompt("what's age"); if("age" <= 12) { console.log("play @ own risk"); } else { console.log("play on!"); } age variable, not string, there no need quotes: prompt ("are ready play"); confirm ("i ready play!"); var age = prompt("what's age"); if(age <= 12) { console.log("play @ own risk"); } else { console.log("play on!"); }

r - Get function being used in error (from call) -

i want extract name of function being used error. if had: mean(letters) "p" * 5 i'd want extract "mean.default" , "*" . can call error follows: capturer <- function(x){ trycatch({ x }, warning = function(w) { w }, error = function(e) { e }) } capturer(mean(letters))$call ## mean.default(letters) capturer("p" * 5)$call ## "p" * 5 but don't have way grab function names. you can grab function name part $call[[1]] . add deparse argument add option of having result returned string. capturer <- function(x, deparse = false) { out <- trycatch({ x }, warning = function(w) { w$call[[1]] }, error = function(e) { e$call[[1]] }) if(deparse) deparse(out) else out } ## these return call capturer("p" * 5) # `*` capturer(mean(letters)) # mean.default ## these return character capturer("p" * 5, deparse =

mysql - ON DUPLICATE KEY UPDATE won't work -

i'm trying hours make simple mysql command , won't work. have database package ids apps stored, 'com.android.package'. stored so: | id | packageid | packagedesc | | 1 | com.android.package | package | | 2 | com.android.test2pa | package 2 | , on... now want insert new entry, if 'com.android.package' don't exist , if exists, want nothing... i've tried following: insert packages (packageid) values ('com.android.package') on duplicate key update packageid=values(packageid) but still creates new entries, that: | id | packageid | packagedesc | | 3 | com.android.package | | | 4 | com.android.package | | | 5 | com.android.package | | i don't know where's error. a proposed packages table schema on duplicate key update work expected following: create table packages ( `id` int not null primary key auto_increment, `packa

Drawing app android: how to undo path, fill color -

i'm creating drawing app feature undo.my app can draw line, fill color. if app have feature draw line, have solution use array list store path , redraw when use tap undo app support fill color (paint bucket) feature. don't found best solution undo. have ideas?????? for undo , redo public void onclickundo () { if (paths.size()>0) { undonepaths.add(paths.remove(paths.size()-1)) invalidate(); } else //toast user } public void onclickredo (){ if (undonepaths.size()>0) { paths.add(undonepaths.remove(undonepaths.size()-1)) invalidate(); } else //toast user }

java and BigDecimal -

this question has answer here: safe string bigdecimal conversion 9 answers i check if variable bigdecimal, there method that? my code: private keystroketextfield myrate; // how can check if myrate.gettext() bigdecimal? bifdecimal test = myrate.gettext(); try create bigdecimal (meaning, call bigdecimal constructor) using text. wrap call inside try/catch .

Excel/Google Sheets: Find MAX Value (Based on Adjacent Cell) + Add 1 -

Image
looking either excel or google sheets. 2 columns: | b. need increment b value 1 based off of max value in b matched in column a. trying accomplish auto increment (+1) based off of max value in column b of department in column a. put formula cell b1: =countif($a$1:$a1;$a1) and copy down b column

ifconfig - How to extract netmask using /sbin/ip? -

i want replace ifconfig /sbin/ip . using ifconfig can see lines inet addr:xx.xxx.x.xx bcast:xx.xxx.x.xx mask:255.255.255.0 and can parse find netmask (255.255.255.0). how can achieve using /sbin/ip ? running ip a you'll output similar running ifconfig . specifically, you'll see line similar yours: inet xx.xxx.x.xx/24 brd xx.xxx.x.xx the /24 denotes subnet mask in slash notation.

ibm mobilefirst - Using WNS for Windows phone Silverlight 8.1-MPNS for Windows phone 8 -

i have developed windows phone 8 application , implemented mpns(microsoft push notification services). **i have upgraded app windows phone 8 version windows phone silverlight 8.1 using visual studio 2013, per link found wns recommended microsoft. has evolved new features , advancements. but when planned go wns need have mobile service back-end. microsoft azure mobile services, payable one. contacted azure mobile support same it's uwp(universal windows apps) if that's case, how proceed wns in upgraded application, or did explain wrong? and have obtained symantec mobile code signing certificate - 299$ can use same signing mpns , wns? to use wns notifications in windows phone app built using mobilefirst tooling, need read documentation. this: http://www-01.ibm.com/support/knowledgecenter/sshs8r_7.1.0/com.ibm.worklight.dev.doc/devref/t_setting_up_push_notification_win8.html?lang=en . it doesn't matter you're app hybrid app.

json - Access Wordpress User data to login/register through App REST -

i developing mobile application using ionic framework e-commerce website developed using woocommerce. i need use single database users, registered users can access profiles , non-registered users can register website / app simultaneously same credentials. i found awesome plugin claims provide rest user data login/register unable use using reactor core , wp-api access products data , wordpress wouldn't allow me use these plugins simultaneously. well wordpress self has communication protocol xml-rpc can read more on here , not have authentication method builtin. but can try thing this: function mynamespace_getuserid( $args ) { global $wp_xmlrpc_server; $wp_xmlrpc_server->escape( $args ); $blog_id = $args[0]; $username = $args[1]; $password = $args[2]; if ( ! $user = $wp_xmlrpc_server->login( $username, $password ) ) return $wp_xmlrpc_server->error; return $user->id; } function mynamespace_new_xmlrpc_method

android - Using ringdroid as library -

i want integrate audio scrubber in project.i added ringdroid module in project.then changed apply plugin: 'com.android.application' to apply plugin: 'com.android.library'. then removed applicationid , deleted files ringdroideditactivity , ringdroidselectactivity .. still getting below error- suggestion: use tools:overridelibrary="com.ringdroid" force usage error:execution failed task ':app:processdebugmanifest'. > manifest merger failed multiple errors, see logs how resolve this?i made minsdkversion , targetsdkversion of build.gradle , manifest same.

swift - How to pass value from navigationController to TabBarController -

i have login project. first view controller navcontroller , need pass user data tabbarcontroller have 3 navigationcontrollers. i tried this. let opennewvc = self.storyboard?.instantiateviewcontrollerwithidentifier("mainnavid") as! uitabbarcontroller //opennewvc.token = token! self.navigationcontroller?.pushviewcontroller(opennewvc, animated: true) you can pass data first view controller view controllers embedded below in uitabbarcontroller . uitabbarcontroller -> uinavigationcontroller -> uiviewcontroller you need traverse viewcontrollers instance of uitabbarcontroller , uinavigationcontroller in order instance of uiviewcontroller . once instance of 'uiviewcontroller' embedded uitabbarcontroller , can assign data required. for example if let tabbarcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("mainnavid") as? uitabbarcontroller { // need view controllers array tabbarcontrollers uinavigationcontro

javascript - InvalidInput: Invalid request on AWS Route 53 -

i trying set resource records in aws route 53 via sdk , getting invalid request error(invalidinput). can double check params make sure have them set correctly? function testw () { var params = { changebatch: { changes: [ { action: 'create', resourcerecordset: { name: 'example.com', type: 'a', aliastarget: { dnsname: 's3-website-us-east-1.amazonaws.com', evaluatetargethealth: false, hostedzoneid: 'z1yu6g6wexamp' }, } }, ], comment: 'this test , should working.' }, hostedzoneid: 'z1yu6g6wexamp' }; route53.changeresourcerecordsets(params, function (err, data) { if (err) console.log(err, err.stack); // error occurred else console.log(data); // successful response }); } thanks help!! can try removing ttl? when use aliases, not specify ttl route 53 use target's ttl. also, per documentation , alias target zone id sho

iOS 9: Using AVPlayerViewController Swift. (crossed out play button) -

Image
i'm having trouble playing video content on both ios device , in simulator. goal: stream video online resource given here: public video streams using hls using avplayerviewcontroller , learn how works. this consistently resulted in no errors being thrown, view controller presenting me view. i decided step , test on local resource, filmed short screen capture in quicktime (.m4v) , saved right project. resulted in exact same behavior no errors reported. here code ( avkit , avfoundation imported ): var playervc : avplayerviewcontroller! var playeritem : avplayeritem! var player : avplayer! var playerlayer: avplayerlayer! override func viewdidappear(animated: bool) { let bundle = nsbundle.mainbundle() let path = bundle.pathforresource("testvideos", oftype: "m4v") let url = nsurl.init(string: path!) playeritem = avplayeritem.init(url: url!) player = avplayer.init(playeritem: playeritem) playervc = avplayerviewcontroller.

angularjs - Angular JS first tutorial -

i have started learn angular js. have query regarding below code. <html ng-app> <head> </head> </body> <h1>{{hello}} </h1> <input type="text" ng-model="hello"/> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script> </body> </html> query: piece of code working fine when refresh page see {{hello}} fraction of second. why? <body ng-cloak> <h1>{{hello}}</h1> -------- -------- -------- -------- </body> to prevent angular html template being displayed browser use ngcloak. note: use ngcloak in body tag hide these thing on complete page. the best way avaid error is, use ng-bing directive see example below. <h1 ng-bind="hello"></h1>

c++ - Can these two functions be combined into one? -

i've finished working on mini task that's described in comment block in code below, i've been trying make code better combining getraredigits , displayraredigits 1 function. no matter do, logic ends breaking. can explain me if it's possible these 2 functions combined? ^_^ /* written by: stephanie yumiko * program ask user series of integers, defined user. * program display user number of rare digits, digits occur once in single integer, not rest. * program sort integers based on number of occurrences of rare digits contains, greatest least. */ #include <iostream> using namespace std; bool num_contains(int, int); void showraredigits(int*, int); void sortraredigits(int*, int* , int); bool num_contains(int digit, int n) { while (n) { if (digit == n % 10) return true; n /= 10; } return false; } void getraredigits(int *arr, int *ordered, int len) { (int index = 0; index < len; ++index) { int n = arr[index];

html - I need to repeat the table heading on every printable page with jquery datatable on chrome browser? -

in page.blade.php have jquery datatable. need repeating table head every pages when print report. i've tried using this @media print { thead {display: table-header-group;} } but can't. please tell me how can add in project on every printable datatable reports? table header showing on top page (page one) when print it, doesn't showing other pages!!

sql server - Powershell Invoke-SqlCmd: Specify port -

i want connect database execute script on database, however, can access database in question specific port number. i have along these lines in terms of code: invoke-sqlcmd -serverinstance "servername,53806" -database "databasename" -inputfile $file.fullname -verbose | out-file -filepath "d:\test\testsqlcmd.rpt" when run ps snippet, nothing happens @ all. nothing written report. nothing written console either. when change snippet around to: invoke-sqlcmd -serverinstance "servername","53806" -database "databasename" -inputfile $file.fullname -verbose | out-file -filepath "d:\test\testsqlcmd.rpt" or invoke-sqlcmd -serverinstance servername,53806 -database "databasename" -inputfile $file.fullname -verbose | out-file -filepath "d:\test\testsqlcmd.rpt" i errors saying value cannot null parameter serverinstance. if remove port, scripts takes bit longer run, resulting in obvious 'a

java - Certificate on the client's side? -

i have server application , client application. the server uses https, , has .jks file. apart that, use authentication login , password. i wonder if client side should use .cert certificate. thought client's certificate should match servers certificate, seems wrong. i have troubles understatding topic, please understanding. keystore a java keystore (jks) repository of security certificates – either authorization certificates or public key certificates – used instance in ssl encryption. in ibm websphere application server , oracle weblogic server, file extension jks serves keystore. the java development kit maintains ca keystore in folder jre/lib/security/cacerts. keystore comes in 2 flavors: 1. trust : trust store contains certificates issued trust, root certificate ca. 2. identity: an identity store contains own certificates , used authenticate when access external service. a trust store not contain sensitive information, while identity store

linux - Extracting/Writing core 2Gb image from 8Gb SD card -

i burned 2gb linux image 8gb, made tuning , archive future use. but, when saving image disk, resulting file 8gb large. how can extract 2gb "core" ? of course, did not expand initial 2gb tot full 8gb. when running df , available linux partition 2gb. used win32diskimager write initial image sd card , write disk after tweaking. try linux tools 'dd' may meet requirement,the whole command should like: dd if=/dev/mmc_xx of=mmc.img bs=2048 count=1024000 please replace mmc_xx sd name. keep in mind result of bs*count couldn't less 2g bytes.

What is the default timeout for a unit test in mstest? -

mstest has timeoutattribute can used specify test timeout. but happens if test without attribute doesn't finish? there default timeout? , default same when test run mstest.exe or in visual studio? i think 5 min, , post unless using ordered test, looks this (kind of old post, it's not easy find reference on it).

c++ - How to use boost::iostreams::null_sink as std::ostream -

i want make output verbose/non verbose based on flag given @ runtime. idea is, construct std::ostream dependent of flag, such in: std::ostream out; if (verbose) { out = std::cout else { // redirect stdout null using boost's null_sink. boost::iostreams::stream_buffer<boost::iostreams::null_sink> null_out{boost::iostreams::null_sink()}; // somehow construct std::ostream nullout } now i'm stuck constructing std::ostream such boost streambuffer. how this? using standard library just reset rdbuf : auto old_buffer = std::cout.rdbuf(nullptr); otherwise, use stream: std::ostream nullout(nullptr); std::ostream& out = verbose? std::cout : nullout; see live on coliru #include <iostream> int main(int argc, char**) { bool verbose = argc>1; std::cout << "running in verbose mode: " << std::boolalpha << verbose << "\n"; std::ostream nullout(nullptr); std::ostream&

eclipse - Proxy Authentication Required for WindowBuilder -

Image
i having trouble installing windowbuilder @ workplace. i did following settings: but error: my connection settings:

python - need a little help from someone who understand code -

import random def main(): random1 = random.randrange(10,21,1) create_file(random1) process_file() def create_file( random1): generate = open('random_numbers.txt','w') x in range(random1): random2 = random.randrange(1,101,1) generate.write(str(random2)+'/n') generate.close() def process_file(): generate = open('random_numbers.txt','r') entries = 0 total = 0 x in generate: entries += 1 integer = int(x) total = integer + total mean= sum/entries print("there are",(entries),"entries in file.") print("the sum total of entries ",(total)) print("the average of entries ", format((mean),'.2f')) main() this keeps giving me error , ive don't understand why integer value not working. tried reduce integer=int(x) integer = x couldn't use x integer , that's problem in of itself traceback (mo

c++ - Unable to move character to right position using SDL? -

i having problem moving character right , showing him he's running after press right key moves right 1 time , when enter left goes left again pressing right again doesn't make go right again. here code using : #include <sdl2/sdl.h> #include "game.h" #include "graphics.h" #include "input.h" /* game class * class holds information our game loop */ namespace { const int fps = 50; const int max_frame_time = 5 * 1000/ fps; } game::game() { sdl_init(sdl_init_everything); this->gameloop(); } game::~game() { } void game::gameloop() { graphics graphics; input input; sdl_event event; this->_player = player(graphics, 100, 100); int last_update_time = sdl_getticks(); //start game loop while(true){ input.beginnewframe(); if(sdl_pollevent(&event)){ if(event.type == sdl_keydown){ if(event.key.repeat == 0){ input.keydownevent(ev

c# - Update display label when changed numericupdown value and button click -

i have nested loop project have display triangle asterisks getting value numericupdown control , displaybutton click. well, work, displays correct shape , number of stars. but when try change value numericupdown control, display label not update, instead, add underneath previous result. need display label update/change when value changed numericupdown, , when displaybutton clicked. private void displaybutton_click(object sender, eventargs e) { if (radiobutton1.checked == true) { int counter = (int)sidelengthnumericupdown.value; (int r = 0; r < counter; r++) { (int c = 0; c <= r; c++) { displaylabel.text += counter.tostring("*"); } displaylabel.text += counter.tostring("\n"); } } else if (radiobutton2.checked == true) {

java - Strange issue while configuring ID types for Embeddable class in EclipseLink-2.5.2 -

in current implementation have separate entity classes each db table. using jpa along eclipselink-2.5.2. working fine me @ point when data huge, lags. that's why decided start using @embedded, @embeddable , @embeddedid. while doing getting error strange me. here full stacktrace posted: https://gist.githubusercontent.com/tjdudhatra/b955812e0d1a71cf97f1/raw/11ea458869e24baae744530417ac99bc877ed514/gistfile1.txt being specific, let me give exact scenario in case getting exception. consider code block has 3 class. 1 annotated @entity , other twos annotated @embeddable. know in 1 class cannot define @id , @embeddedid , have not done that, while deploying server, getting exception says that: [class org.apache.{someclass}] has both @embdeddedid (on attribute [id]) , @id (on attribute []. both id types cannot specified on same entity. @entity @table(name="user") public class user { @id public long id; @column(name="usercode") public string