Posts

Showing posts from March, 2012

php - Add variable number of days to date -

how add variable number of days date in php? i've found examples calculating specific number of days, not variable. $date = $row["date"]; // i.e 2015-12-13 $days = $row["days"]; // i.e 10 i want output (in example 2015-12-23 ) put in variable $futuredate . thanks! you can try strtotime() , date() functions $date = $row['date']; $days = $row['days']; $futuredate = date('y-m-d',strtotime($date) + (24*60*60*$days));

jquery - Call Function Inside ajax success results in ReferenceError: Can't find variable: -

im getting error inside ajax success handler. referenceerror: can't find variable: getresult i'm trying call function called getresult error seems think getresult variable? here jquery: $('#button').click(function(){ var data1 = $('#comments').val(); $.ajax({ type: "post", url: "/modules/business/submitpost.php", data: ({ dat1: data1}), cache: false, success: function(data) { $("#comments").val(""); $("#comments").css('height', 'auto'); $("#comments").height(this.scrollheight); $('#imagepreview').attr('src', ""); $("#imagepreview").hide(); $("#faq-result").html(""); getresult('/modules/business/getresult.php?page=1'); } }); }); function getresult(url) { $.ajax({ ...

scala - Is there a better way to check if a number should be inside a range, in scalatest? -

say wanna check if result (an integer) should >=4 , <=15 , can write such assertion in scalatest test: assert(num >= 4) assert(num <= 15) it works can improved in opinion. there better way check in scalatest? this maybe: assert(4 5 contains res.toint) ?

javascript - Distributed session storage in ExpressJS -

i'm working on distributed web app, , want use expressjs session store data, need distributed session storage. alternatively, build own session storage, don't know how it. i'm using memcached (by mean of this module ) in parts of project different web app, nice able use memcached session storage. i want this: app.use(express.session({secret: 'something', store: new memcachedstorage(...)})); so storage should use? i think this looking for: app.use(express.session({ secret: 'catonthekeyboard', store: new memcachedstore }));

claims based identity - What's best practices to use ThinkTecture IdentityServer from a dekstop app like WPF? -

does know of sample application demonstrating best practices use thinktecture identityserver v2 desktop application wpf? is using httpclient call accountcontroller's signin operation preferred way? i'm trying this, response html page webapplication redirected to sign in. private async task loginrequest(string username, string password) { httpclient client = new httpclient(); client.defaultrequestheaders.add("accept", "application/json"); client.baseaddress = new uri(@"https://<server-name>/idsrv-sample/"); var logindata = new signinmodel { username = username, password = password, issigninrequest = true }; var signinresponse = await client.putasjsonasync("account/signin", logindata); var result = await signinresponse.content.readasstringasync(); messagebox.show(result); // identityserver login page } not sure mean "best practices...

mysql - How to remove line break from LOAD DATA LOCAL INFILE query? -

i using query import data txt file table: load data local infile '~/desktop/data.txt' table codes lines terminated '\n' (code) this working fine. when take in "code"-field, every entry has line break @ end. there way rid of this? load data infile command not suitable data cleansing, may lucky. first of all, determine characters make 'line breaks'. it possible, text file uses windows style line breaks ( \r\n ). in case use lines terminated '\r\n' . if line breaks consist of different characters, consistent across lines, include in line terminated clause. if line break characters inconsistent, may have create stored procedure or use external programming language cleanse data.

python - Can i automatically turn a new created tkinter notebook tab into the active tab -

i writing own text editor in python. when open files or create new file opened in new tab, new tab never active tab. is there can make new tab active tab without manually selecting in application? the notebook widget has method named select make given notebook tab active. this documented in official ttk documentation: https://docs.python.org/3.1/library/tkinter.ttk.html#tkinter.ttk.notebook.select

html - backgroud-color just working for 1st cell -

... <th style='background-color:#cccccc;font-weight:bold'><td></td><td>anschrift</td><td>nachname</td><td>vorname</td><td>plz</td><td>ort</td></th> ... i wonder why first cell of th being formatted style attributes, ideas this? appreciated, regards ismir edit: 1st empty cell intended without seeing remainder of html, i'd start reformatting code follows: <table> <tr> <th>table heading</th> <th>table heading</th> <th>table heading</th> </tr> <tr> <td>anschrift</td> <td>nachname</td> <td>vorname</td> </tr> </table> that may 1 of issues you're encountering, wrapping <tr> 's, <td> 's in table heading element.

javafx - How to fill up a TableView with SQL data -

i've been trying load tableview data queried database, can't seem work. this first attempt @ trying fill database database query items, in case code seems mungled , far good. the fxml done via javafx scenebuilder. this database query class: public static void refreshtableapplicant(){ dataapplicant = fxcollections.observablearraylist(); try { connection con = login.getconnection(); statement stmt = con.createstatement(); if (login.getentitlement() < 3) { resultset rs = stmt.executequery("select * applicant"); while (rs.next()) { observablelist<string> applicant = fxcollections.observablearraylist(); applicant.add(rs.getstring(1)); applicant.add(rs.getstring(5)); applicant.add(rs.getstring(6)); applicant.add(rs.getstring(8)); applicant.add(rs.getstring(...

Joomla K2 No dropdown for "select category" in menu admin -

Image
there's text input instead of dropdown input in menu admin under administration. when try create or edit menu item , select it's type k2 category, under basic options section field label "select category" text field. whatever write there doesn't affect list of posts when click on menu item on page. lists posts. image: image problem http://img713.imageshack.us/img713/305/theproblem.jpg i'm using joomla 2.5.4.

scala - Diverging implicit expansion for Ordered with Product -

why following causing "diverging implicit expansion": trait suit extends ordered[suit] implicitly[ordering[suit]] // ok implicitly[ordering[product]] // none found implicitly[ordering[suit product]] // diverges !? (is related si-8541 ?)

logic programming - pyDatalog: handling unbound variables in a custom predicate -

i'm writing pydatalog program analyse weather data weather underground (just demo myself , others in company @ moment). have written custom predicate resolver returns readings between start , end time: # class reading table. class reading(base): __table__ = table('reading', base.metadata, autoload = true, autoload_with = engine) def __repr__(self): return str(self.time) # predicate resolve 'timebetween(x, y, z)' statements # matches items x time of day between y , z (inclusive). # if y later z, returns items not between z , y (exclusive). # todo - make work t1 , t2 not bound. # somehow needs tell engine try somewhere else first. @classmethod def _pyd_timebetween3(cls, dt, t1, t2): if dt.is_const(): # dt known if t1.is_const() , t2.is_const(): if (dt.id.time.time() >= maketime(t1.id)) , (dt.id.time.time() <= maketime(t2.id)): yield (dt.id, t...

ms access - Is it possible to pass the name of a subroutine to a string in VBA? -

i'm constructing database in access heavy vba use. it useful error reporting if pass name of active subsoutine string. possible in vba? thanks. yes...manually :-) sactiveroutine = "mysubname" if use product mz tools, can make quite easy defining custom header. vba not have way return name of current proc.

python - How to apply multiple functions to a pandas dataframe without multiple loops? -

i use pandas etl process. query database put result in dataframe; dataframe pretty big (1m rows * 50 columns). dataframe composed of string , date. i use apply() function of pandas make transformations. thing transformation contains multiple branching on string. df['merged_contract_status'] = df.apply(lib.merged_contract_status, axis=1) df['renewed'] = df.apply(lib.contract_renewed, axis=1) df['renewal_dt'] = df.apply(lib.contract_renewed_date, axis=1) .... i have bunch of transformation that. functions call: def merged_contract_status(row): if row['tbm_contract_status'] not np.nan: mergedcontractstatus = row['tbm_contract_status'] else: mergedcontractstatus = row['ccn_status'] return mergedcontractstatus def contract_renewed(row): ccn_activation_dt = row['ccn_activation_dt'] ccn_status = row['ccn_status'] f_init_val_dt = row['f_init_val_dt'] f_nat_exp_dt ...

Understanding what is wrong in this git commit graph -

Image
i trying figure out did wrong looking @ commit graph here. have used alphabets , b show each commits parent. shouldn't going straight instead of bending @ security how read kind of graph figure out went wrong? have been given believe healthy commit graph goes straight way. in case not right or it? apologies if question doesn't have enough information. don't know how provide more. here gitk view edit here sourcetree view the graph in sourcetree seems more healthier compared see in gitk. why different? those identical graphs. gitk puts bend in there preserve (very limited) ui space. try running: gitk --date-order that should make things more similar, though still have bend @ "security".

sql - Oracle / PLSQL - Using column results in a where clause -

i've been trying simple still can't. trying interate on table , use each row of column in clause display query. for example: i want retrieve users dba_users pass clause in query show example account_status , profile every user. want in way can turn result many html tables. i've tried many things really, post doesn't work think show problem having, begin in (select username dba_users order 1) loop execute immediate 'select account_status dba_users username ''||i.username||'''; end loop; end; / edit: here's example of want achieve: read 2 sql_ids v$sql sql> select sql_id v$sql rownum < 3; sql_id 9avfy3fv2wq2x 0ywp98ffdz77f use returned ids gather performance info , results in 2 result sets -- html markup set markup html on head " - " - body "" - table "border='1' align='center' summary='script output'" - spool on entmap on preformat off s...

bash - Need to run chromium as normal user from root script -

i have kiosk shuts down every day using rtcwake, , uses root user. i've used && execute boot script after rtcwake completes, starts browser root causing problems. this command use: echo debian | sudo -s rtcwake -m mem -u -t $(date +%s -d '3 days 7:45') && sudo -u debian -i bash $home/kiosk/bin/startup.sh & . the sudo command work extent. calls debian user, , executes correct script, however, still screws chromium preferences. here startup script: echo debian | sudo -s hwclock -w export home=/home/debian #log boot time echo "booting at" $(date) >> $home/kiosk/bin/logs/boot.log #echo debian | sudo -s service connman restart echo debian | sudo -s @ 15:30 -f $home/kiosk/bin/shutdown.sh crontab -u debian crontab.txt bash $home/git.sh #sudo -i -u debian #start kiosk export display=:0 chromium-browser --kiosk --disable-gpu http://localhost/kiosk/client/main.html & #update ip bash /home/debian/git.sh & i'm ...

c++ - Incomplete types and initializer_list -

i trying model meta data serializing/de-serializing c++ objects. here captures nuts & bolts of need; compiles gcc 5.2 ( g++ sample.cpp -std=c++14 ) , clang 3.6 ( clang++ sample.cpp -std=c++14 ). my question struct typeinfo in example. contains std::initializer_list of itself. standards-conforming? #include <cstdint> #include <initializer_list> enum class typecode : std::uint8_t { boolean, int, object, string, sentinel }; struct typeinfo { typecode typecode_; char fieldname_[64]; union { std::uint16_t textminlength_; std::uint16_t objectversionmajor_; }; union { std::uint16_t textmaxlength_; std::uint16_t objectversionminor_; }; // set if typecode_ = object std::initializer_list < typeinfo > objecttypeinfos_; }; int main() { typeinfo const sti { typecode::string, "updatedby", { .textminlength_ = 0 }, { .textmaxlength_ = 16 } }; typeinfo const iti { typeco...

java - Read Full input from TCP Server -

i working on client/server project. until both have been in c++ , making client java based. in order receive server have been using bufferedreader in = new bufferedreader(new inputstreamreader(socket.getinputstream())); and have been using in.readline() the problem when need receive multiple lines server, client stops after first line because of '\n' character. how avoid happening , receive of info? i thought of using char[] this: char[] buffer = new char[1024]; but problem when client receives next message there still left overs in buffer. any great! thanks

seo - .htaccess conditional statement -

i want rewrite urls more seo urls using wildcard sub-domains , unable write htaccess conditions , hoping it. i have url: http://learntipsandtricks.com/blog/c/magento i want rewrite as: http://magento.learntipsandtricks.com/ change pagination link: http://learntipsandtricks.com/blog/92/magento/3 to: http://magento.learntipsandtricks.com/p-92-3 finally change article url: http://learntipsandtricks.com/blog/magento/114/magento-index-management-cannot-initialize-the-indexer-process to: http://magento.learntipsandtricks.com/114-magento-index-management-cannot-initialize-the-indexer-process i wrote this: rewritecond %{http_host} !^www\.(.+)$ [nc] rewritecond %{http_host} (.+)\.learntipsandtricks\.com\/p\-(\d+)\-(d+) [nc] rewriterule ^(.*)$ http://learntipsandtricks.com/blog/%2/%1/%3/$1 [p] rewritecond %{http_host} !^www\.(.+)$ [nc] rewritecond %{http_host} (.+)\.learntipsandtricks\.com\/(\d+)\-(.*) [nc] rewriterule ^(.*)$ http://learnt...

objective c - Crashes when copying SQLite db from bundle to documents and then querying -

this makes absolutely no sense (to me). sqlite throw exc_bad_access errors randomly (on sqlite3_prepare_v2 line in db class) when querying when copy database bundle documents folder in background thread. but, if don't perform in background thread no crashes ever occur. the reason want perform operation in thread is quite large (~150mb). my didfinishlaunchingwithoptions looks - working script commented out below gcd thread: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { dispatch_queue_t setupdb = dispatch_queue_create("setupdb", null); dispatch_async(setupdb, ^{ [db setup]; dispatch_async(dispatch_get_main_queue(), ^{ [db connect]; [[nsnotificationcenter defaultcenter] postnotificationname:@"databaseready" object:nil]; }); }); // if using code, though, works fine // [db setup]; // [db connect]; // [[nsnotificationcenter ...

c++ - Design pattern for accessing non-const through a const intermediate -

can suggest better design situation want 2 objects "talk" each other through const intermediate. here contrived example, 2 players trade lemons. player finds player in "world", "world" should const , since player shouldn't able modify (lets deleting walls). void player::give_lemon() { const world& world = this->get_world(); const player& other = world.get_nearest_player(*this); this->lemons--; other.lemons++; // error } what designs people use, simple const_cast easy dirty. or provide way of "looking up" non-const player reference, lets having access non-const player_list() here we'd duplicating functionality available in world , possibly less efficiently, round-about way of doing specific const_cast . it seems both player , world can seen actors world happens const introduce manager class handles both: manager take const world in constructor , player s can added or removed...

filter - Iterative filtering odd numbers in list -

here task have solve: write iterative function, receives list numbers , creates new list, consists of numbers received list. i found few posts similar questions , solutions, couldn't use them help, because in these solution using "car" , "cdr" commands, haven't had in our schedule yet. how can this? start this: (define filter-odds (lambda(x) (if (odd? x) ...) terrible oversight: no 1 has mentioned how design programs , here. kind of program right smack in middle of htdp's path. specifically, totally straightforward application of list template section 9.3, "programming lists." perhaps class using htdp?

javascript - How to go to new line after each 6 iterations in Imacros -

i'm extracting data website. in 1 line in csv goes 6 parameters separated commas, need go new line , on. when macros increased loop 6 need go new line in csv line. i tried this if(i % 6 === 0) but it's not working. var id = window.document.getelementsbyclassname('divtd textcenter vam').length; var m = "", a=0, b='\\n'; (var = 1; <= id; i++) m += 'tag pos='+i+' type=div attr=class:"divtd textcenter vam" extract=txt\n'; m += 'set !extract eval("\'{{!extract}}\'.replace(/\\\\n/g, \'\');")\n'; m += 'saveas type=extract folder=* file=trafficgoals.csv\n'; if(i % 6 === 0) { iimplaycode('set !extract '+b+'\nsaveas type=extract folder=* file=trafficgoals.csv'); } iimplaycode(m); maybe need solution: var id = window.document.getelementsbyclassname('divtd textcenter vam').length; (j = 1; j <= math.ceil(id / 6)...

Is it possible to format data in CDATA section in xml file to display information into 2 sections using style = float: left setting? -

i trying split page 2 frames display sets of information. struggling set style options. can please suggest me way around please? thanks in advance. code: <?xml version="1.0" encoding="utf-8"?> <system> <parameter name="text"> <![cdata[ <b>summary:</b> <font size="-4"> <div style="float: left;" width=200 padding="0,0,6,6"> <span width="200"> <b>customer details:</b> </span> </div> <div style="float: right;" width="200" padding="0,0,6,6"> <span width="200"><b>product details</b></span> </div> </font>]]> </parameter> </system>

filter child entities collections with predicate in IOS (objective c )? -

Image
i want set predicate on fire date. attribute alerts of entity history nsorderset. nsfetchrequest *fetchrequest = [[nsfetchrequest alloc]initwithentityname:@"history"]; nstimeinterval interval = [[nsdate date] timeintervalsince1970]; nsdate *tempcurrent = [nsdate datewithtimeintervalsince1970:interval]; // firetime nspredicate *predicate = [nspredicate predicatewithformat:@"alerts.firetime < %@", tempcurrent]; [fetchrequest setpredicate:predicate]; [[managedobjectcontext executefetchrequest:fetchrequest error:nil] count]; nsinteger count = [managedobjectcontext countforfetchrequest:fetchrequest error:nil]; nslog(@"%li",(long)count);` problem fetched objects count equal zero. no data fetched core data.

Displaying a progress wheel on main screen while connecting to internet [Android] -

i want display progress bar loads while connecting internet in logo screen. using below class check internet connection: public class appstatus { public boolean isnetworkavailable(final context context) { final connectivitymanager connectivitymanager = ((connectivitymanager) context.getsystemservice(context.connectivity_service)); return connectivitymanager.getactivenetworkinfo() != null && connectivitymanager.getactivenetworkinfo().isconnected(); } } the code of screen progress bar is: public class logo_activity extends appcompatactivity { private progressbar mprogress; private int mprogressstatus = 0; private handler mhandler = new handler(); private appstatus con = new appstatus(); @override protected void oncreate(bundle savedinstancestate) { requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); ...

android - getRunningTasks LOLLIPOP integration -

getrunningtasks deprecated in lollipop. have use usagestatsmanager in order package name of foreground app. have tested on android 6.0 , works. the problem not want set project run android 5.0(the users on kitkat). compile project lollipop , run functions need depending on android version(i make sure not run code usagestatsmanager on lower api lever). in manifest set minsdkversion 10. have tested on android 4.1.1 application works see in logcat: 01-06 19:57:17.570: e/dalvikvm(31534): not find class 'android.app.usage.usagestatsmanager', referenced method 01-06 19:57:17.570: w/dalvikvm(31534): vfy: unable resolve check-cast 39 (landroid/app/usage/usagestatsmanager;) in 01-06 19:57:17.570: d/dalvikvm(31534): vfy: replacing opcode 0x1f @ 0x0009 01-06 19:57:17.585: d/dalvikvm(31534): dexopt: unable opt direct call 0x00a5 @ 0x23 in l should worried these errors/warnings? app works not sure if work on devices(with api level less 21). another possible solution use reflec...

javascript - Setting authorization in native browser fetch -

i'm coming across issue can't seem set headers fetch request , think i'm missing something var init = { method: 'get', headers: { 'accept': 'application/json', 'content-type': 'application/json', 'authorization': 'bearer mykey' } }; return fetch(url, init).then(function(response){... when request inspected in network tab, i'm not seeing headers set , instead see access-control-request-headers:accept, authorization, content-type when expect see authorization: bearer mykey content-type: application/json accept: application/json i've tried using native headers() 0 difference. am missing here? i having same issue , took bit of investigating evening. problem cross-origin resource sharing / cors . fetch default , makes things considerably more complex. unless both origin , destination same cross-domain request, , these suppor...

css - What are reasons for Durandal/Hot Towel template setting body max-width to 1100px when using Bootstrap fluid styles? -

it's noticeable when using "hot towel" spa template durandal views sit in middle window that's 1100 pixels in width rather using available space. and yet views within applicationhost set use bootstrap twitter "fluid" styles. hard-coded max-width set on body tag making these fluid styles redundant , rather meaningless. it's easy enough over-ride body style set in app.css (assumming there no side effects setting ridiculously high value) wondering if knew reason setting way in template, given it's undoing work of trying implement responsive design bootstrap "*-fluid"styles trying implement. no particular reason. feel free remove if layout still appeals you. can submit pull request on github changes too, hottowel open source.

Elasticsearch: How to make all properties of object type as non analyzed? -

i need create elasticsearch mapping object field keys not known in advance. also, values can integers or strings. want values stored non analyzed fields if strings. tried following mapping: put /my_index/_mapping/test { "properties": { "alert_text": { "type": "object", "index": "not_analyzed" } } } now index created fine. if insert values this: post /my_index/test { "alert_text": { "1": "hello moto" } } the value "hello moto" stored analyzed field using standard analyzer. want stored non analyzed field. possible if don't know in advance keys can present ? try dynamic templates . feature can configure set of rules fields created dynamically. in example i've configured rule think need, i.e, strings fields within alert_text not_analyzed : put /my_index { "mappings": { "test": { ...

sorting - Php multi sort function -

i'm trying sort standings table not score, weekly wins well. in league, overall score (pick ratio) top dog, wins tiebreaker. have 3 people in 2nd, 2 of them 1 win each, , 0. standings page displays them out of order. same thing in 3rd place section, 1 2 wins should on top. (see link) http://imgur.com/vh2xzrn i see sorting on standings.php page: $playertotals = sort2d($playertotals, 'score', 'desc'); and calls sorting function functions.php page: //the following function found @ http://www.codingforums.com/showthread.php?t=71904 function sort2d ($array, $index, $order='asc', $natsort=false, $case_sensitive=false) { if (is_array($array) && count($array) > 0) { foreach(array_keys($array) $key) { $temp[$key]=$array[$key][$index]; } if(!$natsort) { ($order=='asc')? asort($temp) : arsort($temp); } else { ($case_sensitive)? natsort($temp) : natcasesort($temp); if($order!='asc') { $temp=arr...

Padding dates in Vertica SQL -

i have 2 tables in vertica database. 1 contains reservation data date of reservation made , date of arrival. other table 1 column dates between 2010-2030. want create query select reservation table data create new date field pads rows arrival date minus 1 day, way arrival date minus 90 days. table1: +--------+------------+-----------+--------+--------+ | id | res_date | arr_date | value1 | value2 | +--------+------------+-----------+--------+--------+ | 123456 | 12/16/2015 | 1/25/2016 | 4 | 100 | +--------+------------+-----------+--------+--------+ my query far i'm not sure how create rows each unique record pad minus 90 days. select t1.id ,t1.reservation_date ,dates.date,t1.value1 ,t1.value2,t1.arrival_date sandbox.t1 left join sandbox.dates on t1.reservation_date = dates.date the desired output such: +--------+------------+-----------+--------+--------+-----------+ | id | res_date | arr_date | value1 | value2 | date_ext | +--------+------...

c# - How can I print values from a text file in the console? -

i've been trying read values values.txt file , print them in console using c#. appears work. i've debugged code , found nothing wrong , program compiling. problem values wont appear on console. prints empty lines. here's code : using system; using system.collections.generic; using system.io; using system.linq; using system.text; using system.threading.tasks; namespace testfilereadtest { class program { static void main(string[] args) { streamreader myreader = new streamreader("values.txt"); string line = ""; while (line != null) { line = myreader.readline(); if (line!= null) console.writeline(); } myreader.close(); console.writeline("allo"); console.readline(); } } } i'm using visual studio express 2013 nowhere print values console. you...

And operator argument evaluation in C++ -

this question has answer here: how c++ handle &&? (short-circuit evaluation) 7 answers how , operator evaluates arguments. have code check whether graph cyclic or not. in code there , condition in if statement. , think, best of can make out is, terminates @ first encounter of false expression without evaluating second expression @ all. this code bool graph::iscyclicutil(int v, bool *visited, bool *recstack){ if (visited[v] == false){ // mark current node visited visited[v] = true; recstack[v] = true; // recur vertices adjacent vertex list<int>::iterator i; (i = adj[v].begin(); != adj[v].end(); i++){ -------->**this , cond**if (!visited[*i] && iscyclicutil(*i, visited, recstack)) return true; else if (recstack[...

python - How to make a query date in mongodb using pymongo? -

i'm trying perform query date in mongodb, result empty. query follows: //in begin code def __init__(self): self.now = datetime.now() self.db = conexaomongo() self.horainicio = self.now - timedelta(minutes=1) def resultadoconsulta(self, modo, porta, id_node): #print "porta e no ", porta, id_node resultadomongo = [] mediafinal = false try: json = {'id_no': int(id_node), 'datahora': {'$gte': self.horainicio, '$lt': self.now}, 'porta': porta} print "consulta ser realizada: ", json resultadomongo = self.db.querymongoone(json) //variable resultamongo return empty. obs: tried without using .isoformat() when put in mongodb directly, return results if add isodate. not return results: db.inoshare.find( {'id_no': 1, 'datahora': {'$lte': '2014-09-24t07:52:04.945306', '$gte': '2014-09-24t07:51:04.958496'}, 'port...

Recursive binary search in sorted array c++ -

i have write recursive function searches through sorted array. #include <iostream> using namespace std; int find(int value, int* folge, int max) { } int main() { int const n = 7; int wert1 = 4, wert2 = 13, wert3 = 2, wert4 = 25; int folge[n] = {3,4,9,13,13,17,22}; wert1 = find(wert1, folge, n); } this part of code given , have finish it. know how if have 4 variables available. (min , max) have three, there way edit start point of array given next function? the function can written following way #include <iostream> int find( int value, int* folge, int max ) { if ( max == 0 ) return -1; int middle = max / 2; if ( folge[middle] == value ) return middle; bool lower = value < folge[middle]; int n = lower ? find( value, folge, middle ) : find( value, folge + middle + 1, max - middle - 1 ); return n != -1 && !lower ? n + middle + 1: n; } int main() { int const n = 7; int w...

multithreading - removing items from combo box in java 8 -

so i'm making small game better @ programming , trying put in way use items. i'm trying use combo box , want hpotion , mpotion taken out of combo box when used keep error says "exception in thread "javafx application thread" java.lang.indexoutofboundsexception". code string[] itemsarray = {"sword","wand","hpotion","mpotion"}; combobox<string> cbo = new combobox<>(); observablelist<string> items= fxcollections.observablearraylist(itemsarray); cbo.getitems().add(items.get(0)); cbo.getitems().add(items.get(1)); cbo.getitems().add(items.get(2)); cbo.getitems().add(items.get(3)); buttons.getchildren().add(cbo); //the items given effects cbo.setonaction((actionevent e)->{ string selected = cbo.getvalue(); switch (selected) { case "sword": player.setpower(player.getpower()+10); break; case "wand": player.setmagicpowe...