Posts

Showing posts from May, 2012

jquery - How do I structure data for POST from form in ReactJS? -

i have basic react component contact form issues post api endpoint (using django rest framework). endpoint handles actual sending, , such. i'm using jquery handle ajax business -- know overkill; removed later -- can't seem grok how structure values form in component submission endpoint. here's component: var contactform = react.createclass({ getinitialstate: function() { return { name: '', email: '', message: '', url: '', }; }, handlenamechange: function (e) { this.setstate({name: e.target.value}) }, handleemailchange: function (e) { this.setstate({email: e.target.value}) }, handlemessagechange: function (e) { this.setstate({message: e.target.value}) }, handleurlchange: function (e) { this.setstate({url: e.target.value}) }, handleformsubmit: function (e) { e.preventdefault(); var name = this.state.name.trim(); var email = this.state.email.trim(); v

javascript - Rename file with NPM -

is there way rename single file in npm scripts? want prepare files distribution, need built files named differently in source... i have tried orn, seems work on command line, not npm script. i'm looking add cross-platform dependency project, rather writing own javascript script copy files over. my ideal solution can include in package.json , 1 line command, e.g. rename old-file-name new-file-name sure. npm script can run node js file want. for example: require('fs').rename(oldpath,newpath) more info: https://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback https://docs.npmjs.com/misc/scripts

c# - Get Parent of custom TextBox control -

when creating custom control extends textbox, inside oncreatecontrol() override, parent null. when extending other controls such button, isn't null. checking following code , adding form , various container controls: protected override void oncreatecontrol() { base.oncreatecontrol(); messagebox.show((parent == null).tostring()); //true when extending textbox, false when extending button } what can retrieve parent of control when added control, ensuring same code work regardless of control extend?

Scala : Compiler emits no warning when pattern matching against a sealed trait -

here snippet. when pattern matching, compiler emits no warning. know workaround ? i compiler emit warning when forget case when pattern matching against simpleexpr.expr , otherexpr.expr . construct allows me factor nodes common both expression trees (like if ) trait hierarchy { sealed trait expr } trait if { this: hierarchy => case class if(cond: expr, yes: expr, no: expr) extends expr } trait word { this: hierarchy => case class word(name: string) extends expr } object simpleexpr extends hierarchy if word //object otherexpr extends hierarchy if integer object demo extends app { import simpleexpr._ def func(expr: expr) = expr match { case if(cond, yes, no) => cond // compiler should emit warning } } because sealed isn't transitive, it's not clear me whether lack of compile error bug or not. i noticed adding case match expression causes compiler issue "unreachable code" warning. here's modified version of co

image - The opposite effect of scratch card for Android. (Anti erase effect of picture) -

i make application, have 2 pictures(layers) , can erase part of foreground image(using tapping , finger painting). make this, had used scratchview library android. android-wscratchview this give opportunity erase parts of images. next step - "anti erase". must use finger draw, , restore parts of image have been erased. dont understand how it. may possible change method of library class , have opportunity "anti erase". may should create special handler this. had tried done long time, , hope can me in this. thanks! i guess article should this: http://www.41post.com/4794/programming/android-rendering-a-path-with-a-bitmap-fill there can see how draw path filled bitmap. rest pretty straightforward: assign bitmap (top layer image) paint in above article. in "motionevent.action_down" add path not mpathlist, other, say, npathlist. in "ondraw" go through npathlist , draw paint article above.

python - Cities with a larger number of acquirers than startups -

my query below produces no output. i'm trying group city, city names of groups satisfy "having" condition. wrong here? create view que select acquirer_city acquisitions group acquirer_city having count(distinct company_name) < count(distinct acquirer_name) your sql creating view, not running query. if run select * que you see content of view. however, if not wanting create view (to used later), remove first line. run query , return results.

ruby - Error using Carrierwave in rails -

