Posts

Showing posts from June, 2015

visual studio 2010 - Encoding problems during INSERT with Sqlite3 C++ and VisualStudio2010 -

Image
i'm developing small wrapper project using sqlite3 c++ api , visualstudio 2010. far goes , checking tool sqlitedatabasebrowser, main problem information try insert in table appears corrupted / doesn't appear @ all. table appears correctly created utf8 encoding. i tried using character set configuration values in vs "use multy-byte character set" , tried "use unicode character set" got no change in result. both gave me same problem corrupted data. use typical std::strings converted legacy c char* , i've seen in several examples should work sqlite3_bind_text(...) functions api provides. sqlite3_bind_int(stmt, 1, newshop.getid()); sqlite3_bind_text(stmt, 2, newshop.getname().c_str(), -1, sqlite_static); sqlite3_bind_text(stmt, 3, newshop.getlocation().c_str(), -1, sqlite_static); sqlite3_bind_text(stmt, 4, newshop.getpicturepath().c_str(), -1, sqlite_static); sqlite3_bind_text(stmt, 5, newshop.getregisters().c_str(), -1, sqlite_s

java - Displaying an image onto a JPanel? -

i have searched on google, looked @ documentation on oracle's webpage, read chapter graphics in java can't seem figure out please help! want button uploads image onto jlabel located in jpanel located in jframe. nothing more that! why isn't code working? happens when execute program absolutely nothing. nothing gets appended log , there aren't errors... nothing happens, i've been programming java quite time never worked graphics can't solve problem myself... jlabel imagelabel = new jlabel(); private void uploadbuttonactionperformed(java.awt.event.actionevent evt) { jfilechooser filechooser = new jfilechooser(); filechooser.setcurrentdirectory(new java.io.file("c:\\")); filechooser.setdialogtitle("choose file"); filechooser.setfileselectionmode(jfilechooser.files_only); if (filechooser.showopendialog(this) == jfilechooser.approve_option) { system.out.println("ge

Android Studio project flavors resources -

this question has answer here: file:///android_res/drawable not working when using flavor other package name 2 answers i created project flavors right, , android studio installs 2 different applications device, that's ok. however, trying add image drawable in html <img src="file:///android_res/drawable/test.png" > and not anymore work in flavors. in original project without flavors, worked. is there must resources included in project flavors well? this might caused different factor adding flavours. on version of android run code? there has been changes webview starting kitkat (4.4), , seems not accept local assets/res anymore. please @ logs , search this: chromium﹕ [info:console(0)] "not allowed load local resource: file:///android_res/drawable/test.png", source: data:text/html, (0) ticket aosp tracker: https

export - How can I backup unused Evernote tags? -

i use gtd-based system in evernote, in each project has tag. of projects inactive, , have no 'next action' - i.e tag has no notes attached. accidentally clicked delete unused account tags last night, , none of backups have lost data; sad bunny. how can backup these unused tags in future? i'd prefer enex, happy e.g. plain-text list of names. i using evernote's 'export' menu-option, - turns out - exports notes , tags, not unused tags. i've tried enscript.exe ( enscript exportnotes /q any: ) , same: notes & tags, no other tags. thing left me try installing sdk , 'rolling own' call notestore.listtags - can't work, given previous 2 results. is there way export unused tags evernote? can api it? yes, can, through api. use listtags method tags in evernote account, list tags "attached" note , tags not "attached" note. can compare notes "attached" notes calling listtagsbynotebook on every notebook (

how can i extract the content of an ISO-8601 with regex and convert the time into numeric in this case using java -

this text : <meta itemprop="duration" content="pt4m32.80000000000001s"> i want extract pt4m32.80000000000001s , convert numeric. had tried integer.parseint() gives me numberformatexception. please. it depends on number want extract, , if context fixed. say, have pt4m before double value of 32.80000000000001 want extract. here sample program : import java.util.regex.*; public class helloworld{ public static void main(string []args){ string str = "pt4m32.80000000000001s"; pattern ptrn = pattern.compile("(?<=pt4m)[\\d.]+"); matcher matcher = ptrn.matcher(str); if (matcher.find()) { system.out.println(matcher.group(0)); double fl = double.parsedouble(matcher.group(0)); system.out.println(fl); } } } output: 32.80000000000001

How to delete child node from xml using php -

$xpath = new domxpath($xml); foreach($xpath->query("/root/info[name = '$c_name']") $node) { $node->parentnode->removechild($node); } am getting error when executing code on localhost. warning: domxpath::query(): invalid expression i guess there error in foreach loop. your code misses error handling , way create xpath expression prone injection can break it. $xpath = new domxpath($xml); $expression = "/root/info[name = '$c_name']"; $result = $xpath->query($expression); if (false === $result) { throw new invalidargumentexception( sprintf( 'xpath expression %s failed input %s' , var_export($expression, true) , var_export($c_name, true) ) ); } foreach($result $node) { $node->parentnode->removechild($node); } this example not yet handle injection issue introduces proper error handling realize possible error occurs. if analyze fur

google app engine - Is GAE Supports EHCache's Write-Behind Operation? -

i trying create web application uses ehcache store , retrieve data. me, following configuration working fine me. <?xml version="1.0" encoding="utf-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="ehcache.xsd" > <cachemanagereventlistenerfactory class="" properties=""/> <defaultcache maxelementsinmemory="10000" eternal="false" timetoidleseconds="120" timetoliveseconds="120" memorystoreevictionpolicy="lru"> <!-- <persistence strategy="none"/> --> </defaultcache> <cache name="st" maxelementsinmemory="10000" eternal="false" timetoidleseconds="300" timetoliveseconds="600" memorystoreevictionpolicy="lru"

java - Login Validation Using Angular Js and JSP -

Image
i making angular js - jsp application, have created login page, have created servlet fetching database , comparing username , password. created login form , passed values angular controller on login form submit. need access servlet compares login how pass information servlet ? have created factory that, have use post method passing datas. i pasting code til have done. html <div class="container"> <form name="myform" novalidate class="col-md-4 col-md-offset-4"> <h2>{{login.username}}</h2> <div class="form-group"> <input type="email" ng-model="login.username" required class="form-control input-lg" placeholder="email"> </div> <div class="form-group"> <input type="password" required ng-model="login.password" class="form-control i

c++ - Error In string comparsion, Bad Excess c -

i'm trying read file , determine type of calculation perform. read in type string. later use else if (euc.compare(type) == 0) compare it. doesn't work. here code: ifstream infile; infile.open(filename.c_str()); // first readin file calcuate on // define needed parameters string word1, word2, word3; string outtype; string type = "tbd"; string euc = "euc_2d"; // want know dimension have int givendimension; int dimen = 0; cout<<endl<<endl; cout<<"this "<<filename<<endl; cout<<"the information given is:"<<endl; // read file , determine dimension , type while(infile >> word1) { //cout<<word1<<endl; if (word1 == "dimension") { infile>> word2 >> givendimension; dimen = givendimension; // dimensional obtianed } if (word1 == "dimension:") { infile>>givendimension; dimen = givendimension; //

java - How to get previous page URL from request using a servlet -

how previous page url request using servlet. example, i'm index.html , submitted form index, how index.html url , use in servlet? request.getrequesturl() getrequesturl doesn't work since returns url of servlet. write in servlet following code string url = request.getheader("referer"); this worked in case.hope works well

Jmeter Webdriver sampler -

jmeter has webdriver sampler. have write scripts. have scripts written in opkey, selenium based tool. can integrate both of them. don't have write scripts in jmeter. not familiar opkey, selenium bad idea load tests beyond trivial loads: selenium never intended large-scale performance testing. selenium , newer avatar webdriver, launch browser engine per user , replay user interactions inside it. great functional testing because executing client side code inside real browser engine - @ same time bad news performance testing. browser instances resource intensive, , scaling becomes hard , expensive. even using selenium grid meant cutting test execution time running in parallel, not generating sort of loads. @ top of their faq . it not scale, when load driver resource intensive, applied load becomes inconsistent. if see drop in performance, load driver bottleneck , not application under test. having said that, can use jmeter sampler, or se grid, or else drive pe

java - How to give a child class a modified inherited method? -

i'm facing trouble finding best oop design solution following problem: have parent abstract class classifier includes abstract method classify(instances dataset) . 2 classes extends classifier , namely normalclassifier , thresholdclassifier . both children classes implements classify(instances dataset) method. however, thresholdclassifier requires classify(instances dataset) method of form classify(instances dataset, double threshold) , can't never work classify(instances dataset) . note thresholdclassifier can't accept threshold parameter in constructor , must have parameters in classify method. in case child class thresholdclassifier share same characteristic parent requires different method signature. i'm not able extend parent class because require me implement original method signature nor makes sense not extend parent class because it's classifier . how 1 solve such design problem in java oop? there technical term issue? edit 1: what did

Using the Twitter REST API to get tweets within a bounding box -

i'm trying use twitter api tweets within bounding box. currently, i've managed streaming api, tweets flow in rather slow looking use past tweets. i can't seem find way rest api. seems allow 'locations', how when query may fall on several locations or in partial locations? ideally, i'd able gather tweets in exact same area using rest api did using streaming api.

html - Quotes issue in Javascript -

i want refresh img element within div every 5 seconds indicate whether user connected internet or not connected. if user connected, display image online, if user offline, local image display. however, cannot around quote problem. tried "&-quot;" thing (without dash) , still not work. here code: <script type="text/javascript"> window.setinterval("refreshdiv()", 5000); function refreshdiv(){ document.getelementbyid("test").innerhtml = "<img id="this" src="http://stallionware.weebly.com/uploads/3/0/4/3/30431988/4901948_orig.png" onerror="this.src='nowifi.png'">"; } </script> <div id=wifi> <img id="this" src="http://stallionware.weebly.com/uploads/3/0/4/3/30431988/4901948_orig.png" onerror="this.src='nowifi.png'"> </div> i not have desire use jquery or ajax or server-side languages because on local machin

javascript - how to limit access to strings i save in cookies? -

if website writes string cookies using document.cookie website able read strings or 1 created it? if can read there way limit access string? question in javascript. edit: have no problem if third party reads cookie shouldn't able edit/delete it. can hacker that? from within browser, cookie created on a.com available other pages on a.com . cannot accessed pages in other domains. specific design principle of cookies. when create cookie, can separately control whether cookie has path restrictions (it can accessed pages on a.com). you can control whether sub-domain can access cookie or not such sub.a.com. see this answer details on sub-domain access. likewise, cookie sent server a.com, not other servers. but, if not using https, should aware cookie being transmitted in plain text on network each time make request of a.com. cookie data stored browser on user's local hard drive coookie may accessed outside of browser (by local application, not within brow

Notepad++ FTP Download Folder -

i working on project using simple text editor , download entire folder of particular part of project. have looked around , see download individual files not entire folder. how can achieve on notepadd++? need particular plugin? there way long know ftp name&pass other notepad++'s ftp plugin? thanks @steve klein's suggestion use winscp, download folder without issues, downloaded inner folder structure well. else interested in using manage remote , local files here download url: http://winscp.net/eng/download.php ui similar notepad++'s ftp plugin , has lot more management tools files.

java - overriding finalize(), referencing object inside it -

what happens if override finalize() , give reference object. object ever garbage collected? other way clean object memory? from javadoc : the finalize method may take action, including making object available again other threads. however: the finalize method never invoked more once java virtual machine given object.

java - I get an extra input space when I run my code -

i run code put in integer, press enter, input space. in input space put in number input space want says "write line". adds numbers put in first input space , input space. please help. (p.s sorry code's format) my output: write integer (put input here) (put input here) write integer (put input here) i don't want 2nd input option. public static void main(string eth[]){ system.out.println("write integer"); scanner input = new scanner(system.in); if (input.hasnextint()){ } else system.out.println("play rules"); scanner input1 = new scanner(system.in); int = input1.nextint(); { system.out.println("write integer"); scanner input2 = new scanner(system.in); int b = input2.nextint(); int answer = (a+b); system.out.println(answer); } } } the space you're getting logical error in first if statement. if input.hasnextint() true, skip on else call scanner directly below because not grouped else stateme

c# - How to search for word in a string (just the word)? -

i want search string word. however, don't want result if word searched inside other word. is i want return number 7 (index of letter f): findword("potato you", "for") but want return -1 (i.e., not found) findword("potato you", "or") if use indexof , find substring "or" inside word "for". is there simple way this? char[] terminationcharacters = new char[] { '\n', '\t', ' ', '\r' }; //get array each word taken consideration string[] words= s.split(terminationcharacters, stringsplitoptions.removeemptyentries); int indexofwordinarray = array.indexof(words, wordtofind); int indexofwordins = 0; (int = 0; <= indexofwordinarray; i++) { indexofwordins += words[i].length; } return indexofwordins; but may not work if there multiple spaces between words. there pre-built way apparently simple thing, or should use regex ? you can use regular expression: var matc

mysql - PHP PDO statement using constants -

so have different file called config.php declares constants using. included config.php in php script coding: my php script: <?php session_start(); //connection config include 'config.php'; $con = new pdo('mysql:host="'. db_host .'";dbname="'. db_name .'"', db_user,db_password); ?> in config.php: <?php define('db_host','localhost'); define('db_name','theclass'); //name of database define('db_user','root'); //mysql user define('db_password',''); //mysql password ?> however, wamp throwing error on $con = new pdo line giving me fatal error. parameter's used in pdo statement correct in terms of format, because i'm not sure if need quotations around db variables.

ios - headerview from previous view takes up space in UISearchController search results -

i have simple tableview, dailyattendancecontroller, searchbar. searchbar added in viewdidload. view tableview here. import uikit class oldcellstableviewcontroller: uitableviewcontroller { let data = ["a", "b", "c"] var searchcontroller:uisearchcontroller! let resultscontroller = searchresultsupdater() override func viewdidload() { super.viewdidload() resultscontroller.data = data searchcontroller = uisearchcontroller(searchresultscontroller: resultscontroller) let searchbar = self.searchcontroller.searchbar searchbar.scopebuttontitles = ["all", "short", "long"] searchbar.placeholder = "search student" searchbar.sizetofit() self.tableview.tableheaderview = searchbar self.searchcontroller.searchresultsupdater = resultscontroller } // mark: - table view data source override func tableview(tableview: uitable

raspberry pi - Another RPi idiot who can't understand cron -

me big dum nooby, no grok cron, pleez fix brain. from pi home directory, type: crontab -e and @ bottom of file add line: */5 * * * * date "+(0 6) %h:%m %z" >> /home/pi/scripts/scripts.log according instructions i've read elsewhere while thrashing on web; take mean every 5 minutes system date printed scripts.log. did add blank line after this, saved , exited nano, , got message "crontab: installing new crontab". i waited, , nothing happened. went raspi-config , set time zone, , rebooted, though shouldn't matter since it's supposed run every 5 minutes, not @ specific time. yes, created scripts directory... after third try... still nothing. no output @ command line, nothing in scripts directory, no error messages. sorry rehash what's been covered before, threads i've read in context of specific project, , don't know enough yet separate out info i'm looking for. want something, anything, work using cron, i'll

twitter bootstrap 3 - Flask/jinja, adding radio buttons to a selectpicker -

Image
apologies in advance if hack formatting, let alone show off massive hole in understanding of things. anywho, scoured stackoverflow , managed cobble dropdown dynamically fills mongo, , faithfully passes user selection make mongo call populates motionchart. all's well. now hoping slip in few radio buttons pass along single choice secondary dimension (first dimension dropdown). no worries, right? ha! not much... i've not been able find single example of mixed inputs/actions (get , post) in single form/input group, while i've tried best intelligently tinker, don't think know enough yet know. many in advance! looking forward learning how needs wired function properly... here's app call: @frontend.route('/orgs_by_ic_motion', methods=['get', 'post']) @login_required def orgs_by_ic_motion(): button = "$org_name" if request.method == 'post': if request.form['submit'] == 'act'

sql - formula for computed column based on different table's column -

consider table: c_const code | nvalue -------------- 1 | 10000 2 | 20000 and table t_anytable rec_id | s_id | n_code --------------------- 2 | x | 1 the goal have s_id computed column, based on formula: rec_id*(select nvalue c_const code=ncode) this produces error: subqueries not allowed in context. scalar expressions allowed. how can calculate value computed column using table's column input? you create user-defined function this: create function dbo.getvalue(int @ncode, int @recid) returns int select @recid * nvalue c_const code = @ncode and use define computed column: alter table dbo.yourtable add newcolumnname dbo.getvalue(ncodevalue, recidvalue)

matlab - setting variables with vpa in loops -

i trying set variable vpa (variable-precision arithmetic). if try a=vpa(tanh(1)) then a=0.76159415595576485102924380043987 desired. try in loop: a=[]; i=1:3 a(i)=vpa(tanh(1)); end however, when output a(1) , value 0.761594155955765 . why don't last digits did in first case? there 2 problems code. first, if run class(a) after for loop you'll see a 'double' rather 'sym' . reason because allocated a empty double precision array: a = []; . each time insert symbolic variable precision values this, cast same class a . to build symbolic array, need allocate such: a = sym([]); = 1:3 a(i) = vpa(tanh(1)); end class(a) even better, specify final size: n = 3; = sym(zeros(n,1)); % or = zeros(n,1,'sym'); = 1:n a(i) = vpa(tanh(1)); end class(a) in case, both of above options equivalent following because you're applying vpa last operation on each element: n = 3; = zeros(n,1); = 1:n a(i) = tanh(1); end = vpa(

javascript - Modal window only pulling information from first record in a PHP for each loop -

i have page foreach loop shows data set of parks. foreach loop runs fine. within loop have button push modal window show additional information on park. button knows in loop (i've labeled variable test) when modal window opens brings information first record. foreach ($showresult $display) { $display_result[] = array ('parkid' =>$display['parkid'], 'trailsys' =>$display['trailsys'], 'state' =>$display['state'], 'trailset' =>$display['trailset'], 'name' =>$display['name'], 'description' =>$display['description'], 'url' =>$display['url'], 'ldes' =>$display['ldes'],

c++11 - C++ Monte Carlo portfolio Pricer -

i'm developing portfolio option pricer using monte carlo, have encountered problem. program compiles , runs. have out of range vector when program has compute portfolio price. do? have attached portfolio.cpp , monte carlo.cpp . portfolio.cpp: #include "portfolio.h" #include <iostream> #include <numeric> portfolio::portfolio(const vector<vanillaoption>& option_){ numberofoptions = option_.size(); (unsigned int = 0; < getnumberofoptions(); ++i) { theoption.push_back(option_[i].clone()); } } shared_ptr<portfolio> portfolio::clone() const { return shared_ptr<portfolio>(new portfolio(*this)); } void portfolio::setoptionprice(const double& price) { optionprice.push_back(price); } double portfolio::getoptionprice(const unsigned int& index)const { return optionprice[index]; } double portfolio::getnumberofoptions()const { return theoption.size(); } double portfolio::getpayoff(const unsig

swift - Unable to Update User: UserCannotBeAlteredWithoutSessionError -

greetings parse neophyte: task: update current user's attributes (in parse's user table). problem: received 'usercannotbealteredwithoutsessionerror' error. here's code: func updateparseuser(newuser:user, sender:uiviewcontroller) { let currentuser = pfuser.currentuser() if ((currentuser) == nil) { return } if let location = newuser.location { currentuser["location"] = location } if let phone = newuser.phonenumber { currentuser["phone"] = phone } currentuser["displayname"] = "turkey" pfuser.currentuser().save() } result: error: parse::usercannotbealteredwithoutsessionerror (code: 206, version: 1.5.0) need create session or something? remedy? update sdk. had exact same issue. when updated 1.6.0 issue resolved itself.

jfilechooser - Create a .zip file in Java with images -

i'm creating java program gets images jfilechooser , create .zip file containing selected images. files code: final jfilechooser fc = new jfilechooser(); fc.setmultiselectionenabled(true); fc.setfilefilter(new filenameextensionfilter("image files", "bmp", "png", "jpg")); fc.setacceptallfilefilterused(false); fc.showopendialog(null); file files[] = fc.getselectedfiles(); how create .zip file containing files of files[] array? thank :d. file somefile = new file("somefile.zip"); file files[] = fc.getselectedfiles(); bufferedoutputstream bos = new bufferedoutputstream(new fileoutputstream(somefile)); // create zip file first try (zipoutputstream out = new zipoutputstream(bos)) { // write files/copy archive (file file : files) { // put new zip entry output stream every file out.putnextentry(new zipentry(file.getname())); files.copy(file.topath(), out); ou

ios - UITableViewCell - Update tableview layout -

i have tableviewcell, on tap, grows in size, height wise, updating frame. the problem is, cells below don't adjust, move down make visible underneath, , select row events still based on old sizes, before tap. using facebook pop - handling animation, tableview.beginupdates() out of question, maybe? you cannot manually update frame of uitableviewcell changing frame or bounds. instead, need change value returned -tableview:heightforrowatindexpath: indexpath , perform: [self.tableview beginupdates]; [self.tableview endupdates]; this cause tableview recalculate heights of rows.

devise - i am having problems redirecting after a method call in Rails -

i have got custom def methods working , updating table in database know having issues redirecting accounts index page. go update.html.erb page. source of issue mayb in routes and/or authenication issue cancancan/devise ? maybe before_filter :authenticate_user! when change redirect_to accounts_url, this, render and/or redirect called multiple times in action. please note may call render or redirect, , @ once per action. note neither redirect nor render terminate execution of action, if want exit action after redirecting, need "redirect_to(...) , return". my controller , declarations @ top , update method class accountscontroller < applicationcontroller before_action :set_account, only: [:show, :edit, :deposit, :withdrawl,:update, :destroy] # before_filter :set_account, only: [:show, :edit, :deposit, :withdrawl, :update, :destroy] before_filter :authenticate_user! respond_to :js, :html #respond_to :html def update @account = account.find(param

about calculating row and columns in r -

i want ask how calculate mean value specific rows , columns? example, dataframe this: df: precip tmax tmin wind date year month day 1.75 18.38 6.29 2.06 1952-05-26 1952 5 26 2.12 14.45 1.97 3.50 1952-05-27 1952 5 27 0.00 18.98 1.95 2.82 1952-05-28 1952 5 28 0.00 24.22 5.19 4.12 1952-05-29 1952 5 29 2.00 21.66 6.41 1.90 1952-05-30 1952 5 30 35.38 18.79 5.34 3.13 1952-05-31 1952 5 31 0.62 22.64 6.79 3.50 1952-06-01 1952 6 1 2.30 24.58 9.98 2.07 1952-06-02 1952 6 2 (1)how calculate mean tmax specific month, such in may? dataset 1950 until 2000. used code: df_jul = apply(df[,'month'==5],2,mean,na.rm=t) but result is: numeric(0) if in way: df_jul.entry = which(df[,7]==5) df.tmax = apply(df[c(df_jul.entry),2],2,mean,na.rm=t) it throws error: dim(x) must have positive length can't check out problem. (2) how calculate yearly precip? say, add precip each year. help

c# - Binding SelectedValue through converter not matching anything in ItemsSource -

i've got combobox looks following, selectedvalue bound int , itemssource bound collection of string s: <combobox selectedvalue="{binding value, converter={staticresource priorityint2stringconverter}}" itemssource="{binding path=stringtointdictionary.keys, source={x:static helpers:helperclass.instance}}"/> the priorityint2stringconverter converter looks this: public class priorityinttostringconverter : ivalueconverter { private static readonly helperclass helper = helperclass.instance; public object convert(object value, type targettype, object parameter, cultureinfo culture) { if (value int) { int priority = (int)value; string prioritystr; if (helper.inttostringdictionary.trygetvalue(priority, out prioritystr)) { value = prioritystr; } } return value; } public object convertback(object value, type targettype,

concatenation - How do I make a self repeating formula in Google sheets that -

how make self repeating formula in google sheets concatenates content of 4 cells 1? one: =arrayformula( concatenate( d3:h3 & ", " )) works when copied manually, need repeat automatically when new line added? the concatenate formula doesn't work in array formula, easiest way use & operator instead. =arrayformula( d2:d & e2:e & f2:f & g2:g & h2:h & ", " ) this join whatever in columns d, e, f, g , h; row 2 end of sheet.

How to work with JPEG-LS in Java -

is there example how work jpeg-ls in java? library? i have heard might work: http://www.oracle.com/technetwork/java/current-142188.html however, there extremely little support jpeg-ls. orphan format.

python - Custom coloration for matrix in matplotlib -

Image
i have 3 matrices i'd plot, solution i've come plotting 1 after other, , leaves me last matrix plotted. ax.imshow(mat1, cmap='blues', interpolation='nearest') ax.imshow(mat2, cmap='binary', interpolation='nearest') ax.imshow(mat3, cmap='autumn', interpolation='nearest') # actual plot what want display 0s in 3 matrices in white, , higher values in different tones depending on matrix, e.g.: blue, black , red. also, in example, red cells have precedence on black , black on blue. solution i'm imagining function that, given triple (blue, black, red) different values each component, returns color cell should colored, , feed colormap, don't know how or if it's possible. every kind of , different solutions (that's happen) welcome , appreciated. in advance. you want fourth image, rgb value @ each point function of single value of first 3 matrixes @ corresponding point? if so, can produce algebra 3 value

java - How to add objects to JSON -

in post service, using below method parse , update database: objectmapper mapper = new objectmapper(); jsonnode node = mapper.readtree(<string>); userlogin userlogin = mapper.convertvalue(node.get("userlogin"), userlogin.class); usersecuritydetails usersecuritydetails = mapper.convertvalue(node.get("usersecuritydetails"), usersecurity now, in service, want send same data retieving db , adding json. suggest best way? sample json formed: { "userlogin": { "user_login_id": "10011", "user_password": "password" }, "usersecuritydetails": { "user_sequence_id": "1", "seq_question_id": "1", "seq_answer": "test answer" } } create wrapper pojo having userlogin , usersecuritydetails . jackson automatically deserialize object. it practice expect r

ios - Parse - Facebook users being recreated everytime -

i'm using parse.com + facebook user , i'm noticing unusual has not been happening previously. user creates account via facebook, logs in, logs out, logs in, logs out, , when try logging in, user gets deleted , user gets created. why be? here signup/signin code: -(ibaction)facebooksignin:(id)sender{ clgeocoder *geo = [[clgeocoder alloc] init]; if(![cllocationmanager locationservicesenabled] || [cllocationmanager authorizationstatus] == kclauthorizationstatusdenied ){ uialertview *locationalert = [[uialertview alloc]initwithtitle:@"oops!" message:@"you must have location services enabled app work properly" delegate:self cancelbuttontitle:nil otherbuttontitles:@"okay", nil]; [locationalert show]; }else{ [pffacebookutils loginwithpermissions:_permissions block:^(pfuser *auser, nserror *suerror) { if(!auser){ nslog(@"not fbook user because %@",[suerror description]);

php - JavaScript pop box won't work properly -

i have problem script. when press 'yes' deletes user fine. problem still deletes user when click cancel. ideas? <script> function myfunction() { var x; if (confirm("are want delete user ?") == true) { x = "delete.php"; } else { x = "memberlist.php"; } document.getelementbyid("demo").innerhtml = x; } </script> the mentioned javascript works fine. may there issue in delete.php or memberlist.php code. solution per expectations, please provide code delete.php , memberlist.php.

html - Why these two spans doesnt align vertically at the same position? -

i rookie, tried make div 2 spans today img , p element. well, here relative code below, 2 spans stay @ diff vertical position.i not know why, have same css, , width of wrapper long far enough. <div id="bannerwrapper"> <span> <a href="mailto:xxxx@gmail.com"><img src="mail.png"></a> </span> <span> <strong><a href="mailto:xxxx@gmail.com">xxxx@gmail.com</a></strong> </span> </div> and, css is *{ margin: 0; padding: 0; line-height: 1.6; } #bannerwrapper{ width: 163px; height: 21px; margin: 10px auto; } #bannerwrapper span{ display: inline-block; height: 21px; } #bannerwrapper span img{ width: 30px; height: 21px; } at last, gave second span float right css solve problem, surely would. but not leaving problem, not asking solutions, want know why, why 2 spans did not stay @ same vertical po

WebGL not rendering may be related to warning -

i rather new opengl , trying learn little webgl. came across a tutorial that, while great, appears bit dated. implemented own version of example in plunkr . left out square on purpose, however, once have wired not see triangle. found warning in console... warning: attribute 0 disabled. has signficant performance penalty and there so question seems similar looking through diff can't work , can't saying click. here drawing code reference... drawscene() { this.gl.viewport(0, 0, this.gl.viewportwidth, this.gl.viewportheight); this.gl.clear(this.gl.color_buffer_bit | this.gl.depth_buffer_bit); mat4.perspective(45, this.gl.viewportwidth / this.gl.viewportheight, 0.1, 100.0, this.pmatrix); mat4.identity(this.mvmatrix); mat4.translate(this.mvmatrix, this.mvmatrix, [-1.5, 0.0, -7.0]); this.gl.bindbuffer(this.gl.array_buffer, this.trianglevertexpositionbuffer); this.gl.vertexattribpointer(this.shaderprogram.vertexpositionattribute, this.trianglever

android - WebView onpagefinished not called for second time -

i using webview load url, first time works properly. if load url second time (for refreshing page , loading different url), onpagefinished not fired. mwvclient = new webviewclient() { @override public void onpagefinished(webview view, string url) { super.onpagefinished(view, url); log.i(this.getclass().getsimplename(), "page has finished loading"); } }; mwebview.loadurl(mairlinesdata.geturl()); mwebview.setwebviewclient(mwvclient); try first set client, , load urls mwvclient = new webviewclient() { @override public void onpagefinished(webview view, string url) { super.onpagefinished(view, url); log.i(this.getclass().getsimplename(), "page has finished loading"); } }; mwebview.setwebviewclient(mwvclient); mwebview.loadurl(mairlinesdata.geturl());

java - Orika not able to map when the application is running on Jetty -

i using orika map between 2 java objects. when run junit tests works fine - objects mapped correctly, when execute code running on jetty exception: ... caused by: java.lang.noclassdeffounderror: loracle/dms/console/dmsconsole; @ java.lang.class.getdeclaredfields0(native method) ~[na:1.8.0_45] @ java.lang.class.privategetdeclaredfields(class.java:2583) ~[na:1.8.0_45] @ java.lang.class.getdeclaredfields(class.java:1916) ~[na:1.8.0_45] @ com.carrotsearch.sizeof.ramusageestimator.createcacheentry(ramusageestimator.java:568) ~[java-sizeof-0.0.4.jar:na] @ com.carrotsearch.sizeof.ramusageestimator.measuresizeof(ramusageestimator.java:532) ~[java-sizeof-0.0.4.jar:na] @ com.carrotsearch.sizeof.ramusageestimator.sizeofall(ramusageestimator.java:380) ~[java-sizeof-0.0.4.jar:na] @ com.carrotsearch.sizeof.ramusageestimator.sizeofall(ramusageestimator.java:361) ~[java-sizeof-0.0.4.jar:na] @ ma.glasnost.orika.statereporter.humanreadablesizeinmemory(statereporter.java:48) ~[orika-core-1.4.5.jar: