Posts

Showing posts from June, 2015

R- add empty columns to a dataframe with specified names from a vector -

i have dataframe, df, a number of columns of data already. have vector, namevector, full of strings. need empty columns added df names of columns namevector. i trying add columns loop, iterating on each string in namevector. for (i in length(namevector)) { df[, i] <- na } but left error. error in [<-.data.frame ( *tmp* , , i, value = na) : new columns leave holes after existing columns alternatively, have thought of creating empty dataframe correct names, cbind-ing 2 dataframes not sure how go coding this. how go resolving this? the problem code in line: for(i in length(namevector)) you need ask yourself: length(namevector) ? it's 1 number. you're saying: for(i in 11) df[,i] <- na or more simply: df[,11] <- na that's why you're getting error. want is: for(i in namevector) df[,i] <- na or more simply: df[,namevector] <- na

java - Constructor and method -

for project have question says newgenerationnumber integer. if argument passed parameter less zero, set generationnumber instance variable zero. otherwise assign newgenerationnumber generationnumber instance variable. i'm confused on how start this. code out private int generationnumber then made if if (generationnumber >0) generationnumber = generationnumber i'm confused if right , if need make else generationnumber = newgenerationnumber; if (generationnumber < 0) { generationnumber = 0; } else stays way is

elasticsearch - Can fielddata_fields be used in mget request? -

i trying fielddata not_analyzed field in multi get query. working fine in _search queries. this i've tried no luck: curl -xget "http://es:9200/articles/article/_mget/?pretty&fielddata_fields=url" -d '{"ids" : ["5763197951"]}' curl -xget "http://es:9200/articles/article/_mget/?pretty" -d '{"fielddata_fields": ["url"], "ids" : ["5763197951"]}' curl -xget "http://es:9200/articles/article/_mget/?pretty" -d '{"docs" : [{"_id" : "5763197951", "fielddata_fields": ["url"]}]}' it looks fielddata_fields ignored, since result: { "docs" : [ { "_index" : "articles", "_type" : "article", "_id" : "5763197951", "_version" : 1, "found" : true } ] } i'm running es version 1.4.4 jvm: 1.8.0_31 edit...

vba - Matching excel value of column A and E to a name in column B and D -

basically have huge excel file numbers assign name (i start name unknown) | b 123456 | unknown 456875 | unknown2 assign sequenced number different values of rows. if column a2 = column e25, replace value of d25 unknown2 does make sense? i looking macro automatically it's clear enough me understand you... you have numbers in column , d - each number want specific name. the names should listed in column b (for numbers in a) , column e (for numbers in d). if there numbers in in d, too, these numbers share same name. try code: sub test() dim rng range dim long, j long, k long, l long dim firstaddress string, foundaddress string = 1 rows.count - 1 if isempty(cells(i, 1).value) exit next j = 1 rows.count - 1 if isempty(cells(j, 4).value) exit next j set rng = range("a1:a" & & ", d1:d" & j) l = 1 k = 1 + j if k < firstaddress = rng.find(cells(l, 1).value, lookat:=xlwhole, matchca...

ng-model is not updating in Angularjs -

acutally learning angularjs. i've introduced problem when click ng-click, ng-model not updating. code follows, <div ng-repeat="product in cart"> <input type="number" ng-model="product.quantity" ng-required class="input-sm"> <button class="btn btn-xs" type="button" ng-click="product.quantity++">+</button> <button class="btn btn-xs" type="button" ng-click="product.quantity--">-</button> </div> try this <button type="button" ng-click="product.quantity = product.quantity+1">+</button> <button type="button" ng-click="product.quantity = product.quantity -1">-</button>

java - How to access to element from another class -

i have servlet need show list of products first image next title , price. i try with proizvodi pr = new proizvodi(); for(int i=0; i<pr.getkatalog().size();i++) { out.println("<br />"); out.print("<img src='pr.getkatalog().get(i).getimg()'>"); out.print("<p>pr.getkatalog().get(i).gettitle()</p> "); out.print("<p>pr.getkatalog().get(i).getprice()</p> "); } but doesn't work. hope u can me. you need replace this: out.print("<img src='pr.getkatalog().get(i).getimg()'>"); with out.print("<img src='" + pr.getkatalog().get(i).getimg() + "'>"); to method return value appended string. otherwise pr.getkatalog().get(i).getimg() being in double quotes treated normal string , not method call. you need same thing these st...

android - How to use Nuclide debugger? -

Image
i selected debugger >> launch/ attach , "type" "react native" , check "start packager". "starting debugger" progress bar opens on right panel hangs after while , nothing happens. according this instruction should: from command palette (cmd-shift-p) choose "nuclide react native: start packager" start react native server. ensure in root directory of react native project, run application command-line: "$ react-native run-ios" (or choose other existing simulator, example react-native run-ios --simulator="iphone4s"). after starting server, can prime react native debugger when application begins running. command palette (cmd-shift-p), launch "nuclide react native: start debugging". from simulator press cmd-d (ctrl-d on linux). bring debug options application. select "debug js remotely. ...after enable debugging simulated application, nuclide attach debugging process automati...

jquery - How to pass data's through ajax if that variable have any values -

the following code ajax, $( ".location" ).on( "click", function(){ var loc = $('.location:checked').map(function(_, el) { return $(el).val(); }).get(); if($(".hedu").is(':checked')) { var edu = $('.hedu:checked').map(function(_, el) { return $(el).val(); }).get(); } $.ajax({ url: 'search_cv_result', type: 'get', data: { edu:edu, loc: loc, fltr:"ftr" }, success: function(data) { $('.course_list').html(data); } }); }); here,i pass loc variable , edu variable .. the edu value either null or not null. if null don't want send edu value through ajax.. i tried this.. data: { if(edu != ''){ edu:edu,} loc: loc, fltr:"ftr" }, but think it's not c...

stored procedures - How to Generate Report table [SSRS] for the Query which returns different columns based on parameters -

i have prepared dynamic stored procedure returns set of different columns based on parameters passed it. this procedure having set of common columns , based on parameter returns more (there no specific numbers defined it) all calculation done in procedure itself, want render query returned procedure return. can possible ? please suggest. in advance valuable help. ssrs isn't going work unless make stored procedure return column names same each time. ssrs reports need know names of dataset columns ahead of time them report.

go - Restore type information after passing through function as "interface {}"? -

i'm running slight architectural problem golang right that's causing me copy/paste bit more code i'd prefer. feel there must solution, please let me know if perhaps possible: when pass things through interface {} -typed function parameter, start getting errors such "expected struct or slice", etc. ... though passed struct or slice. realize manually convert these type after receiving them in function, become tedious in instances such this: local interface type *interface {} can decoded remote interface type; received concrete type ... in case, receiving function seems it'd need hard-coded convert interface {} items respective original types in order work properly, because receiving function needs know exact type in order process item correctly. is there way dynamically re-type golang interface {} typed variables original type? this, how convert reflect.new's return value original type ... maybe? edit: clarify, basically, i'm ...

asynchronous - print function does not get called in an async function before await in python -

i want links requests , asyncio.i have sample program think there problem because print function gets called when i'm using await. so why doesn't print gets called call actual function? have understood if await keyword used, function interrupts until future presentable. in case, print function should called before await keyword before print statement: doing stuff in between or wrong? import asyncio import requests import bs4 urls = ["http://www.google.com", "http://www.google.co.uk"] async def getcontent(url): loop = asyncio.get_event_loop() print("getting content for: " + url) # print should called here # execute non async function async future = loop.run_in_executor(none, requests.get, url) # doing stuff bs4 soup = bs4.beautifulsoup((await future).text, "html.parser") # should interrupt return soup async def main(): loop = asyncio.get_event_loop() print("starting gathering......

php - filter_var returns false with valid emails -

i made function takes emails csv , stores them in database, problem filter_var returning false. i have in loop $email = trim(str_replace('"', "", $row[0])); if(filter_var($email, filter_validate_email)){ //save }else{ echo "failed: -$email-".mb_detect_encoding($email)."<br/>"; } when executed, echos emails meaning it's failing, echoed emails valid, theres no spaces or quotes or anything, i've placed dashes before , after see if there any. failed: -email@gmail.com-ascii is failing because of aschii encoding?

Installing MySQL libmysqlclient-dev and UDF files on Mac OSX -

i trying install following package on mac in order test api on local environment far have not succeeded. https://github.com/spachev/mysql_udf_bundle i have tried various things such as: brew install libmysqlclient-dev this produced following error: error: no available formula name "libmysqlclient-dev" ==> searching named formulae... error: no named formulae found. ==> searching taps... error: no formulae found in taps. i used working on centos not particularly familiar likes of apt , brew ... can advise me on how best install on mac? not sure if of relevance running mac osx 10.11.4 (el capitan). i did not install mysql using brew install mysql , instead, followed instructions here: http://jason.pureconcepts.net/2015/10/install-apache-php-mysql-mac-os-x-el-capitan/ try installing mysql-connector-c: brew install mysql-connector-c

android - Geocoder returns multiple addresses -

in android's geocoder, method getfromlocation can return more 1 address given lat long . lat long uniquely represents location on earth surface, why return multiple objects? reverse geocoding translates latitude, longitude human-readable address. however, there different objects may interested in. example, can search nearest street address, nearest postal code, neighborhood, city, etc. reason reverse geocoder returns more 1 result. please @ example in geocoder tool . as can see first result has type street_address, second result has type bus_station, third has type neighborhood, , on until country level. hope answer addresses doubts.

php - Explain Why This Happens Please -

i'm watching tutorial on oop php, , i've come constructor/destructor segment. when instantiate object, goes through constructor, deconstructs it. here's code: <?php class person { var $first_name; var $last_name; function __construct($firstname, $lastname) { $this->first_name = $firstname; $this->last_name = $lastname; echo 'hi, name is: ' . $this->first_name . ' ' . $this->last_name . '!<br>'; } function __destruct() { echo "class objects being destroyed!<br>"; } } $person1 = new person('ringo', 'starr'); $person2 = new person('john', 'lennon'); ?> now when run code, echoes back: hi, name is: ringo starr! hi, name is: john lennon! class objects being destroyed! class objects being destroyed! but, logically, @ least in mind, shouldn't code echo: hi, name is: ringo starr! class objects ...

Image does not appear in html but it works in php -

i need display image database html page; wrote code displays image in php, can't output image on html. <?php class kep { function proba(){ $id=3; $db = new pdo("mysql:host=localhost;dbname=nyarigyak;charset=utf8", 'root', ''); $stmt = $db->prepare('select data, mime kepek kepek_id = ?'); $stmt->execute(array($id)); $stmt->bindcolumn(1, $data, pdo::param_lob); $stmt->bindcolumn(2, $mimetype, pdo::param_str); $ret = $stmt->fetch(pdo::fetch_bound); header('content-type: ' . $mimetype); header('content-length: ' . strlen($data)); return $data; } } ?> <?php $g = new kep(); echo $g->proba(); ?> this code works , displays image. if put html tag not work. how can make work? <?php class kep { function proba(){ $id=3; $db = new pdo("mysql:host=localhost;dbname=nyarigyak;charset=...

php - Hide option in a select box dependant on previous choices. Options generated from SQL -

i user able select people went hiking with. have used jscript allows user add more selection boxes depending on how many people on hike. names in selection box generated database query. i put in place stop same person being selected multiple times different selection boxes. example if option 1 in selected in first section box, should not available user in 2nd, 3rd, 4th.....selection box. the selection boxes generated using following code <table id="buddytable" class="form" border="1"> <tr> <td><input type="checkbox" required="required" name="chk[]" checked="checked" /></td> <td><label>buddy</label> <select name="buddy[]"> <option>solo</option> <?php if ($result->num_rows > 0) { // output data of each ...

java - Use web service in background of HTML -

i have web service , html page , want calculate 2 values , show on third text field code shows me on next page. 1 me fyp. my index.html <!doctype html> <html> <head> <title>to supply title</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <h1>jax-rs</h1> <form action="http://localhost:8080/connectingtonode/webapi/myresource?id" method="post" target="_self"> <p> number1 : <input type="text" name="number1" /> </p> <p> number2 : <input type="text" name="number2" /> </p> <p> number3 : <input type="text" name="number3" /> </p> <input type="submit" value="a...

javascript - Adding a div element to another part of the website when clicking a button -

i'm trying code jquery script adds functionality button. when click button (ex: settings), want add specific text (ex: settings), different div (the div predefined css rules), how google chrome tab works. $(document).ready(function() { var wbuttons = document.getelementbyid('#wrapper'); $(".buttonsettings").click(function() { var domelement = $('<span>settings</span>').appendto(wbuttons); $(this).after(domelement); }); }); the code works partially, won't append #wrapper , under .buttonsettings div. should mention have predefined number of tabs (max 6). thank you! if want append html string element, use jquery appendto() method this. $("button").click(function() { $("<span>span content</span>").appendto("#wrapper"); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <bu...

Python Pandas DataFrame: Split variable text column and then count -

i have column in database each cell having list of e-mail addresses separated commas. each cell has different numbers of e-mail addresses. trying figure out e-mail address common overall. i thinking combine these cells 1 cell, , split thm comma, , use counter function find used e-mail address. getting stuck @ first step. there way combine everything? in[0] import pandas pd in[1] data = pd.series(["abc@def.com,pqr@def.com", "abc@def.com", "abc@def.com,xyz@def.com,pqr@def.com"]) in[3]: data = pd.dataframe(data, columns=["emails"]) in[4]: pd.series(data.emails.str.split(',', expand=true).values.ravel()).mode().values[0] out[4]: 'abc@def.com'

php - Cant get JSON POST data using Slim v3 -

im using slim v3 . installed via composer. here register.php file : use \psr\http\message\serverrequestinterface request; use \psr\http\message\responseinterface response; require 'vendor/autoload.php'; $app = new \slim\app(['settings' => ['displayerrordetails' => true]]); //-------------- register ------------------ $app->post('/', function (request $request, response $response ,$args) use($app) { $json =$request->getparams(); $data = json_decode($json, true); $response->getbody()->write($data); return $response; }); $app->run(); when post sample json like {"name":"jack", "age":"10", "gender":"male"} via postman runtimeexception error could not write stream . use $app->request()->post(); , $request->getparams(); , $request->getparsedbody(); face other errors undefined method , on . please me. i think supposed use getbody() re...

2sxc - can not perform valueFIlter in visual query on boolean value -

here json data visual query returns no valuefilter: { "default": [ { "title": "demo image", "id": 2062, "description": "<p>wonderful description goes here</p>", "available": true, "image": "/portals/29/gallery/image-holder.jpg", "category": "landscapes" }, { "title": "second image", "id": 2179, "description": "<p>more info gallery item</p>", "available": true, "image": "/portals/29/adam/image gallery/d_1cnvc7ok2xknwelffzxw/image/northeastwomensvids.jpeg", "category": "landscapes" }, { "title": "krisis", "id": 2191, "description": "<p>super duper</p>", "available":...

ajax - jQuery math two float numbers -

i try math 2 float number , add them ajax query. didnt work. here code: // padejpremium_x 225.00 var amount = $("#padejpremium_2").val() / 100) * 2; // (225.00 / 100) * 2 = 4.5 var data = { dueamount0: $("#padejpremium_1").val() + 10.00, dueamount1: $("#padejpremium_2").val() + amount, dueamount2: $("#padejpremium_3").val() + amount, dueamount3: $("#padejpremium_4").val() + amount, i glad if give idea. in advance. you have missing ( in first line. check below code: var amount = ($("#padejpremium_2").val() / 100) * 2; // (225.00 / 100) * 2 = 4.5 var data = { dueamount0: $("#padejpremium_1").val() + 10.00, dueamount1: $("#padejpremium_2").val() + amount, dueamount2: $("#padejpremium_3").val() + amount } console.log(data); check demo here: jsfiddle (check in console)

reactjs - React-slick Slider stays on same page if slides items are changed -

i stuck issue react-slick. subject line may not make sense, try explain scenario in detail. see example fiddle see issue in action. var demoslider = react.createclass({ getslides(count) { var slides = []; for(var = 0; < count; i++) { slides.push((<img key={i} src='http://placekitten.com/g/400/200' />)); } return slides; }, render: function() { var settings = { dots: false, infinite: false, slidestoshow: 3, slidestoscroll: 3 } var slides = this.getslides(this.props.count); return ( <div classname='container'> <slider {...settings}> { slides } </slider> </div> ); } }); in demo, slider shows 20 slides (3 per page). idea if click button, generate random number, new number of slides. code simple , self-explanatory. to reproduce problem, 1. keep on clicking next arrow until reach last slide. 2. click on button says 'click' generate new random number of slides. my expectation slide g...

libcrypto - Can't start JXBrowser -

i reinstalled os due problem, copied old project , can't jxbrowser works correctly. i've got licence open source project. log says this 04:49:31 info: os name: linux 04:49:31 info: jre version: 1.8.0_91 64-bit 04:49:31 info: jxbrowser version: 6.4 04:49:31 info: jxbrowser type: heavyweight 04:49:31 info: starting ipc... 04:49:31 info: starting ipc server... 04:49:31 info: starting socket server 04:49:31 info: starting socket server @ port 1101... 04:49:31 info: starting ipc process... 04:49:31 info: starting chromium process... 04:49:31 info: '/lib/x86_64-linux-gnu/libudev.so.0' library exists: false 04:49:31 info: '/tmp/jxbrowser-chromium-49.0.2623.110.6.4/libudev.so.0' library exists: true 04:49:31 info: '/lib/x86_64-linux-gnu/libgcrypt.so.11' library exists: false 04:49:31 info: '/tmp/jxbrowser-chromium-49.0.2623.110.6.4/libgcrypt.so.11' library exists: true 04:49:31 info: '/lib/x86_64-linux-gnu/libcrypto.so.1.0.0' library exist...

c# - Render 16 bits image in picturebox -

i have array consists in pixeldata extracted dicom image. here's code: byte[] bytes = img.pixeldata.getframe(0).data; // img dicom image int count = bytes.length / 2; ushort[] words = new ushort[count]; (int = 0, p = 0; < count; i++, p += 2) { words[i] = bitconverter.touint16(bytes, p); } pixels16 = words.tolist(); //pixels16 contains pixeldata grayscale image now, here's question, how render picturebox?? well, don't know specifics, because depends on how want go (if performance important, need create own subclass of bitmap, otherwise, bitmap.setpixel work fine). but essentially, need shove pixels bitmap, set picture box's image bitmap, like: bitmap bitmap = new bitmap(width, height); for(int y = 0;y < height;y++) for(int x = 0;x < width;x++) bitmap.setpixel(x,y, color.fromrgb(/* unpack r,g,b channel of pixel here */); picturebox.image = bitmap;

Redirect to Another Page within Object Page - HTML CSS -

i have 2 pages. page1.html <object width="100%" height="550px" data="url"></object> page2.html <html> <body> other content <object width="100%" height="550px" data="page1.html"></object> other content </body> </html> on mobile devices, page1 redirects page3 . currently, when load page2, redirected page3 because having object / iframe redirecting page3. i need redirect within page2 like page2 should be other content <object data="redirected page3 because of mobile device"></object> other content redirection should not done on top level page. looking help. thanks.

opengl - How to have multiple storage layouts in one Vertex Array Object? -

when storage layout, mean define glvertexattribpointer . state saved in bound vao or buffer bound gl_array_buffer ? you can't have multiple "storage layouts" in 1 vao. same reason can't have multiple textures in 1 texture object. or multiple buffers in 1 buffer object. , on. vaos are "storage layout". if need more 1 layout, need more 1 vao. or can modify existing vao's state; they're not immutable. kinda defeats purpose of vao.

http - meaning of multiple values in cache-control header -

i've read single cache-control header value. test learned, opened facebook , inspect. cache-control response header get: cache-control:private, no-cache, no-store, must-revalidate i confused header tells, because contains 4 values @ once. happens resource send through network, if contains such header? edit: no-store says, "do not store @ all, not in private not public caches", , no-cache says "yeees can cache, make sure revalidate freshness when resource requested". private says "you can store in private caches". cant 3 @ same time. yet, here having them send in response @ same time. looks there additional rules not aware of. rfc 7234 reference precise meaning of headers. no-cache , no-store mean different things , cannot obeyed @ same time example. they absolutely can. directives redundant, not contradictory. no-cache : indicates cache must not use stored response satisfy request without successful validati...

Make any button on the page as a trigger for an asp.net UpdatePanel other than its sibling or child postback controls -

consider following code fragment: <div> <asp:button runat="server" id="trickyuptrigger" text="tricky update" /> <div> <asp:button runat="server" id="normaluptrigger" onclick="normaluptrigger_click" text="normal update" /> <asp:updatepanel runat="server"> <triggers> <asp:asyncpostbacktrigger controlid="normaluptrigger" /> </triggers> <contenttemplate> <asp:label runat="server" id="changeablelabel" text="change me"></asp:label> </contenttemplate> </asp:updatepanel> </div> </div> now make button with id of trickyuptrigger trigger of updatepanel. or, devise mechanism (probably... using javascript?) when button clicked updatepanel updates without full page postb...

c++ - How to fix error "clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)"? -

when compiling c++ program containing main.cpp, pattern.cpp, , pattern.h (a header file containing 2 function declarations no class; functions defined in pattern.cpp , main.cpp contains #include "pattern.h" @ top) typing: clang++ main.cpp error message was: /tmp/cc-nrpup0.o: in function `main': main.cpp:(.text+0x69): undefined reference `pattern(int, int)' collect2: ld returned 1 exit status clang: error: linker (via gcc) command failed exit code 1 (use -v see invocation) how fix this? tried typing -v clang output had terminated , invalid command it looks compiled main.cpp not pattern.cpp . when came time link executable together, functions defined in pattern.cpp won't found. undefined reference indicates main.cpp using pattern(int, int) somewhere. can see why becomes problem if pattern.cpp never compiled in. try compiling with: clang++ -wall -pedantic main.cpp pattern.cpp -o main

java - Trouble understanding Object State, Behavior, and Identity? -

i have been instructed professor introduce myself on page if object, , must address 3 things. object state, behavior, , identity. however, still confused how go doing this. (i have read 3 attributes must address, don't know how apply person). example, told dog have states, such name, color, , breed; behaviors, such walking, barking, or wagging tail. similar to: student me = new student(); system.out.println(me.getname()); //a state? system.out.println(me.getcurrentactivity()); //a behavior? (if return watching tv or something) system.out.println(me.get....()); //??? or getting wrong idea here? characteristics of objects are: state : what objects have , student have first name, last name, age, etc behavior : what objects do , student attend course "java beginners" identity : what makes them unique , student have student-id-number, or email unique. (this important when implementing equals method, determine if objects different or ...

Python CSV: One code but unfortunately two diffrent results -

i have problems following code. i'm trying read datas csv file create nested dictonary. when run first time intent when run twice changes order of output. have idea why hapening? i'm using python 3.4. import csv delimiter = ';' result = {} open("f:\\python projects\\database.csv", 'r') data_file: data = csv.reader(data_file, delimiter=delimiter) headers = next(data)[1:] row in data: temp_dict = {} name = row[0] values = [] x in row[1:]: values.append(x) in range(len(values)): temp_dict[headers[i]] = values[i] result[name] = temp_dict print(result) my input looks this: input_csv and result this: output column 1 shows diffrent order when run code twice. from the docs have helpful note: cpython implementation detail: keys , values listed in arbitrary order non-random, varies across python implementations, , depends on dictionary’s history of insertions , deletions. it turns o...

neo4j - How do I return the count of multiple relationship types with one query? -

i need stats node based on relationships. example, if had node "celebrity" 3 types of relationships: fan_of, friend_of, , relative_of how can number of fans, friends, , relatives 1 query? know how each relationship type individually, need return them in 1 query. if understand question is, should close: start n=node(*) match n-[r]->m return n, type(r), count(m) you restrict matching relationships types (though none of these exist in sample): start n=node(*) match n-[r:fan_of|friend_of|relative_of]->m return n, type(r), count(m) check out , play around here: http://console.neo4j.org/?id=nbba2s

javascript - how to include general JS in an html view of MEAN JS app -

i trying add classes html elements js events. everythings works fine if try opening page outside(the meanjs app). if keep view of meanjs module wont work. events not triggering @ all. js script inside view code itself. how solve prblm? even 'profiledesc' of $scope doesnt bind heading of second thumbnail. whats wrong thing on here? plz me.. <head> <link href='http://fonts.googleapis.com/css?family=raleway:400,800,300' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=josefin+sans' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="modules/core/client/css/set1.css" /> </head> <body class="cbp-spmenu-push" ng-controller="homecontroller"> <div class="container"> <!-- top navigation --> <h2 class="headin...

android - Eclipse IDE yellow warning icon on main activity -

apologies not explaining problem within original question. below can see image of source code warnings occurring. new this, , therefore unaware of how solve this. source code image thanks andrew this means there warnings issues in source file. edit file see warnings or in 'problems' view. the warning icon removed once fix warnings in code.

python http server, multiple simultaneous requests -

i have developed rather extensive http server written in python utilizing tornado. without setting special, server blocks on requests , can handle 1 @ time. requests access data (mysql/redis) , print out in json. these requests can take upwards of second @ worst case. problem request comes in takes long time (3s), easy request comes in after take 5ms handle. since first request going take 3s, second 1 doesn't start until first 1 done. second request takes >3s handled. how can make situation better? need second simple request begin executing regardless of other requests. i'm new python, , more experienced apache/php there no notion of 2 separate requests blocking each other. i've looked mod_python emulate php example, seems block well. can change tornado server functionality want? everywhere read, says tornado great @ handling multiple simultaneous requests. here demo code i'm working with. have sleep command i'm using test if concurrency works...

javascript - Jquery Tabs: Accessing non default tab with url -

i using jquery tabs create 3 tabs , following html code <div id="sections" class="sections"> <ul class="sections" role="tablist"> <li class="active" role="presentation"> <a href="#user" aria-controls="user" role="tab" data-toggle="tab">user</a> </li> <li role="presentation"> <a href="#setting" aria-controls="setting" role="tab" data-toggle="tab">setting</a> </li> <li role="presentation"> <a href="#customer" aria-controls="customer" role="tab" data-toggle="tab">customer</a> </li> </ul> <div class="tab-content"> <section id="user" class="panel...

python - Using Numpy from keyword.py -

i want use numpy in python script uses pandas process excel file. however, 1 of constraints file must named keyword.py , causes import error. import error traced line from keyword import iskeyword _iskeyword in c:\python27\lib\collections.py , assume causes error because own keyword.py overriding default keyword module. there way avoid collision? not pretty, keyword.py of if true: import imp, sys keyword_loc = imp.find_module("keyword", sys.path[1:])[1] imp.load_source("keyword", keyword_loc) import collections print(collections.counter) fails attributeerror if replace true false , gives me (2.7) dsm@notebook:~/coding/kw$ python keyword.py <class 'collections.counter'> as is. works finding out original keyword library , manually importing it. after this, following attempts import keyword see it's there.

windows - How do I change my TFS identity? -

Image
when first getting set in tfs, company misspelled username. since changed correct spelling, change apparently not reflected in tfs. when try check in changes, error: is there way can change tfs identity 1 correct spelling can check stuff in machine? our tfs administrator has looked @ , isn't sure how fix it. i using visual studio 2012. edit: have tried removing , re-mapping workspace, no luck. also, can check in files in visual studio 2010, gives me error in visual studio 2012. fellow employee fixed it. here's did: removed workspaces, deleted files, cleared credential manager, disconnected tfs, deleted tfs connection, closed vs, opened vs, created new connection tfs, re-downloaded files.

r - How do I rename the columns in a list of multi- series zoo objects? -

my r learning curve has got best of me today. so.. have list of multi series zoo objects. i'm trying rename columns in each same values. i'm attempting in last line... , runs without error... names aren't changed. ideas great. require("zoo") monthly data of stocks. symbs = c('aapl', 'hov', 'nvda') importdata <- lapply(symbs, function(symb) get.hist.quote(instrument= symb, start = "2000-01-01", end = "2013-07-15", quote="adjclose", provider = "yahoo", origin="1970-01-01", compression = "m", retclass="zoo")) names(importdata) <- symbs #calculate monthly pct chgs of stocks. monthlypctchgs = lapply(importdata, function(x) diff(x, lag = 1) / lag(x, k = -1)) names(monthlypctchgs) <- symbs #merge pct chgs , monthly closing prices pricingandperfsmerged = mapply(merge, importdata, lag(monthlypctchgs, k = -1), simplify = false) #rename colum...

c++ - System exception handling on different platforms -

basically, how catch exceptions on mac/linux? is, exceptions, not intrinsic language, segfaults & integer division. compiling on msvc, __try __except perfect because stack handling allows catch exceptions , continue execution lower down stack. now, extend program other platforms (mainly ones mentioned), have no idea how exception handling works on these platforms work. far understand, it's handled through posix signals? , of such, wont allow handle exception , continue lower down stack? edit: valid (pseudo code)? see it, leave c++ blocks correctly , dont indulge myself in ub. jmp_buf buffer; template< typename func > protected_code(func f) { if(!setjmp(buffer) { f(); } else { throw std::exception("exception happened in f()"): } } void sig_handler() { longjmp(buffer); } int main() { sigaction(sig_handler); try { protected_code( [&] ...

swift - How to conform to protocol using subclass -

say have protocol protocol a: class { func configure(view: uiview) } now want conform protocol, using uilabel subclass of uiview final class b: { init() {} func configure(view: uilabel) { } } but errors type b not conform protocol a it seems swift needs same type stated in protocol. works final class b: { init() {} func configure(view: uiview) { } } but want use uilabel , how work around this? you use associatedtype constrained of type uiview . protocol a: class { associatedtype view: uiview func configure(view: view) } now in class b , since uilabel subclass of uiview , it's fine do: final class b: { init() {} func configure(view: uilabel) { ... } }

php - Get info using table Joins with 2 MySQL tables and DISTINCT -

i have 2 tables: 'bidders' , 'solditems' tables. the solditems table has 2 columns need use: buyerid , paidstatus . in bidders table, want info columns: bidnum , bidfname , bidlname , bidphnum . (the 'buyerid' values in sold items corresponds 'bidnum' in bidders) i'm trying unique buyer numbers solditems table paidstatus marked unpaid , , buyers' info (fname, lname, , phnum) bidders table. this have right now: select distinct(i.buyerid), b.bidfname, b.bidlname, b.bidphnum 'solditems' inner join 'bidders' b on i.buyerid = b.bidnum i.paidstatus='unpaid' order i.buyerid asc if use in phpmyadmin sql section test it, error says: 1064 - have error in sql syntax; check manual corresponds mariadb server version right syntax use near ''solditems' inner join 'bidders' b on i.buyerid = b.bidnum i.paids' @ line 1 i've never done joins before can't...

python - How to call a specific attribute from views? -

i have application tests if value greater attribute configurationform . if true, sends email e_mail attribute of configuration form. these views , form files. don't know how call attribute? views.py from django.shortcuts import render, render_to_response choix.forms import configurationform django.http import httpresponse, httpresponseredirect django.core.urlresolvers import reverse choix.models import configuration django import forms rasp import foo django.core.mail import send_mail, badheadererror def index(request): x = configuration.objects.temperature() = configuration.objects.e_mail() l = foo() subject = request.post.get('subject', 'subject') message = request.post.get('message', 'attention ! la temperature depasse le maximum ') from_email = request.post.get('from_email', '**********@gmail.com') in range(len(l)): if l[i] > 14: if subject , message , from_email: ...

r - Dynamically add and remove uiOutput elements based on index using actionButtons -

Image
i'm trying add , remove uioutput elements using index keep track of each individual element. there actionbutton adding , element list, , x button each element removes selected item, in image below: i'm using single .rmd file includes both ui , server code. current solution (with cannot produce desired functionality shown above---it nothing) following: actionbutton("addfilter", "add filter", icon=icon("plus", class=null, lib="font-awesome")) <- 0 observeevent(input$addfilter, { <<- + 1 uioutput(paste("filterpage",i,sep="")) output[[paste("filterpage",i,sep="")]] = renderui({ fluidpage( fluidrow( column(6, selectinput(paste("filteringfactor",i,sep=""), "choose factor filter by:", choices=c("factor a", "factor b", "factor c"), selected="factor b", ...

python - Read from two serial ports asynchronously -

i'd read 2 (or more) serial ports (/dev/ttyusb0 etc) @ same time in python on linux. want read complete lines each port (whichever has data) , process results in order received (without race conditions). simple example write lines single merged file. i assume way based on pyserial, can't quite figure out how it. pyserial has non-blocking reads using asyncio , using threads . asyncio marked experimental. assume there wouldn't race conditions if processing done in asyncio.protocol.data_received() . in case of threads, processing have protected mutex. perhaps can done not in pyserial. 2 serial ports can opened files , read when data available using select() . you try take values in order , memorise in variables: a = data1.read () b = data2.read () and after process in order: if len (a) != 0 or len (b ) != 0: process process b using method if 1 or both of value has data, process it

c# - Properties.Resources.Image not working with ImageList -

i working on game dice , when clicked, change color keep same number. i using imagelists (as requirement) , using red , blue die. setup using bitmaps. i'm not sure how images versus bitmaps work, saw suggestion use bitmaps took it. private bitmap reddie1 = properties.resources.die1; private bitmap bluedie1 = properties.resources.die1s; private bitmap reddie2 = properties.resources.die2; private bitmap bluedie2 = properties.resources.die2s; private bitmap reddie3 = properties.resources.die3; private bitmap bluedie3 = properties.resources.die3s; private bitmap reddie4 = properties.resources.die4; private bitmap bluedie4 = properties.resources.die4s; private bitmap reddie5 = properties.resources.die5; private bitmap bluedie5 = properties.resources.die5s; private bitmap reddie6 = properties.resources.die6; private bitmap bluedie6 = properties.resources.die6s; i setup imagelists (reddieimages, bluedieimages) want use adding variable...

c - How to compile a dll which needs other dlls -

i'm trying cross compile piece of software i'm doing. i'm on linux , i'm having pretty hard time trying write makefile compiling dll library using sdl2. here it: #the compiler cc = i686-w64-mingw32-gcc #the standart ompilation flags of project cflags = -o3 -wall -wno-unused-variable -wno-unused-but-set-variable -wno-implicit-function-declaration #path folder's root, holy not build framework is. relate makefile prepath = .. #path sdl, sdl_image , lua includes , libs sdl2includes = -i $(prepath)/sdl2/include sdl2libs = $(prepath)/binaries/4windows/sdl2/64/sdl2.dll sdlimage2includes = -i $(prepath)/sdl2/sdl_image sdlimage2libs = $(prepath)/binaries/4windows/sdl2_image/64/sdl2_image.dll $(prepath)/binaries/4windows/sdl2_image/64/libjpeg-9.dll $(prepath)/binaries/4windows/sdl2_image/64/libpng16-16.dll $(prepath)/binaries/4windows/sdl2_image/64/libtiff-5.dll $(prepath)/binaries/4windows/sdl2_image/64/libwebp-4.dll $(prepath)/binaries/4windows/sdl2_image/64/zlib1....

java - Difference between class declaration -

what's difference between declaring class inside of class , declaring class in separate file?. literally, nested classes added java 2 reasons: 1. source code clarity. 2. name-conflict reduction. java didn't need support doing this, totally doing programmers "solid" because i'm sure know how messy code can when you're in moment of all. to answer question, explicitly: difference there not difference, makes code easier read , end less name-conflict mistakes.

javascript - AWS S3 browser upload: Invalid Policy Invalid JSON error -

i want upload file s3 machine directly browser, bypassing sending server. i've read relevant post amazon here , , full javascript example posted answer here . when attempt javascript solution receive following error: <?xml version="1.0" encoding="utf-8"?> <error> <code>invalidpolicydocument</code> <message>invalid policy: invalid json.</message> <requestid>2f09c5449f42e3af</requestid> <hostid>m++sn+v5bjffkg0qa5cedves5bbsvjfhcxanlyf2ay11llld3eea54ct7rpg0cjhkla0itrnpgg=</hostid> </error> on server side generate policy , sign using s3policy package edit: included signed policy example below: var policy = {s3policybase64: "eyjlehbpcmf0aw9uijoimjaxni00ms0yovqxoji0oji4wiisim…swyjzdgfydhmtd2l0acisiirdb250zw50lvr5cguilciixv19", s3signature: "jlz6uddwvhhoeiu5urdttqupko0=", s3key: "akiaj6lfzzby24mbq4ga"} here code i'm using in browser generate form , submit p...