Posts

Showing posts from April, 2012

tensorflow - Installing libcudnn -

7 hours (9:33 am) morning, i had question regarding instructions of libcudnn tensorflow in python. ive put folders , added respective path , environment variables, after instructions indicate add compiler , link lines. dont understand mean. give me advice on how or reference learn line concepts? i'd appreciate it. linux cd <installpath> export ld_library_path=`pwd`:$ld_library_path add <installpath> build , link process adding -i<installpath> compile line , -l<installpath> -lcudnn link line. in normal installation, works. ld_library_path tells tensorflow cuda dynamic libraries are. if installed them with-apt-get, or if using nvidia-docker container, there might nothing else do. if installed bazel, should not have tinker compile flags. if found in current documentation, let know , can update docs. for installation issues, better equipped answer questions on our github page, can have longer-form submission , discussion: https://github....

How to inject input events into own application on Android? -

i way how inject input events such touch or keyboard events own application, code within particular app. not android os or other apps b/c needs signature-level permission android.permission.inject_events or rooted device , have avoid both. code runs on non-rooted device without anyhow elevated rights. i'm somehow making bit of progress code based on following concept: view v = findviewbyid(android.r.id.content).getrootview(); v.dispatchtouchevent(e); i think getrootview , dispatch should works well, if there problem it. please brief it. or there more high level tricky way this. in view.java, there hide api called getviewrootimpl() return object of android.view.viewrootimpl of activity. , there method called enqueueinputevent(inputevent event) on it. can use reflection method. as have finished project using keyboard send touch commands screen, think when trying inject these kind of events activity, multiple touch might problem. when try send finger screen. eve...

html - How to remove extra whitespace around body from Zurb Foundation -

i'm using foundation framework website , there's white-space around the whole body (the gutter). remove gutter i've tried: *{margin:0;padding:0;} body{margin:0;padding:0;} downloading custom foundation gutter set 0 none of has worked out me. can done remove white-space? here's screenshot gutter highlighted red this not margin issue max-width issue. using devtools you'll find .row class has max-width of 62.5rem, think standard. (i work on site has modified width of 72.5rem.) i think it's idea maintain version of limitation if have normal page content people have read on large screens. can safely override want 100% width. you can adding class overrides default max-width , selects relevant element sufficient specificity in style sheet. alternatively, can refrain using class .row on outer containers want span page. allows option of putting rows within. way could, example, have teal background span page keep content constrained , aligne...

mysql - innodb save storage space -

i want ask mysql innodb suggest getting smaller database? i not have innodb_file_per_table not need reclaim space(this have been nice see how space able save). most of strings saved utf8mb4. columns use latin1(i know there can there latin characters). think save lot of space if convert them latin1? seems change should performance increase in searches. i have defined columns have lot of text mediumtext . think should save space if define column text? - see type acts varchar(it occupies length of string) what other suggestions have? the database has more 300 millions rows , stored in 100g thanks changing character set not help. when use utf8 or utf8mb4, each character stored in variable number of bytes. characters can stored in single byte stored way. changing mediumtext text not much. each string in such columns stored in variable length, length needed string stored. text can store strings 64kb, mediumtext can store strings 16mb. suppose each such string may n...

Perl - longest common prefix of 2 or more strings? -

how can create perl subroutine take in array , find longest common prefix 2 or more of elements? (strings) i have code: sub longest_common_prefix { $prefix = shift; (@_) { chop $prefix while (! /^\q$prefix\e/); } return $prefix; } but works if looking longest common prefix of all strings. for example, if pass array following strings: aaabgfb aaajjjj jjfkbbb aaahghg i want return aaa answer. thanks! one way store information in hash. in example, set hash key length of each prefix, , value being actual prefix found. note method overwrites key , value if same-length prefix exists, you'll last prefix found of longest length ( sort() takes care of finding longest one). the regex says "find first character in string , capture it, , use char found in second capture, , capture many there are". string join() ed scalar , put hash. use warnings; use strict; %prefixes; while (<data>){ $prefix = join '...

CLion C++ formatting -

