Posts

Showing posts from June, 2014

java ee - GlassFish deployment of ear file fails due to archive type of ear not recognized -

i researching creating ‘ear’ file deployment of web application websphere. i using intellij 2017.2, glassfish 5.0, java 8 update 144, , java se development kit 8 update 144. following intellij ‘developing java ee application’ instructions created , deployed war file. after creating ear file deploying fails with: artifact jhw:ear: error during artifact deployment. see server log details. artifact jhw:ear: java.io.ioexception: com.sun.enterprise.admin.remote.remotefailureexception: ‘archive type of c:\...\jhw_ear.ear not recognized.’ this failure same whether run deployment in intellij or use command line deploy glassfish. i have found no articles describing error.

c# - Disable only the link part of a ASP.Net LinkButton -

i have asp.net linkbutton in repeater. in conditions on rows i'm trying disable link of button acts more label, other rows link fires off itemcommand event. what solution this? i'm trying avoid having 2 separate control on page handle pretty same thing. anyone have experience this? wire itemdatabound event repeater. in each item, find link button, , use method on solution disable link button on item item basis how disable link button?

python - Repeatedly try to download data from web using pandas_datareader try again -

i downloading stock data using pandas_datareader. however, sometimes, perhaps due bad internet connection, no data received @ first try. there way re-try download without running command again? here's error message: traceback (most recent call last): file "", line 25, in file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/site-packages/pandas_datareader/data.py", line 121, in datareader session=session).read() file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/site-packages/pandas_datareader/yahoo/daily.py", line 115, in read df = super(yahoodailyreader, self).read() file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/site-packages/pandas_datareader/base.py", line 181, in read params=self._get_params(self.symbols)) file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/site-packages/pandas_datareader/base.py", line

java - Authenticate a Springboot Application against another application using Basic Auth -

how can authenticate spring boot application against third party application? according examples implementing basic auth using spring security, user , password validated want validate against 200 response service. here's how user can authenticated: user sends credentials basic auth access springboot rest service -> springboot service makes request basic auth header third party service -> receives 200 ok , authenticate end user access urls on rest service. @configuration @enablewebsecurity public class springsecurityconfig extends websecurityconfigureradapter { @autowired private authenticationentrypoint authentrypoint; @override protected void configure(httpsecurity http) throws exception { http.csrf().disable().authorizerequests() .anyrequest().authenticated() .and().httpbasic() .authenticationentrypoint(authentrypoint); } @autowired public void configureglobal(authenticationmana

excel - IF(ISBLANK(V4),"",TODAY()-V4) for the Day Past Due -

Image
i trying have weekly schedule keeps count of days past due , stops when days count surpass 90, every time day count exceeds 7 in given week, number moves 1 cell right , still tally until 90 days (13 weeks). i have if(isblank(v4),"",today()-v4) for day past due. and weekly past due it’s =if(isblank(v4)-today()<7,v4,""); =if(isblank(v4)-today()<14,v4,"")… can me? in first cell put min in w4: =if(v4<>"",min(today()-$v4,7),"") then in x4 put: =if(w4=7,min((today()-$v4)-sum($w4:w4),if(column(b:b) = 13,6,7)),"") and copied on 12 columns

Video generation with png frame with random name - Linux -

i have folder contains .png pictures named in following way: name_number.png however number written in scientific way ( 1, 1e1, 1e2 ). i create video, command line, combination of of them. is there command linux takes consideration scientific name? should rename them command , generate video? with ruby can tackle way: def rename_sci(name) name.sub(/(\d+e\d+)/) |m| '%.0f' % $1.to_f end end %w[ test_1e1.png test_1e2.png ].each |name| puts '%s -> %s' % [ name, rename_sci(name) ] end where output like: test_1e1.png -> test_10.png test_1e2.png -> test_100.png now can make actual renaming tool pretty easily: require 'optparse' def rename_sci(name) name.sub(/([0-9]+e[0-9]+)/) |m| '%.0f' % $1.to_f end end options = { dry_run: false } # use optionparser add --dry-run option testing program = optionparser.new |op| op.on('-y', '--dry-run', 'dry run, no renaming occur

sql - Inserting data into multiple tables at same time -

