Posts

Showing posts from July, 2010

ios - How to use completion block with delegate -

i have class that's set delegate class b. how works method class uses instance of class b call method. after b's method done executing, call delegate method implemented in a. what want have class a's method include success completion block, when b's method done executing, know same method in class b's method executed. can done? in class a, store block property. in class b's delegate method (implemented class a), can call block via property. @property (nonatomic, copy) void (^completion)(bool); - (void)classamethod:(void (^)(bool))completion { self.completion = completion; [classb method]; } - (void)classbdelegatemethod:(bool)result { if(self.completion) { self.completion(result); } }

wordpress - css won't respond when changing resolutions -

i working custom theme in wordpress , i'm wanting add formatting when viewing mobile (320px min - 400 max) meta tag: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> css: /* smartphones (portrait , landscape) ----------- */ @media screen , (min-device-width : 320px) , (max-device-width : 480px) { .logo{margin-left:0px !important} .content{width:100% !important; } .mainmenu {background:rgba(0,0,0,0.6) !important; } .mainmenu li{padding:0 5px !important;} .mainmenu li a{font-size:18px !important; font-family:'impactregular' !important; color:#000 !important;} } @media screen , (min-width : 1000px) { .logo{float:left;} } now reason detects 1000px not smaller..not sure i'm doing wrong here. here's link site i'm trying fix. in advance. it you. media queries standard devices. and use meta tag. <meta name="viewport" content="width=device-width

mysql - PHP script write to secure folders via browser? -

i'm building php scripted program local server process database tables , upload them production server. i'm bit worried security on local server however, need connect remotely - period of possible risk open up. script needs move files around on server , way can these commands work lower folder permissions 777 open highway anyone. run scripts via browser, there way make them more secure , still run them via browser? suppose need login root or other elevated user.

ios - How big is the download for my users if my app requires the 2015 Android Vision API? -

i interested in adding face detection app (com.google.android.gms.vision.face google play services 7.8 version described here here , here ) but in documentation says 'adding vision functionality dependency project's androidmanifest.xml indicate installer should download dependency on app install time' its important me app size should small , not require huge download- know how big 'dependency' com.google.android.gms.vision.face , how add download users don't have it? also people know if ios works same way? your app size depends upon artwork have used beautify app interface, how detailed application has been developed , how many dependency application using, sometime application size small on app store, after downloading app on phone, app installs dependency on run time , consume disk space.this approach save developers submit heavy applications store. this can true both platforms i.e. ios , android. expert on ios development don't kno

javascript - Regex calling backreferences from all group interations -

i'm catching international numbers , running regex replace characters people put between numbers. i'm using below regex: [+]([0-9]{1,3})(([\s\-\.\(\)]*)([0-9]*)([\s\-\.\(\)]*)){1,3} it works great when use repeated group, catches last iteration. when use regex101 site debug regular expression, see: a repeated capturing group capture last iteration. put capturing group around repeated group capture iterations i want take advice i'm not sure how can put capturing group around repeated group . see: https://regex101.com/r/pt3ck9/1 as stated in comments, simples way clean phone numbers define list of unwanted characters, , replace them spaces: '+94 (666) 999-5555'.replace(/[ .()-]+/g, ' '); // +94 666 999 5555 '+42 555.123.4567'.replace(/[ .()-]+/g, ' '); // +42 555 123 4567

linux - ncurses good practices: clear screen with windows -

ncurses app checks if terminal has been resized. if size less 80x25, blank screen , show error message. if app has n windows, should of them removed delwin() , or calling clear() enough? on other hand, can existing windows later reused after clear() - refresh , display contents if terminal size became satisfactory - or should recreated? clearing windows sounds application's behavior rather ncurses such. ncurses library (see resizeterm ) clear areas if windows increase in size. the best policy when resizing depends on have inside windows. ncurses making reasonably safe changes, since has no information intention in making things close on screen, , others separated, can attempt resize windows contents preserved. application can still clear them , start on again — moving windows around on screen. it's decision whether simpler recreate windows or reuse them. as long of rebuilding done before next repainting of screen (e.g., wrefresh ), ncurses make updates