hey there know how achieve following: i format piece of code (1. clion default, 2. want) mat<int, 4> m2({ vec<int, 4>({2, 3, 4, 5}), vec<int, 4>({2, 3, 4, 5}), vec<int, 4>({2, 3, 4, 5}), vec<int, 4>({2, 3, 4, 5}) }); i have this: mat<int, 4> m2({ vec<int, 4>({2, 3, 4, 5}), vec<int, 4>({2, 3, 4, 5}), vec<int, 4>({2, 3, 4, 5}), vec<int, 4>({2, 3, 4, 5}) }); i couldn't figure out right settings. ideas? thank you. sorry, can not. have similar issue in tracker. please, vote!

angular - How long does an Angular2 service hold the class variable values -

i'm have angular2 app dataservice should display different content based on logged in user. my issue authentication service doesn't store data value after first constructed making me unable access user id in other data providers. here's have done accomplish 2 services, 1 component , 1 authguard (see below). logic expect is: authguard called before inbox route activated authguard calls authservice subscribes firebaseauth , sets authstate variable at times if user logged in, dataservice should have value authservice.id authservice however, happens authservice.id yields 'not set' appears never set though user logged in. can proved adding console.log(state) after subscribing auth$ in authservice prints logged in user. my question therefore how long variable private authstate stored in authservice? there other solution obtaining observable value of authservice.id variable before making other calls in dataservice? 1 solution can think of using s...

python - How to print a 2D array in a "pretty" format? -

hello let's have 2d array a = [[1,2,1,2], [3,4,5,3], [8,9,4,3]] , print out in grid table. far code have is: def printarray(a): row in range(len(a[0])): col in range (len(a[0])): b = print("{:8.3f}".format(a[row][col]), end = " ") print(b) when printed out gives me: 1.000 2.000 1.000 2.000 none 3.000 4.000 5.000 3.000 none 8.000 9.000 4.000 3.000 none and error: file "hw8pr2.py", line 17, in printarray b = print("{:8.3f}".format(a[row][col]), end = " ") indexerror: list index out of range can tell me why happening? don't want 'none' @ end of each row either. want output: 1.000 2.000 1.000 2.000 3.000 4.000 5.000 3.000 8.000 9.000 4.000 3.000 there 3 main issues code have posted: way of iterating through array, assignment of b variable return of print statement, , printing of b variable. firs...

git - Relative parent directory path for .gitignore -

