Posts

Showing posts from May, 2011

c# - Why does my custom layout placeholder text box without bullets produce a slide text box with bullets? -

i have following powerpoint 2010 c# add-in code (the "test" button only). don't understand why slide created manually, using customlayout ppplaceholderbody set ppbulletnone, produces bulleted text box placeholder. slide master layout in powerpoint looks fine no bullet. i'm sure there must more setting bullet none understand. can shed light on this? private void button4_click(object sender, eventargs e) { powerpoint.customlayout ppcl = globals.thisaddin.application.activepresentation.slidemaster.customlayouts.add( globals.thisaddin.application.activepresentation.slidemaster.customlayouts.count + 1); ppcl.name = "my custom master layout - text without bullet!"; powerpoint.shape ppshape = ppcl.shapes.addplaceholder(powerpoint.ppplaceholdertype.ppplaceholderbody); ppshape.textframe.textrange.text = "candidate"; ppshape.textframe.textrange.paragraphformat.bullet.type = powerpoint.ppbullet

testing - What is the best way to test methods that traverse the react components -

i have tried test small react components. following component tab system when click tab, change classname of tab clicked. working want test them , dont know how steps test method traverse lot of components. put code above. tabsystem: has method change currenttab state, method prop in tabs component renders each tab. react.createclass({ .... handleclick (currenttab) { this.setstate({ currenttab }) }, render () { return ( <div> <tabs tabs = {tabs2} currenttab = {this.state.currenttab} onclick = {this.handleclick}/> </div> ) } }); tabs: receive onclick prop parent method, method prop tab component, goal add onclick method in name of tab. react.createclass({ ... rendertabs () { return this.props.tabs.map((tab, index) => { var classname = index === this.props.currenttab ? 'active' : null; var clickhandler = this.props.onclick.bind(null, index); return ( <tab key={tab.name

How disable screen in Android without root? -

i want disable screen (android 4.4.2) when press button. possible without rooting device? have tried code below, doesn't work (it throws exception). private devicepolicymanager mdpm; oncreate: mdpm = (devicepolicymanager)getsystemservice(context.device_policy_service); button listener: mdpm.locknow(); androidmanifest.xml: <intent-filter> <action android:name="android.app.action.device_admin_enabled" /> <action android:name="android.app.action.device_admin_disabled" /> </intent-filter> stack trace: 10-03 20:32:50.187 4172-4172/com.microchip.android.basicaccessorydemo_api12 e/androidruntime﹕ fatal exception: main process: com.microchip.android.basicaccessorydemo_api12, pid: 4172 java.lang.securityexception: no active admin owned uid 10175 policy #3 @ android.os.parcel.readexception(parcel.java:1465) @ android.os.parcel.readexception(parcel.java:1419) @ andr

swing - java efficient repainting on moving objects -

i'm wondering what's efficient way of repainting in case, , how go it. i've got jframe , containing jpanel . jpanel contains awt graphics. of these graphics fixed, don't move. other graphics (on top of fixed graphics) in panel move. layout updated every 3 seconds. fixed graphics require quite bit of math draw, don't want repaint graphics, moving ones. this possibilities came with: to put fixed graphics , moving graphics in 2 separate panels , repaint 1 panel, layed on each other. to add 2 different graphics objects panel (one fixed graphics , 1 moving) , repaint 1 graphics object. (is possible?) perhaps other way don't know? like others saying, use bufferedimage fixed object. moving objects, should calculate bounds of area needs redrawn (i.e. old bounding box union w/ new bounding box objects moved). blit fixed graphic section of area down first, , blit moved object(s). you should double buffering if haven't already. better ex

deep learning - h2o deeplearning checkpoint model -

folks, i have problem when try resuming h2o deep learning in r checkpointed model with validation frame provided . says "validation dataset must same check pointed model", believe have same validation datasets. if leave validation_frame blank, checkpointing model works fine. attach code below: localh2o <- h2o.init(nthreads = -1) train_image.hex <- read.csv("mnist_train.csv",header=false) train_image.hex[,785] <- factor(train_image.hex[,785]) train_image.hex <- as.h2o(train_image.hex) test_image.hex <- read.csv("mnist_test.csv",header=false) test_image.hex[,785] <- factor(test_image.hex[,785]) test_image.hex <- as.h2o(test_image.hex) mnist_model <- h2o.deeplearning(x=1:784, y = 785, training_frame= train_image.hex, validation_frame = test_image.hex, activation = "rectifierwithdropout", hidden = c(500,1000), input_dropout_ratio = 0.2, hidden_dropout_ratios = c(0.5,0.5), adaptive_rate=true, rho=0.98, epsilon = 1e-7

angularjs - MEAN making posts with individual url -

when see questions on stackoverflow.com, find https://stackoverflow.com/questions/ 11234554 each post has individual url. i have made q&a list pulls data mongodb , html page have each question. create url based on question number database? if so, how can append /11234554 /questions ? can make request each item on list, then? router.get('/questions', function(req, res, next){ "how make request every question number?" }) any guide appreciated!

c# - Is it possible to add a range to UIElementCollection? -

i want add huge amount (100k) of rectangle canvas, programmatically. unfortunately code slow if 1 one via add(). since know number of new elements, i'm looking method first initialize set of new instances , add set uielementcollection (canvas children). looking method addrange, copyfrom (array) or so. idea? no there no addrange or similar function uielementcollection . cannot add many elements @ same time. but comments question says, doing wrong if adding 100k elements same canvas. what trying do?

node.js - In my post req of comment, I want to update the values of reviews which consist of userid and comments -

i trying update event. event schema shown below. how can push values desire? new this. so, facing difficulties. in advance. want post in id id matches , update comment section userid. server.js var express= require('express'); var bodyparser= require('body-parser'); var morgan = require('morgan'); var config=require('./config'); var app= express(); var mongoose=require('mongoose'); var lodash= require('lodash'); var underscore= require('underscore'); //var user=require('./database/user') mongoose.connect('mongodb://localhost:27017/db',function(err){ if(err){ console.log(err); } else{ console.log("connected!"); } }); //res.json({message:" " }) app.use(bodyparser.urlencoded({extended: true })); //if false parse strings app.use(bodyparser.json()); app.use(morgan('dev'));//log requests console var api=require('./app/routes/api')(app,express

c - How to use "zd" specifier with `printf()`? -

looking clarification on using "zd" printf() . certainly following correct c99 , later. void print_size(size_t sz) { printf("%zu\n", sz); } the c spec seems allow printf("%zd\n", sz) depending on on how read: 7.21.6.1 fprintf function z specifies following d , i , o , u , x , or x conversion specifier applies size_t or corresponding signed integer type argument; or following n conversion specifier applies pointer signed integer type corresponding size_t argument. c11dr §7.21.6.1 7 should read as " z specifies following d ... conversion specifier applies size_t or corresponding signed integer type argument ... "(both types) , " z specifies following u ... conversion specifier applies size_t or corresponding signed integer type argument ..." (both types) or " z specifies following d ... conversion specifier applies corresponding signed integer type argument ..." (signed type only)

java - changing style of a varying class with document.getElementsByClassName -

i using woocommerce , plugin fit needs of german market. use addon implements delivery times. in normal black colour. actualy work 2 delivery times, 1 - 3 , 5 - 10 days. if delivery time 1 - 3 days should displayed in green, if delivery time 5 - 10 days want see in orange. i made change displayed colour needs on static pages (products without variants colors). complete css class called "wc-gzd-additional-info delivery-time-info" i added java footer: <script type='text/javascript'> var elementsa = document.getelementsbyclassname("delivery-time-info")[0]; var elementsb = elementsa.innerhtml; var elementsc = elementsa.innerhtml; if (elementsb == "lieferzeit: 1 - 3 tage") { elementsa.innerhtml = "<span style='color:green;font-weight:bold;'>"+elementsb+"</span>"; } if (elementsc == "lieferzeit: 5 - 10 tage") { elementsa.innerhtml = "<span style='color:o

c++ - Segmentation fault with nodes -

on code keep running segmentation fault when try insert front of linked list. assume has head not being changed on properly. in program baskets nodes. debugger used pointed last line in function issue not sure originates. include <cstdlib> #include <iostream> #include <ctime> #include "basketlist.h" using namespace std; basket::basket(int _datum, basket * _next): egg_num(_datum), nextbasket(_next) {} int basket::geteggs() const { return egg_num; } basket const* basket::getnextbasket() const { return nextbasket; } basketlist::basketlist() : head (null) {} void basketlist::insertbasket(int eggs) { basket *currptr = head; basket *prevptr = null; basket *newbasketptr; if(eggs < head->egg_num) { currptr->nextbasket = head; head = currptr; } while(currptr != null && eggs > currptr->egg_num) { prevptr = currptr; currptr = currptr->nextbasket; } newbasketptr = new

authentication - AES calculation CMAC Java to Swift -

i trying calculate cmac byte[] key={0x09,0x11,0x12,0x34,0x56,0x78,0x00,0x01,0x01,0x13,0x14,0x36,0x58,0x7a,0x02,0x03}; aes maes=new aes(); maes.aesinit(key); byte[] response = maes.calccmac(challenge); swift using lib cryptoswift let key = [0x09,0x11,0x12,0x34,0x56,0x78,0x00,0x01,0x01,0x13,0x14,0x36,0x58,0x7a,0x02,0x03] [uint8] let message:nsdata = nsdata.fromhexstring("da55c255") let mac = authenticator.poly1305(key: key).authenticate(message.arrayofbytes()) but it's not working expected. the expected result challenge isda55c255 response ised7ca01a we don't find solution, have created our own classe https://gist.github.com/bolom/b426a0163943b576175b

javascript - How do I know if there are any rows selected in my datatable? -

i using datatables , validationengine plugin. my issue able know rows selected on particular page in pagination. so, if have rows selected on second page of pagination , no rows selected on 1st page, show me error 'please select row'. i have read posts not specific code, that's reason asking question. so in addition validation code have, should add following code, code $("#mselector").on("click", "button[name='next'],button[name='finish']", function() { var $stepselector = $(".wizardstep:visible"); // current step var anyerror = false; $stepselector .find("input,textarea,select").each(function () { if (!$(this).validationengine('validate')) {// validate every input element inside step anyerror = true; } }); if (anyerror) return false; // exit if error found }); }); code $(function () { var single

angularjs - angular multiple boolean conditions with associated classes -

this question has answer here: adding multiple class using ng-class 11 answers i'm trying have different classes based on state, how's possible have different classes based on different conditions? <i ng-class="'icona': state == 100, 'iconb': state == 200, 'iconc': state == 300"></i> i think might missing curly brackets inside double quotes - try this? <i ng-class="{ 'icona': state == 100, 'iconb': state == 200, 'iconc': state == 300 }"></i> we did similar worked us: <button class="date-picker__day" ng-class="{ 'date-picker__day--this-month': ctrl.isactivemonthforday(day), 'is-selected': ctrl.isselectedday(day), 'is-active': ctrl.isactiveday(day), 'is-today': ctrl.istoday(day), 'is-d

c - Program prints number of chars instead of words -

i'm trying program print out amount of words in test string, it's printing out larger number instead. example, test string has 24 words , program prints out 102 instead. i'm wondering why it's doing that. #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { char testval[1024]="this test... test... next sixty seconds test of emergency broadcasting system."; int inword=0; int wordcount=0; int i=0; while(testval[i] != 0) { if (testval[i]==' ') { if (inword) inword=0; } else { if (!inword) inword=1; wordcount++; } i++; } printf("the number of words in testval %d\n",wordcount); return 0; } ./numwords number of words in testval 102 if (!inword) inword=1; wordcou

Manage Splash screen activity and background tasks on android -

i have 2 activities. 1 splash , other main activity loads fragments pages. splash no background tasks, sit pretty , transition main activity following background tasks. set admob ads request data file server decript encryption key loads images disk display set google leader-board or sign in if user not sigh in. my question how delegate of these tasks splash screen? , how pass these complex objects between activities (can use static variables) at moment contemplating ditch splash activity , use main activity show splash image in that. main activity layout has banner adds not sure how cover entire screen image. please help! my main activity <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:id="@+id/fragment"

java - I'm getting the following runtime error. Please help me figure out why -

i'm developing app material design. after running below code & tapping on 'about' option menu, app crashing & i'm running following exceptions: java.lang.runtimeexception: unable start activity componentinfo{com.abc.xyz/com.abc.xyz.aboutactivity}: java.lang.nullpointerexception: attempt invoke virtual method 'void android.support.v7.app.actionbar.setdisplayhomeasupenabled(boolean)' on null object reference` here's aboutactivity.java file's code: public class aboutactivity extends appcompatactivity { public toolbar toolbar; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_about); spannablestring s = new spannablestring("about"); s.setspan(new typefacespan(this, "pacifico.ttf"), 0, s.length(), spannable.span_exclusive_exclusive); getsupportactionbar().setdis

why hive can‘t select data from hdfs when use partition? -

i use flume write data hdfs,path /hive/logs/dt=20151002 .then,i use hive select data,but count of response 0. here create table sql, create external table if not exists test (id string) partitioned (dt string) row format delimited fields terminated '\t' lines terminated '\n' stored textfile location '/hive/logs' here select sql, select count(*) test it seems not registering partition in hive meta-store. although partition present in hdfs path,hive won't know if not registered in meta store. register can following: alter table test add partition (dt='20151002') location '/hive/logs/dt=20151002';

javascript - Using jquery, how can I get this "inner text" of a li element? -

this question has answer here: how select text nodes jquery? 11 answers i have following html , trying figure out right selector logic read in part. note : can't change html being generated plugin. <li class="select2-selection__choice" title=""> <span class="select2-selection__choice__remove" role="presentation">×</span> ms office </li> <li class="select2-selection__choice" title=""> <span class="select2-selection__choice__remove" role="presentation">×</span> photoshop </li> and trying read out text inside <li class="select2-selection__choice"> but not including the <span class="select2-selection__choice__remove"> so example above, looking parse out following text:

How to convert this extensive Python loop to C++? -

i know little on python, i'm quite experienced in c++. looking algorithm loop through points in hexagon pattern , found 1 written in python seems need. problem have no idea how interpret it. here python code: for x in [(n-abs(x-int(n/2))) x in range(n)]: y in range(n-x): print ' ', y in range(x): print ' * ', print i'd show attempts there 30 different ones failed (which i'm sure bad interpretation). hope helps you.tested both python , c++ code .got same results. #include <iostream> #include <cmath> using namespace std; int main() { // code goes here int n = 10; int a[n]; for(int j = 0; j < n; j++) { a[j] = n - abs(j - (n / 2)); } for(int x = 0; x < n; x++) { for(int y = 0; y < (n - a[x]); y++) { std::cout << " " << std::endl; } } for(int k = 0; k < a[n-1]; k++) { std::cout << &q

Anonymous function breaking when upgrading PHP -

the following code breaking when switched servers/upgrading php 5.3 5.4: function arrayvalrecursive($key, array $arr, $string=false){ $val = array(); array_walk_recursive($arr, function($v, $k) use($key, &$val){ if($k == $key) array_push($val, $v); }); if($string==true){ return count($val) > 1 ? $val : array_pop($val); } else { return $val; } } i'm receiving parse error: syntax error, unexpected t_function error, seems due anonymous function in array_walk_recursive line. how write function differently avoid issue, , why happening when upgrading php? thanks you using php 5.2 can tell. running phpinfo() code <? echo phpinfo(): ?> detect version. tests using php 5.2 - 5.5 occurs in php 5.2 before lambda functions existed. of course know our comments, future visitors.

objective c - StatusBarStyle not working as expected on iOS 9 -

Image
i trying following statusbarstyle on swift app : my appdelegate uses uinavigationcontroller follows self.nav = uinavigationcontroller(rootviewcontroller: controller!) so tried set uibarstyle black follows : self.nav?.navigationbar.barstyle = uibarstyle.black however, results in following : btw, on info.plist, have following set <key>uistatusbarstyle</key> <string>uistatusbarstyledefault</string> <key>uiviewcontrollerbasedstatusbarappearance</key> <false/> and settings result in desired statusbar style on launchscreen not on other screens. i tried adding following method vcs inside uinavigationcontroller override func preferredstatusbarstyle() -> uistatusbarstyle { return uistatusbarstyle.default } but results in following status bar style : what best way have desired status bar style in case have uinavigationcontroller on ios 9? additionally, if remove plist entry , set self.nav?.navigationbar.b

authentication - gcloud auth login : Properties Parse Error -

i installed google-cloud-sdk in ubuntu 14.04 , when tried login,it showing error. krish@jarvis:~$ gcloud auth login traceback (most recent call last): file "/usr/bin/../lib/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 87, in googlecloudsdk.calliope import base file "/usr/bin/../lib/google-cloud-sdk/./lib/googlecloudsdk/calliope/base.py", line 8, in googlecloudsdk.core import log file "/usr/bin/../lib/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 413, in _log_manager = _logmanager() file "/usr/bin/../lib/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 195, in init self.console_formatter = _consoleformatter(sys.stderr) file "/usr/bin/../lib/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 172, in init use_color = not properties.values.core.disable_color.getbool() file "/usr/bin/../lib/google-cloud-sdk/./lib/googlecloudsdk/core/properties.py"

TeamCity configuration doesn't persist inside docker -

i've setup teamcity inside docker image , can access via localhost everytime restart docker, teamcity ask configuration again (from beginning, meaning have reconfigure whole teamcity again). how make configuration persist? how make configuration persist? you can mount volume or use data volume container , in order persist configuration. if not, copy-on-write mechanism used docker remove modification of docker rm (unless docker commit right after docker stop ) for example, teamcity docker project runs mounted volume: docker run --link some-postgres:postgres \ -v <teamcitydir>:/var/lib/teamcity -d \ sjoerdmulder/teamcity:latest

sql - PHP - get beginning inventory from ending inventory of last month -

i have orders table , inventory table. need function beginning inventory of last month. this formula. beginning inventory = ending inventory ending inventory = beginning inventory + deliveries - usage. to ending inventory of last month, need beginning inventory of last last month don't know how that. i thinking on how it. <?php function get_beginning_inventory($month_date) { //do formula here or code here return $data; } ?> can me please?

html - Box-shadow and overflow: scroll -

i using 3 bootstrap panels panel headings col-md-4 , @ bottom of each panel have box-shadow , panels have max height of 300px. text inside panels longer panels themselves. use overflow: scroll when use overflow: scroll "overwrites" box-shadow (of which, understand why). have searched seemingly simple solution while , have come nothing. i have excluded box-shadow style , other 2 panels keep clean underneath. [fiddle][1] .sub-content-panel { height: 400px; border-radius: 5px; position: relative; color: black; } <div class="col-md-4 text-border"> <a href="gallery.php"> <div class="panel panel-default sub-content-panel"> <div class="panel-heading sub-content-panel-heading"> <p><i class="fa fa-commenting-o"></i>about us</p> </div>

angularjs - How to keep focus on a recently added row in (angular) ui grid -

i'm brand new angular , i'm trying make simple application using ui grid. i want add new empty row clicking on button (add button). then, want set focus first row, empty new row, on first cell. after editing first cell, want hit tab, , should take me next column field. instead, focus gets second row , second column. i've read documentation of ui grid cell navigation service here: http://ui-grid.info/docs/#/api/ui.grid.cellnav.service:uigridcellnavservice and i've followed tutorial examples also. the thing don't find way keep focus on first row. here how code looks like http://embed.plnkr.co/wctm5xexjsf93tn07mzj/preview any help? thanks!

How to install cordova plugin from a forked repository -

to install phonegap plugin can installed using cordova plugin install https://github.com/wymsee/cordova-http.git and adding following config.xml <gap:plugin name="com.synconset.cordovahttp" version="0.1.4" /> as mentioned in this official document . need installed forked repository , build app ios , because i'm working on windows, need use phonegap cloud service . is enough install using: cordova plugin install https://github.com/brendonparker/cordova-http.git if yes, should put in config.xml? its simple that, need fork plugin git , use cli add plugin project via cordova plugin add https://github.com/username/forked-plugin-name.git and if required edit config.xml accondingly

Java: Find Integers in a String (Calculator) -

if have string looks this: string calc = "5+3" . can substring integers 5 , 3 ? in case, know how string looks, this: string calc = "55-23" therefore, want know if there way identify integers in string. for that, regular expression friend: string text = "string calc = 55-23"; matcher m = pattern.compile("\\d+").matcher(text); while (m.find()) system.out.println(m.group()); output 55 23 now, might need expand support decimals: string text = "string calc = 1.1 + 22 * 333 / (4444 - 55555)"; matcher m = pattern.compile("\\d+(?:.\\d+)?").matcher(text); while (m.find()) system.out.println(m.group()); output 1.1 22 333 4444 55555

jquery - How to write the code for slider image -

<?php $query1="select * user_photos_offline ssmid='$ssmid' , status='1' order date_uploaded desc limit 0,5"; $sql=mysql_query($query1); $count=mysql_num_rows($sql); $results=array(); while($row=mysql_fetch_assoc($sql)){ // $results[]=$row['image']; ?> <img src="upload_images/<?php echo $row['image']?>" class="img-responsive image" onclick="showimg('upload_images/<?php echo $row['image']?>')"> <!-- here got images,now showing in row row,but dont want this,i want row , remaining photos come slider, idont know how write code--> <?php } ?> friends ,i want write code image slider,i dont know how write code slider image,for me no need plugin,see below explained... you can try below code. fiddle @keyframes slidy { 0%

max msp jitter - Matching OSC input in Max patch -

Image
i need i’m stuck trying match incoming osc message trigger event. it’s quite simple, i’m beginner. the incoming osc message sends zone number, user number , 0 or 1 if zone activated/deactivated. e.g. zone_1 1 0 i need change zone number each instance of patcher. don’t need user info, if needed in sequence, between 1 , 20 create match. need toggle on /off using last element in message (0/1) if zone number matched. i’ve put rough outline of need in patch, i’m not sure should using zl slice , match, or how combination of variables , non-variables match. appreciate guidance much! here approach should work: ----------begin_max5_patcher---------- 664.3ocyw0saabce9z3o.4qypvlvoyr8iyzjxd7rcexirmciqpu6cnnzlzkx nma5tajo13y224ed12ckk2wznfug7i.oum887.qcb7nr1cuq2sojpgigxalf o.svtknohkjyfxo7abkml2kslz17.wrcshswx0hnjbw3hfnjrtwjk8oc94gu gw.5tl+32hh85zd2l80l6sfxohsnw+fsyeircb0i3ee+tgkfi8dre2psduyx 6.nhzrx.7yim4rjllloirsbghm4bjnzmowzrxaewapxypofe0aeig.2v1wwg tnhi8htridm5aqojzeyvtqyb

autotools - Abstracting include paths and library names with pkg-config? -

i'm working project goes 1 of 2 package names, depending on distribution. on debian , derivatives, package name libcrypto++ . on fedora , derivates, called libcryptopp . (the official project name crypto++). users write code, , things like: #include <crypto++/aes.h> and later, link library -lcrypto++ . obviously, using "debian conventions" breaks things on fedora (and vice versa). see, example, how change include file path autotools? i'm trying determine can used abstract differences away user's code "just works". can pkg-config files used handle differences? if so, how handle #include <crypto++/...> versus #include <cryptopp/...> found in user code? (i'm concerned header clashes, openssl , crypto++ both providing aes.h ). if not, can issues caused different names on different platforms? there's nothing built-in auto-tools automatically. it's unusual need. there ways work. here couple: m

c# - Changing FontSize dynamically in windows phone 8.1 application -

i need change application font size dynamically resource dictionary using slider control for setting common font size created this <x:double x:key="versefontsize">30</x:double> and called style in textblock this <style x:key="title_subtext" targettype="textblock"> <setter property="verticalalignment" value="center"/> <setter property="horizontalalignment" value="center"/> <setter property="foreground" value="{staticresource foregroundcolorbrush}"/> <setter property="fontweight" value="normal"/> <setter property="fontsize" value="{staticresource versefontsize}"/> <setter property="margin" value="0,5"/> </style> now want increase or decrease font size using slider control. i spend whole day making 1 solution , tri

C++ iomanip expression -

variables: static const float s_period[] = { 100, 50, 25, 12, 5, 7, 3, 2, 1 }; static const unsigned s_timerscount = sizeof( s_period ) / sizeof( s_period[0] ); float min = 10000000; float max = 0; double sum = 0.0; c++ version: for( unsigned = 0; < s_timerscount; ++i ) { ... std::cout << "id: " << std::setw(2) << (i+1) << ", expected: " << std::setw(3) << s_period[i] << ", min: " << std::setw(3) << min << ", max: " << std::setw(3) << max << ", avg: " << std::fixed << std::setw(10) << std::setprecision(6) << avg << std::endl; std::cout.unsetf( std::ios_base::floatfield ); } c version: for( unsigned = 0; < s_timerscount; ++i ) { ... printf( "id: %2d, expected: %3.0f, min: %3.0f, max: %3.0f, avg: %10.6f\n", ( + 1 ),

java - determining if an array list beginning and ending and displaying everything in between -

i'm trying filter through array list contains content of url stored in: (list<string> quotes = new arraylist<>();) and, display result every thing in between <pre> </pre> tags (all quotes placed between these 2 tags). figured out printing part there method in java allows filter array list specified? thanks more detail: so have normal html file contains kinds of tags. lets scan page , store text in string array. want display content between <pre></pre> tags , not rest. hope helps here how text stored: list<string> cookies = new arraylist<>(); public void init() throws servletexception { try { url url = new url(" http://fortunes.cat-v.org/openbsd/"); bufferedreader in = new bufferedreader(new inputstreamreader(url.openstream())); string line ; while((line = in.readline()) != null) { cookies.add(line); //line = in.

java - The name of my checkbox can not be resolved -

i have problem checkbox. when try read state of name of can not resolved. jcheckbox checkbox1 = new jcheckbox("test"); checkbox1.setbounds(6, 59, 121, 23); frmtree.getcontentpane().add(checkbox1); public void checkbox() { if (checkbox1.isselected()) { sytem.out.println("selected"); }} //add checkbox1.setselected(true); change checkbox function code: //try using boolean in condition //get selection state of checkbox boolean selected = checkbox1.isselected(); if (selected) { system.out.println("selected."); } else { system.out.println("not selected."); } frmtree.getcontentpane().add(checkbox1);

How to do math in PHP echo result -

the issue have need in following if: <td> <?php if($result['job']['no_of_searches']<'5') { echo '<span class="badge bg-warning">100</span>'; } if($result['job']['no_of_searches']>'5') { echo ‘problem-is-here’; } ?> </td> in problem-is-here field want display math result from: <?php echo $result['job']['no_of_searches']; ?> / <?php echo $result['job']['total_autoaccepted']; ?> * 100 but how can this? it depends on type of $result[$x][$y] . if string, suggested code of developercoolio , has converted integer php function intval() before performing numerical operations on it. in case, however, string comparison <'5' unappropriate, because string '10' considered lower string '5', not behaviour expect.

javascript - How to Reflect input of a textbox into another textbox -

this code reflect text of textbox1 textbox called textbox1a on keyup event. separate them same background. show each result specific input. when write in first text box repeat text others. how can separate them? here code : $("input[type=text]").keyup(function(){ var classname = $(this).attr('class').replace('valueenter','').trim(); $("."+classname).val($(this).val()); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="first"> textbox 1a : <input type="text" class="textbox1 valueenter" style="background:#ccc;"/><br/> textbox 1b : <input type="text" class="textbox1 valueenter" style="background:pink;"/> <br/> textbox 2 : <input type="text" class="textbox2 valueenter"/> </div> <br/> <div class="s

php - How to use array inside while loop so it can track every id fetching from database? -

i'm fetching multiple rows database. that's why use while loop need every individual id inside while loop. how can use array inside while loop? friendid prints last result loop.i don't want print result inside loop. while ($row = mysqli_fetch_assoc($run_sql)) { $name = $row['name']; $friendid = $row['id']; } echo $friendid; create empty array before while loop. in each iteration of loop, append fetched row this array. $resultarr = array(); while ($row = mysqli_fetch_assoc($run_sql)){ $resultarr[] = array($row['id'], $row['name']); } // display $resultarr array var_dump($resultarr);

python - Reindex data in an array such that missing data points are filled with NaNs -

i have several arrays 1 below: [[ 0. 1. 0.73475787 0.36224658 0.08579446 -0.11767365 -0.09927562 0.17444341 0.47212111 1.00584593 1.69147789 1.89421069 1.4718292 ] [ 2. 1. 0.68744907 0.38420843 0.25922927 0.04719614 0.00841919 0.21967246 0.22183329 0.28910002 0.54637077 -0.04389335 -1.33445338] [ 3. 1. 0.77854922 0.41093192 0.0713814 -0.08194854 -0.07885753 0.1491798 0.56297583 1.0759857 1.57149366 1.37958867 0.64409152] [ 5. 1. 0.09182989 0.14988215 -0.1272845 0.12154707 -0.01194815 -0.06136953 0.18783772 0.46631855 0.78850281 0.64755372 0.69757144]] please note, array[i,0] gives me count. in particular array counts 1, 4, , 6 missing. in other case might 2, 3, 5 or not missing. now, later metaanalysis have arrays have nans included missing counts. in above example, have [[ 0. 1. 0.73475787 0.36224658 0.08579446 -0.11767365 -

Is it possibe to reduce the number of css style names in Vaadin? -

e.g., in example below, possible rid of class names except own, w-grid ? or @ least reduce number? <div class="v-csslayout v-layout v-widget w-grid v-csslayout-w-grid root_z_template v-csslayout-root_z_template v-has-width v-has-height" style="position: absolute; width: 100%; height: 100%;" id="root_z_template">

flutter - Where should I look for assertion fail on `'_semantics != null': is not true.` -

what issue when flutter app cause following assertion fail. offending widget not showing in ui. ══╡ exception caught rendering library ╞═════ following assertion thrown during _updatesemantics(): 'package:flutter/src/rendering/object.dart': failed assertion: line 2677 pos 14: '_semantics != null': not true. either assertion indicates error in framework itself, or should provide substantially more information in error message determine , fix underlying cause. in either case, please report assertion filing bug on github: https://github.com/flutter/flutter/issues/new when exception thrown, stack: #2 renderobject._getsemanticsfragment (package:flutter/src/rendering/object.dart:2677:14) #3 renderobject._getsemanticsfragment.<anonymous closure> (package:flutter/src/rendering/object.dart:2690:49) #4 renderbox&containerrenderobjectmixin.visitchildren (package:flutter/src/rendering/object.dart:3246:14) #5 renderobject.visitchildrenforsemantics