this trying do: let's have 2 tables dbo.source & dbo.destination want copy records source destination if natural key (unique non clustered) not exist in destination. if insert successful, output values temporary buffer table. next want list records source did have match in destination, , copy these buffer table. is there anyway can achieve buffer table not hold redundant data ? this current logic: step1: records source table natural key not match destination , insert destination insert these buffer table flag merge dbo.destination dest using dbo.source src on dest.name = src.name --natural key when not matched insert (xxx) values (xxx) output src.id, inserted.id, 'flaga' dbo.buffer; step2: records source table natural key matched destination insert these buffer flag insert dbo.buffer select src.id, src.name, 'flagb' dbo.source src inner join dbo.destination dest on src.name = dest.name with logic, getting redundant rows buffer, not track in

sql - Power Bi creating monthly measure from repeated monhts -

i have application database designed following way: (i cannot change it)  i need able create cash flow can tell me month, property , type amount of month is. figured need in measure in table has months need, not sure how it.  any appreciated it! link screenshot, wont let me post directly even screenshot, not entirely clear me meant repeated month. assuming if repeat_count = 2 , amount = 100 amount_wanted = 200. assuming loaded data power bi. in case need perform following steps: create calculated column holding month. can using function month(date). create calculated column amount_wanted = [repeat_count] * [amount] create new measure: new_measure = sum([amount_wanted]) create matrix visual property , type in rows, month in columns , new_measure in values.

conv neural network - Forward Propagation with Dropout -

i working through andrew ng new deep learning coursera course. we implementing following code : def forward_propagation_with_dropout(x, parameters, keep_prob = 0.5): np.random.seed(1) # retrieve parameters w1 = parameters["w1"] b1 = parameters["b1"] w2 = parameters["w2"] b2 = parameters["b2"] w3 = parameters["w3"] b3 = parameters["b3"] # linear -> relu -> linear -> relu -> linear -> sigmoid z1 = np.dot(w1, x) + b1 a1 = relu(z1) ### start code here ### (approx. 4 lines) # steps 1-4 below correspond steps 1-4 described above. d1 = np.random.rand(*a1.shape) # step 1: initialize matrix d1 = np.random.rand(..., ...) d1 = (d1 < 0.5) # step 2: convert entries of d1 0 or 1 (using keep_prob threshold) a1 = a1*d1 # step 3: shut down neurons of a1 a1 = a1 / keep_prob

python 2.7 - How to set timeouts of db calls using flask and SQLAlchemy? -

i need set timeout of db calls, , looked sqlalchemy documentation http://flask-sqlalchemy.pocoo.org/2.1/config/ there many configuration parameters, never illustrate example of how use them. show me how use sqlalchemy_pool_timeout in order set timeout of db calls? have them in .py files, don't know whether use parameter correctly. app = flask(__name__) app.config["logger_name"] = ' '.join([app.logger_name, socket.gethostname(), instance_id]) app.config["sqlalchemy_database_uri"] = config.sqlalchemy_database_uri app.config["sqlalchemy_track_modifications"] = false app.config["sqlalchemy_pool_timeout"] = 30 the document states "specifies connection timeout pool. defaults 10." , don't know unit of 10, seconds or milliseconds?

unity3d - branch.io sharesheet questions -

im using branch.io's sdk unity, im having 2 questions im hoping answer: 1: way restrict share sheet sharing apps? example apps doesn't handle links , in special sms service. reason not want ability send sms app needs permission access phone book , google play service need "privacy policy" link. 2: if not know if guys lead me in right direction when writing privacy policy because not have legal education , not know how wright it. sufficient state using sdk? demands things "you should see code secure , encrypted" (something that) though i'm using sdk , not have clue how works. thanks! there no way change list of apps share sheet in branch's unity sdk. although branch have end point exclude apps using android sdk. you need export unity 3d project android studio. once export project, can use branch android sdk endpoint exclude app providing package name of app. this sample code update share sheet: //define share sheet style share

javascript - Creating Tableau WDC from associative array -