in sbt-project have files not want share colleagues personal notes , stuff that. want have them .gitignore d. how can this. placed folder personal project , added .gitignore there line ../personal/ i hoped hide folder personal (including responsible .gitignore) git, seems not valid git. how can achieve this? also /personal/ not work hoped. option 1: using .gitgnore file in personal directory create .gitignore file following content: * git ignore personal directory , files inside it. ignoring files or directories outside of personal directory not possible using approach (at least don't know how achieve using option). option 2: using .git/info/exclude file add following lines .git/info/exclude file: /personal *.dictionary git ignore personal directory , files inside it. it ignore files .dictionary suffix no matter if inside or outside personal directory. further notes & documentation files tracked git not affected. purpose...

php - TravisCI Docker Permissions -

i use docker run php app. want travis ci test app. builds fail, because containers can not open files in /temp directory of app. i have data container: from ubuntu copy ./ /project volume /project cmd ["true"] i use own php fpm container based on php:7.0-fpm - extensions installed. same nginx. my docker compose looks this version: '2' services: data: build: ./ volumes: - .:/project command: "true" nginx: image: mynginx ports: - "80:80" - "443:443" volumes_from: - data links: - php php: image: myphp ports: - "9000:9000" volumes_from: - data you can see use shared volume host. works on local machine (windows) not on travis. and finaly travis.yml sudo: required language: php services: - docker before_script: - docker-compose --build -d # run firefox - docker run -d -p 4444:4444 -p 5900:5900 --name firefox --link ...

How to display data based on post date similar to a timeline using PHP MYSQL -

please me i'm in great problem. want display posts(articles) under respective posting date. for example, november 05 * post 1 * post 2 * post 3 november 04 * post 1 * post 2 i have written php code it's repeating dates , values twice, like: november 05 * post 1 * post 2 * post 3 november 05 * post 1 * post 2 * post 3 november 04 * post 1 * post 2 november 04 * post 1 * post 2 please me! here's code: <?php include("db.php"); include("function.php"); $result=mysqli_query($con,"select distinct post_submitted_on posts order id desc"); while($row=mysqli_fetch_array($result)){ $datetime=$row['post_submitted_on']; //2016-11-05 23:10:45 $date=date("d",strtotime($datetime)); //05 $month=date("f",strtotime($datetime)); //november $final_date=date("y-m-d",strtotime($datetime)); //2016-11-05 ?> <h4 class="date"> <i style...

Autocomplete JQuery XML with Categories -

i'm working on autocomplete jquery xml data being pulled through via ajax. i'm struggling create categories each <state> . the example shown in link below trying achieve https://jqueryui.com/autocomplete/#categories javascript note: tjq = jquery.noconflict(); tjq(function() { var myarr = []; tjq.ajax({ type: "get", url: "http://www.cyplon.co.uk/images/www.cyplon.co.uk/opa-rooms/1/js/destinations-generic.xml", datatype: "xml", success: parsexml, complete: setupac, failure: function(data) { alert("xml file not found"); } }); function parsexml(xml) { tjq(xml).find("state, category").each(function() { console.log(this); label = tjq(this).find("label").attr('value'); country = tjq(this).find("country").attr('value'); destair = tjq(this).find("destair").attr('value'); wantedname = tjq(thi...

build system - How to pass compiler options during Linux kernel compilation? -

for reasons , need compile linux kernel (currently 4.7.10) passing simple , innocent additional command line options (e.g. -pipe -wsomething etc) c compiler. how do it? more specifically, how enforce these compiler flags during plain make during make menuconfig , similar, i.e. passed c compiler whenever latter executed. ps: beg please not ask me details why need stupid this. satisfactory explanation take me several hours write, not 1 of best skills. from linux kernel's makefile: # add arch overrides , user supplied cppflags, aflags , cflags # last assignments kbuild_cppflags += $(arch_cppflags) $(kcppflags) kbuild_aflags += $(arch_aflags) $(kaflags) kbuild_cflags += $(arch_cflags) $(kcflags) so, passing additional options kbuild uses usual environment/makefile variables k prefix: make "kcflags=-pipe -wsomething"

gmail - Java: IMAP with Apache Commons Net - select root folder -

i using apache commons net , goal list of existing gmail folders. i'm trying following code: imapclient imap = new imapsclient(); imap.setdefaultport(port); imap.addprotocolcommandlistener(new printcommandlistener(system.out, true)); imap.connect(server); imap.login(username, password); imap.list("", "*") but gives me: i/system.out: * ok gimap ready requests 5.18.55.93 fi8mb55620436ldc i/system.out: aaaa login ******* i/system.out: * capability imap4rev1 unselect idle namespace quota id xlist children x-gm-ext-1 uidplus compress=deflate enable move condstore esearch utf8=accept list-extended list-status literal- appendlimit=35651584 i/system.out: aaaa ok rextuz@gmail.com authenticated (success) i/system.out: aaab list * i/system.out: aaab bad not parse command i need server provide me list of folders because custom or localized ones might exist. you can use list() method send list command gmail imap server. add appropriate addp...

java - looping jtextfields so it clears if anything but an integer is entered -

i know need code looped i'm not sure how it, don't know have loop? clears textfields @ minute, want textfield has integer cleared. appreciated. try { int = integer.parseint(theapp.tred.gettext()); int b = integer.parseint(theapp.tgreen.gettext()); // uses // information // entered int c = integer.parseint(theapp.tblue.gettext()); if (a < 0) { = 200; // if statements values above , below targets // set tred.settext("200"); } if (a > 255) { = 255; tred.settext("255"); } if (b < 0) { b = 200; tgreen.settext("200"); } if (b > 255) { b = 255; tgreen.settext("255"); } if (c < 0) { c = 200; tblue.settext("200"); } if (c > 255) { ...

parsing - How do I re-write/modify my current Python interpreter's grammar structure, not too good with Python? -

this current python interpreter uses parsing rules take input , print out expression. interpreter works fine, want make , add changes of current grammar rules new grammar rules. far can grammar changes want. this changes want make current grammar: # <stmt-list> ::= empty | <stmt> <stmt-list> # <stmt_list> ::= <stmt> | <stmt> <stmt_list> # <factor> ::= id | intnum | ( <expr> ) # <base> ::= (<expr>) | id | number <stmt> ::= id = <expr> ; | print <expr>; <stmt> ::= id = <expr> ; | iprint <expr> ; | rprint <expr> ; also i'm sure not sure how implement new grammar rules below interpreter, think might have them? <prog> ::= <decl_list> <stmt_list> <decl-list> ::= <decl> | <decl> <decl_list> <decl> ::= <type> <id_list> ; <type> ::= int | real <id_list> ::= id | id {, <id_list>} this curren...

shell - How can I curl 127.0.0.1/8000 while django development server is running? -

i have never ran before because can run dev server, open new tab in terminal , curl there. can't because running django development server docker container , if open new tab, in local shell , not docker container. how can leave development server running , still able curl or run other commands? when run development server i'm left message: django version 1.10.3, using settings 'test.settings' starting development server @ http://127.0.0.1:8000/ quit server control-c. and unable type commands. you can use & run server background job in current shell: $ python manage.py runserver & [1] <pid> $ you can use fg command direct control on runserver process, can stop usual using ctrl+c . to set foreground process background job, can pause using ctrl+z , , run bg command. can see list of running backgrounds job in current shell using jobs command. the difference screen run server in current shell. if exit shell, server stop well,...

c++ - How to apply a tuple of actions on tuple of numbers? -

i have 2 tuples, 1 containing values , tuple containing actions these values. want apply corresponding action on each value, little code "overhead" possible. simplified example below. #include <iostream> #include <boost/hana.hpp> namespace hana = boost::hana; using namespace hana::literals; struct thinkpositive { void operator()(int &val) const { std::cout << "think positive!\n"; val = std::abs(val); } }; struct nice { void operator()(int &val) const { std::cout << val << " nice!\n"; } }; void numbers() { auto handlers = hana::make_tuple(nice{}, thinkpositive{}); auto nums = hana::make_tuple(5, -12); auto handlers_and_nums = hana::zip(handlers, nums); hana::for_each(handlers_and_nums, [](auto &handler_num) { handler_num[0_c](handler_num[1_c]); }); auto result = hana::transform(handlers_and_nums, [](const auto &handler_n...

.net - How to handle click event on shapes of System.Drawing -

i've been trying reach following result in winforms vb.net application desired result where each arc or circle in image clickable , clickable arc colored in pink. i managed write following code private sub form1_paint(byval sender system.object, byval e system.windows.forms.painteventargs) handles mybase.paint 'create pen objects dim p new pen(color.green, 30) dim p1 new pen(color.yellow, 30) dim p2 new pen(color.red, 30) dim p3 new pen(color.blue, 30) 'create rectangle objects dim rt new rectangle(160, 150, 80, 100) dim rt1 new rectangle(100, 150, 80, 100) dim rt2 new rectangle(130, 120, 80, 100) dim rt3 new rectangle(130, 180, 80, 100) 'draw arcs e.graphics.drawarc(p, rt, 45, -90) e.graphics.drawarc(p1, rt1, -135, -90) e.graphics.drawarc(p2, rt2, -45, -90) e.graphics.drawarc(p3, rt3, 135, -90) end sub that resulted following output . output what didn't figure out : 1- how make ...

angular - Debug with Visual Studio Code not working -

Image
i'd able debug angular2 application visual studio code. here's environment: os : ubuntu 16.10 x64 browser : chromium 53.0.2785.143 node : 6.8.0 angular-cli : 1.0.0-beta.19-3 creating new project angular-cli : ng new test-vsc-debug cd test-vsc-debug then open vsc , load project : file/open folder i click on debug logo , configure launch.json selecting chrome . generates following file : { "version": "0.2.0", "configurations": [ { "name": "launch chrome against localhost, sourcemaps", "type": "chrome", "request": "launch", "url": "http://localhost:8080", "sourcemaps": true, "webroot": "${workspaceroot}" }, { "name": "attach chrome, sourcemaps", "type": ...

C - Inserting into sorted linked list with double pointers -

i'm trying create sorted linked list in c following code getting segmentation fault before of input printed. believe because i'm checking ((*link)->value < val) in while loop, @ beginning, null. tried adding conditional if there no elements in list didnt work. how check see if value add smaller without getting seg. fault? struct nodetag { int value; struct nodetag *next; }; typedef struct nodetag node; typedef struct { node *head; int length; } list; void insertsorted(list *list, int val) { node **link = &(list->head); while (*link != null || (*link)->value < val) { //move node correct place in list link = &((*link)->next); } //create new node node *n = (node *)malloc(sizeof(node)); n->value = val; //set next null n->next = null; //insert new node *link = n; } here printlist: void printlist( list *list ) { printf( "%d elements :", list->length )...

python - How can I pass a ctx (Context) to CliRunner? -

clirunner lists no parameter provide context in documentation . the following should qualify minimum working example. real problem bit different. solved moving click decorated function own function test coverage. click function rendered useless. import click click.testing import clirunner class config(): def __init__(self): self.value = 651 @click.command() @click.pass_context def print_numberinfo(ctx): if not hasattr(ctx.obj, 'value'): ctx.obj = config() click.echo(ctx.obj.value) def test_print_numberinfo(): ctx = click.context(print_numberinfo, obj = config()) ctx.obj.value = 777 runner = clirunner() # how pass ctx runner.invoke? result = runner.invoke(print_numberinfo) assert result.output == str(ctx.obj.value) + '\n' you directly pass config instance keyword argument obj runner.invoke : import click click.testing import clirunner class config(): def __init__(self): self.value =...

linux - ./program: cannot execute binary file -

when try execute program, error: mybookliveduo1:/opt/program# ./program -bash: ./program: cannot execute binary file there output of objdump: mybookliveduo1:/opt/program# objdump -a /bin/bash /bin/bash: file format elf32-powerpc mybookliveduo1:/opt/program# objdump -a program program: file format elf32-little can execute such file on cpu architecture?

python - 'NoneType' object has no attribute 'username'? -

so got error attributeerror: 'nonetype' object has no attribute 'username' any suggestions, models.py class user(db.model): __tablename__ = "users" id = db.column(db.integer, primary_key=true) username = db.column(db.string(80), unique=true) password = db.column(db.string(20), unique=true) def __init__(self, username, password): self.username = username self.password= bcrypt.generate_password_hash(password, 10) def is_authenticated(self): return true def is_active(self): return true def is_anonymous(self): return false def get_id(self): return (self.id) def __repr__(self): return '<user %r>' % self.username views.py @app.route('/register', methods=['get','post']) def register(): if request.method == 'get': return render_template('register.html') user = user(request.form...

c++ - static method or non-static method using static field -

i have static const std::vector<sometype> field in class. have 2 private methods uses field (searching methods). not use members of class. should define static or normal methods? what should prefer? advantages/disadvantages? methods reference static members should defined static. lets access these methods without creating instance of class, , access them static context (e.g. non-member function). the exception rule when need make access member function defined virtual. in case have no option make function static, because static functions cannot override virtual functions.

performance - Sharing of resources on AWS -

i interested in understanding way in hardware resources (cpu, disk, network, etc.) of aws physical server shared between different applications. people have experiences inexplicable performance changes in services running on aws have attributed application sharing physical resources? if so, how did go debugging this? in particular, interested in more complicated interactions between resources, such cpu->memory bandwidth. if run 15 vms on single machine, surely have worse performance if ran 2 vms. perhaps more general question xen virtualization, don't know if there kind of aws magic happening under hood don't know about. i not sure if right forum kind of question; if not, helpful if point me towards resource or forum. amazon ec2 instances not susceptible "noisy neighbour" problems. based upon instance type selected, ec2 instance receives cpu, memory , (for instance types) locally attached disk storage. these resources dedicated instance , not...

algorithm - Permutations II, remove duplicates in recursion -

given list of numbers duplicate number in it. find unique permutations. for numbers [1,2,2] unique permutations are: [ [1,2,2], [2,1,2], [2,2,1] ] in method called hepler, in order remove duplicates, have if statement: if (i != 0 && nums[i] == nums[i-1] && !set.contains(i-1) ) { continue; } but found if change !set.contains(i - 1) set.contains(i-1) it's still correct(leetcode accepted), should !set.contains(i - 1) . anyone know reasons? class solution { /** * @param nums: list of integers. * @return: list of unique permutations. */ public list<list<integer>> permuteunique(int[] nums) { list<list<integer>> list = new arraylist<list<integer>>(); if (nums == null) { return list; } if (nums.length == 0) { list.add( new arraylist<integer>() ); return list; } arrays.sort(nums); hashset<integer> set = new hashset<integer>(); array...

c - How to output special characters in cmd window? -

once write c program , try output special characters (like ä ö ü ß) printf() on cmd window on windows 10 shows sth ▒▒▒▒▒▒▒▒▒▒▒▒ but if type them in cmd window without c programm being executed displays these characters properly. when change console type standard output in netbeans output correct well. tried change codepage of cmd didnt fix problem. use gcc c compiler. it way printf handled , default printf only prints ascii characters in , a's z's , here link wikipedia article https://en.wikipedia.org/wiki/ascii , print special characters / characters other languages , use , replace your string text want print printf(l"your string"); in short , add prefix l , capital l before string print special characters. hope helped mukund2003

javascript - D3.js: Text is not showing inside a circle(They are on the same level of an element-group). How do I bring the text to the front? -

the title says all, this codepen. text not showing within circles. how do put text on front?. code: var dataset = [ 5, 10, 15, 20, 25, 40 ]; var w=600,h=600; var svg=d3.select("body").append("svg") .attr("width",w) .attr("height",h); //1st level:all circles group var circlesgroup = svg.append("g").classed("general-group",true); //2nd level: group of circle , text var elementgroup= circlesgroup .selectall('circle') .data(dataset) .enter() .append("g").classed("element-group",true); var circle=elementgroup.append('circle'); var circleattributes= circle .attr("cx", function(d,i){return i*80+40;}) .attr("cy", h/2) .attr("r", 20) .attr("stroke","black") .attr("fill"...

URL Rewrite wordpress -

i want rewrite posts url in wordpress using add_rewrite_rule. if query_var action set. example: example.com/my-post-name-slug/?action=query_action to: example.com/my-post-name-slug/query_action is possible? htaccess # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase /hot/ rewriterule ^ajax/([^/]*)/([^/]*).html$ /hot/wp-admin/admin-ajax.php?action=$1&movie_id=$2 [l] rewritecond %{request_filename} ^\?action\=$ rewritecond ^\?action\= ^/?$ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /hot/index.php [l] </ifmodule> # end wordpress update: solve add_rewrite_rule('^slug/([^/]*)/([^/]*)/?','index.php?post_type=tpp&name=$matches[1]&action-query=$matches[2]','top'); you do rewriteengine on rewritecond %{request_filename} ^\?action\=$ rewritecond ^\?action\= ^/?$ should work hope helped mukund2003

mysql - Need help writing SQL queries(joins, subqueries) -

given following schema, i'm supposed write queries questions. my first query runs no result , second 1 gives subquery returns more 1 row error. student (sid, sname, sex, birthdate, gpa) prof (pname, dname) course (cnum, dname, cname) section (cnum, secnum, pname) enroll (sid, cnum, secnum, grade) for each course, return number of sections (numsections), total number of students enrolled (numstudents), average grade (avggrade), , number of distinct professors taught course (numprofs). show courses in chemistry or computer science department. make sure show courses if have no students. not show course if there no professors teaching course. return students received higher grade course section average in @ least 2 courses. order number of courses higher average , show top 5. sql query: select c.cnum, c.cname, count(*) numsections, count(e.sid) numstudents, avg(e.grade) avggrade, count(p.pname) numprofs course c join section s on c.cnum = s.cnum join enroll...

Refactoring C to C++ for Bernoulli Number calculation -

rosettacode has article calculation of bernoulli numbers . unfortunately not provide example in c++, 1 in c (as of december 27, 2016). i not familiar c, lot of recognizable. how program adapted c++? #include <stdlib.h> #include <gmp.h> #define mpq_for(buf, op, n)\ {\ size_t i;\ (i = 0; < (n); ++i)\ mpq_##op(buf[i]);\ } while (0) void bernoulli(mpq_t rop, unsigned int n) { unsigned int m, j; mpq_t *a = malloc(sizeof(mpq_t) * (n + 1)); mpq_for(a, init, n + 1); (m = 0; m <= n; ++m) { mpq_set_ui(a[m], 1, m + 1); (j = m; j > 0; --j) { mpq_sub(a[j-1], a[j], a[j-1]); mpq_set_ui(rop, j, 1); mpq_mul(a[j-1], a[j-1], rop); } } mpq_set(rop, a[0]); mpq_for(a, clear, n + 1); free(a); } int main(void) { mpq_t rop; mpz_t n, d; mpq_init(rop); mpz_inits(n, d, null); unsigned int i; (i = 0; <= 60; ++i) { bern...

Linux - Loop User input in CSH -

i need loop user input 10 times or until user presses "n" , echo out list of words entered. when run message: directory stack not deep . #!/bin/csh echo "enter word" set buffer = ("" "" "" "" "" "" "" "" "" "") set count = 0 set argument = $< while ($count <=10 && $argument != "n") set buffer[$count] = $argument @ count++ if ($argument = "n") break endif set buffer [$count] = $argument @ count++`enter code here` end echo $buffer 1st try that's 1st csh script: #!/bin/csh set buffer = ('' '' '' '' '' '' '' '' '' '') set count = 1 echo -n "enter 1st word: " set argument = $< while ($count <= 10 && $argument != "n") set buffer[$count] = $argument @ count++ if ($count <= 10) echo ...

javascript - Changing individual characters in a string does not work in a loop -

so, i'm working on exercise questions. code seems working fine until decide loop through string replace instance of period nothing. reason, loop doesn't work. imagine has not calling somehow, i'm not sure how call loop. thought loops automatically overwrote looping through. here exercise , incomplete solution: write javascript function parameterize string. function string_parameterize(string) { var lowercase_string = string.tolowercase(); var split_string = lowercase_string.split(" "); var joined_string = split_string.join("-"); (i = 0; < joined_string.length; i++) { if (joined_string[i] === ".") { joined_string[i] === ""; } } return joined_string; } //test data : console.log(string_parameterize("robin singh usa.")); the answer should robin-singh-from-usa without period, keeps coming out robin-singh-from-usa. period. the other...

esp8266 - NodeMCU Flashing Error -

my board nodemcu devkit v1.0. have been trying flash nodemcu custom build using cloud service.(on top of standard selected ones add dht library) binary name nodemcu-master-8-modules-2016-11-03-03-23-44-integer believe uses master build 1.5.4.1 first attempt: i used esp8266flasher.exe windows. selected custom build binary , flashed address 0x00000.(baud:230400 flash speed:40 mhz spi mode:dio flash size:4mbyte) at point board repeatedly rebooting(blue led going on/off @ high frequency) so have gone through documentation , learned problems due change of esp_init_data_default.bin when upgrade nodemcu 0.9 build. second attempt: i used erase_flash using esptool.py esptool.py --port /dev/tty.slab_usbtouart erase_flash and flashed custom build again. third attempt: i did erase_flash via esptool.py. time downloaded sdk patch 1.5.4.1 , flashed esp_init_data_default.bin address 0x3fc000 custom build 0x00000. there no rebooting error when ran esplorer , connect board fol...

d3.js - how to plot one column as x axis and the other column as y axis in D3/javascripts -

i'd know how scatter plot 1 column(a) values x axis , other column(b) y axis. each row have redundant values in column different values in column b. i'd plot unique values in x axis. e.g. a b groupa 10 groupb 20 groupa 30 groupc 5 groupb 11 in x axis, plot group a, b, c without redundancy. in y axis, plot each values belong each group. instead of setting x axis values manually pre defining {groupa,groupb,groupc}, read observations automatically column , saves array , plot it. can me start this? thanks, the easiest way achieve setting 2 scales, 1 ordinal scale x axis, scalepoint , , 1 linear scale y axis. this x scale: var xscale = d3.scalepoint() .domain(data.map(function(d){return d.a})) .range([50, width-50]) .padding(0.5); and y scale: var yscale = d3.scalelinear() .domain([0, d3.max(data, function(d){return d.b})*1.1]) .range([height - 50, 10]); here demo: var data = [{a: "gr...