i have website contains many users , each user have own profile want let them upload there image through carrierwave gem loop following errors first time work carrierwave gem :( : actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' web-console (2.2.1) lib/web_console/middleware.rb:39:in `call' actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.2.4) lib/rails/rack/logger.rb:38:in `call_app' railties (4.2.4) lib/rails/rack/logger.rb:22:in `call' quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets' request_store (1.2.0) lib/request_store/middleware.rb:8:in `call' actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in `call' rack (1.6.4) lib/rack/methodoverride.rb:22:in `call' rack (1.6.4) lib/rack/runtime.rb:18:in `call' rack-timeout (0.3.2) lib/rack/timeout/core.rb:125:in `block in call' rack-timeout (0.3.2) li

ruby - Capybara Rspec tests fail unless I use selenium webdriver -

i writing rock paper scissors program course on. my feature test file follows... require 'spec_helper' require 'capybara/dsl' require 'selenium-webdriver' require 'tilt/erb' require './lib/computer.rb' feature 'user can play rock, paper, scissors..' let(:computer){double :computer} # before # include capybara::dsl # capybara.default_driver = :selenium # end scenario 'user can enter name' sign_in expect(page).to have_content "player name = reiss" end scenario 'page has buttons allows user select move' sign_in click_button('rock') end scenario 'see move computer played' sign_in click_button("rock") expect(page).to have_content "the computer played" end scenario 'see move computer played' sign_in click_button("paper") expect(page).to h

How to write batch file in SAS that automates the opening of files? -

