Posts

Showing posts from September, 2013

java - @JsonProperty Json object inside Json object -

how use @jsonproperty() json object within json object? example json want is: "location" : { "needs_recoding" : false, "longitude" : "-94.35281245682333", "latitude" : "35.35363522126198", "human_address" : "{\"address\":\"7301 rogers ave\",\"city\":\"fort smith\",\"state\":\"ar\",\"zip\":\"\"}" } a helpful reference using @jsonproperty annotations in constructor provided staxman . simple example shown below: public class address { private string address; private string city; private string state; private string zip; // constructors, getters/setters } public class location { private boolean needsrecoding; private double longitude; private double latitude; private address humanaddress; public location() { super(); } @jsoncreator public loca...

linux - Running sed in parallel -

i naively ventured use following command process data file: cat old.one | parallel --pipe 'sed -r "s/\./\,/g"' > new.one the goal replace "." "," . resulting file differs obtained sequential treatment: sed -r "s/\./\,/g" old.one > new.one maybe parallel work can done somehow differently? here great without semaphores, , combine parts @ end. solution thanks lot! here results: sed: 13.834 s sed -r "s/./\,/g" old.one > new.one parallel sed: 12.489 s cat old.one | parallel -k --pipe 'sed -r "s/./\,/g"' > new.one tr: 6.480 s cat old.one | tr "." "," > new.one parallel tr: 5.848 s cat new.one | parallel -k --pipe tr "." "," > old.one if works correctly (-j1): cat old.one | parallel -j1 --pipe 'sed -r "s/\./\,/g"' > new.one then should work (-k): cat old.one | parallel -k --pipe 'sed -r ...

android - How to populate a ListView using a FirebaseListAdapter? -

i working on android project, allow users find nearest petrol pump's name, address, , importantly prices. have listview, want populate through firebase list adapter because using firebase project. after writing code getting nothing firebase -- it's blank screen on android phone (no error showing in android studio). after writing setcontentview(lview); in end of oncreate() method , giving me error , activity crashes. got error firebase : com.firebase.client.firebaseexception: failed bounce type import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.listview; import android.widget.textview; import com.firebase.client.firebase; import com.firebase.ui.firebaselistadapter; public class testbezinpriser extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // setcontentview(r.layout.activity_testbezinpriser); listview lview = ...

html - Label of the control is jumping to the right side when resized -

Image
the generated html have this: i put in bootply can see , play easier, notice has small css section too: http://www.bootply.com/nrxidfzjdc problem is not "bootstrappy" enough! if start making window smaller labels jump right side of control. have done has caused issue? you have couple of major problems here. right alignment: you have set adding .text-right on labels. meant desktop view only. take off of labels , use min-width media query set alignment or override alignment max-width @ small resolutions overflowing text boxes: you didn't use row. should use row because corrects padding wit negative left , right margins. tried fix instead adding class removes padding on .col-sm-4 . padding there reason , should not removed. adding in row , removing .multi-row doesn't correct issue, however. when run text inputs being wide. because added 100% width inputs. not bad thing per se, causes problems because have used span s inner column...

OpenGL vertex color interpolation from center (how to?) -

Image
here's image show mean: i've assigned blue top, , red bottom. how make entire top half blue, start interpolating bottom? there's 2 solutions. either render blue rectangle top half, , blue-->red rectangle bottom half: float vertices[] { -1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, -1, 1, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1, -1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1 }; or write fragment shader manually interpolation you. #version 450 //we're assuming these normalized [0,1]. in vec2 texturecoord; out vec4 color; void main() { if(texturecoord.y >= 0.5) color = vec4(0, 0, 1, 1); else { float factor = 1 - (texturecoord.y * 2); color = vec4(1, 0, 0, 1) * factor + vec4(0, 0, 1, 1) * (1 - factor); } }

python - Regex, how to get a certain amount of lines of text up to a certain word with regex? -

i trying pull class , class number along prerequisites. having trouble getting course (ex: acct 203), , including prerequisites (ex: acct 301) , nothing else. doing in python, in hopes of later inserting data database. can this? relatively new regex. acct 203 financial accounting 3 credits development of basic accounting concepts. emphasis on classifying, recording, , reporting of business transactions forms of business organizations. offered every semester. acct 204 managerial accounting 3 credits emphasis on generating, analyzing, , using accounting information in planning , control processes. topics include budgets, standards, cost systems, incremental analysis, , ~nancial statement analysis. offered every semester. prerequisite: acct 203 acct 301 intermediate accounting 3 credits ~rst course in two-course sequence intended provide comprehensive understanding of concepts, principles, assumptions, , conventions used classifying, recording, , reporting economic tr...

MongoDB java driver : filter by the id -

i use latest version of java driver of mongodb. unfortunately after searching not able filter _id ... i tried lot of things : _id id_objet = new _id(); id_objet.set$oid(idobjet); document mydoc = collection.find(eq("_id", id_objet)).first(); i got bad request error grizzly ... what proper way filter _id latest version of driver ? thanks help it not big deal : document mydoc = collection.find(eq("_id", new objectid(idobjet))).first(); you have use objectid(id).

pandas - python: recursively find the distance between points in a group -

i can apply vincenty in geopy dataframe in pandas , determine distance between 2 consecutive machines. however, want find distance between machines in group without repeating. for example, if group company name , there 3 machines associated company, want find distance between machine 1 , 2, 1 , 3, , (2 , 3) not calculate distance between (2 , 1) , (3 , 1) since symmetric (identical results). import pandas pd geopy.distance import vincenty df = pd.dataframe({'ser_no': [1, 2, 3, 4, 5, 6, 7, 8, 9, 0], 'co_nm': ['aa', 'aa', 'aa', 'bb', 'bb', 'bb', 'bb', 'cc', 'cc', 'cc'], 'lat': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'lon': [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}) coord_col = ['lat', 'lon'] matching_cust = df['co_nm'] == df['co_nm'].shift(1) shift_coords = df.shift(1).loc[matching_cust, coor...

c# - Why this button has a small functionality area? -

Image
i have behaving button in wpf application. has image on it. it's working fine, user needs press in middle functionality. so image covering whole "button" technically border. yet users have tiny space click. edges maybe 20 pixels away each edge not functional. what reason user has small functional space? <border x:name="previewbutton" margin="0,10" height="89" padding="0" mousedown="previewbutton_mousedown" mouseup="previewbutton_mouseup" borderbrush="#ff535151" borderthickness="1" mouseleave="previewbutton_mouseleave" touchdown="previewbutton_touchdown" touchup="previewbutton_touchup" touchleave="previewbutton_touchleave" > <image width="50" source="/ez3d;component/resources/old/eye.png" margin="4.2,0.2,3.4,0.2" /> </border> border: image on border: set background of border tr...

regex - regexp_extract not working -

i have string created rsa key 1234 intelligent expense id 54678||||||" and need extract 54678 in hive ql. using select description,regexp_extract(description,'id\s(\d*)\|') cctkey smartmatching limit 10 i tested regex , looks fine. hive not return output me. showing null. can help you need escape \s , \d , \| . should be id\\s(\\d*)\\|

order - Control the ordering of the output expression from factor -

can control ordering of output expressions in maxima's factor() function? factor(7*x^2-7*x); returns 7*(x-1)*x but get 7*x*(x-1) there isn't simple way specific ordering of terms. maxima has pretty strong idea ordering , isn't easy change. advice let go , used it; don't think it's worth trouble try change it. in fact, in case, in trying change ordering of x , x - 1 , don't think there way it.

scala - Trait does not conform with type parameter bounds -

i having issues types. in case have 2 traits base methods, , 1 of them depends on other. after have 2 implementations them. have idea wrong here? the compiler saying: type arguments [impldefinition,impldto,impldtoidentifier] not conform trait childoperations's type parameter bounds [c <: types.baset[a,i],a <: types.idobj[i],i <: iidentifier] [error] class imploperations extends parent2(new impldefinition) childoperations[impldefinition, impldto, impldtoidentifier] { the code: /* * generic implementation */ object types { type idobj[i <: iidentifier] = anyref {def id: i} type baset[a, <: iidentifier] = parent1[a] { def id: foo[i] } } trait iidentifier extends { def id: long override def tostring = id.tostring } class parent1[a](a: string) class foo[a](a: string) trait childdefinition[a <: types.idobj[i], <: iidentifier] { self: parent1[a] => def id(a: a): foo[i] } class parent2[a](a: a) trait childoperations[c <...

ssh - "Unable to send channel-open request" when using ssh2 crate -

i'm trying implement module interacting network gear on ssh. my code generates error ssh session creation don't know how fix. here code: extern crate ssh2; // cut init code match ssh.authenticated() { true => println!("logged in !"), false => println!("failed login"), }; let mut channel = match ssh.channel_session() { ok(ch) => ch, err(e) => panic!("unable create channel: {}", e), }; and here result: running `target/debug/e6000` trying connect connection successfull logged in ! thread '<main>' panicked @ 'unable create channel: [-7] unable send channel-open request', src/main.rs:25 i see on device authentication successful, why can't create channel?

objective c - The app gets frozen when returning a custom UIView as a marker infoWindow (Google Maps iOS SDK) -

i have custom uiview (with xib , .h , .m files) , want gmsmarker 's info window. when return custom uiview in -mapview: markerinfowindow: method, app gets frozen , stuck (it's not crashing). my code is: -(uiview *)mapview:(gmsmapview *)mapview markerinfowindow:(gmsmarker *)marker { //creating "infowindow"(infowindow) , setting nib file called "infowindow" custommarkerinfowindow *infowindow=[[[nsbundle mainbundle] loadnibnamed:@"custommarkerinfowindow" owner:self options:nil] lastobject]; //returning "infowindow"(infowindow) return infowindow; } i have no idea why it's freezing , know sure code worked in past, can't understand what's wrong. can me this? thank you! put method in custom view implementation file -(void)didmovetosuperview{ self.superview.autoresizessubviews = no; }

qt - QML TextField validator does not work on Android -

i have written code below: textfield { id:malzemeolcuinput anchors.fill: parent validator: regexpvalidator { regexp: /\d+/ } font.pixelsize: 18 placeholdertext: "kullanılan..." horizontalalignment: text.alignhcenter verticalalignment: text.alignvcenter } textfield accepts numbers. on mingw, when press alphanumeric a,b,c, field has no effect. if deploy android, textfield accepts character. wrong when use code on mingw?

python - not understanding a call in django -

from socketio.namespace import basenamespace class chatnamespace(basenamespace): _registry = {} def initialize(self): self._registry[id(self)] = self i looking @ code , not understanding [id(self)] why id has been called , how it's effecting current line of code? _registry dictionary, , specifically, class-level object (meaning every instance of class shares same dictionary. id built in python method ( https://docs.python.org/2/library/functions.html#id ) returns “identity” of object , guaranteed unique , constant object during lifetime. (for cpython, memory address of object.). in other words, doing adding new registry entry key being "globally" unique value object , value being object.

json - speed and memory comparison between rowwise with do and transmute -

i wondering, memory , speed comparison between rowwise , transmute function in dplyr i have list in data frame column, want know 1 better. currently, due limited knowlege, using rowwise collect information list, i have 3 column. first column unique id each row. second column json response third column list extracted json response following code vectorize_fromjson <- vectorize(fromjson) z <- vectorize_fromjson(x) example of json response x extracted data frame x = c('{"company_name": "a", "employees":[ {"firstname":"john", "lastname":"doe"}, {"firstname":"anna", "lastname":"smith"}, {"firstname":"peter", "lastname":"jones"} ]}', '{"company_name": "a", "employees":[ {"firstname":"john", "lastname":"doe"}, {"firstname":"...

Trouble parsing string to date c# (from sqlite database) -

i modeled solution on answers many other posts still not work. public void dtparsing() { string date = "2016-04-19 15:14:19.597"; console.writeline("date c# string : {0} : ", date); string pattern = "yyyy-m-d h:m:s.f"; datetime mydate = datetime.parseexact(date, pattern, null); console.writeline("\ndate c# datetime : {0} : ", mydate.tostring()); console.readkey(); } one problem values not set number of digits: milliseconds can anywhere 0 3 digits. there solution without parsing more manual parsing? this should stop error (no need pattern, must match exactly) datetime mydate = convert.todatetime(date);

c# - In the execution of a program, are events like threads? WPF -

i have background worker thread continuously updating data displayed in window network source. have button fire event. my question is, @ stage (relative background worker execution) event method executed? similar threads in happen simultaneously? i.e, background worker still running whilst button click method executing? in case, need use locking. or background worker pause until button click method has terminated? events raised ui controls (e.g. buttons) execute in main thread, a.k.a. ui thread. events raise raised on whatever thread raise them on. event raisings block execution of own thread until complete. they're not special, when call them: little syntactic sugar around calling arbitrary list of delegates. in absence of explicit synchronization code, other threads humming along background merrily continue execute. if need or want communicate between event handler in ui thread , worker thread, you'll need write explicit code so. nothing special here: 2 th...

prototype - javascript concat using call method -

i'm trying concat 2 arrays in javascript using concat() method. i'm wondering difference between these 2 cases var = [1, 2, 3]; console.log(array.prototype.concat.call(a, [4, 5, 6])); // result: [1, 2, 3, 4, 5, 6] console.log(array.prototype.concat(a, [4, 5, 6])); // result: [1, 2, 3, 4, 5, 6] i thought using call method, passing in this object first argument, change array a . didn't. array.prototype.concat.call(a, [4, 5, 6]) is equivalent a.concat([4, 5, 6]) (assuming a.concat === array.prototype.concat , case in example a instanceof array ). array.prototype.concat(a, [4, 5, 6]) is equivalent array.prototype.concat.call(array.prototype, a, [4, 5, 6]) . given array.prototype empty array, both yield same result. [].concat(a, [4, 5, 6]) or array.prototype.concat.call([], a, [4, 5, 6]) well.

date - Create a time (by half hours) table in MySQL -

for reporting purposes need time table acts lookup table lists every half hour in day. function same way date table except it's time. i found great example of 24 hour table: create table hourly_data ( id int primary key auto_increment, date date not null, hour int not null, f1 int not null, f2 int not null, f3 int not null, f4 int not null, f5 int not null, f6 int not null, inserted timestamp not null default current_timestamp on update current_timestamp ) but rather every half hour. ideas on how this? shifts , create specialized reports. in advance! in mariadb can direct use sequence engine this: select date('2010/01/01') + interval (seq * 30) minute mydate seq_0_to_10; sample mariadb [mysql]> select date('2010/01/01') + interval (seq * 30) minute mydate seq_0_to_10; +---------------------+ | mydate | +---------------------+ | 2010-01-01 00:00:00 | | 2010-01-01 00:30:00 | | 2010-...

sql - SSIS Sending Email with a Link -

i have couple of ssis questions regarding send mail task. first if pulling email body , subject directly sql server table , putting variable, there way in expression builder messagesource replace values (such flag !!!) other variable values? second, there way when pull email body sql variable have link in email? have tried <a href> tag in sql table , code comes through in every email have tried. using expression builder mentioned above. again help! you can use ssis variables construct message using expression task. the send mail task supports plaintext. sending html mail message script task 1 alternative, cozyroc send mail task plus another.

c# - ASP.net MVC cross application POST request -

i have several asp.net mvc applications deployed on single site in iis. of applications using forms authentication, , of applications configured use same machine key. one of applications 'base site' provides navigation other applications , login/logout functionality being handled. stands, user can log in on base site , visit other applications , still authenticated, working intended. i have logout form in header of shared layout views submits post request logout action in controller belonging base site. when submit form base site, logout works expected. if try submit form of other sites, receive error message: "the anti-forgery cookie token , form field token not match." this log off action looks in security controller: [httppost] [validateantiforgerytoken] public actionresult logoff() { formsauthentication.signout(); return redirect("~/"); } this form looks in base site view: using (html.beginform(...

PHP friendly URL with .htaccess -

my pages looks this: www.mywebsite.com/work-view?id=1 www.mywebsite.com/work-view?id=2 www.mywebsite.com/work-view?id=3 and on... how set them .htaccess? www.mywebsite.com/work/1 www.mywebsite.com/work/2 www.mywebsite.com/work/3 i've tried this, doesn't work. rewriterule work/(.*)/ work-view.php?id=$1 edit: here's new code i'm trying. rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php rewriterule ^/?work/([0-9]+)$ work-view.php?id=$1 [l] when check page /work-view?id=2 displays fine, when try enter /work/2 shows 500 internal server error. unfortunately on cpanel logs don't see error related issue, maybe because of hosting restrictions. new edit: arkascha answer works great, problem related css , in case when use .htaccess i've changed paths css , it's working great. here's code works great too. rewriterule ^work/([0-9]+)/?$ work-view?id=$1 ...

excel - Proc Report Color Coding with Traffic Lights instead of highlighting entire cell? -

Image
i have report run in sas , format in excel has traffic color coding based on excel formulas. i'd have created in sas, have been using proc report create tables. not sure if traffic lights (like below) can used in sas, , they're pretty adamant need traffic lights (or arrows), not highlight entire cell or text. using sas eg 9.4. should use image have circles populate in column? or there nifty way this? yes, can. how bit long stack overflow question. google returns number of results. sgf paper job of covering basics http://support.sas.com/resources/papers/proceedings11/290-2011.pdf

swift - Multiple circles drawn SpriteKit -

i'm working on simple game based on paiting background player. in left , right corner there buttons move character left or right. i've implemented (character moving , lefts painted background behind), adding circles fps's drops fast. there solution that? import spritekit class gamescene: skscene { var playerdot:playerdot = playerdot(imagenamed:"player") var isturningleft:bool = false var isturningright:bool = false var lastlocation:cgpoint = cgpoint() override func didmovetoview(view: skview) { /* setup scene here */ let mylabel = sklabelnode(fontnamed:"helvetica") mylabel.name = "left" mylabel.text = "left" mylabel.fontsize = 30 mylabel.horizontalalignmentmode = .left mylabel.position = cgpoint(x:cgrectgetminx(self.frame), y:cgrectgetminy(self.frame)) self.addchild(mylabel) let mylabel2 = sklabelnode(fontnamed:"helvetica...

c# - Entity Framework tree structure -

i have entity called field, looks like: field.cs class field { public int id { get; set; } public string name { get; set; } } so fields simple list this: 1 : first name 2 : last name 3 : gender 4 : passport 5 : driver license 6 : issued 7 : expired for each of entity called batch, want have arbitrary tree of fields, might this: first batch first name | last name | passport | gender | issued | expired | or this: second batch first name | last name | gender | driver license | | issued | expired | or other tree of fields, users type different values each field (some fields headings, passport, example) so fields list of elements can reused, having sort of relationship between them based on batch. idea have batch entity like: batch.cs class batch { public int id { ge...

jaydata indexedDb joined database -

Image
i have created sample database , test scripts it. database structure is: i have created jsfiddle it: fiddle click buttons except stress test on top, click tests. the problem is, works provider websql, fails on provider indexeddb. downloaded pro packages , makes test 3 work partially still fails on test 2 completely. problem found when query database join relation(ex: employees in department.id 1) indexeddb cannot process request. how can circumvent situation? whole code is: index.html: <!doctype html> <html> <head> <meta charset="utf-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="jaydatapro/jaydata.min.js"></script> <script src="jaydatapro/jaydataproviders/indexeddbproprovider.min.js"></script> <script src="jaydatapro/jaydataproviders/sqliteproprovider.min.js"></script> <scr...

Getting underlying exception from third party WCF - SOAP Exception -

i have client connecting third part wcf service (i have access web.config or service not code). third party throws soap exception because faulting assembly isn't marked serializable - "type assembly not marked serializable". is there anyway can underlying exception detail thrown , not faulted on wcf service via configuration edit or other means? you need enable includeexceptiondetailinfaults in web.config file. please check this .

java - Use Mockito to mock some methods but not others -

is there way, using mockito, mock methods in class, not others? for example, in (admittedly contrived) stock class want mock getprice() , getquantity() return values (as shown in test snippet below) want getvalue() perform multiplication coded in stock class public class stock { private final double price; private final int quantity; stock(double price, int quantity) { this.price = price; this.quantity = quantity; } public double getprice() { return price; } public int getquantity() { return quantity; } public double getvalue() { return getprice() * getquantity(); } @test public void getvaluetest() { stock stock = mock(stock.class); when(stock.getprice()).thenreturn(100.00); when(stock.getquantity()).thenreturn(200); double value = stock.getvalue(); // unfortunately following assert fails, because mock stock getvalue() method not perform stock.getvalue() calculation code. assertequals("stock value not ...

Jenkins launch slave via execution of command on the master + The system cannot find the file specified -

trying start slave on remote machine master (local machine) using jenkins (launch slave via command line on master) ssh 10.1.18.135 java -jar d:/jenkins/slave.jar the slave.jar present in above path,but fails error: [07/01/13 14:16:11] launching slave agent $ ssh 10.1.18.135 java -jar d:/jenkins/slave.jar system cannot find file specified error: unable launch slave agent test123 : system cannot find file specified java.io.ioexception: cannot run program "ssh": createprocess error=2, system cannot find file specified @ java.lang.processbuilder.start(unknown source) @ hudson.slaves.commandlauncher.launch(commandlauncher.java:115) @ hudson.slaves.slavecomputer$1.call(slavecomputer.java:230) @ java.util.concurrent.futuretask$sync.innerrun(unknown source) @ java.util.concurrent.futuretask.run(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.runtask(unknown source) @ java.util.concurrent.threadpoolexecutor$worker....

java - Updating Realm to 0.88.3 -

i have updated realm version 0.87.2 0.88.3 , i'm getting error below: java.lang.runtimeexception: unable start activity componentinfo{user.temp/user.temp.mainactivity}: io.realm.exceptions.realmmigrationneededexception: realmmigration must provided i didn't change in models , don't know how fix issue. any idea? thanks! try this: go app setting clear cache , clear data , run again hope helps.

machine learning - Python K means clustering -

i trying implement code on website estimate value of k should use k means clustering. https://datasciencelab.wordpress.com/2014/01/21/selection-of-k-in-k-means-clustering-reloaded/ however not getting success - in particular trying f(k) vs number of clusters k graph can use procure ideal value of k use. my data format follows: each of coordinates have 5 dimensions/variables i.e. data points live in five-dimensional space. list of coordinates below, example first data point has coordinates ( 35.38361202590826,-24.022420305129415, 0.9608968122051765, -11.700331772145386, -9.4393980963685) . variable1 = [35.38361202590826, 3.0, 10.0, 10.04987562112089, 5.385164807134505, 24.35159132377184, 10.77032961426901, 10.816653826391967, 18.384776310850235, 14.317821063276353, 24.18677324489565, 3.0, 24.33105012119288, 8.94427190999916, 2.82842712474619, 4.123105625617661, 4.47213595499958, 13.453624047073712, 12.529964086141668, 19.4164878389476, 5.385164807134505, 5.0, 24.0416305603...

Running multiple tasks in parallel with NAnt -

i trying run multiple task in parallel reduce time builds. seems tasks executing 1 after sequentially. taking time builds. there way run multiple tasks in parallel in nant? looks has been asked before. see nant: parallel threads execution of tasks; exist? not best question/answer, since answer moved out of comment, links blog have code. see asyncexec , waitforexit speeding build more even gets example of how use code @ async tasks zip file i have not used code, searching nant. had used parallelism of multiple build machines.

html - Why am I getting """j"" is not valid at the start of a code block." here? -

i've got in index.cshtml (view) code: <div class="col-md-6"> <label class="control-label">delivery performance (report spans number of days)</label> <br> <label>from</label> <select> @for (int = 1; <= @maxdaysbackfordeliveryperformance; i++) { <option id="selitem_@(i) value=@"i">@i</option> } </select> <label>days back</label> <br> <label>to</label> <select> @for (int j = 1; j <= @maxdaysbackfordeliveryperformance; j++) { <option id="selitem_@(j) value=@"j">@j</option> } </select> <label>days back</label> <br> <button id="btntestdeliveryperformancesettings">test settings</button> </div> this ran fine (prior adding part @ bottom): <div ...

Java - Can enum in a parameter of an abstract method -

i not familiar enum , want ask whether can put enum in abstract method , override in other class? here example working with: i have many subclasses extend abstract class, each have own sub command enum type. enum type has int id , string name. also, method takes sub command , change input ui base on selected sub command. public class commandone extends commandclass{ ........ public void updateuibysubcmd(subcommand subcmd){ /*do something*/ } private enum subcommand{ subcmd1 (id1, name1), subcmd2 (id2, name2), ........ } } i have abstract class extended above subclass, not consist enum couple function override subclass. the question is, can following , have method updateuibysubcmd become abstract enum type? if allowed, how accomplish it? public abstract class commandclass{ .......... public abstract void updateuibysubcmd(enum x); } sounds you're looking this: public abstract class commandcl...

Php email attachment extraction -

i'm trying create piece of code go mailbox , take out attachments of specific file. far able view if there attachment or if there not attachment on e-mail. but want able take attachments out of e-mail , save them specified directory. type of attachment i'm trying take out .jpg i've tried bunch of different pieces of code i've found on google , i've been trying tailor fit code, far have been unsuccessful in finding works correctly. i wondering if able me create piece of code able take attachments out of emails , store them in directory. thanks. <?php /* connect email */ $hostname = '{*****.com:110/pop3}inbox'; $username = '*****'; $password = '*****'; // try connect $inbox = imap_open($hostname,$username,$password) or die('cannot connect server: ' . imap_last_error()); // grab emails $emails = imap_search($inbox,'all'); // search 39th email, has attachment $count = ...

c# - Why is my API not printing out to the textbox? -

so after understanding how api work managed set prints out data labels flawlessly. when try same thing different api (almost same one) decides not print out, feels missed code, me? the first ticker (update_btc_ticker) works flawlessly, prints out should other 1 (update_btc_trades) not want print out, did miss out? private void update_btc_ticker(object sender, eventargs e) { var client = new restclient("https://btc-e.com/api"); var request = new restrequest("2/btc_usd/ticker", method.get); //request.addheader("key", "46g9r9d6-wj77xoip-xh9hh5vq-a3xn3yoz-8t1r8i8t"); request.onbeforedeserialization = resp => { resp.contenttype = "application/json"; }; irestresponse<btcusdticker> response = client.execute<btcusdticker>(request); selllabel.text = convert.tostring(response.data.ticker.sell); buylabeltrue.text = convert.tostring(response.data.ticker.buy); } private void update_btc_trades...

How to edit the exposure of an HDRI image using GraphicsMagick and Node.js? -

i have imagemagick installed support hdri images. using bash, following command can used save image different number of 'stops' (where stops measure of exposure): stops=`convert xc: -format "%[fx:pow(2,-1)]"` convert input.exr \ -colorspace rgb \ -function polynomial "$stops,0" \ -gamma 1 \ -colorspace srgb \ output-minus-one-stop.jpg in order node.js, translation needed: var stops = math.pow(2, -1); gm('input.exr').colorspace('rgb') .out(`function polynomial "${stops},0"`) .gamma(1, 1, 1) .colorspace('srgb') .write('output-minus-one-stop.jpg', function(err){}); however error: command failed: convert: unable open image `function polynomial "0.25,0"': no such file or directory @ error/blob.c/openblob/2702 convert: no decode delegate image format `25,0"' @ error/constitute.c/readimage/501 the error happening because of line: .out(`function pol...

python sphinx - How do you hyperlink monospaced text in reStructuredText? -

`pandoc <https://github.com/jgm/pandoc>`_ creates link looks like pandoc but how create link monospaced text: pandoc if try ` ``pandoc`` <https://github.com/jgm/pandoc>`_ i crud: ` pandoc < https://github.com/jgm/pandoc >`_

Javascript/PHP: send a pop up or some alert to users who have permissions? -

i have site used operators in factory don't log in have 0 permissions, users in office have permissions. what need is, upon click of button submits note sql database job , operation number, send pop or kind of alert message logged in. this in form of opening new tab or method really. what i've got far cell highlights relevant job has note, want provide alert when new message present, opposed old note displaying highlighted cell. can please provide suggestions? edit: sorry, here's code on operator's page, requires no permissions update database. <script type="text/javascript"> function savenotes() { var jobid = "<?php echo $_get['jobid']; ?>"; var operation = "<?php echo $_get['operation']; ?>"; var nnotes = document.getelementbyid('notes').value; if (nnotes == 'null') nnotes = ""; sendasync("editdatabase.php?sql=updat...

c++ - Progress bar for copying files -

i trying create progress bar file copy in qt. this close find, believe doesn't work because according qt class documentation: unlike other qiodevice implementations, such qtcpsocket, qfile not emit abouttoclose(), byteswritten(), or readyread() signals. implementation detail means qfile not suitable reading , writing types of files, such device files on unix platforms. how can this? don't know how implement own signals. here code: void replicator::anotbaandbfile(qdir source, qdir target) { source.setfilter(qdir::files | qdir::nodotanddotdot | qdir::nosymlinks); target.setfilter(qdir::files | qdir::nodotanddotdot | qdir::nosymlinks); qdebug() << "scanning: " << source.path(); qstringlist sourcefilelist = source.entrylist(); qstringlist targetfilelist = target.entrylist(); (int acount = 0; acount < sourcefilelist.count(); acount++) { bool found = false; (int bcount = 0; bcount < t...

node.js - "npm --save install <module>" without actually installing the module -

for development setup, i'm using node.js inside docker container. i'm placing node_modules folder in docker image avoid potential problems caused architectural differences between non-linux host , docker engine. whenever add module, rebuild image, process invokes npm install within container. add dependency package.json, run npm --save install <module> on host computer since that's i'm editing files. installs module onto host computer doesn't need it. it's waste of time , bandwidth. i manually edit package.json, that's error-prone , requires looking module's version number. there way make change through npm while avoiding unneeded installation? when docker container running can run npm install inside container: docker exec -ti <container id or name> npm install --prefix ./path/to/your/app <package> --save

angularjs - PhoneGap doesn't want to use REST service no matter what I do -

i have phonegap app using angularjs with. i'm using pretty simple $http call node backend: $http.get("http://localhost:6969/random") .then(function(response) { $scope.images = response.data; }); no matter what, phonegap never hits backend. have tested in normal browser , works expected. i have read bunch , people fix using whitelisting, in config.xml , whitelisting open can be: <plugin name="cordova-plugin-whitelist" source="npm" spec="1.1.0" /> <allow-navigation href="*" subdomains="true" /> <allow-intent href="*" subdomains="true"/> <access origin="*" subdomains="true"/> <!-- required ios9 --> what have change? been wrestling bug few days off , on , it's bit annoying not able create new cool features in free time. edit: serving app using phonegap serve , testing using phonegap developer app. i suggest co...