i creating tableau web data connector described in getting started guide here . i have implemented similar solution previous data basic associative array, having trouble current api call. i make api call external web service returns json similar 1 listed below (simplified version)( comment added clarity , not part of original code). { "status": true, "employee": { "id": 123 }, "company": { "id": 123 }, "job": { "id": 123, "job_workflows": [{ "id": 1, "name": "start", "action_value_entered": "start" }, { "id": 2, "name": "date", "action_value_entered": "2017-09-11" }, { "id": 3, "name": "crew",

Copy excel workbook to new folder in Unix using SAS -

i attempting copy excel workbook 1 directory using sas code. have found many suggestions online, none seem work me. folders these files saved in windows folders, our sas server unix server path names must translated. need use macro in destination folder , path names have spaces in between names. so far simplified paths without spaces or macros , have tried: data _null_; rc=system('copy /sasdata/win_shares/corpfs01/global/data/evicore/test/workbook.xlsx /sasdata/win_shares/corpfs01/global/data/evicore/test2/workbook.xlsx'); put rc; run; and x 'copy '/sasdata/win_shares/corpfs01/global/data/evicore/test/workbook.xlsx' '/sasdata/win_shares/corpfs01/global/data/evicore/test2/test2''; where /sasdata/win_shares/corpfs01/global/ path connects our windows r: drive. i have tried various versions of these codes adding , deleting quotation marks around path names, none seem work. top code giving me return code of 127, if helpful. get comma

visual studio - xUnit showing truncated Expected and Actual in Test Explorer -

i using xunit visual studio test explorer , when there's error in assert.equal() , getting truncated version of actual , expected. for example, xunit.sdk.equalexception assert.equal() failure expected: list<result> [result { status = statusenumvalue1, message = "the request or response type contains special ty"..., path = "1234" }] actual: wherelistiterator<result> [result { status = statusenumvalue1, message = "the request or response type contains special ty"..., path = "1234" }] this test fails because message s different, given message s truncated, cannot see part different test explorer. when copy out, it's still truncated. is known shortcoming of xunit? can keep debugging test or use writeline compare message s surprised xunit framework not have way allow full response shown. tried resharper test explorer, , not solve problem. this appears limitation of visual studio. looks resolved visual

java - I am getting StaleElementReferenceException after navigating to different Page and coming back -

i getting staleelementreferenceexception after navigating different page , coming back.i have tried explicit wait,re-write locator again seems not working.any highly appreciated. select selectelement = new select(dropdown); list<webelement> alloptions=selectelement.getoptions(); (webelement eachelement : alloptions) { system.out.println(eachelement.gettext()); selectelement.selectbyvisibletext(eachelement.gettext()); clickelement(selectthisoption); enteronlinepage().dataentry; changedistrictpage(); waitfunctions.waitforpageloaded(driver); new select(dropdown); //select selectelement = new select(dropdown); alloptions=selectelement.getoptions(); } this correct behaviour! once navigate anywhere (forward , back) all webelements stale. have change logic of loop, this: select selectelement = new select(dropdown); int count = selectelement.getoptions().size(); (int = 0; < count; i++

java - How to allow request from a certain url with spring security -

i'm developing simple project in order learn spring. i've created login page , authentication management, i'm trying build registration page, i've done both backend , frontend side have problem. the button 'save' send post request path user/signup fails, network console says 302 , think security problem because if authenticate , try register user request successfull. maybe need spring security registration request must available user, unauthenticated ones. put path user/signup in spring boot doesn't works, tried using /signup @override public void configure(websecurity web) throws exception { web.ignoring().antmatchers("/script/**", "/css/**", "/getregisterpage","user/signup"); } this project: https://github.com/stefanopisano/expenses (branch 0.2) @override protected void configure(httpsecurity http) throws exception { http.authorizerequests() .antmatchers("/s

email - Cant send php mail but no error is shown -

this question has answer here: setting ubuntu/apache/php machine send email 5 answers php mail function doesn't complete sending of e-mail 22 answers hi, i running centos 7 cant send php mail. dont error whatsoever. mail wont reach destination. this script: <?php date_default_timezone_set('america/los_angeles'); mb_internal_encoding('utf-8'); if(isset($_post['submit'])){ $name=$_post['name']; $email=$_post['email']; $subject=$_post['subject']; $to = $_post['target']; $message = $_post['message']; $from_name = mb_encode_mimeheader($name,'utf-8'); $headers = "mime-version: 1.0\r\n"; $headers .= "content-type: text/html; charset=utf-8\r\n"; $headers .= "to: $name <$to

git - Why can't I "check out from version control" on PhpStorm using GitLab -

i've paid gitlab, , managed import codebase webserver using git command line gubbins. i've installed phpstorm on windows laptop, , want import files gitlab. i click on "check out version control". i select "git" i paste https://gitlab.com/myname/projectname top field i hit test - says connection established. i hit clone - nothing, dumps me before clicked on "check out version control" button. what have misunderstood, or doing wrong? i hadn't installed git on windows. phpstorm bit flawed here, if tried clone github correctly gives warning git.exe isn't installed. when specifying git doesn't give same warning.

javascript - ParsleyJS custom validator always fails the validation -

https://codepen.io/joshuajazleung/pen/jgeyna <form data-parsley-validate> <input type="file" name="files" multiple data-parsley-max-files="4"> <button type="submit">submit</button> </form> window.parsley .addvalidator('maxfiles', { requirementtype: 'integer', validatenumber: function(value, requirement) { return true; }, messages: { en: 'maximum number of files 4.', } }); the file input supposed invalid time because validator return true (for testing purposes). when clicked submit button, input isn't valid. wondering why?? it's because value of input not valid number (ever) , defined validatenumber . need define validatestring . to validate files, inspire custom validators example

c# - instead of downloading Open pdf in browser(using itext) mvc -

this question has answer here: pdf downloading directly in google chrome — how display in browser window instead? [closed] 1 answer i able download , store pdf document being generated instead of downloading want open in browser. have memorystream os = new memorystream(); pdfwriter writer = new pdfwriter(os); var pdfdocument = new pdfdocument(writer); using (var document = new document(pdfdocument)) { //i adding different sections here } var response = new httpresponsemessage { statuscode = httpstatuscode.ok, content = new bytearraycontent(os.toarray()) }; response.content.headers.add("content-type", "application/pdf"); response.headers.add("content-disposition", "attachment;filename=" + "testpdf.pdf"); return response; the response further being sent controller , there being downloaded want open in n

environment variables - Using rake to run a file -

i have environment variables of app in file this: export variable=value ... etc when run tests, have remember run file before, or tests fail. created task in rakefile automatically run file before running tests. not working. i tried this: task :env_test { sh('source ./credentials/.env_test') } but error: source ./credentials/.env_test rake aborted! command failed status (127): [source ./credentials/.env_test...] i tried: task :env_test { `source ./credentials/.env_test` } and got: rake aborted! errno::enoent: no such file or directory - source i tried: task :env_test { `. ./credentials/.env_test` } for tests using environment variables fail. finally tried: task :env_test { `./credentials/.env_test` } and again tests fail. what doing wrong?

javascript - Trigger scroll to animate on Safari -

currently have gallery when clicked on correct menu appears animation. works fine on desktop, when used on iphone needto scroll items appear. it works in desktops because trigger scroll when clicked on menu, don´t know why changes on safari iphone. <div class="offset-top-60 inset-left-15 inset-right-15 inset-md-left-0 inset-md-right-0"> <!-- responsive-tabs--> <div data-type="horizontal" class="responsive-tabs responsive-tabs-classic" > <ul data-group="tabs-group-default" class="resp-tabs-list tabs-1 text-center tabs-group-default"> <li class="rtabs">propiedades</li> <li class="rtabs">comunicación</li> <li class="rtabs">cuotas</li> <li class="rtabs">amenidades</li> <li class="rtabs">eventos</li>

cygwin.bat Disappeared from Windows7 Machine -

i using cygwin testing, , @ point needed close open window , reopen start over. when clicked on desktop shortcut got message said 'cygwin.bat has changed or moved'. any idea possibly could've happened , if can recovered from? cygwin.bat created cygwin setup . run setup again re-create it.

r - How to use unique function with blank/missing values -

how possible make below data frame rows uniquely depend on second column when there blank/missing values? > head(interproscan) v1 v14 1 sp0000001-mrna-1 2 sp0000001-mrna-1 3 sp0000001-mrna-1 4 sp0000005-mrna-1 go:0003723 5 sp0000006-mrna-1 go:0016021 6 sp0000006-mrna-1 go:0016021 > head(unique(interproscan[ , 1:2] )) v1 v14 1 sp0000001-mrna-1 4 sp0000005-mrna-1 go:0003723 5 sp0000006-mrna-1 go:0016021 7 sp0000006-mrna-2 go:0016021 9 sp0000006-mrna-3 go:0016021 the aim be: v1 v14 1 sp0000001-mrna-1 4 sp0000005-mrna-1 go:0003723 5 sp0000006-mrna-1 go:0016021 thank in advance try data frame or data table: inter

layout - android.view.InflateException: Binary XML file line #8: Error inflating class android.widget.ImageView -

i'm getting below error in xml file of android project. android.view.inflateexception: binary xml file line #8: error inflating class android.widget.imageview i've seen this solution can't understand/ doesn't in project. there problem xml file? or need work on activity file? i'm getting error while adding custom navigation drawer. here error 09-14 04:23:53.841 22880-22880/? e/androidruntime: in writecrashedappname, pkgname :info.androidhive.navigationdrawer 09-14 04:23:53.851 22880-22880/? e/androidruntime: fatal exception: main process: info.androidhive.navigationdrawer, pid: 22880 java.lang.runtimeexception: unable start activity componentinfo{info.androidhive.navigationdrawer/info.androidhive.navigationdrawer.activity.splashscreen}: android.view.inflateexception: binary xml file line #8: error inflating class android.widget.imageview @ android.app.activitythread.performlaunchactivity(activitythread.java:2195) @ android.app.activitythread.handl

Application Initialization in Azure Function Project in VS2017 15.3.4? -

in visual studio 2017 latest update, azure functions template, want can initialize program.cs in webjobs template. i trying create new subscription new namespace manager when application initializes can listen 1 service bus topic. is there way that? if yes how? for azure functions template, want can initialize program.cs in webjobs template. as far know, azure functions not have support right now. can find a similar question : question: i have c# function , want know if there initialization point. have dependency injection containers need initialization , want know that. mathew's reply we don't have story right now. please see open issue here in our repo discussed.

java - How to get the values on operand stack which the JVM instruction operates on with Javassist? -

javassist provides codeiterator editing code attribute, can used transverse instructions in method. for jvm instruction, follows specification : mnemonic operand1 operand2 ... different binary assembly, stack-based jvm instructions takes value on operand stack. take ifge example. instruction has following format if<cond> branchbyte1 branchbyte2 ifge succeeds if , if value on stack ≥ 0, branchbyte1 , branchbyte2 targets of jump. my question is, can value on operand stack using javassist? the answer javassist.bytecode.analysis module. according jvm specification, frame used store data , partial results. each frame has own array of local variables, own operand stack, , reference run-time const pool. in javassist.bytecode.analysis.frameprinter , funciton print shows how print each frame @ each instruction. /** * prints instructions , frame states of given method. */ public void print(ctmethod method) { stream.println("\n" + getmethod

go - Golang cannot find/use vendor folder -

does have clue why _ in front of $gopath , $goroot when import github.com/juju/errors e.g. repo structure -$gopath/src/github.com/codelingo/lexicon/vendor -$gopath/src/github.com/codelingo/lexicon/codelingo/ast/go/src/main.go -$gopath/src/github.com/codelingo/lexicon/codelingo/ast/go/src/node/node.go main.go line number 1 package main 2 3 import ( 4 "encoding/json" 5 "fmt" 6 "os" 7 "strings" 8 9 "github.com/juju/errors" 10 11 "./key" 12 "./node" 13 "./parser" 14 "./property" 15 "./util" 16 ) // rest of main.go node.go line number 1 package node 2 3 import ( 4 "encoding/json" 5 "github.com/juju/errors" 6 "reflect" 7) //rest of node.go $ go run main.go node/node.go:5:2: cannot find package "_/home/jzhu/go/src/github.com/codelingo/lexicon/codelingo/ast/go/src/vendor/github.com/juju/errors" in of: /usr/local/

hive - Decimal type columns in Spark -

i have questions regarding decimal type columns. i not understand why got decimal type columns, , got double type column. i did division operation in spark sql, looks like: select a/b c table is because small number generated in data, spark determine column type decimal type? i got error when trying save table hive, using saveastable method: java.lang.unsupportedoperationexception: parquet not support decimal.hiveexception: java.lang.unsupportedoperationexception: parquet not support decimal. see hive-6384 what should do? convert column type double? there automatic way handle this, or tell spark use double type instead of decimal type @ time?

Using POST parameters in WordPress functions.php -

i need use get_header action hook onto functions.php, can check if request being sent proper page, @ point in time, $_post empty, because of redirect. there way somehow pass info function: add_action('get_header', 'handle_app_post');

api - Spotify Audio Analysis Endpoint - what do the 'Timbre' values represent? -

endpoint documentation: https://developer.spotify.com/web-api/get-audio-analysis/ what these values in 'timbre' array represent? believe spotify got lot of analysis echo nest when acquired it, can't find there either. "timbre": [ 23.312, -7.374, -45.719, 294.874, 51.869, -79.384, -89.048, 143.322, -4.676, -51.303, -33.274, -19.037 ]

Where does the linux finger command get info the user? -

i trying understand linux finger command information email, plan , other stuff ? i've tried googling answers find information command , not how. does connect default linux email server etc? thank you shabir

Python mysql output from function not working -

i'm relatively new @ python have more experience in java, understand of concepts. however, keep having issues mysql , passing information function using mysql use in function later. i need make complex mysql queries multiple return field, don't want running multiple sql queries each sql field smash database. saying below small example of i'm trying achieve. i wanted function run sql query (def connectory_mysql()) took parameters elsewhere, (this part works) take output of sql query , pass main function use. main function needs use different column results of sql query different parameters. i can return result , assign result1 appears , looks dictionary when printed, i'm unable split/use different keys or data result1 = connector_mysql(subserialnum, ldev, today_date) if splituse keys in dictionary in sql function before returning ie ldev_cap = result['ldev_cap'] can print individual elements within sql function... however, cant seem pass parameters m

How to plot a magnitudes of a value in a vector against latitude and longitude in MATLAB? -

i have list of velocities collected along ship track. plot magnitudes of velocities against latitude , longitude coordinates of point @ data collected? ideas on how plot this? pcolor wouldn't work because velocities data vector. thank you.

python - I wanna assign trunsaction_id each user_id -

i wanna assign trunsaction_id each user_id.now user model is class user(models.model): trunsaction_id = models.uuidfield(primary_key=true, default=uuid.uuid4, editable=false) regist_date = models.datetimefield(auto_now=true) user_id = models.charfield(max_length=200,null=true) name = models.charfield(max_length=200,null=true) age = models.charfield(max_length=200,null=true) when run code,trunsaction_id assigned in turn of registration. possible assign trunsaction_id each user_id?if answer yes,i wanna know way. example,if user_id 1,trunsaction_id 1 of connected user_id &trunsaction_id in under score 1_randomly trunsaction_id .is possible?if answer no,is there way assign trunsaction_id each user_id? it's not clear trying accomplish. if trying use composite primary key, not supported django. see documentation here . if trying column 2 fields combined, try solution below. however depending on need may better off doing in querysets. please

c# - How does BackgroundWorker decide on which thread to run the RunWorkerCompleted handler? -

i trying figure out how bgw decides thread run runworkercompleted handler when work done. my initial test uses winform application: on ui thread, start bgw1.runworkerasync() . tried start bgw2.runworkerasync() through bgw1 in 2 different places: bgw1_dowork() method or bgw1_runworkercompleted() method. my initial guess bgw should remember thread started on , return thread execute runworkercompleted event handler when work done. but test result strange: test 1 if start bgw2.runworkerasync() in bgw1_runworkercompleted() , bgw2_runworkercompleted() executed on ui thread. ui @ thread: 9252 bgw1_dowork @ thread: 7216 bgw1_runworkercompleted @ thread: 9252 <------ same ui thread 9252 bgw2_dowork @ thread: 7216 bgw2_runworkercompleted @ thread: 9252 bgw1_dowork @ thread: 7216 bgw1_runworkercompleted @ thread: 9252 bgw2_dowork @ thread: 1976 bgw2_runworkercompleted @ thread: 9252 bgw1_dowork @ thread: 7216 bgw1_runworkercompleted @ thread: 9252 bgw2_dowork @ th

data structures - Using a SymbolTable in Java to Play Short Song -

i'm using java play short song , have create symbol tables out of input text file, have feeling i'm doing wrong assigning keys , values, i'm not sure i'm doing wrong. when run program make sound audio file going start , stops why think key value pairs incorrect. appreciated, here code: package program2; import algs31.binarysearchst; import stdlib.stdaudio; import stdlib.stdin; public class playsimplesong{ public static void main(string[] args) { stdin.fromfile("data/notes_frequencies.txt"); binarysearchst<string, double> nf = new binarysearchst<>(); string key = stdin.readline(); string[] lines = key.split("\\s"); string notes = lines[0]; double frequency = double.parsedouble(lines[1]); nf.put(notes, frequency); stdin.fromfile("data/sample_simple_song.txt"); binarysearchst<string, double> ss = new binarysearchst<>(); string song = std

r - How to create new rows dependent on other rows -

this question has answer here: split delimited strings in column , insert new rows [duplicate] 6 answers split comma-separated column separate rows 4 answers i have following table: sp0000001-mrna-1 sp0000005-mrna-1 go:0003723 sp0000006-mrna-1 go:0016021 sp0000007-mrna-1 go:0003700|go:0006355|go:0043565 the aim generate new rows go ids separated | . above example lead 2 more rows sp0000001-mrna-1 sp0000005-mrna-1 go:0003723 sp0000006-mrna-1 go:0016021 sp0000007-mrna-1 go:0003700 sp0000007-mrna-1 go:0006355 sp0000007-mrna-1 go:0043565 how possible r? thank in advance

sql - Finding Substring in Bigquery -

how find substrings in bigquery? couldn't find function supports firing queries 'substring(column_name,3,7)'. there way out achieve same functionality in bigquery? #standardsql yourtable ( select 'finding substring in bigquery' column_name ) select substr(column_name, 9, 12) yourtable so substr(value, position [, length]) use see string functions more

server side - Updating CloudKit Public Database from a Third-Party API -

i create script run around clock updating public database of cloudkit third party api. new me, have never implemented server-side logic before, , documentation aspect of cloudkit sparse. can point me in right direction? write code somehow stored in cloudkit via dashboard? code written in js? there examples shed light on process? not looking work me, don't know put code @ point, advice extremely helpful in getting started.

matlab - How to create a plot with the negative values of a noisy signal? -

Image
so have generate cos fuction 0 2 pi added gaussian noise 0 mean , standard deviation of .5 have create different plots for: a) signal noise , signal without noise this i've done: clear close % plot cos function 0 2 pi x = linspace(0, 2*pi, 1000); y1 = cos(x); noise = .3*randn(1,1000); prob1a = y1 + noise; figure plot(x, y1, x, prob1a) b) plot negative values of noisy signal c) plot positive values of noisy signal i need parts b , c. does want? figure() pos_noise = noise; pos_noise(pos_noise < 0) = 0; plot(x, pos_noise) hold neg_noise = noise; neg_noise(neg_noise > 0) = 0; plot(x, neg_noise)

error capture photo and display thumbnail android studio -

hi i'm making app internship , got error. please me solve this this activity.java private void dispatchtakepictureintent() { intent takepictureintent = new intent(mediastore.action_image_capture); // ensure there's camera activity handle intents if (takepictureintent.resolveactivity(getpackagemanager()) != null) { // create file photo should go file photofile = null; try { photofile = createimagefile(); } catch (ioexception ex) { // error occurred while creating file } // continue if file created if (photofile != null) { uri photouri = fileprovider.geturiforfile(this, "com.example.android.provider", photofile); takepictureintent.putextra(mediastore.extra_output, photouri); startactivityforresult(takepictureintent, request_take_photo); } } } and onactivityresult() code: @override protected void onactivityresult(int req

How to make daterangepicker stay open always -

can me how make daterangepicker stay open always? daterangepicker url " http://www.daterangepicker.com/ ". cannot find option make possible. can suggest how make it? what have tried far is html <div class="row"> <div id='divtest'> <input id="txtassetcategorybootstrapdaterangepicker" class="form-control" /> </div> </div> <div class="clearfix"></div> javascript $('#txtassetcategorybootstrapdaterangepicker').daterangepicker({ inline: true, singledatepicker: false, startdate: moment().subtract(30, 'days'), enddate: moment(), mindate: moment().subtract(30, 'days'), maxdate: moment(), //ranges: { 'today': [moment(), moment()-29] } }); and document.ready here $(document).ready(function () { $('.daterangepicker.dropdown-menu.ltr.show-calendar.opensright').s

Parsing CSV file into Structs using C -

i trying parse csv file , put values struct, when exit loops returned value of file. can't use strtok because of values in csv file empty , skipped over. solution strsep, , can print songs while i'm inside first while loop when leave returns me last value of file. #include <stdio.h> #include <stdlib.h> #include <string.h> #include "apue.h" #define buffsize 512 typedef struct song{ char *artist; char *title; char *albumname; float duration; int yearrealeased; double hotttness; } song; typedef song *songptr; int main(){ file *songstream; int count = 0; int size = 100; char *token; char *buffer; song newsong; songptr currentsong; songptr *allsongsarray = malloc(size * sizeof(songptr)); buffer = malloc(buffsize+1); songstream = fopen("songcsv.csv", "r"); if(songstream == null){ err_sys("unable open file"); }else{

ios - how to remove a bar button in swift 3? -

Image
i have used swrevealviewcontroller having side menu , in having myaccount page use navigate myaccount page. according requirement placed tab bar in storyboard in 1 tab used account page , tab bar placed using storyboard , here while moving tab bar account page, need remove bar button placed in storyboard. can 1 me how implement ? you can hide menu button setting nill in viewdidload self.navigationitem.leftbarbuttonitem = nil; store controller identity in userdefault(sidemenu , tabbar) like //leaving side menu account userdefaults.standard.set("side", forkey: "menubutton") //leaving side menu account userdefaults.standard.set("tab", forkey: "menubutton") when view disappear , check menubutton key in myaccount , show/hide menu button like let controllername = userdefaults.standard.value(forkey: "menubutton") if (controllername == "side") { } else { self.navigationitem.leftbarbuttonitem = nil; }

java - How to split a string into an integer array? -

how can split string integer array without using loops? for example: if have string "12345" , wanted converted int array [1,2,3,4,5] without using loop. know how way. there built-in function java provides splits , converts desired data type? if java 8 use stream : "a sequence of elements supporting sequential , parallel aggregate operations." observe: import java.util.arrays; import java.util.stream.stream; class main { public static void main(string[] args) { string numbersstring = "12345"; int[] numbersintarray = stream.of(numbersstring.split("")).maptoint(integer::parseint).toarray(); system.out.println(arrays.tostring(numbersintarray)); // [1, 2, 3, 4, 5] } }

python - Pandas unable to read csv in current directory in Jupyter -

forgive me if simple i'm new python , having trouble reading csv pandas through both: df = pd.read_csv(os.path.abspath(os.path.curdir)+r"\test.csv") and df = pd.read_csv("test.csv") i'm running python 3.6 , i've managed import csvs pandas fine spyder's ipython terminal. nevermind, turns out error because of corrupted character in csv

Hibernate Query Error Mysql -

i new hibernate query. database mysql. when run got error like org.hibernate.hql.internal.ast.errorcounter.reporterror - line 1:293: unexpected token: minute my query follows below select distinct lol.spajno,wasup.key11,lol.creationdate facebook lol , watsapp wasup " + "lol.spajno=wasup.key21 , lol.creationdate >= date_add(sysdate(),interval -"+timerange+" minute) , " + "lol.status not in ?1 , lol.retryattempt > "+no_retry_attempt; afaik interval not supported hql, either change query, switch native query or pass value query parameter

ios - Returning values URLSession.shared.dataTask in swift -

this question has answer here: how can data nsurlsession.sharedsession().datataskwithrequest 1 answer i started coding in swift , have following code parses json func parse (latitude: double, longtitude: double){ let jsonurlstring = "https://api.darksky.net/forecast/apikey/\(latitude),\(longtitude)" guard let url = url(string: jsonurlstring) else{ return } var information: forecast? urlsession.shared.datatask(with: url) { (data, res, err) in guard let data = data else { return } { let json = try jsondecoder().decode(forecast.self, from: data) self.info = json } catch { print("didnt work") } }.resume() processjson(info) } my problem want pass data stored in json variable in class processed using processjson f

reactjs - How to unit test addTodo in redux app? -

i trying example : https://github.com/reactjs/redux/tree/master/examples/todomvc based in solution have created unit test looks this: it('should call addtodo if length of text greater 0', () => { const props = { addtodo: jest.fn() } let cb = shallow(<header {...props} />) expect(props.addtodo).not.tobecalled() cb.find('todotextinput').simulate("onsave",{text:"fsdhsd"}); //error starts here: expect(props.addtodo).tobecalled() }); the result of 1 : fail src/components/newheadertest.spec.js ● header enzyme style › should call addtodo if length of text greater 0 expect(jest.fn()).tobecalled() expected mock function have been called. @ object.it (src/components/newheadertest.spec.js:46:27) this part of component: handlesave = text => { console.log('handlesave'); if (text.length > 0) { this.props.addtodo(text); } } render = () =>