i assigned task don’t know start. here’s context: there’s variable in data, var1, indicating directory bunch of image files. observation 1, var1 may d:\project\data\images\image1.tiff , on. of course, image files exist in computer. what need figure out sas program(s) , later run them automatically using batch file. when batch file runs, will, in way, opens image files 1 one. “one one”, mean firsts open 1 image file and, upon closing file, opens next image file until end of list. better yet, batch file make copy of original image files , put them in folder (e.g., d:\project\data\temp images) before opening them. make sure original data left untouched. do know how can write such program in sas? given following spss file reference, job nicely described. don’t know enough spss understand every detail how works. 2 variables dir5 , tiff5 specify location of image files, , variables scqid , ohhscqid id variables. string out2 (a200). compute out2=concat('copy "&

swift - Variable/class in array -

so i'm kinda stuck on somethng. kinda want random drop wen kill monster. got. i've got weapon1 class weapon { var str = int } class weapon1: weapon { override init() { super.init() str = 10 } class weapon2: weapon { override init() { super.init() str = 20 } i've got monster class monster { str = 20 def = 10 drops = [weapon1(), weapon2()] } and have place link drops if monster death var itemdrops = weapon() and when monster dies should link monster drop itemdrops.. can use somewhere in inventory. when try this random = (arc4random_uniform(uint32(monster.items.count-1))) //-1 becous 2 items , array starts @ 0 itemdrops = monster.items[random] but items in white.. the problem items instance property of monster : class monster { str = 20 def = 10 drops = [weapon1(), weapon2()] } but when try access it, try access through class : monster.items[random] the class monster has no class/static

Symfony Call to a member function get() on null -

i use symfony components in own framework. installed di component , tried in basecontroller time same error: call member function get() on null my base controller: abstract class basecontroller implements containerawareinterface { use containerawaretrait; ... } and when try access $this->container->get('ser_id'); return call member function. how slove this? update: only work if include in controller service container $this->service_container = include __dir__ .'/../../../container.php'; and use this: $this->service_container->get('id');

python - Implementing Depth Limited Path Finding with Stack -

hey title says i'm trying implement depth limited search in python3 returns path given graph, start vertex , goal vertex. i'm struggling bit how enforce limit search. far have: def dfs(g, v, goal, limit=-1): sentinel = object() visitedstack = [v] path = "" while visitedstack: currentvertex = visitedstack.pop() if g.getvertex(currentvertex) != none: if g.getvertex(currentvertex).visited == false: path += currentvertex + ' -> ' g.getvertex(currentvertex).hasbeenvisited() if currentvertex == goal: return path[:-3] elif currentvertex == sentinel: limit += 1 elif limit != 0: limit -= 1 visitedstack.append(sentinel) visitedstack.extend(g.getvertex(currentvertex).getconnections()) return "depth limit reached&qu

Logistic Regression Using Gradient Descent in R -

i new here. please pardon me if breaking stackoverflow rules. trying implement logistic regression using gradient descent in r. results gradient descent not matching newton's method ( solution ). cannot figure out going wrong. please help? in advance. source dataset: http://openclassroom.stanford.edu/mainfolder/courses/machinelearning/exercises/ex4materials/ex4data.zip this theta = [-0.2268167, 0.6366124, -0.4850165] correct theta values [-16.37875042 0.14834094 0.15890845] rm(list=ls()) rawdataset <- read.csv("ex4data1.csv") # x1,x2,y -> csv format dataset = cbind(o = rep_len(1,nrow(rawdataset)), rawdataset) x = data.matrix(dataset[1:ncol(rawdataset)]) y = data.matrix(dataset[ncol(rawdataset)+1]) iterations = 500 alpha = 0.01 m = nrow(y) theta = matrix(c(rep(0,ncol(x))),1,ncol(x)) costhistory = matrix(c(0),iterations,1) for(i in 1:iterations) { predictions = 1 / (1 + exp(-x %*% t(theta))) for(j in 1:ncol(x)) { errors = (predictions

android - createPrintDocumentAdapter replacement -

i warning when building android project "createprintdocumentadapter" has been deprecated. method on webview. i have been looking have been unable find intended replacement is. can shed light on this? thanks, jason per javadoc createprintdocumentadapter() : this method deprecated in api level 21. use createprintdocumentadapter(string) requires user provide print document name. therefore if need support < api 21, continue use current method, on api 21+ devices, use createprintdocumentadapter(string)

plot - Plotting 2D Hilbert Spectrum in MATLAB -

i want create 2d plot of hilbert spectrum. want time vs frequency plot, amplitude of signal represented color changes in plot. what have done this , need this . thank in advance edit: i have values of amplitude , instantaneous frequency on time, have produced using hilbert huang transform. let's use first imf, , have 100 samples. have is: instantaneous_frequency = [f1 f2 f3 ... f100] instantaneous_amplitude = [a1 a2 a3 ... a100] time = [t1 t2 t3 ... t100] what need way plot them second image, without using spectrogram function, since uses stft , have applied hht. the code producing first plot is: time_window = 1:101; signal= rand(1,101); hilb = hilbert(signal); inst_amp = abs(hilb); inst_th = angle(hilb); inst_freq = diff(a_inst_th)/(1/256)/(2*pi); %instantaneous frequency %inst_freq = remove_outliers(inst_freq,time_window(1:end-1)); inst_freq(end+1) = inst_freq(end); % done due diff() plot(time_window*4,inst_freq,'k.','markersize

R 3.2.3 new H2o Package (2015) cannot achieve the same results from old package -

i using h2o r package (2014 version) perform deep learning task using textual data. did research in 2015 , obtained promising results using deep learning method (function - h2o.deeplearning; e.g. fscore , recall achieve >0.9). found original r code doesn't work (due change of h2o package in nov 2015) , revised code. however, when tried run same deep learning model (same setting), not achieve outperfom results anymore!! please, wish know if h2o has changed internal modeling settings since revision of h2o package? wish reproduce old results new package... please kindly help. h2o deep learning (2.0 , 3.0) not reproducible default -- can change setting reproducible = true , slow things down quite bit, reproducibility requires code run on single core. therefore variability due randomness in algorithm alone, rather upgrade of h2o 2.0 3.0. if want use h2o classic (2.0), old code still work, is. might try running first see if can track down source of variability. there

java - Why the switch statement does not enter to the case 2? -

thank read question. don´t have problem compiler, , when run program case 1 works case 2 not work, when try use program go main menu. help. public static void main(string[] args) { int opcion=0; double[][] m; do{ m=new double[0][0]; opcion=integer.parseint(joptionpane.showinputdialog(null,"el programa permite:\n1.ingresar inventario\n2.calcular inventario\n3.salir")); switch(opcion){ case 1: m=metodos.llenarmatriz(); metodos.imprimir(m); break; case 2: double[][] r=metodos.calcularinventario(m); metodos.imprimir(r); break; } } while(opcion!=3); } } here 2 methods: public static double[][] calcularinventario (double[][] x){ double fac,n=0; int filx; filx=x.length; double [][] c=new double[filx][3]; for(int i=0;i<x.length;i++){ for(int j=0;j<x[i].length

php - how to sent the ANY operand mysql -

so have 2 tables users (idn,rop) , search_info (idn, location, age) (idn - key column ) need collect , count rows database have correct type(rop) , correct information (location , age). so php : $location = $_post['location']; $age = $_post['age']; $type=$_session['type']; so make mysql code...it doesn't select raws count them. know query not used anymore, used educational purpose. $search_result= mysql_query(" select count(a.idn) users left join info_search b on a.idn = b.idn a.rop='$s_type' , b.location = '$location' , b.age = '$age' "); $search=mysql_fetch_array($search_result); so can see code working here staff. sent location 1, 2 or 3 , otherwise 0. if location == 0 grab database rows regardless location (in other words - location). similar age. possible realize on mysql? how change variable mysql grab location? , last question in code. i'm

c# - Threads locked in TraceSource methods by Console -

i've run situation , don't know if can resolved. i've started adding tracesource , trace statements multithreaded service, , i'm running locks in threads process trace methods in code. causing entire app hang. my service configured run within console window debugging purposes. know related issue writing consoletracelistener . this locking seems occur between external code , internal call console.readkey() . example of code , configuration, application may make calls such these within async methods: class myservice : servicebase { static tracesource trace = new tracesource("mysource"); void asyncmethod1() { trace.traceinformation("some useful information."); } void asyncmethod2() { trace.traceinformation("some other useful information."); } /// other members , methods ... } the tracesource defined in app.config file as <?xml version="1.0" encoding="utf-

node.js - Mongodb version specified in package.json fails to install -

if npm install mongodb , desired version of mongodb installed without problem: - bson@0.1.5 node_modules/mongodb/node_modules/bson mongo-invoices@0.0.0 /home/lorencm/downloads/mongo-invoices └─┬ mongodb@2.1.6 ├── es6-promise@3.0.2 ├─┬ mongodb-core@1.3.1 │ ├── bson@0.4.21 │ └─┬ require_optional@1.0.0 │ ├── resolve-from@2.0.0 │ └── semver@5.1.0 └─┬ readable-stream@1.0.31 ├── core-util-is@1.0.2 ├── inherits@2.0.1 ├── isarray@0.0.1 └── string_decoder@0.10.31 as have dependencies in package.json stored (see below) , use npm install fails (see below) install mongodb@2.1.6 , instead installs mongodb@1.1.11 : { "name": "mongo-invoices", "version": "0.0.0", "description": "open-source invoice system build on node.js , mongodb", "main": "app.js", "dependencies": { "accounting": "~0.4.1", "bcrypt-nodejs": "0.0.3", &q

javascript - how to pass jquery date parameters in php -

please me.. have following codes.. //get value of start , end of week $('#weeklydatepicker').on('dp.change', function (e) { var value = $("#weeklydatepicker").val(); var firstdate = moment(value, "mm/dd/yyyy").day(0).format("mm/dd/yyyy"); var lastdate = moment(value, "mm/dd/yyyy").day(6).format("mm/dd/yyyy"); $("#weeklydatepicker").val(firstdate + " - " + lastdate); }); now want pass firstdate , lastdate php. how should this. , how can retrieve passed value in php. i'm not familiar javascripts. hope can me. in advance. here full code.. js tags <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.css" rel="stylesheet" <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment

Azure AD B2C AuthenticationResponseChallenge -

i'm working on azure ad b2c last few days, got sample , made running. issue facing aad b2c issue point #3, valuable comment in question may solve problem. example running fine me when implemented in solution, after giving aad b2c credentials i'am ending with: private async task onredirecttoidentityprovider(redirecttoidentityprovidernotification<openidconnectmessage, openidconnectauthenticationoptions> notification) { policyconfigurationmanager mgr = notification.options.configurationmanager policyconfigurationmanager; if (notification.protocolmessage.requesttype == openidconnectrequesttype.logoutrequest) { openidconnectconfiguration config = await mgr.getconfigurationbypolicyasync(cancellationtoken.none, notification.owincontext.authentication.authenticationresponserevoke.properties.dictionary[startup.policykey]); notification.protocolmessage.issueraddress = config.endsessionendpoint; } else

android - Can not create the AVD in eclipse+adt bundle -

also, don't have android device manager adt bundle. the ok button disabled , not create avd please suggest can done either have download new adt-bundle or can done in current scenario? for ok button disabled issue, had not installed system images under $your_sdk_installation_dir/system-images/ which required emulation , related configurations, hope helps.

Reading a text file and inserting numbers into array in C -

i'm starting learn c myself. i've been trying learn of other languages myself (such java, html, css). anyways have basic question regarding inserting text file of numbers int array. this how i'm starting (let me know if i'm doing wrong). i created text file using linux command prompt: cat > input.txt i entered random numbers of choosing input.txt: 14 21 78 14 i want load numbers input.txt somehow array made in arraytest.c file. here array made: main() { int num[100]; // array want insert numbers input.txt } void readnumbers() { // function reads numbers /* not sure how start -- nice */ } void displaynumbers() { // function displays numbers in output printf("your numbers are:\n", num[1], num[2], num[3], num[4]); // example and output display so: your numbers are: 14 21 78 14 i've been looking @ tutorials , can't seem it. look @ documentation file opertions; fopen, fread, , fclose. these let code access contents of fil

JQuery Templates: pass html parameter into a function -

i have jquery template: $.tmpl('<p>${text}</p>', { text: 'cool text' }).appendto('div'); works great. want pass html parameter it, following won't work. $.tmpl('<p>${text}</p>', { text: '<span>cool text</span>' }).appendto('div'); any suggestions? you can use {{html content}} construct $.tmpl('<p>{{html text}}</p>', { text: '<span>cool text <b>bold</b></span>' }).appendto('div'); span { color: red; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.js"></script> <div></div>

javascript - Why an object key's first value is treated as a string - AngularJs -

i have object named "param" , has key named "item[]". values of item[] inserted dynamically. problem when "item[]" has single value, treats value string , not first index of array. example : item[]="123"; but when has multiple values treats array desired, example- item[] = ["123","456"]; i want single value index of array item[] = ["123"] how ? p.s. - object created querystring parameters http://example.com/def?item[]=123&item[]=456 , when extract querystring, returns these parameters keys of object i extracting querystring in way(javascript)- var param = $location.search(); console.log('param'); console.log(param);//returns object{item[]=[2]} in console this because variablename[] not javascript syntax. since not recognise [], part of name if not throw error. to create array, have 2 possibilities : //contsructor var ar = new array(); //empty array //literal

android - Checkbox choice changed when listview expanded -

Image
i checked first 3 checkbox on expandablelistview . why when expand listview last checkbox checked? private arraylist<group_items> setalldata() { string group_titles[] = { "payment of employer , employees contribution", "monthly return filing in form 5 , declaration in form 2", "monthly return filing in form 10", "monthly return filing in form 12", "statement of recovery contractor", "annual return in form 6a", "renewal of contribution card of employee filing form 3 & 3a", "submission of contribution card of employees leaving services" }; string child_info[] = { "we have deployed secured web services framework in accordance oasis standards. please refer user manual (secured web service user manual) under section , necessary changes @ end start consuming same. exist

c# - The OperationContractAttribute declared on method 'method' in type 'service' is invalid. in wcf -

i trying make wcf service in visual studio can see here: [servicecontract] public interface ireportsrc{ [operationcontract] list<tblarticle> returnarticlelist(); [operationcontract] int returnarticlelistcount(); [operationcontract] list<tblpayment> returnpaymentlist(); [operationcontract] int returnpaymentsum(); [operationcontract] list<tblnew> returnnews(); [operationcontract] list<tbluserinfo> returnusers(); [operationcontract] int returnuserscount(); [operationcontract] list<tbluserinfo> returnreviewers(); [operationcontract] list<tblsponsor> returnssponser(); } so implement interface can see in service : [aspnetcompatibilityrequirements( requirementsmode = aspnetcompatibilityrequirementsmode.allowed)] public class reportsrc : ireportsrc { dbli

performance testing - How to do correlation on dynamic parameter that are occuring in request and not in response in JMETER? -

i developing mobile script using jmeter. i.e trying record , replay mobile web applications using jmeter 2.9 , firefox 43.0.4 i able record application. throws error during replay, dynamic parameter passed post data below: post data: skin=&skinloaderchecksum=&isajaxrequest=true&**x=****0.7379947959390617** when checked same flow in load runner, same failure occurs on same url again. in load runner: http status-code=500 (internal server error) , {"errorcode":"unexpected_error","errormsg":"fwlse0009w: user identity null. check application''s authentication requirements. these settings must match deployed application [project mobile]"} in jmeter: response headers:http/1.1 401 unauthorized in sampler result , in response data: / -secure- {"challenges":{"wl_antixsrfrealm":{"wl-instance-id":"geqcaecehouktkfn0rfqmmdu6"}}} / is able this? responses highly apprec

excel - Error when opening XLSX file made by tealeg xlsx in Go language on Google App Engine -

i'm using https://github.com/tealeg/xlsx generate xlsx file in go language. application running on google app engine. var file *xlsx.file var sheet *xlsx.sheet var row *xlsx.row var cell *xlsx.cell var err error file = xlsx.newfile() sheet, err = file.addsheet("test") if err != nil { fmt.printf(err.error()) } row = sheet.addrow() cell = row.addcell() cell.value = "i cell!" w.header().set("content-type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") w.header().add("content-disposition", "attachment; filename=test.xlsx") file.write(w) fmt.fprint(w, nil) the variable w http.responsewriter. i have tested code , browser downloaded xlsx file , can open libreoffice on linux 64 bit. when tried open file microsoft excel 2010 on windows 7 32 bit, gave me following error message:- excel found unreadable content in 'test.xlsx'. want recover contents of workbook? if trust source of wor

java - Saving and restoring an ArrayDeque onSaveInstanceState -

i working on video app thats uses arraydeque store our history of videos viewed, using push, pop. works i'm looking clean way of saving , restoring arraydeque private deque<programmodel> mvideohistory = new arraydeque<>(); i save list saving arraylist. @override public void onsaveinstancestate(final bundle outstate) { // save history arraylist<programmodel> history = new arraylist<>(); (programmodel program : mvideohistory) { history.add(program); } outstate.putparcelablearraylist("videohistory", history); } then restore it if (savedinstancestate != null) { // restore history arraylist<programmodel> history = savedinstancestate.getparcelablearraylist("videohistory"); mvideohistory = new arraydeque<>(history); } can done in more efficient/cleaner way this? ive tried outstate.putserializable("videohistory", mvideohistory.toarray()); restoring caused

visual studio - C++ will not create a file to output text to? [SOLVED] -

so, have here simple snippet of c++ code merely askes filepath, checks if filepath exists, , if does, program closes. if doesn't, creates file , writes text it. path enter c:\temp.txt, no matter path use result same: no file created. using visual studio 2010. string outfile = ""; cout << "enter file path output file not exist already: "; cin >> outfile; ofstream file_writer; file_writer.open(outfile, ios_base::out | ios_base::in); if (!file_writer.fail()) { cout << "this file exists already!" << endl; cout << strerror(errno) << endl; system("pause"); return 255; } file_writer << "hello!"; file_writer.close(); you try: string outfile = ""; cout << "enter file path output file not exist already: "; cin >> outfile; ofstream file_writer; file_writer.open(outfile, ios::in); if (file_writer.good()) { //this checks if file exists

java - The method sipHash24() is undefined for the type Hashing -

i trying use siphash24() hashing function google guava, , gave following error, the method siphash24() undefined type hashing i have included guava dependency in pom.xml <dependency> <groupid>com.google.guava</groupid> <artifactid>guava</artifactid> <version>19.0</version> </dependency> i tried include siphash24() in following way - hasher metahash = hashing.siphash24().newhasher(); instead of siphash24() , other hashes such murmur3_128() or md5 allowed, want use siphash24() only 64 bit hash in given list. i able use siphash in project of mine, built project using gradle. sounds have 2 versions of guava on classpath, 1 hashing.siphash24() (>= guava 15.0) , 1 without (< guava 14.0).

inheritance - Why java doesn't allow final class to be inherited? -

this question has answer here: good reasons prohibit inheritance in java? 11 answers as know, can't inherit final class in java want know why java doesn't allow so? reason behind it? final means "do not inherit me" (in context, has other meaning in different contexts). the reason developers mark class final optimizations. either can guarantee variables of class , jit can take advantage of can avoid more expensive virtual calls , rather inline methods directly.

java - Converting JavaFx project to .exe and .app in Netbeans -

this question has answer here: how can convert java program .exe file? [closed] 13 answers i developing desktop app in javafx mac , windows , want distribute users not .jar file. want distribute installer file both mac , windows. i have read @ forums , in stackoverflow can export project .exe windows , .app mac using neatbeans not able find how it. is possible through netbeans create .exe , .app files ?? i have neatbeans 8. can see ways convert .exe using apps, .app or .dmg not able find anything. there tools available jartoexe etc..please refer similar discussion [ compiling java program executable also can create batch file while execute jar. soemthing this java -jar "myapp.jar"

How do I restrict java function usage in intellij? -

i have project more 100 java classes. case is: - have button.java, dropdown.java, checkbox.java, listbox.java.... - also, business class represent page web app custom functions , mapping button.java , dropdown.java - want able use functions button , dropdown an example: public class fieldsproperties extends rhregion{ public static void setproperties(string strmap){ hashmap<string, string> mapproperties = getmapproperties(); if(strmap.equals("properties")){ mapproperties = uisummary.getproperties("uisummary"); } setmapproperties(mapproperties); rhregion.setproperties(strmap); } } so in scenario want allowed functions uisummary.java or notified if used class you can use illegaltype rule checkstyle : checks particular classes never used types in variable declarations, return values or parameters. rationale: helps reduce coupling on concrete classes. simply add classes list o

javascript - Player facing away from the wall should not collide -

i'm working on first javascript game. top down 2d view (think gta 1/2). i'm having trouble collision detection. have multiple entities 1 player , other static object (let's wall simplicity). each object has x/y coordinates , player has velocity , angle (which way player facing 0-360 degrees). collision detection against wall works fine , stop velocity on 1 of axis if player collide having result player can "slide" agains wall. now issue: once player collides agains wall movement on 1 of axis stopped. if player after turns around , facing away wall movement of axis still stopped since ha collided. i player, if facing away object, free move how want's how achieve this? guess need figure out way player facing , if facing against or away object? for( var = 0; < game.entities.length; i++ ) { if( this._collision( game.entities[i] ) ) { var distancex = game.entities[i].x - this.x; var distancey = game.entiti

wordpress - MySql how to avoid having to create temporary tables -

i'm new sql , have query need use through wordpress plugin ( wp data tables ) plugin doesn't allow creation of temporary tables. to work around believe have create new tables within join i'm not sure how this. the query need remove creation of table is: create temporary table if not exists _surveydata (select _reftable.refid, _reftable.clientref, _reftable.sitename, _jobtable.jobid, _jobtable.jobtypeid, _jobtable.jobcloseddate _reftable, _jobtable _reftable.refid = _jobtable.refid , _jobtable.jobtypeid = 1); create temporary table if not exists _installdata (select _reftable.refid, _reftable.clientref, _reftable.sitename, _jobtable.jobid, _jobtable.jobtypeid, _jobtable.jobcloseddate _reftable, _jobtable _reftable.refid = _jobtable.refid , _jobtable.jobtypeid = 2); select _reftable.refid, _reftable.clientref, _reftable.sitename, _surveydata.jobid, _surveydata.jobcloseddate

Amazon AWS Cloudformation JSON template to assign the LAMP www/html folder permissions to ec2-user -

i have created json template create amazon aws lamp stack rds (free tier) , succeffully created stack. when tried move files var/www/html folder seems have no permission ec2-user. know changing permission of ssh. intention create template setup stack (hosting environment) without using ssh client. also know how add file or copy zipped source var/ww/html cloudformation json templating. need is, create environment , later upload files using ftp client , db using workbench or something. please me attain goal, share publicly aws beginners not familiar setting things ssh. the json template bit lengthy , here link code http://pasted.co/803836f5 use cloud formation init meta instead of userdata. that way can run commands on server such pulling down files s3 , running gzip expand them. http://docs.aws.amazon.com/awscloudformation/latest/userguide/aws-resource-init.html

substr - How to remove all data after last dot using php? -

how remove data after last dot using php ? i test code. it's echo aaa i want show aaa.bbb.ccc how can ? <?php $test = "aaa.bbb.ccc.gif"; $test = substr($test, 0, strpos($test, ".")); echo $test; ?> you can try - $test = "aaa.bbb.ccc.gif"; $temp = explode('.', $test); unset($temp[count($temp) - 1]); echo implode('.', $temp); o/p aaa.bbb.ccc strpos — find position of first occurrence of substring in string you need use strrpos strrpos — find position of last occurrence of substring in string $test = "aaa.bbb.ccc.gif"; $test = substr($test, 0, strrpos($test, ".")); echo $test; o/p aaa.bbb.ccc

android - I can't set repeating of AlarmManager using setExact() -

i tried set repeating alarmmanager using setexact. in activity: alarmmanager alarmmanager = (alarmmanager) getsystemservice(context.alarm_service); intent intent = new intent(this, alarmreceiver.class); intent.setaction(action_alarm_retry); pendingintent sender = pendingintent.getbroadcast(this, 0, intent, pendingintent.flag_cancel_current); alarmmanager.setexact(alarmmanager.rtc_wakeup, 7000, sender);` and in receiver after operations have: public void onreceive(context context, intent intent){ //here operations... alarmmanager alarmmanager = (alarmmanager) context.getsystemservice(context.alarm_service); intent intent = new intent(context, alarmreceiver.class); intent.setaction(action_alarm_retry); pendingintent sender = pendingintent.getbroadcast(context, 1, intet, pendingintent.flag_cancel_current); alarmmanager.setexact(alarmmanager.rtc_wakeup, 7000, sender); } but repeats time without foggiest pause... please!

objective c - IOS: getting the value of "id" along with an item is selected through table view -

in project response data in form of { "procedures": [5950] 0: { "procedures": { "id": "1" "procedure_name": "3d render w/o postprocess" "procedure_code": "76376" } } 1: { "procedures": { "id": "2" "procedure_name": "3d rendering w/postprocess" "procedure_code": "76377" } there 5950 elements in data array. create separate arrays "id" , "procedure_name" , show data in uitableview displays correct data id. applied search functionality filter data difficult find element in 5950 elements scrolling. search function works when select uitableviewcell of filtered result doesn't provide actual id of element whereas returns current indexpath value of uitableview . searching put following code

python - How to continue after receiving None response from xml parse -

i finding prices of products amazon using api bottlenose , parsing xml response beautifulsoup. have predefined list of products code iterates through. code: import bottlenose bn import lxml bs4 import beautifulsoup = 0 amazon = bn.amazon('myid','mysecretkey','myassoctag',region='uk',maxqps=0.9) list = open('list.txt', 'r') print "number", "new price:","used price:" line in list: = + 1 listclean = line.strip() response = amazon.itemlookup(itemid=listclean, responsegroup="large") soup = beautifulsoup(response, "xml") usedprice=soup.lowestusedprice.amount.string newprice=soup.lowestnewprice.amount.string print , newprice, usedprice this works fine , run through list of amazon products until gets product doesn't have value set of tags, like no new/used price. at python throw response: attributeerror: 'nonetype' object has no attribute