Posts

Showing posts from May, 2012

Javascript loop through array of audio files, playing one after another -

i have array of audio urls want loop through , play 1 after other, little bit of space in-between. i'm using angular2 , typescript. currently happening plays first track, switches , plays second track, not switch next track continues play second one. never stops playing second track , play each once , stop. my array of audio urls stored in this.listenservice.messagesrcs so ["http://localhost:8000/5827a34e88554c09a7c0d182", "http://localhost:8000/5827a35088554c09a7c0d183", "http://localhost:8000/5827a35288554c09a7c0d184"] and here attempt @ looping through them loopmessages() { if (this.listenservice.card && this.listenservice.messagesrcs) { console.log(this.listenservice.messagesrcs); let message = new audio(); message.setattribute('src', this.listenservice.messagesrcs[0]); message.load(); settimeout(function() { message.play(); }, 5000); if (this.listenservice.messagesrc...

ubuntu - What's the /path/to means -

i beginner in caffe. in tutorials see "/path/to". i'm confuse that. what's means. specific path in computer? here part of a tutorial . prepare data images: put images in folder (i'll call here /path/to/jpegs/). labels: create text file (e.g., /path/to/labels/train.txt) line per input image . it's telling you should specify path, , giving example of path format. /path/to/labels/train.txt the tutorial or instructions expect replace own path, can want as long it's in path format /hanbing/data/train.txt /documents/cafe/example_app/train.txt

javascript - Passing data and submit functions between controllers -

basically when user submits calculation done data , stored in variable. had working when in 1 controller, need split between pages. want service. see, i'm confused , know i'm doing wrong. not sure going astray or maybe should better handle on misunderstanding - appreciated. basic pointer nice: .factory('meals', function() { var data = { baseprice: 0, taxrate: 0, tippercentage: 0, mealcount: 0, tiptotal: 0, averagetip: 0, subtotal: 0, tip: 0, tiptotal: 0, total:0 } function set(data) { saveddata = data; } function get(){ return saveddata; } return { set: set, get: } }) .controller('homectrl', [function(meals) { }]) .controller('mealctrl', [function(meals) { var ws = this; meals.set(); ws.data = meals.get(); ws.submit = function(){ ws.tax_rate= ws.taxrate/100; ws.tip_rate= ws....

c# - Cannot convert from 'System.IO.FileStream' to 'int' when reading text file into a List -

this question has answer here: how read text file , add data int array in c#? 4 answers all want have program read .txt file, take whatever in file, , input list. tell me can't convert (no matter if set variable var, string, int, or whatever) tried using int.tryparse, convert.toint32(), etc. while convert.toint32 shuts up, when run program crashes. static void main(string[] args) { string listpath = @"k:\listdata\listdata.txt"; int listdatasum = 0; int listdatamax = 0; int listdatamin = 0; string userinput = null; var numerallistdata = system.io.file.openread(listpath); var listdata = new list<int>(numerallistdata); listdatasum = listdata.sum(); listdatamax = listdata.max(); listdatamin = listdata.min(); console.writeline( "please input...

python - tensorflow works in ipython command line but not in notebook -

Image
tensorflow works me in both python , ipython in command line, when loading tensorflow using import tensorflow , gives following errors: importerror: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.19' not found (required /usr/local/packages/python/2.7.10-anaconda/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so) error importing tensorflow. unless using bazel, should not try import tensorflow source directory; please exit tensorflow source tree, , relaunch python interpreter there. here screenshot shows tensorflow works in command line here screenshot shows doesn't work in notebook interface so why work in command line not in notebook interface? i've compared environment variable using os.environ , looks same in command line , in notebook. system information: linux qb2 2.6.32-358.23.2.el6.x86_64 #1 smp sat sep 14 05:32:37 edt 2013 x86_64 x86_64 x86_64 gnu/linux tensorflow version: 0.11.0rc0 i don't think relevant, ipython ...

sublimetext3 - Configuring Emmet to Work on EJS files (Sublime Text 3) -

i've begun writing nodejs web app .ejs files templating views. i'm trying emmet work on .ejs extensions .html extensions in sublime text 3. have ideas how this? i assumed installed emmet , configured key binding emmet-sublime https://packagecontrol.io/packages/emmet . in other make emmet work .ejs install ejs package: https://packagecontrol.io/packages/ejs . then close .ejs files reopen them. can #root , hit tab in .ejs files.

java - Cucumber test for Spring Boot can run in "mvn test" but not in "mvn verify" -

summary: i running tests using cucumber against spring boot application. cucumber test running fine when execute them using "mvn test" fails when execute them in "mvn verify" lifecycle. details: my cucumber runner class looks this: @runwith(cucumber.class) @cucumberoptions( features = {"src/test/resources/features/creditcardsummary.feature"}, glue = {"th.co.scb.fasteasy.step"}, plugin = { "pretty", "json:target/cucumber-json-report.json" } ) public class creditcardrunnertest { } when execute "mvn test", can see in logs cucumber runner instantiated before maven spring boot plugin instantiates spring boot instance: ------------------------------------------------------- t e s t s ------------------------------------------------------- running creditcardrunnertest @creditcards feature: post /creditcards/summary user, basic infor...

Ruby Array to Histogram. How to group numbers by range? -

i need group array values range-based histogram in ruby... values = [ 139, 145, 149, 151, 152, 153, 163, 166, 169 ] for example: 141 - 145 = 2 146 - 150 = 1 151 - 155 = 3 ... is there simple way use group_by ? to prepare histogram 1 specifies smallest value of first range, range size , number of ranges. pre-processing of data may necessary determine values. example, given values = [139, 145, 149, 151, 152, 153, 164, 166, 169] group_size = 5 we might compute smallest value of first group , number of groups follows: smallest, largest = values.minmax #=> [139, 169] start = group_size*(smallest/group_size) #=> 135 nbr_groups = ((largest-start+1)/group_size.to_f).ceil #=> 7 we can construct array can use create histogram. def group_values(values, start, nbr_groups, group_size) groups = array.new(nbr_groups) |i| f = start + * group_size { nbr: 0, range: f..f+group_size-1 } end values.each_with_object(groups) { |v,arr| ...

javascript - Fade in new background and fade out after 10s -

i've tried make website change background every 10 seconds. successful. now, want fade them in , fade them out, appear smoothly. i've searched other forumpages , found related questions, wasn't able understand answers well. javascript: function run(interval, frames) { var int = 1; function func() { document.body.id = "b"+int; int++; if(int === frames) { int = 1; } } var swap = window.setinterval(func, interval); } run(10000, 6); //milliseconds, frames css: #b1 { background-image: url("standaard01.jpg"); } #b2 { background-image: url("standaard02.jpg"); } #b3 { background-image: url("standaard03.jpg"); } #b4 { background-image: url("standaard04.jpg"); } #b5 { background-image: url("standaard05.jpg"); } #b6 { background-image: url("standaard06.jpg"); } #b7 { background-image: url("standaard07.jpg"); } #b8 { background-image: url("standaard08.jpg"); } #b9 { back...

ios - Mutable string color change alters character to be displayed as square -

Image
i changing color of last character of table view section title , getting odd result ios 9+, swift 3. the last character checkmark ✔︎ , color green. result green square instead of green checkmark. if print console checkmark shows correctly. if remove color change, shows checkmark fine (in black). if use symbol such double exclamation point, ‼ works fine. simplified code struct personconstants{ static let default_status_index : int = 1 static let validstatus : nsarray = ["✔︎","?","‼"] } let colorsarray = [ uicolor(red: 29/255.0, green:166/255.0, blue:47/255.0, alpha:1.0), uicolor(red: 0/255.0, green: 0/255.0, blue: 255/255.0, alpha: 1.0), uicolor(red: 225/255.0, green: 0/255.0, blue: 0/255.0, alpha: 1.0), ] override func tableview(_ tableview: uitableview, titleforheaderinsection section: int) -> string?{ var title = string(safe.count) + " " title += nslocalizedstring("accounted", commen...

ios - How to get value of UnsafeMutableRawPointer? -

Image
i'm trying address pointed unsafemutablerawpointer, i'm unable so. i'm new swift might missing or doing wrong. preferably cast raw value cchar. note passers-by: of answer won't make sense, doesn't answer initial question above, rather question(s) arose in chat op. took me few hours, i've learned assembly, can answer questions. cchar c char ... literally. represents char type of c . it's typealias int8 . it's single byte. can't use pointer type, 8 bytes (on 64 bit machines). you don't need unsafemutablerawpointer boilerplate, , certainly don''t need access raw value. can pass arrays directly pointers expected. when function declared taking unsafepointer argument, can accept of following: ... a [type] value, passed pointer start of array. from interacting c apis - pointers . you experiencing issues mutation of 0x8(%rdi) did not seem reflected on swift side. issue here you're writing @ of...

c# - MQ Client is taking much time to understand that MQ queue manager is down -

try { mqmanager = new mqqueuemanager(queuemanager); try { mqrequestqueue = mqmanager.accessqueue(queuename, mqc.mqoo_input_as_q_def + mqc.mqoo_fail_if_quiescing); return true; } catch (ibm.wmq.mqexception exibm) { closeconnection(); errorcode = exibm.reason; errordescription = exibm.message; } } catch (ibm.wmq.mqexception exibm) { closeconnection(); errorcode = exibm.reason; errordescription = exibm.message; i using above c# code connect mq using mqseries dll provided webspheremq. when queuemanager down taking 20-30 seconds till exception , can see has been stopped @ code. is expected behaviour of mq client-server communication? if not ,how can detect if queuemanager down can hit next available queuemanager? there timeout property? when running on client-server communication state are, there net...

python - Why I get different results using reshape and expand_dims in Tensorflow? -

overall, writing rnn model using tensorflow. inherit rnncell , customize own cell. finally, use dynamic_rnn build entire rnn. detail want transform tensor shape [n, m] [n, m, 1]. use 2 methods implement this: tf.reshape(matrix, [n, m, 1]) # first method tf.expand_dims(matrix, -1) # second method what expect using these 2 methods, totally identical training , prediction results(all random seeds fixed). results different. confused. tf.reshape rearranges elements, tf.expand_dims adds dimension tensor. functions different. however, expect due random initialization, everytime train results should different.

Excel Conditional Formatting and SUMPRODUCT -

when put formula in cell, works, returning true or false: =sumproduct((table1[start]<=ak26)*(table1[end]>=ak26))>0 but, when try put same formula in conditional formatting, receive error: "there's problem formula" can me?

javascript - Getting news description with Cheerio -

i'm trying text 'a' tag in every entry of webpage https://hn.algolia.com/?query=apple&sort=bypopularity&prefix&page=0&daterange=all&type=story i have parsed webpages i'm having issues one, here's code. var cheerio = require('cheerio'); var request = require('request'); request({ method: 'get', url: 'https://hn.algolia.com/?query=apple&sort=bypopularity&prefix&page=0&daterange=all&type=story' }, function(err, response, body) { if (err) return console.error(err); // tell cherrio load html $ = cheerio.load(body); // list = []; // $('div[id="item-main"]').each(function(){ // var href = $(this).find('div > div').attr('h2'); // list.push(h2); // }); $('item-title-and-infos').each(function() { var href = $('h2', this).attr('href'); if (href.lastindexof('/') > 0) { console.log($('a', this).t...

c# - DataTables Header displaying as a row? MVC Asp.net -

Image
i'm following along udemy course, i'm @ stage data tables meant render table, reason when renders table pushes th table td? screenshot <table id="your_contacts" class="table"> <tr> <th>@html.displaynamefor(model => model.firstname)</th> <th>@html.displaynamefor(model => model.lastname)</th> <th>@html.displaynamefor(model => model.email)</th> <th>@html.displaynamefor(model => model.phoneprimary)</th> <th>@html.displaynamefor(model => model.phonesecondary)</th> <th>@html.displaynamefor(model => model.birthday)</th> <th>@html.displaynamefor(model => model.address1)</th> <th>@html.displaynamefor(model => model.address2)</th> <th>@html.displaynamefor(model => model.city)</th> <th>@html.displaynamefor(model => model.po...

ubuntu - voyager linux cpu and time display customize -

Image
i want move time , cpu display of voyager linux(xubuntu fork). in default setting, @ left. want move right top. solved myself voyager uses conky for select thema desktop > right click > voyager box > conkey control to open config file cd cd .conkey

sublimetext3 - Sublime Text 3 Git Gutter not working -

Image
when first installed gitgutter, kept saying needed git , path specified. i first moved git in same folder, decided switch original folder , specified path in environment variable. stopped showing error message, still not working. why not working? here have tried: this repository created: https://github.com/groxtheprogrammer/concerning-git-gutter . i downloaded zip. here before add bunch of spaces: this after add spaces: as can see, gitgutter not display indicating file has changed. why? try going link. however, assumes have gotten git , running. might looking https://github.com/jisaacks/gitgutter/issues/152 . hope helps!

javascript - How to append whole set of model to formdata and obtain it in MVC -

how pass whole set model object through formdata , convert model type in controller? below i've tried! javascript part: model = { eventfromdate: fromdate, eventtodate: todate, imageurl: imgurl, hotnewsdesc: $("#txthtdescription").val().trim(), }; formdata.append("model",model); then pass through ajax, string, , if check value of request.form["model"] result same, received string , value "[object object]" is there way pass model through formdata , receive in controller? if view based on model , have generated controls inside <form> tags, can serialize model formdata using var formdata = new formdata($('form').get(0)); this include files generated <input type="file" name="myimage" .../> and post using $.ajax({ url: '@url.action("youractionname", "yourcontrollername")', type: '...

c# - Can I launch DotNet's OpenFileDialog in C:\Users\Public\Documents? -

is there way launch openfiledialog in c:\users\public\documents folder? i writing c# application, using dotnet framework. trying launch openfiledialog , initialdirectory of "c:\\users\\public\\documents\\" , filename of "world.txt" . unfortunately, openfiledialog putting me in documents shortcut instead of c:\users\public\documents . expected results expect see openfiledialog open, top textbox showing > pc > windows7_os (c:) > users > public > documents , bottom textbox showing world.txt . expect if click in top textbox, show c:\users\public\documents . actual results openfiledialog opens. top textbox shows > pc > documents , bottom textbox shows world.txt . if click in top textbox, shows documents . displayed folder contents not same contents of c:\users\public\documents . things have tried have stopped code in visual studio debugger after following line of code: openfiledialog dlg = new openfiledialog(); ...

The Difference Using Java and Hadoop Types in Hive UDF -

when writing simple hive udf, possible use both standard java , hadoop types in evaluate() method. example, following methods should return same results. using string input , output types: public string evaluate(string input) { if(input == null) return null; return input.touppercase(); } using text input , output types: public text evaluate(text input) { if(input == null) return null; return new text(input.tostring().touppercase()); } my question benefits of using 1 vs other? if use standard java input , output types (like string) hadoop converting these objects hadoop types me?

rainmeter - How do I make a task run on startup through raimeter? -

i want random number generated every time start computer can randomly choose background on rainmeter. every time try search answer keep getting pages how make rainmeter run on startup. you can use runcommand plugin execute command line input. make run once when skin loaded, need set option updatedivider=-1 . following opens notepad on startup, replace in parameter=notepad command wish run. [rainmeter] update=1000 [measureruncmd] measure=plugin plugin=runcommand parameter=notepad [meterruncmd] updatedivider=-1 meter=string text=none onupdateaction=[!commandmeasure measureruncmd "run"] if don't need flexibility of plugin can use following [rainmeter] update=1000 [meterruncmd] updatedivider=-1 meter=string text=none onupdateaction=["notepad"]

MYSQL Multiple Group Concat -

hi have table called engineers , table called post_codes when use following sql list of engineers , postcodes associated them using group concat statement cannot figure out how include in group concat (if indeed need one) list in field called secondary_post_codes_assigned post codes linked same engineer via secondary_engineer_id field. select engineer.engineer,group_concat(post_code separator ', ') post_codes_assigned, engineer.region, engineer.active, engineer.engineer_id engineer inner join post_code on engineer.engineer_id = post_code.engineer_id group engineer_id what need output similar this. engineer_id | post_codes_assigned | secondary_post_codes_assigned ---------- 1 | aw, aw3 | b12 | 2 | b12 | aw, cv12 | i hope clear pretty new mysql. regards alan you joining primary post codes , list them, same secondary ones. s...

vectorization - Sum without use of loop in R -

i've vector. basket <- c(4,5,10,102,10); if i've sum, call sum(basket) if i've use loop find out sum, total <- 0; len <- length(basket); for(i in 1:len) {total <- total + basket[i]} is there way find total, without using sum(), or using lengthy loop construct? add <- function(x) reduce("+", x) add(basket) or write shorter loop: s <- 0 for(a in basket) s<- s+a

android - Runnable not run -

i using handler , runnable display time of media player. runnable don't run. code is: handler timerhandler; public contstructor() { timerhandler = new handler(); } i'm using: runnable sourcetimer = new runnable() { @override public void run() { long totalduration = source.getduration(); long currentduration = source.getcurrentposition(); string remaindurationlabel = millisecondstotimer(totalduration - currentduration); log.e(tag, "source remain time " + remaindurationlabel); timerhandler.postdelayed(this, 100); } }; start timer: void sourceplay() { source.start(); timerhandler.postdelayed(sourcetimer, 0); } i don't receive error not logging "source remain time " in logcat. what's problem?

android - query for words between two tag <h3></h3> -

Image
in need query search word between 2 tag <h3>ali</h3> hasan ali <h3>ali kamali</h3> when user search ali need, <h3>ali</h3> <h3>ali kamali</h3> try this, select * mytable field '<h3>%' + query + '%</h3>' see this fiddle working sample.

Is storing a delimited list in a database column really that bad? -

imagine web form set of check boxes (any or of them can selected). chose save them in comma separated list of values stored in 1 column of database table. now, know correct solution create second table , normalize database. quicker implement easy solution, , wanted have proof-of-concept of application , without having spend time on it. i thought saved time , simpler code worth in situation, defensible design choice, or should have normalized start? some more context, small internal application replaces excel file stored on shared folder. i'm asking because i'm thinking cleaning program , make more maintainable. there things in there i'm not entirely happy with, 1 of them topic of question. in addition violating first normal form because of repeating group of values stored in single column, comma-separated lists have lot of other more practical problems: can’t ensure each value right data type: no way prevent 1,2,3,banana,5 can’t use foreign key cons...

algorithm - Unity Line Vector Calculation -

let's suppose have 2 position vectors a , b , base line: g: x = + r*d (d being direction of line) can sure b lies on g due game generation algorithm. question how can find r ? problem seems result being positive, when calculating length , checking how d fits result positive, , therefore partly correct. other idea calculate a + r * d = b <=> r = (b - a) / d . unity doesn't allow vector division. thank in advance help, maybe being stupid @ point. sorry g result, start point. r = (g -a ).magnitude; use dot(d, (g-a)) know whether positive or negative.

java - How to parallelize a for loop -

i try parallelize for in loop because want use in code parallel stream in java . problem is.. every time i've try don't entire result. mean... code should rotate image angle, if i'm doing parallelize receive half of image rotated. one issue a, b, xx, yy variables being declared outside loop. different (interleaved) iterations overwrite values of these variables. instance, iteration 0 writes , b iteration 0 stop , iteration 1 starts , write , b scheduler goes iteration 0 values of , b iteration 1.

datetimepicker - Pick only year from a dropdown in bootstrap? -

i trying year datetimepicker. can't year. there same question here. bootstrap year picker doesn't pick year only can't year.

Javascript: How to recursively group arrays based upon upcoming index value -

i have situation want group arrays chunks based upon value of upcoming index. let's consider example input var tokens = [{ tag: null, line: 'starting of file' }, { tag: 'each', line: null }, { tag: null, line: 'foo bar' }, { tag: null, line: 'baz' }, { tag: 'endeach', line: null }, { tag: null, line: 'hello world' }] expected output [{ tag: null, line: 'starting of file' }, { tag: 'each', line: null, childs: [{ tag: null, line: 'foo bar' }, { tag: null, line: 'baz' }] }, { tag: null, line: 'hello world' }] what happening elements after opening each tag nested childs. can happen recursively there can multiple each tags before endeach . hope makes sense! using array.prototype.reduce() , whenever encounter each add children array container array. whenever ...

WordPress and Visual Composer custom page template -

i hope can me. i'am working visual composer , whould create template use on page's. i whant create first section in pure code , save in theme's template file. then when pick template in page editor, whould use visusal composer, content made composer should go below, have done in theme's templatefile. so if template file in theme folder contains big image , buttons, whant output visual composer content below it. is @ possible.? when try pick template file default blank output containing header , footer no content visual composer. when use default template, works. i whant create file can tell visual composer output content, hope makes sense. kind regards dannie yes possible. below code-example of template file can add custom code wherever like. name file example-page.php id's , classes of course optional. <?php // template name: name get_header(); ?> <!-- custom code goes here --> <div id="primary" class...

php - Change rules on local server so URLs don't include file extensions using MAMP? -

this question exact duplicate of: how hide specific files extensions (html & php) in url? 1 answer i'm running local server via mamp pro . urls (expect index.php) require file extension suffix. example: site/page.php how change rewrite rules site/page i've attempted adding htaccess file has no effect on file structure. there way via mamp? this rewrites [every_name].php [every_name] , same .html files rewriteengine on rewritecond %{request_filename}.php -f rewriterule ^([^\.]+)$ $1.php [nc,l] rewritecond %{request_filename}.html -f rewriterule ^([^\.]+)$ $1.html [nc,l] if want one filename extensionless use this: rewriteengine on rewriterule ^page$ page.php [l] somewhat more trivial: don't use rewriterules, , let apache handle all request path extensions (along file type , language auto-negotiation): options +multiviews ...

How to use printf "%q " in bash? -

i print out augments of function file. told command printf "%q ", instruction following, # man printf %q argument printed in format can reused shell input, escaping non-print‐ able characters proposed posix $'' syntax. on basis of instruction above, tried following code. #!/bin/bash # file name : print_out_function_augs.sh output_file='output.txt' function print_augs() { printf "%q " "$@" >> "${output_file}" echo >> "${output_file}" } print_augs 'b c' cat "${output_file}" rm "${output_file}" and run bash print_out_function_augs.sh the results following, a b\ c i expected results as a 'b c' which original augments print_augs function. why output , original augments different? or can print out original augments are? thank much. bear in mind when using %q : argument printed in format can reused shell input , escap...

mongodb - Meteor reactive publish data from different collections -

i try build homeautomation system meteor. therefore following thing. i have collection different livevalues i'm reading kind of source. each document value of example sensor actual value. now want create second collection called thing. in collection i'd add "things" example "roomtemperature living" data thing. 1 attribute should connection 1 of livevalues. now want publish , subscribe meteor thing collection, because on webinterface doesn't matter livevalue behind thing. here, in optionen, complicated part starts. how can publish data client , have reactive update when livevalue has changend thing? because it's differnt collection "thing" collection. in idea via 1 subscrition 1 "thing" document , subscription update of livevalue of livevalue collection. is workable? has idea how can handle this? i've heard meteor-reactive-publish i'not sure if solution. i've heard needs lots of power server. th...

string - Character replacement and substitution in C -

i'm trying write code replace character in string user selects character he/she does. eg string london if user picks o , a output should landan . here code: #include <stdio.h> #include <string.h> #define maxlen 100 int function2(char str[], char drop, char sub) { int = 0; int num = 0; while (str != null) { if (str[i] == drop) { str[i] = sub; num++; } i++; } return num; } int main() { char d, s; char my_string[maxlen]; printf("input string\n"); scanf("%s", &my_string); printf("input character want drop\n"); scanf(" %c", &d); printf("now character want substitute\n"); scanf(" %c", &s); function2(my_string, d, s); printf("the string %s\n", my_string); return exit_success; } it works until point print altered string. segmentation fault (core dumped). note code function ...

python - Is there an error of precision in that program? -

i'm trying verify sum , seems in program don't find 0, there error ? from mpmath import * mp.dps = 1500 a=mpf(0.1) p=mpf(2.) def f1(x): return (a-(mpf(1)-mp.sqrt(1-x**2)))**p*x def f2(x): return x*(x-a)**p def f3(x): return x**p i=mp.quad(f1,[0,mp.sqrt(mpf(1)-mpf(0.9)**mpf(2))]) j=mp.quad(f2,[0,a]) k=mp.quad(f3,[0,a]) print i,j,k print mp.fabs(i)+mp.fabs(j)-mp.fabs(k) even 1500 digits don't find 0. when creating mpf instances python float, value enter in code first converted 53-bit value , converted high-precision value. working values not expecting. if working high-precision code, should either initialize string or integer. try following instead: from mpmath import * mp.dps = 1500 a=mpf("0.1") p=mpf(2) def f1(x): return (a-(mpf(1)-mp.sqrt(1-x**2)))**p*x def f2(x): return x*(x-a)**p def f3(x): return x**p i=mp.quad(f1,[0,mp.sqrt(mpf(1)-mpf("0.9")**mpf(2))]) j=mp.quad(f2,[0,a]) k=mp.quad(f3,[0,a]) print i,j,k ...

c++ - Why does Declaring in header file and defining in file gives multiple definition error? -

i new programming in c++. had better knowledge on java. using hackerrank trying learn c++. keep track of each program sepearate entity started using header file , program file each program or challenge. trying hackerrank exercise input , output ( https://www.hackerrank.com/challenges/cpp-input-and-output ). tried implement program in manner; inputandouput.h #ifndef inputandoutput_h_ #define inputandoutput_h_ int arr[3]; int m; int inputandoutput(); #endif inputandoutput.cpp #include "inputandoutput.h" #include<iostream> #include<cmath> #include<cstdio> int inputandoutput(){ int arr[3]; for(int i1 = 0; i1 < 3 ; i1++) std::cin >> arr[i1]; for(int = 0; < 3 ; i++) m = m + arr[i]; return m; } main.cpp #include<iostream> //#include<day1datatypes> #include<cmath> #include<cstdio> //#include "day1datatypes.h" #include "inputandoutput.h" int main() { ...

After installing IntelliJ Idea, I cannot use GutHub and Git beacause of missing "git.exe" file -

found reason , solution. when installin idea, git installed on computer, idea haven't installed on existing one. to solve problem, fist find "git.exe" file on computer using operating system's search. after you've found it, go file>settings>version controls>git (even if you're having problem github) >path git executable > "..." , paste destination path of git.exe file have found erlier. if choose not full path (environment variable) integration when installing git (on windows), you'll need tell intellij find git.cmd; , can in settings > project settings > version control > vcss > git

constraints - BASYS3 Lighting the leds -

i'm beginner fpga programming , working on basys3 . in system-verilog code have 2 2 bit outputs: la , lb. assuming these 2 traffic lights , 00 means red, 10 means yellow, 11 means green. if output red, 3 leds light. don't know how implement in constraint file. normally, when output 1, want led light , write kind of code: set_property package_pin u14 [get_ports {la[0]}] set_property iostandard lvcmos33 [get_ports {la[0]}] but time want led light when output 0. maybe can write 2 more outputs become opposite of real outputs , can use them in constraint wonder can directly implement want in constraint file?

python - Cannot Use Geometry Manager Grid inside . which already has slaves managed by pack -

so i'm writing small application, , error: cannot use geometry manager grid inside . has slaves managed pack import tkinter tk tkinter import ttk large_font = ("times new roman", 16) normal_font = ("times new roman", 12) def popup(title, string): popup = tk.tk() popup.geometry('300x100') popup.wm_title(title) label = ttk.label(popup, text=string) label.pack(pady=10) b1 = ttk.button(popup, text='okay', command=lambda:popup.destroy()) b1.pack(pady=10) class fecapp(tk.tk): def __init__(self, *args, **kwargs): tk.tk.__init__(self, *args, **kwargs) container = tk.frame(self) container.pack(side='top', fill='both', expand=true) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) tk.tk.iconbitmap(self, default='icon.ico') tk.tk.wm_title(self, 'family entertainment center management s...

ctypes - How do I set the desktop background in python? (windows) -

this i'm trying: import ctypes import os drive = "f:\\" folder = "keith's stuff" image = "midi turmes.png" image_path = os.path.join(drive, folder, image) spi_setdeskwallpaper = 20 ctypes.windll.user32.systemparametersinfoa(spi_setdeskwallpaper, 0, image_path, 3) basicaly, code supposed set desktop background midi turmes.png, changes desktop, however, odd reason, it's green background (my personalized settings in windows green background behind image) how fix , make desktop this?: http://i.imgur.com/vqmzf6h.png the following works me. i'm using windows 10 64-bit , python 3. import os import ctypes ctypes import wintypes drive = "c:\\" folder = "test" image = "midi turmes.png" image_path = os.path.join(drive, folder, image) spi_setdeskwallpaper = 0x0014 spif_updateinifile = 0x0001 spif_sendwininichange = 0x0002 user32 = ctypes.windll('user32') systemparametersinfo = user32.sys...

java - How to send post request with x-www-form-urlencoded body -

Image
how in java, can send request x-www-form-urlencoded header . don't understand how send body key-value, in above screenshot. i have tried code: string urlparameters = cafedra_name+ data_to_send; url url; httpurlconnection connection = null; try { //create connection url = new url(targeturl); connection = (httpurlconnection)url.openconnection(); connection.setrequestmethod("post"); connection.setrequestproperty("content-type", "application/x-www-form-urlencoded"); connection.setrequestproperty("content-length", "" + integer.tostring(urlparameters.getbytes().length)); connection.setrequestproperty("content-language", "en-us"); connection.setusecaches (false); connection.setdoinput(true); connection.setdooutput(true); //send request dataoutputstream wr = new dataoutputstream ( ...

java - Apache Solr DataImportHandler failes trying to index -

i trying index xml files solr 6.2.1 using dataimporthandler. for purpose have added needed import , requesthandler solrconfig.xml: <lib dir="${solr.install.dir:../../../..}/contrib/dataimporthandler/lib/" regex=".*\.jar" /> <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar" /> <requesthandler name="/dataimport" class="org.apache.solr.handler.dataimport.dataimporthandler" startup="lazy"> <lst name="default"> <str name="config">data-config.xml</str> </lst> </requesthandler> then wrote data-config.xml , put same path solrconfig.xml: <dataconfig> <datasource type="filedatasource" encoding="utf-8"/> <document> <entity name="pickupdir" processor="filelistentityprocessor" datas...

R 2D contour how to smoothen contours -

i've got r script plot 2d contour. data .5 -1.25 10.2804 6.5404 -1.25 10.4907 6.58081 -1.25 10.8087 6.62121 -1.25 10.4686 6.66162 -1.25 10.506 6.70202 -1.25 10.3084 6.74242 -1.25 9.68256 6.78283 -1.25 9.41229 6.82323 -1.25 9.43078 6.86364 -1.25 9.62408 6.90404 -1.25 9.23871 6.94444 -1.25 9.4298 6.98485 -1.25 9.42173 7.02525 -1.25 9.45413 7.06566 -1.25 9.2722 7.10606 -1.25 9.02645 7.14646 -1.25 9.29053 etc script: options(device = png) mat <- read.table("bla2",header=true,col.names=c("x", "y", "z")) library(latticeextra) col.l <- colorramppalette(c('blue', 'cyan', 'green', 'yellow', 'orange', 'red')) col.divs<-15 levelplot(z ~ x * y, mat, cex.axis=4, cex.lab=4, contour=true, cuts=30, col.regions=col.l, at=seq(from=0,to=9,length=col.divs), scales=list(x=list(at=seq(6,10.5,1), cex=2), y=list(at=seq(-1.2,1.7,0....

ios - Unable to parse XML from URL for indeed API -

well, using library parse xml: swiftyxmlparser unfortunately unable results array respond in ios can see them on browser see link or sample of respond ! this operation : urlsession.shared.datatask(with: nsurl(string: urlstring)! url, completionhandler: { (data, response, error) -> void in if error != nil { print(error) return } if let data = data { let xml = xml.parse(data) print(xml) //tried xml["results"]["0"] didn't work } }).resume() this output in ios : <response version="2"> <query>ios</query> <location>austin, tx</location> <clickedcategories/> <paginationpayload/> <radius>25</radius> <dupefilter>true</dupefilter> <highlight>false</highlight> <start>1</start> <end>10</end> <pagenumber>0</pagenumber> <totalresults>315</totalresults> <results> /...

php - XAMPP - SSL Certificate. Broken HTTPS -

i trying ssl certificate website using xampp. doing tell me using tutorial http://robsnotebook.com/xampp-ssl-encrypt-passwords . reason error https://i.gyazo.com/5da7549ca6baaed8ce96d5c55c9dd7e4.png says "the page insecure (broken https). this httpd-vhosts.conf <virtualhost *:443> documentroot "c:\users\administrator\desktop\xampp\htdocs" servername myproject sslengine on sslcertificatefile "conf/ssl.crt/server.crt" sslcertificatekeyfile "conf/ssl.key/server.key" <directory "c:\users\administrator\desktop\xampp\htdocs"> options allowoverride require granted </directory> </virtualhost> and i've did told me on tutorial, please tell me why error appears.. that ssl certificate has outdated certificate chain called sha1. sha1 announced in late 1995 , not fit current security standards according nist (nat...