javascript - How to send the name and value off the textbox to ajax which is used in php for validation -

so trying send name , value of textbox ajax , want use name of text box in php validate field. trying use this.name apparently not correct way!. ajax code. <script type="text/javascript"> function frmvalidation(str) { if (str=="") { document.getelementbyid("txterror").innerhtml=""; return; } if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("txterror").innerhtml=xmlhttp.responsetext; } xmlhttp.open("get","validation.php?value="+str,true

multithreading - Java socketserver how to test? -

i want receive text files through socket connection in java, set server end before continue client know if code made works, except have no idea how test this. any appreciated.. edit: know port open , listening requests, want test happens if receives anything, create file input , can test simulation(sending file or bytes dont know)? public class server { private static int port = 8080; private static int maxconnections = 100000; // listen incoming connections , handle them public static void startserver() { int = 0; try { serversocket listener = new serversocket(port); socket server; system.out.println("started server on port:" + port); while ((i++ < maxconnections) || (maxconnections == 0)) { runserver connection; server = listener.accept(); runserver conn_c = new runserver(server); thread t = new thread(conn_c);

java - Hashcode value is same -

why hashcode value same? public static void main(string args[]) { string s1="abc"; string s2=new string("abc"); system.out.println("hashcode s1-:"+ s1.hashcode()); system.out.println("hashcode s2-:"+ s2.hashcode()); if(s1==s2){ system.out.println("==true:"); } } output hashcode s1-:96354 hashcode s2-:96354 the hash code 2 equal objects should equal. in case, objects strings , considered equal because hold same sequence of characters, "abc". if want hash code based on object identity rather equality use system.identityhashcode() .

node.js - When doing react server-side, how do I use imported other file types like Webpack? -

when doing server-side rendering of jsx files, won't read in files webpack have make adjustments want. for example, cannot read in files this: import './assets/styl/site' node.js doesn't have webpack's loaders doesn't know how read .styl or .cjsx file. my node app run off of coffeescript had use workaround reading .jsx using babel in file i'm requiring coffeescript: // enable runtime transpilation use es6/7 in node var fs = require('fs'); var babelrc = fs.readfilesync('./.babelrc'); var config; try { config = json.parse(babelrc); } catch (err) { console.error('==> error: error parsing .babelrc.'); console.error(err); } require('babel-core/register')(config); i think i'm fundamentally getting wrong w/ server-side rendering, examples, seems way it. question why webpack loaders should used @ client-side don't work server-side. here's blog series explaining how us

php - let a forum in a div reload without the page reloading -

i curious know if it's possible can have div reload window does. reason have forum don't want full page reload after 4 completed. wondering if elements in div or forum section background reload or load them self when submit button pressed. this in file called forum information gets typed in. want not reload page stay on forum , still send data database. <html> <body> <form action="demo.php" method="post" /> <p>input 1: <input type="text" name="firstname" /></p> <input type="submit" value="submit" /> </form> <div id = "load_results"></div> </body> </html> this sending information database want done discreetly. <?php $servername = "localhost"; $username = "root"; $password = "root"; $dbname = "mydb";

arrays - Why doesn't this python implementation of mergesort work? -

when input [8,7,6,5,4,3,2,1] output => [4, 3, 2, 1, 8, 7, 6, 5] . it seems thing different working solution (comparing here ) instead of sorted list, have k variable incrementing, , update arr[k] in place of sorted . why doesn't work? , how updating arr[k] work? seems losing data updating original input array. def mergesort(arr): if len(arr) == 1: return else: mid = len(arr)/2 left = arr[0:mid] right = arr[mid:len(arr)] sorted = [] = 0 j = 0 mergesort(left) mergesort(right) while < len(left) , j < len(right): if left[i] < right[j]: sorted.append(left[i]) += 1 else: sorted.append(right[j]) j += 1 while < len(left): sorted.append(left[i]) += 1 while j < len(right): sorted.append(right[j]) j += 1 return

Xamarin forms C#, How to make the label change value in a listview? -

my code , listview works fine (no errors , label in listview), when click on stepper want value of label created change in listview. doesn't anything. check out code below. my xaml: <stepper minimum="0" maximum="10" increment="0.1" valuechanged="onsteppervaluechanged" /> <label text="{binding amount}" /> my listview code figured out , add public class string in listview give value of 0. public class theinfo { public string amount { get; set; } } mylist.add (new theinfo () {amount = "0" }); //i add in listviewcode. works, 0 in listview on every created row. async void onsteppervaluechanged(object sender, valuechangedeventargs e) { new theinfo () {amount = string.format ("stepper value {0:f1}", e.newvalue) }; //i reckon have convert amount label.text somehow? }

android - Passing parameter in request handler is not showing correct results -

new android, trivial issue not resolve in last 3 hours. when use parameter called keyword, not showing correct results. otherwise working fine if pass keyword value in url. not sure, how pass parameter in url correctly retrieves correct result. requesthandle requesthandle = client.get("http://koha-dev.cvpl.com.sg:9900/biblios?version=1.0&operation=searchretrieve&query=" + keyword + "&startrecord=1&maximumrecords=10&recordschema=dc", new texthttpresponsehandler() { above not showing correct results. requesthandle requesthandle = client.get("http://koha-dev.cvpl.com.sg:9900/biblios?version=1.0&operation=searchretrieve&query=knowledge&startrecord=1&maximumrecords=10&recordschema=dc", new texthttpresponsehandler() { is working correctly. i tried check value of keyword: toast.maketext(getactivity().getapplicationcontext(), "checkdetails " + keyword, toast.length_long).show(); result b

javascript - Adding highcharts to mapbox popup from CSV? -

i'm creating map in mapbox marker points csv file using omnivore. i've figured out how add highcharts maps on popup each marker, can't work pulling data same csv. have figured out how add highcharts pasting in data, instead of manually adding series data, i'd pull data existing csv file , iterate through each column year highchart popup. could please me add series csv data? attempts replicate have failed. here current working example (with highcharts popup not using data csv file): (also on jfiddle need add csv locally:) https://jsfiddle.net/mofq60zq/ <!doctype html> <html> <head> <meta charset=utf-8 /> <title>styled markers csv data</title> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <script src="jquery1.6.4.min.js"></script><!-- jquery-1.6.4.min.js --> <script src="jqueryui1.8.16.custom.min.js"></script>&

testing - How to kill and restart an akka persistent actor in unit test to see if it retains state -

in unit tests, there way kill , restart persistent actor check whether can retain state (and that, instance, event serialisation/deserialisation works fine)? // initialize actor , probe actor val probe = testprobe() val act = system.actorof(props[myactor], "name") // send messages actor change state // validate state has changed // send message terminate actor act ! poisonpill // wait actor shutdown probe.watch(act) probe.expectterminated(act) // initialize new probe , new instance of actor, assumption // actor has same persistence id initial one. // actor should in same state before. val probetwo = testprobe() val rehydrated = system.actorof(props[myactor], "name") // validate state of actor. // todo: put validation checks here here useful information on how test actors.

matlab - Can't find liblapack.so.3 in ubuntu 12.04 -

when ran matlab code in ubuntu 12.04, error occurred: liblapack.so.3: cannot open shared object file: no such file or directory then installed lapack , libatlas , found liblapack.so.3gf instead of liblapack.so.3 in /usr/lib . package should install liblapack.so.3 ? take @ thread: liblapack.so file you have manually download , install package (follow links aforementioned thread) fro ubuntu 12. thing suggest try create link "liblapack.so.3gf" this: sudo ln -s /usr/lib/liblapack.so.3gf /usr/lib/liblapack.so.3 there more 1 distribution of library , implementation might differ.

Gulp watch crashes in between if any error is found -

i writing gulp task browserify, compile less files css , run gulp-webserver. on client side using react 0.14. moment error found in browserify, gulp watch crashes. every time have stop watch task , run again. how avoid this? mean if error found , if fix error, how can again run browserify task without watch getting crashed. if error in browserify like: closing jsx tag missing...and once fix error, how stop watch crashing. var gulp = require('gulp'); var browserify = require('browserify'); var babelify = require("babelify"); var source = require('vinyl-source-stream'); var plugins = require('gulp-load-plugins')(); var runsequence = require('run-sequence'); var watchless = require('gulp-watch-less'); var domain = require("domain"); gulp.task('webserver', function(){ gulp.src('./') .pipe(plugins.webserver({ fallback : 'index.html', host

php - How do I create a section (form) for the WordPress plugin setting page (admin panel)? -

i using herbert plugin framework , creating plugin. here code using: panels.php $panel->add([ 'type' => 'panel', 'as' => 'mainpanel', 'title' => 'plugin', 'rename' => 'general', 'slug' => 'plugin-admin-settings', 'icon' => 'dashicons-chart-area', 'uses' => __namespace__ . '\controllers\plugincontroller@createadminpage' ]); now plugincontroller <?php namespace plugin\controllers; use herbert\framework\models\option; use herbert\framework\redirectresponse; use herbert\framework\http; use \google_client; use \google_service_analytics; use plugin\helper; class plugincontroller { public static function createadminpage() { $this->option = get_option('pluginauthenticationsetting'); //if (!isset($this->option['authentic

javascript - Uncaught TypeError: Cannot read property 'getContext' of null Help Please -

i keep getting error in title. doing wrong? dont want use jquery. know there simple answer this, im literally not seeing it. <!doctype html> <html> <body> <canvas id="canvas1" width="500px" height="500px"> </canvas> <script> var canvas = document.getelementbyid("#canvas1"); var c = canvas.getcontext("2d"); c.beginpath(); c.moveto(0,0); c.lineto(100,100); c.stroke(); </script> </body> </html> you done minor mistake @ following line var canvas = document.getelementbyid("#canvas1"); instaed specify id without # like var canvas = document.getelementbyid("canvas1");

linked list - Is there a Java's public LinkedListNode<E> class to store a temporary node -

i have java's linkedlist<integer> object. want temporarily store node object in linkedlistnode<integer> tempnode , cannot seem find linkedlistnode class in java docs. is there way store node, java library class or other technique? , without writing our own implementation. code: public void method(linkedlist<integer> list){ linkedlistnode<integer> tempnode = list.getfirst(); //<------- tempnode for( k times){ tempnode = tempnode.next();} }

android - Color accent (default color) not changing in lolipop and marshmallow -

Image
how change default color in android 5.1 , 6. how make layout api 19 in api 22,23? i have been using color show progress bar color: <color name="coloraccent">#efad04</color> its working in kitkat , lower versions not in lollipop , marshmallow here's progressbar.java @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.progress_bar); if (android.os.build.version.sdk_int >= build.version_codes.lollipop|| android.os.build.version.sdk_int >= build.version_codes.m) { progressbar = (progressbar) findviewbyid(r.id.progress_launch); progressbar.getindeterminatedrawable().setcolorfilter(contextcompat.getcolor(progressbar.this, r.color.coloraccent), porterduff.mode.src_in); }else { progressbar.getindeterminatedrawable().setcolorfilter(getresources().getcolor( r.color.coloraccent), porterduff.mode.src_in); } progressbar =

validation - C number guessing game with isdigit() verification -

i'm working on challenge problem textbook i'm supposed generate random number between 1-10, let user guess, , validate response isdigit(). (mostly) got program work code below. the main issue ran using isdigit() required input stored char, had convert before comparison actual number compared , not ascii code number. so question is, since conversion works numbers 0 - 9, how can change code allow user guess 10 when that's number generated? or if wanted game have range of 1-100 - how accomplish this? can not verify input isdigit() if i'm using possible range greater 0-9? better way verify user input? #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <time.h> int main(void) { char buffer[10]; char cguess; char inum; srand(time(null)); inum = (rand() % 10) + 1; printf("%d\n", inum); printf("please enter guess: "); fgets(buffer, sizeof(buffer), stdin); sscanf(buffer, "%c", &

internationalization - How to apply i18n to values that are stored in a database? -

i'm building website using visual studio 2012 mvc4 , entity framework 5. thing is, have apply i18n of values stored in database. e.g., need have dropdown showing employment areas (engineering, health, finance, etc.), both in spanish , english. i thinking of 2 different approaches, none of them sounds 100% ok me: add columns in "area" table reflect area name in different languages (e.g.: areaid, englishname, spanishname). doesn't sound design-wise since i'm lucky have 2 languages, if had 100 languages support? don't save areas in database, add them in views, using i18n keys , reading values resource files. adding logic view (i'd have use iteration there), doesn't seem either. is there else i'm missing, better way it? thanks!! first of all, think keeping i18n logic separate database entities better approach in terms of flexibility , maintenance. so in order keep i18n separate database either use enumerations (it's has di

php - Removing frontend dependancies from WordPress Advanced Custom Fields -

i'm trying make theme totally independent of acf's get_field , the_field (so in case plugin disabled site not break). have image loaded via custom field 'slider_image' inline background-image . need call url of image. possible load inlined html? here's working code (w/ acf's the_field ): <!-- hero image --> <section class="hero" style="background: url('<?php the_field('slider_image'); ?>') no-repeat center center; background-size: cover;"> </section> <!-- end hero image --> how can use get_post_meta rewrite statement in case plugin disabled? i've tried: <section class="hero" style="background: url('<?php echo get_post_meta( get_the_id(), 'slider_image', true ); ?>') no-repeat center center; background-size: cover;"> which returns: <section class="hero" style="background: url('98') no-r

.net - Linq query to filter a list of strings in Observable collection -

from observable collection want filter items names aaa,bbb,ccc,ddd,eee. how this? public class item { public string itemname {get; set;} public int itemnumber {get; set;} } public observablecollection<item> _items; public list<string> searchitems = new list<string>(5); searchitems.add("aaa"); searchitems.add("bbb"); searchitems.add("ccc"); searchitems.add("ddd"); searchitems.add("eee"); i tried bit in linq.. dont know how list.. var filtereditems = item in _items _items.any(x => x.itemname == "aaa") select x; you can use contains; var filtereditems = item in _items _items.any(x => searchitems.contains(x.itemname)) /*select x;*/ select item;

Jenkins section "people" is empty -

i have problem jenkins "people" section being empty. when project builds can see did latest commits etc. can click on user , change settigs email etc. when go "people" tab don't see there. i've tried update subversion plugin didn't take effect. you misunderstood people part. see list of committers. people listed in people section jenkins users, i.e people registered jenkins. not ones committing project. to have people listed up, proceed below: manage jenkins>configure system in access control: security relam. opt jenkins's own user database and check allow users sign up save changes. now in manage jenkins have manage users option. can create users here. listed in people page.

ios - 'Application windows are expected to have a root view controller at the end of application launch' In Cocos 2d -

i getting error while running cocos2d project. new cocos2d please solve error. code in applicationdidfinishlaunching. self.notifycenter = [nsnotificationcenter defaultcenter]; [notifycenter addobserver:self selector:@selector(tracknotifications:) name:nil object:nil]; // init window //window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; self.window = [[[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease]; // cocos2d inherit these values [window setuserinteractionenabled:yes]; [window setmultipletouchenabled:yes]; // try use cadisplaylink director // if fails (sdk < 3.1) use default director if( ! [ccdirector setdirectortype:ccdirectortypedisplaylink] ) [ccdirector setdirectortype:ccdirectortypedefault]; // use rgba_8888 buffers // default is: rgb_565 buffers [[ccdirector shareddirector] setpixelformat:kpixelformatrgba8888]; // create depth buffer of 16 bits // enable if going use 3d transitions or 3d objects // [[ccdirector

jquery - How to check initial screen size -

i have jquery code dynamically check screen size, goes this... $(window).resize(function() { windowsize2 = $(window).height(); windoww = $(window).width(); if (windowsize2 < 400) { ... ... the purpose of code resize particular div when screen made smaller. works, when screen greater 400 , shrunk down below 400 . however, lets user opens website screen size of < 400 , in case, code above not read screen size , therefore not resize div. if user resizes screen. how can use jquery ensure div resized if user opens website screen height of < 400 ? how can use jquery ensure div resized if user opens website screen height of < 400? you can refactor code method , call method on both resize , once page loaded. refactor code like: function resizediv() { windowsize2 = $(window).height(); windoww = $(window).width(); if (windowsize2 < 400) { ... ... } then, depending on use case, there 2 options call method when page load

javascript - submitting popup div without refreshing the parent page -

i have parent page main.php running using ajax. in page click on image opening popup div using jquery.in popup div data entered , need save data in database . while doing , using button submits form, because of parent page getting refreshed. how avoid this... /*main.php */ <form id="popform"> <input type="hidden" id="hdnsubmt"> <div id="popup"> <input type="text" id="text1" name="text1" value=" "> <input type="button" value="submit" id="btnsubmit" onclick="submitform();"> </div> </input> </form> <script> $(document).ready(function(){ $('#popup').hide(); $( "#image1" ).click(function() { $('#popup').show(); //if image clicked pop appears });

linux - how to do 'ls -lrt' of data from a input file -

i have input file file.csv (data separated comma delimiter) have 3 comma-delimited rows. data file names. e.g: test,test1,test2,test3,,n a,b,c,d,,n p,q,r,s,,n now, have requirement first row of file file.csv data exist or not in directory abc command ls -lrt . output of command should redirected text file a.txt . e.g: ls -lrt test ls -lrt test1 .... next: second row of file.csv data in directory abc command ls -lrt . output of command should appended text file a.txt . e.g: ls -lrt ls -lrt b .... next: third row of file.csv data in directory xyz command ls -lrt . output of command should appended text file a.txt . e.g: ls -lrt p ls -lrt q .... sample output: -rw-r--r-- 1 dba dba 122 jan 21 06:44 test ls: p: no such file or directory how can achieve this? something maybe: dirs=(abc abc xyz) index=1 while read -r line; ifs=, f in $line; ls -lrt "${dirs[$index]}/$f" 2>&1 done let index++ done <

c++ - Searching parallel arrays -

my program designed take input file containing list of titles , authors. file looks so: title associated author next title associated author etc. the problem i'm having showbooksbytitle , showbooksbyauthor functions. right code returns exact matches , prints empty newline , new line spaces , (). of course appreciated. first year programming. i've included whole code safe i'm not leaving out problem. #include <iostream> #include<string> #include<fstream> #include<cstring> using namespace std; struct book { string title; string author; }; const int array_size = 1000; book books [array_size]; int loaddata (string); void showall (int); int showbooksbyauthor (int, string); int showbooksbytitle (int, string); int main() { //declare variables string pathname; string title; string name; string word; int count; char response; //ask user pathname cout << "what path of library file? "

javascript - How to change body background image by clicking a button in Angular Js? -

hello adding buttons website allow users change background. i trying make background change angular. so far have been able change background color couple ways (changing single color , gradient)... however, trying change background-image 1 button , other button trying change background gradient , background-size @ same time. these steps have done far: <body ng-style="mystyle"> successful: <input type="button" class="bg stripes" ng-click="mystyle={background: 'red'}"> failing: <input type="button" class="bg numbers" ng-click="mystyle={background-image:'url(../images/count2.png)'}"> successful: <input type="button" class="bg stripes" ng-click="mystyle={background:'linear-gradient(45deg, #379690 25%, #3aa19b 25%, #3aa19b 50%, #379690 50%, #379690 75%, #3aa19b 75%, #3aa19b)'}"> failing: <input type="button" cl

jquery - Custom text in tooltip and legend: ChartJs -

im using doughnut chartjs. tooltip text long gets cut. wanted add ellipsis(...) @ end of tooltip text. ellipsis gets added in legend also. how add different text in legend , tooltip? controller.js doughnutdata.push({ 'value': value.count, color: $scope.doughnutcolors[key], highlight: $scope.doughnutcolors[key], label: value.website }); directive.js $scope.mydoughnut = new chart(ctx).doughnut(value, { showscale: true, scaleshowlabels: true, animation: false, tooltiptemplate: "<%if (label){%><%=label%>:<%=value%>%<%}%>", legendtemplate: "<ul class=\"doughnutalt-legend\"><% (var i=0; i<segments.length; i++){%><li><span style=\"border-color:<%=segments[i].fillcolor%>\"></span><label><%if(segments[i].label){%><%=segments[i].label%><%}%></label></li><%}%></ul>", })

asp.net mvc - Tokenizing a expression string in C# -

i have calculation formula string of form string formula = w_tb + min(d_3,a_x) * pow(x,2) in above example w_tb, d_3, a_x, x variables. able find list of variables in formula splitting strings using operands delimiter. but in order assign values variables (value database), first approach replace variable name value of variable database. result in replacing substring of expression string value. eg : if variable x replaced value 1,2 in expression string a_x replaced a_1,2 not required result. i have list of variables , and complete list of delimiters(operators). what trying achieve? i trying following list expression string list<string>() {"w_tb","+","min","(","d_3",",","a_x",")","*","pow","(","x",",","2",")"} is there way achieve task. i have tried solution mentioned in this answer. tokenizer having string.

html5 - The "hover" not work properly -

i have problem div "transition"\"hover" @ project : comverese . at section "success stories" . when hover div's , go o.k ,but not stay when move mouse in div. what problem? .story1{ position: absolute; width: 22rem; height: 12rem; z-index: 9; background: white; padding: 1rem; -webkit-transition:transform .6s ease-out; -moz-transition:transform .6s ease-out; -ms-transition:transform .6s ease-out; -o-transition:transform .6s ease-out; transition:transform .6s ease-out; } .story1:hover{ -webkit-transform:translate(0px,-200px); -moz-transform:translate(0px,-200px); -ms-transform:translate(0px,-200px); -o-transform:translate(0px,-200px); transform:translate(0px,-200px); } the problem div not hovered anymore after translates. div moved up, , you're hovering div below (namely .quote div) -> story div comes down. one way fix use bit of javascript instead of solely re

Why do you need to put the label "day:" but not "name:" in my Swift function program? -

i started learn swift , took official book on swift read. don't understand particular idea behind first example on functions . this example code looks like: func greet(name: string, day: string) -> string { return "hello \(name), today \(day)." } greet("bob", day: "tuesday") which gives correct output: "hello bob, today tuesday." i don't understand why code has " day: " in: greet("bob", day: "tuesday") i mean, the issue is , if has have "day: tuesday", why don't have "name: bob" , instead have "bob". things i've replaced** greet("bob", day: "tuesday") with: greet(name: "bob", day: "tuesday") error: extraneous argument label 'name:' in call. greet(name: "bob", day: "tuesday") error: missing argument label 'day:' in call. that'

Template MySQL didn't get result in Zabbix -

i'm planning use temple mysql monitor mysql detail instances. unfortunatelly can't result. still missing in configuration. check out zabbix-agent log piece of log not whole log. xecute_str() command:'/usr/lib/zabbix/externalscripts/mysql_check.pl' len:0 cmd_result:'' 28786:20160121:141008.072 sending [] 28786:20160121:141008.072 listener #2 [waiting connection] 28788:20160121:141008.648 in send_buffer() host:'127.0.0.1' port:10051 values:0/100 28788:20160121:141008.648 end of send_buffer():succeed 28788:20160121:141008.648 active checks #1 [idle 1 sec] 28784:20160121:141008.795 collector [processing data] 28784:20160121:141008.796 in update_cpustats() 28784:20160121:141008.796 end of update_cpustats() 28784:20160121:141008.796 collector [idle 1 sec] 28785:20160121:141009.075 listener #1 [processing request] 28785:20160121:141009.075 requested [mysql[root,qwestions,lld]] 1. add special user mysql: example: grant usage on *.*

html - how to style dayMouseover in Fullcalender -

Image
i using fullcalender plugin in angular application. want change cell color when mouse on time slot (eg. 7.30am-8.00am) in agendaweek view.i want this: i have tried changing css : .fc-widget-content:hover { background: #adf4fa; } doesn't work cell.it changes entire row color. i don't think can edit background color of 1 cell because cells aren't cells rows: <tr data-time="11:30:00" class="fc-minor"> <td class="fc-axis fc-time fc-widget-content" style="width: 51px;"></td> <td class="fc-widget-content"></td> </tr>

how to nginx rewrite a.php,b.php,c.php to /index.php -

here rewrite code: location / { if (!-e $request_filename){ rewrite "(*utf8)^/(.*)$" / last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_param php_value "open_basedir=$document_root:/tmp/:/proc/"; } i wanna rewrite a.php,b.php,c.php /index.php.but doesn't work!but when type a.,b.c.,code above can work,i make wrong? your current problem uri .php processed php location block , therefore bypasses rewrite rule. use try_files in both / location , php location. example: location / { try_files $uri $uri/ /index.php; } location ~ \.php$ { try_files $uri /index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param script_filename $document_roo

xhtml - XForms data model can not be saved in XML file -

i have following xforms code: <?xml-stylesheet href="./xsltforms.xsl" type="text/xsl"?> <?xsltforms-options debug="yes"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"> <head> <title>xforms submit example</title> <xf:model id="mymodel"> <xf:instance src="./model.xml"/> <xf:bind id="firstname" nodeset="/mydata/firstname"/> <xf:submission id="save" method="put" action="./mydata.xml" replace="none" /> <xf:submission id="loaddoc" action="./mydata.xml" replace="instance" method="get" /> </xf:model> </head> <body> <xf:input ref=

java - How to pickup excel date as it is without changing format using poi -

i reading cell value using poi in java. suppose enter date 10.10.2015 in case when set celltype numeric , getdatecellvalue() returns me date in calendar format nov 10, 2015 mm:ss xyz . apart tried using below code snippet new dataformatter().formatcellvalue(cell) and return 10/10/15 . want read date in poi(in java code) text mean 10.10.2015 .

php - Curl login not working -

i trying login website in php , store cookie.however not able pass login reason.here code far first cookie , xsrf-token .you can consider $cookie_file_path exist empty $ch = curl_init("https://ahrefs.com/user/login"); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_autoreferer, true); curl_setopt($ch, curlopt_useragent, 'mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/47.0.2526.111 safari/537.36'); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_cookiejar, $cookie_file_path); curl_setopt($ch, curlopt_cookiefile, $cookie_file_path ); curl_setopt($ch, curlopt_header, 1); curl_setopt($ch, curlopt_referer, ""); curl_setopt($ch, curlopt_connecttimeout , 120); curl_setopt($ch, curlopt_timeout , 0); $result = curl_exec($ch); a

php - How do I UPDATE a value in a DB and add another value to it -

what wish update value stored in db same value + value. example: $points=$_post['points']; $ptsupdt = "update kids set points = points + '$points' name='$name'"; currently when run statement, adds double value stored in $points. example: if $points=5 updated value original value + 10. just don't quote $points! $ptsupdt = "update kids set points = points + $points name = '$name'";

python - TensorFlow installation results in ImportError: No module named tensorflow -

i'm trying tensorflow work on mac (osx el capitan 10.11.2). tried pip install setup guide , followed instructions in the accepted answer here . in both cases able activate virtualenv , prompt changes tensorflow. python works fine, i'm able simple computations on command line . when try import tensorflow: import tensorflow tf i repeatedly error: importerror: no module named tensorflow any appreciated. i had issue reported in original question. python worked fine, followed installation steps on tensforflow website, , got "no module named tensorflow." re-installing python via brew, , re-installing pip result, fixed it. didn't need uninstall anything, line below along normal pip install tensorflow installation document afterwards: brew install python