Posts

Showing posts from April, 2015

android - How to make it from vertical to horizontal view -

when activate start time see number being increased during time when change mobile landscape vertical horizontal , horizontal vertical. obstacle: when number displayed increased value , want change mobile landscape vertical horizontal view. when did itthe numbers go scratch. today, i'm newbie in android , source code below doesn't work make it. what part missing? -------------------------- class stopwatchactivity package com.jfdimarzio.stopwatch4; import android.os.handler; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.textview; public class stopwatchactivity extends appcompatactivity { private int seconds = 0; private boolean running; private boolean wasrunning; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_stopwatch); if(savedinstancestate != nu...

python - Asyncio looping or Multiprocessing blocking most cpu intensive? -

i've never done asyncio, beacuse control freak. when i've threaded programs i've use multiprocessing , structured programs around queue, blocks if nothing happening, sitting there waiting. well asyncio has event loop. i'm wandering wast resources most? wonder if there obvious case using asyncio?

ruby on rails - Live Mode Stripe Error `can't communicate with our payment processor because the API key is invalid.` -

Image
i got app working on stripe's test mode, when flipped toggle switch live on stripe dashboard , changed stripe_publishable_key , stripe_secret_key on secrets.yml file keep getting error: stripe checkout can't communicate our payment processor because api key invalid. please contact website owner or support@stripe.com. i'm not sure code put on here people troubleshoot because working fine in test mode, here's structure of secrets.yml : development: secret_key_base: ***secret key base here*** stripe_publishable_key: ***publishable key here*** stripe_secret_key: ***secret key here*** test: secret_key_base: ***secret key base here*** # not keep production secrets in repository, # instead read values environment. production: secret_key_base: <%= env["secret_key_base"] %> stripe_publishable_key: env['stripe_publishable_key'] stripe_secret_key: env['stripe_publishable_key'] i checked other posts this one ...

windows - Python method for reading keypress? -

i'm new python, , made game , menu in python. question is, using (raw_)input() requires me press enter after every keypress, i'd make pressing downarrow instantly select next menuitem, or move down in game. @ moment, requires me type "down" , hit enter. did quite alot of research, prefer not download huge modules (fe. pygame) achieve single keydown() method. there easier ways, couldn't find? edit: found out msvcrt.getch() trick. it's not keydown(), works. however, i'm not sure how use either, seems quite weird, here? got @ momemt: from msvcrt import getch while true: key = getch() print(key) however, keeps giving me these nonsense bytes, example, downarrow this: b'\xe0' b'p' and have no idea how use them, i've tried compare chr() , use ord() can't comparisons. i'm trying this: from msvcrt import getch while true: key = getch() if key == escape: break elif key == downarrow: mo...

android - progress dialog will not show up -

i want pressing button show progress dialog , dismiss when function done. code below , although it's easy unknown reason me won't run. final button button = (button) findviewbyid(r.id.syncbtn); button.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { // perform action on click progressdialog progressdialog = new progressdialog(mainactivity.this); progressdialog.setprogressstyle(progressdialog.style_spinner); progressdialog.setcancelable(false); progressdialog.settitle("please wait.."); progressdialog.setmessage("preparing download ..."); progressdialog.show(); bringdata(); progressdialog.dismiss(); } }); two possibilities can think of why not working you: the method "bringdata()" executed on ui thread. ui thread doing work (executing bringdata) , won't redraw ui. afte...

hdl - verilog, why is this illegal reference to net -

i new verilog don't why illegal reference net signal (subcounter_of_counter). mean it's combinational logic thanks in advance :) wire [n-1:0] subcounter_of_counter; reg [n-1:0] mask,free; @(*) begin //command or id or mask or free or subcounter_of_counter if (command==increment) begin (int = 0; < n; i=i+1)begin if (i<id) begin subcounter_of_counter[i]=1'b0; end else if (i==id) begin subcounter_of_counter[i]=1'b1; end else begin if( (|mask[id+1:i]) || (|free[id+1:i]) ) begin subcounter_of_counter[i]=1'b0; end else begin subcounter_of_counter[i]=1'b1; end end end end end a wire nettype, , nettype cannot assigned in always blocks or initial blocks. change subcounter_of_counter ...

jquery - How to use external javascript in chrome extension -

i writing chrome extension , want use jquery , simpleweather.js . purpose of extension show outside temperature in new tab nice background image. when use scripts externally html site working , displays temperature extension not working. html: <head> <title>nová karta</title> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.simpleweather/3.1.0/jquery.simpleweather.min.js"></script> <script src="javascript.js"></script> </head> manifest: { "browser_action": { "default_title": "timepage", "def...

ios - Swift: Share email with HTML contents and list the email apps existing in the device using UIActivityViewController -

i want share email swift application containing link, text , styled text receive server in html form. find can use uiactivityviewcontroller list applications , set array of objects share. my questions: 1: how can letting user choose mail application want use? 2: if specify application in code didn't exist in device? 3: how html can converted custom text in email?

sql server - Splitting contents of one sql column into 3 columns based on certain characters that always happen in the value -

i'm trying form sql query, using sql server 2014 without creating function. not have permissions on database create functions have query only. i have column named test example value of: accounting -> add missing functionality in payable -> saving blank missing row i want query return information (of varying length) between 2 arrows ( -> ). have tried right, left, substring, charindex , patindex functions , various combinations of each. basically query needs substring(test, charindex(' -> ', test) +3, <some length here>) the length part i'm having hard time figuring out. need full length minus first part before , including first -> evaluates to: add missing functionality in payable -> saving blank missing row from result, need remove after , including -> , leave me with: add missing functionality in payable at end of day, want split 1 column 3 so: domain | feature | test ----------...

python - efficiently convert uneven list of lists to minimal containing array padded with nan -

Image
consider list of lists l l = [[1, 2, 3], [1, 2]] if convert np.array i'll 1 dimensional object array [1, 2, 3] in first position , [1, 2] in second position. print(np.array(l)) [[1, 2, 3] [1, 2]] i want instead print(np.array([[1, 2, 3], [1, 2, np.nan]])) [[ 1. 2. 3.] [ 1. 2. nan]] i can loop, know how unpopular loops are def box_pir(l): lengths = [i in map(len, l)] shape = (len(l), max(lengths)) = np.full(shape, np.nan) i, r in enumerate(l): a[i, :lengths[i]] = r return print(box_pir(l)) [[ 1. 2. 3.] [ 1. 2. nan]] how do in fast, vectorized way? timing setup functions %%cython import numpy np def box_pir_cython(l): lengths = [len(item) item in l] shape = (len(l), max(lengths)) = np.full(shape, np.nan) i, r in enumerate(l): a[i, :lengths[i]] = r return def box_divikar(v): lens = np.array([len(item) item in v]) mask = lens[:,none] > np.arange(len...

C++ Linked list issues with strings -

i'm quite new c++ , trying insert phone number , name inside of linked list user can set.i'm wondering i'm going wrong, i've been watching video after video using integers in linked lists , not strings. so if main taken out program shows (0)errors , (0)warnings think problem in main. so in main i'm trying cin nam(which have inside function part of set_first). i've tried passing address think i'm pulling @ straws that. so question is: can point me in right direction, or let me know how put name , phone number node user specifies? here's programs far descending main: #include <iostream> #include <cstdlib> #include "l_list_1.h" using namespace std; int main() { l_list_1 obr; std::string nam; cout << "name"; cin >> nam; obr.set_first(nam); //i'm trying give nam since that's have inside set_first function. return 0; } my header file looks this: #ifndef l_list_1_h #...

Python numpy matrix assign value -

i wondering why different result in 2 prints? shouldn't same? import numpy np x = np.array([[1.5, 2], [2.4, 6]]) k = np.copy(x) in range(len(x)): j in range(len(x[i])): k[i][j] = 1 / (1 + np.exp(-x[i][j])) print("k[i][j]:"+str(k[i][j])) print("value:"+str(1 / (1 + np.exp(-x[i][j])))) i've run code python3 , python2 , results absolutely same. besides, don't have looping when using numpy arrays allows express many kinds of data processing tasks concise array expressions might otherwise require writing loops. practice of replacing explicit loops array expressions commonly referred vectorization. in general, vectorized array operations 1 or 2 (or more) orders of magnitude faster pure python equivalents, biggest impact in kind of numerical computations. so, keeping in mind may rewrite code follows: import numpy np x = np.array([[1.5, 2], [2.4, 6]], dtype=np.float) k = 1 / (1 + np...

mysql - Trouble determining isolation level -

i creating database of stock income statements. every year on january first, companies update information previous year. companies go public/go bankrupt, added or deleted database. don't believe there conflict between of these transactions, still unsure whether go read committed or repeatable read. this example of 2 of tables table: company attributes: ticker(primary key), compname table: incomestatement attributes: ticker(primary key), revenue, netincome

python - Broadcasting with reduction or extension in Numpy -

in following code calculate magnitudes of vectors between pairs of given points. speed operation in numpy can use broadcasting import numpy np points = np.random.rand(10,3) pair_vectors = points[:,np.newaxis,:] - points[np.newaxis,:,:] pair_dists = np.linalg.norm(pair_vectors,axis=2).shape or outer product iteration it = np.nditer([points,points,none], flags=['external_loop'], op_axes=[[0,-1,1],[-1,0,1],none]) a,b,c in it: c[...] = b - pair_vectors = it.operands[2] pair_dists = np.linalg.norm(pair_vectors,axis=2) my question how 1 use broadcasting or outer product iteration create array form 10x10x6 last axis contains coordinates of both points in pair (extension). , in related way, possible calculate pair distances using broadcasting or outer product iteration directly, i.e. produce matrix of form 10x10 without first calculating difference vectors (reduction). to clarify, following code creates desired matrices using slow looping. pair_coords = np.zeros(10...

C++ access to static class member variables, not friend -

i'm sorry in advance if stupid or nonsense question, but: can non-constant static class variable 1 class used class without using friend or base/derived classes? (abbreviated) situation is: class decl { public: static string searchval; ... (other irrelevant stuff) }; class conj { public: static string searchval; ... (other irrelevant stuff) }; i don't want repeat searchval in both classes, , because of rest of program, i'm not keen on using friend (but if it's option). since static members public , if class definitions both visible, static members can accessed using decl::searchval or conj::searchval respectively. for example class decl { public: static string searchval; }; class conj { public: static string searchval; }; // within function, including members of either class above // ... long both definitions above visible compiler if (conj::searchval == decl::searchval) { ...

How to remove duplicate values from defaultdict(int) in python? -

i have dictionary consists of unique key value pairs follows: edu_bg={1: 1, 2: 2, 3: 1, 4: 1, 5: 2, 6: 2} i want create dictionary above data similar records (which has similar values) grouped follows: {(1, 3): 1, (5, 6): 1, (1, 4): 1, (2, 6): 1,(2, 5): 1, (3, 4): 1}) i tried achieve above output using following code: myedu = defaultdict(int) k,v in edu_bg.iteritems(): k,v in edu_bg.iteritems(): if k == k , v == v: pass if k != k , v == v: myedu[(k,k)] += 1 else: pass however has resulted in duplicate records follows: defaultdict(<type 'int'>, {(1, 3): 1, (5, 6): 1, (4, 1): 1, (3, 1): 1, (5, 2): 1, (1, 4): 1, (2, 6): 1, (4, 3): 1, (6, 2): 1, (2, 5): 1, (3, 4): 1, (6, 5): 1}) i want remove these duplicate values. advice on problem appreciated. instead of iterating on cartesian product of every pair, iterated on n^2 elements, iterate on every ...

android - PushNotification does not work in ionic 1 -

i'm working on ionic 1 application not work. not seem read pushnotification plugin. > var push = pushnotification.init ({ > android: { > senderid: "---------------" > }, > ios: { > alert: "true", > badge: "true", > sound: "true" > }, > windows: {} > }); how can make pushnotification work on ionic 1?

html5 - How to assign a filename to a direct .mp3 download? -

first of all, let me state have pretty 0 knowledge of code. own http://www.cultureleak.com , i'm changing way people can download off site. i have direct .mp3 links (f.e. http://dopefile.pk/mp3embed-74bktdjz1web.mp3 ) , when click them save audio.mp3 (audio1.mp3, audio2mp3 etc). want assign them filename. tried doing via html5 download attribute. i can't work (and it's not browser related). ideas/is possible give link assigned name? just use download attribute name file (not download) (click here ) <a href="audio/youraudio.mp3" download="youraudioname.mp3">download</a>

mysql - I can't edit /etc/hostfig -

i want uninstall mysql,initially can't use ls , set vi ~/.bash_profile insert ls='ls -a' then delete '.bash_profile.swp' file, after found can't edit /etc/hostconfig tip:-bash:edit:command not found. you must use user correct rights , root or sudo.

css3 - How can I put a interpolation in sass name of var -

Image
i cant math in loop name of var nane of color var i want this i sure have minor syntax error how interpolation works in general , sure it's doable similar approach. see answer corrects error. however, in place go approach instead (probably in file named _colors.scss): $brown: ( brown1: #000, brown2: #000, brown3: #000, brown4: #000, brown5: #000, brown6: #000 ); @each $key, $value in $brown { .txt-#{$key} { color: $value; } } it's called sass maps , it's pretty powerful tool complex use cases well. suggest it. start: https://www.sitepoint.com/using-sass-maps/

Where should css go in .html page? -

i have index.html page , style.css file. i have style class called .slider , style class called .logo . should put both .slider , .logo inside style.css page or should put .slider in index.html , .logo inside .css? im asking because dont know if should put styles related 1 page inside global style.css or should put inline in page applies to? styles can go in 1 of 3 places. inline on element itself in html page in separate file i suggest either putting in <style> tag in <head> of html or putting in separate file, either work well. having styles in separate file means reuse styles on page if needed.

html - Border Right is being set on the opposite of the page -

when place border on right of text border @ right of page, not right of text. i've removed default border properties of browser , result still same. on code pen third result want border on right. example: http://codepen.io/twig941/pen/zoqexx code: <div class = "logo"> 3 words </div> <br> <br> <br> <br> <div class = "ideal-logo"> <br> 3 <br> words </div> <div class = "ideal-left"> <br> 3 <br> words </div> .logo { border-right: 10px solid black; } .ideal-logo { border-right: 5px solid black; } .ideal-left { border-left: 5px solid black; } use display: inline-block; on .logo & .ideal-logo . block elements why flowing end-to-end. here snippet, have look: .logo { display: inline-block; border-right: 10px solid black; } .ideal-logo { display: inline-block; border-right: 5px solid black; } ...

ios - How to set default text for addTextField in UIAlertController in Swift -

below the code tried. textfield.placeholder works perfectly, need set default text textfield created using addtextfield in uialertcontroller. let getpinnamealert = uialertcontroller(title: title, message: message, preferredstyle: .alert) getpinnamealert.addtextfield(configurationhandler: { (textfield) -> void in // textfield.placeholder = "pin name" textfield.text = "current pin name" textfield.keyboardtype = uikeyboardtype.default textfield.clearsonbeginediting = true }) remove line textfield.clearsonbeginediting = true by default, alert automatically focuses on text field, why text set being cleared.

authentication - Why is php password_verify and password_hash using different encryption identifiers? -

after troubleshooting, have determined when hash password using php's password_hash function, encryption identifier $2y$. however, when use password_verify function compare stored hashed password user input password, password_verify not return true. if generate new password using $2a$ identifier on https://www.bcrypt-generator.com/ , replace stored hashed password it, returns true. i'm hoping can explain why password_hash($password, password_default) using $2y$ , why password_verify() using $2a$. or else might doing wrong here matter. doing locally on wamp server running php version 7.0.10. here example of code having trouble ($2y$ identifier not return true). <?php // $hashnotworking came password_hash("testing", password_default)."\n"; $hashnotworking = '$2y$10$dnpos6f7vo4z2iryu./ecobd7bmkwlkk9yiyjb0hvni14b1dbfhbc'; if (password_verify('testing', $hashnotworking)) { echo 'password valid!'; } else { echo 'invalid...

Stop user from typing into input field after certain character limit with PURE JAVASCRIPT -

i have use js. assignment. this code: var bio = document.getelementbyid('bio'); var charsleft = document.getelementbyid('charsleft'); bio.onkeypress = function(evt) { evt = evt || window.event; var remaining; var perm = bio.value; remaining = 139 - bio.value.length; charsleft.innerhtml = remaining; if (remaining == 0) { bio.value = perm; } } it not stop user typing stuff after charsleft 0. please not mark duplicate! this pure javascript approach find you dont need javascript : <input type="text" name="fieldname" maxlength="100">

firefox addon - Options page not showing -

i'm writing new add-on web extension. in package.manifest, have options_ui set: "options_ui": { "page": "options.html" } but in about:addons, options button not present. so tried call page directly background script: runtime.openoptionspage(); but error: message: referenceerror: runtime not defined same error type with: chrome.runtime.openoptionspage(); message: referenceerror: chrome not defined i'm missing obvious there. tested firefox esr 45.0.4 , latest firefox dev edition (51.0a2). how can options page show in about:addons , how can call background script? it's browser.runtime.blah or chrome.runtime.blah . i'm not sure if esr 45 supports it. this code should go in background script right? please post more of code can update answer.

php - $_post does not contain anything -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 23 answers i trying login seems variables dont contain anthing. encountered problem before managed fix , name attribute missing in html form time..but time don't know doing wrong .plz help? here html snippet. returning blank after submit: <form action="onlogin.php" method="post"> <h1>login form</h1> <div> <input type="text" placeholder="username" required="" name="username" /> </div> <div> <input type="password" placeholder="password" required="" name="password" /> ...

java - How to solve Apache jmeter installing error? -

Image
i truing jmeter latest version in windows 7 ultimate version 6.1.7601 . have java 1.7.9.10, added jdk system path, , added jre 7 also. [please click see error] https://i.stack.imgur.com/cwtky.png your appreciated. you need add bin folder of jdk or jre path jmeter find existing java installation. if have installed jre - restart cmd process pick relevant path entries. also make sure java -version command reports you're sitting on jdk or jre not earlier 1.7 more information: how started jmeter: part 1 - installation & test plans

python - Divide a dict by a number (int) -

i have problem, have create fuction divide dict int. dict: counter({1: [9, 10, 1], 2: [5, 1, 1, 2, 1, 1, 9, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 3, 1, 1, 2, 1, 1, 1, 3, 4, 1, 1, 1, 3, 1, 4, 1, 1, 1, 1], 0: [1, 5, 1, 1, 2, 10, 1, 2, 1, 2, 2, 1, 1]}) and function: def probabilitacondizionata(lista, sommafreq): lista= {k: v / sommafreq k, v in lista.items()} return lista and function, sum value(int) sommafreq: def sommafrequenze(lista): sommafreq= sum(lista.values()) return sommafreq this instruction gives me error: unsupported operand type(s) /: 'dict_values' , 'int' .. the output like: counter({1: [9/sommafreq, 10/sommafreq, 1/sommafreq], 2: [5/sommafreq, 1sommafreq, 1/sommafreq, 2/sommafreq, 1/sommafreq, 1/sommafreq, 9, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 3, 1, 1, 2, 1, 1, 1, 3, 4, 1, 1, 1, 3, 1, 4, 1, 1, 1, 1], 0: [1, 5, 1, 1, 2, 10, 1, 2, 1, 2, 2, 1, 1]}) and...

java - Iterator doesn't have a method to getNextElement directly without moving cursor -

why there no method element directly without iterating through it? i have looked answer , found copy-pasted answer this: it can implemented on top of current iterator interface since use rare, doesn't make sense include in interface has implement. what's reason behind this? collection interface extends "iterable".so implementations have use iterator. element in map directly,we can use map.get(key). element in list can use index. list implements randaomaccess interface easy element directly using key. in set cant element directly. point trying make implementations different 1 thing common in implementations need go through objects inside collection .this job done iterator. now java promotes object oriented programming using iterator can use object(iterator instance) , call methods hasnext() first check if element present.it imposes limit of iteration restriction. using next() next element. hasnext() imposes nullcheck also. in nutshell promote...

recyclerview - Native express ad in recycler view, Article model cannot be cast to com.google.android.gms.ads.NativeExpressAdView -

Image
this error: this code: nativeexpressadviewholder nativeexpressholder = (nativeexpressadviewholder) holder; nativeexpressadview adview = (nativeexpressadview) mlist.get(position); viewgroup adcardview = (viewgroup) nativeexpressholder.itemview; if (adcardview.getchildcount() > 0) { adcardview.removeallviews(); } // add native express ad native express ad view. adcardview.addview(adview); error @ line: viewgroup adcardview = (viewgroup)nativeexpressholder.itemview;

swift3 - Resume Data from URLSessionDownloadTask Always nil -

i have app need download file internet when downloading file it's work problem when pressed pause button pause downloading 1 minute or more nil resume data the following code : @ibaction func startdownloading(_ sender: uibutton) { isdownload = true sessionconfig = urlsessionconfiguration.default let operationqueue = operationqueue.main session = urlsession.init(configuration: sessionconfig, delegate: self, delegatequeue: operationqueue) let url = url(string: "www.example.com") downloadtask = session.downloadtask(with: url!) downloadtask.resume() } @ibaction func pause(_ sender: uibutton) { if downloadtask != nil && isdownload { self.downloadtask!.cancel(byproducingresumedata: { (resumedata) in // here nil resume data }) isdownload = false downloadtask = nil pasuebtnoutlet.settitle("resume", for: .normal) } if !isdownload ...

ReDim Preserve to a Multi-Dimensional Array in Visual Basic 6 -

i'm using vb6 , need redim preserve multi-dimensional array: dim n, m integer n = 1 m = 0 dim arrcity() string redim arrcity(n, m) n = n + 1 m = m + 1 redim preserve arrcity(n, m) whenever have written it, following error: runtime error 9: subscript out of range because can change last array dimension, in task have change whole array (2 dimensions in example) ! is there workaround or solution this? as correctly point out, 1 can redim preserve last dimension of array ( redim statement on msdn): if use preserve keyword, can resize last array dimension , can't change number of dimensions @ all. example, if array has 1 dimension, can resize dimension because last , dimension. however, if array has 2 or more dimensions, can change size of last dimension , still preserve contents of array hence, first issue decide whether 2-dimensional array best data structure job. maybe, 1-dimensional array better fit need...

css - Bootstrap grid of images for small resolution -

i have simple home page: https://jsfiddle.net/1lotp6ce/1/ there 6 images in 2 rows (3 x 2). works fine larger screens, once gets sm images start overlapping. how may fix sm 2 images x 3 rows without overlapping. update: i'd need not not overlap have spaces between rows. you can using 1 .row element parent , other child. keep in mind size of images should pixel perfect each other (i.e. image sizes should 200x200). and use .img-responsive class on <img> tags. and use column classes <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">...</div> something like: <div class="row"> <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4"> <a href="#"><img class="img-responsive" src="img-url"></a> </div> <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4"> <a href="#"><img class="img-responsive" src=...

javascript - Array.prototype.reject(): TypeError: ....reject is not a function -

i taking cool online course functional programming in javascript. following along fine until instructor used array.prototype.reject() , did not work me @ run time. i use "reject" instead of loop because less code. but, browser, nodejs , express code consoles tell me reject not function . i researched other articles discuss promise.reject not function, provide solutions not make sense scenario. here example code in course: var animals = [ { name: 'fluffykins', species: 'rabbit' }, { name: 'caro', species: 'dog' }, { name: 'hamilton', species: 'dog' }, { name: 'harold', species: 'fish' }, { name: 'ursula', species: 'cat' }, { name: 'jimmy', species: 'fish' } ]; var isdog = function(animal){ return animal.species === 'dog'; } var otheranimals = animals.reject(isdog); the work-around for-loop: var...

php - How to show all users, including IP, rank and other variables? -

i starting php/sql-programmer, making dashboard learning , have question. want let page show this: id name       ip              rank 1   willem   127.0.0.1 5 2   you       127.0.0.1 3 <table style="width:100%;color:white;"> <tr> <th><center>id</center></th><th>naam:</th><th>ip:</th><th><center>actie</center></th> </tr> <?php $d = $con->query("select * tbl_users order id desc limit 1000"); while($r = $d->fetch_object()){ ?> <tr> <td style="width:35px;text-align:center;"><?php echo $r->id; ?></td> <td><?php echo $r->username; ?></td> <td><font color="r...

shell - WGET get HEADER if 302 -

i need response if 302 redirect. page returns set-cookie headers , after redirects page. how can header response if redirecting wget? (cant use curl) i trying max-redirects = 0, it's stop redirect , response empty --2016-11-13 14:55:43-- https://host/cgi-bin/auth resolving host ... 255.255.255.255 connecting host|255.255.255.255|:443... connected. http request sent, awaiting response... 302 ok location: https://host/messages/inbox?back=1&modal=1&opener=host.login&allow_external=1&back=1&from=mail.login&type=login [following] 0 redirections exceeded.

scala - Add column index to dataframe based on another column (user in this case) -

i have dataframe given below last column represents number of times user has searched location , stay | hanks| rotterdam| airbnb7| 1| |sanders| rotterdam| airbnb2| 1| | hanks| rotterdam| airbnb2| 3| | hanks| tokyo| airbnb8| 2| | larry| hanoi| | 2| | mango| seoul| airbnb5| 1| | larry| hanoi| airbnb1| 2| which want transform follows | hanks| rotterdam| airbnb7| 1| 1| |sanders| rotterdam| airbnb2| 1| 1| | hanks| rotterdam| airbnb2| 3| 2| | hanks| tokyo| airbnb8| 2| 3| | larry| hanoi| | 2| 0| | mango| seoul| air...

java - AWT Radio Button -

i want change background of frame based on selected radio button. has done using awt. current code change color blue. when clicked on green, nothing changed. import java.awt.*; import java.awt.event.*; class extends frame implements itemlistener { checkbox c1,c2; checkboxgroup cbg; a() { setlayout(new flowlayout()); cbg= new checkboxgroup(); c1= new checkbox("blue",cbg,false); c2= new checkbox("green",cbg,true); this.add(c1); this.add(c2); c1.additemlistener(this); c2.additemlistener(this); } public void itemstatechanged(itemevent e) { if(e.getstatechange()==itemevent.selected) this.setbackground(color.blue); else if(e.getstatechange()==itemevent.selected) this.setbackground(color.green); else this.setbackground(color.black); } public static void main(string[] args) { a= new a(); ...

elasticsearch - Multiple should queries with must query -

i building query elastic 5 (using nest in .net), trying achive result: must have value1 , value 2 should have value3 or value 4 and should have value5 or value6 here query: { "query": { "bool": { "must": [ { "match": { "code": { "query": "value1" } } }, { "match": { "code": { "query": "value2" } } } ], "should": [ { "match": { "code": { "query": "value3" } } }, { "match": { "code": { "query": "value4" } } } ], "should": [ { ...

html - Want my nav be responsively inline centered under logo -

got logo: <div class="logo"></div> and navigation: <ul class="bar"> <li><a href="#">home</a></li> <li><a href="#">about</a></li> <li><a href="#">skills</a></li> <li><a href="#">contacts</a></li> </ul> i want nav under logo on mobile phones. have got logo centered don't know how center nav under logo. here's css: .bar { position: relative; float: right; right: 9%; top: -60px; display: inline-block; font-size: 1.5em; font-family: 'coming soon', sans-serif; } .bar li { display: inline-block; margin-left: 60px; } you can use css media queries. , apply properties, in case using screen width <= 767px . like: /* on mobiles */ @media screen , (max-width: 767px) { .bar { display: block; float: none; text-align:...

javascript - How do I remove setInterval on a function? -

i've function called fadein , want return until condition met. i tried put alert in else line along clearinterval(myvar) , keeps alerting. css: * { background-color: black; padding: 0; margin: 0; height: 100%; } #title { background-color: white; height: 50px; } audio { display: none; } #audio-icon { width: 50px; background-color: white; } #focus { background-color: black; margin: auto; width: 100%; height: 700px; border: 5px, solid, grey; border-style: inset; border-radius: 10px; } #text-box { background-color: black; width: 100%; height: 200px; margin-top: 500px; float: left; border: 5px, solid, grey; border-style: inset; border-radius: 10px; } #command-line { background-color: black; width: 100%; height: 50px; margin-top: 150px; float: left; border: 5px, solid, grey; border-style: inset; border-radius: 10px; } #element { opacity: 0.1; } ...

php - Wordpress using add action 'the content' deletes all pages content -

i using: add_action('the_content' , 'statistics_page'); and in function 'statistics_page' put: if(is_page(25)) { //blabla } this works on page want displayed on (25) other pages have content stripped, don't display anything. how can fix this? edit: info website link: http://pauldekoning.com/wot youll see home doesnt display text, nor forum page have forum. statistic page displays something. the_content filter should apply_filter instead of add_action , you've make sure return actual content function. try after updating code following. apply_filters('the_content' , 'statistics_page'); function statistics_page($content){ if( is_page(25) ) { //blabla } return $content; }

css - HTML simple layout -

i'm doing store site , need want, see photo i've attached: img i not know how can add list , buttons there, @ code: <div class="modal-body"> <a><img src="images/******.png" alt="img"><a> </div> thanks =) <div class="modal-box"> <div class="modal-header"> <h2>title</h2> <button class="modal-close">x</button> </div> <div class="modal-body"> <div class="img-container"> <a href="#"> <img src="images/****" alt="img" /> </a> </div> <div class="text-container"> <ul> <li>text</li> <li>text</li> <li>text</li> <li>text</li> </ul> <div class="button-...

loops - Weird if-else behaviour Javascript -

this question has answer here: if statement in javascript true 5 answers the else-statement below never executes if if-statement false. think i've made basic mistake can't figure out what. var = ["king","queen","100"]; (var i=0; i<a.length; i++) { if (a[i] === "king" || "queen"){ console.log("monarch"); } else { console.log("the number is: "+ parseint(a[i])); } } // prints out "monarch" 3 times should be: var = ["king","queen","100"]; (var i=0; i<a.length; i++) { if (a[i] === "king" || a[i] === "queen"){ console.log("monarch"); } else { console.log("the number is: "+ parseint(a[i])); } } you wrot...

php - looping through json from mysql or xcode -

my app asks customers features of car want rent goes database , search , come findings , number of available cars based on loop. i'm wondering method right implement in ios app. in api created there index function return cars in database in json style. the question is: should create function in api takes parameters app , loop in database , return result customers? or should app index json , loop swift? the json index [ { "id": 1, "created_at": "2016-11-13 12:06:02", "updated_at": "2016-11-13 12:06:02", "name": “r”, "age": “12y”, “plate#”: “43ytr”, "status": "request", "appearance": "ok", “made”: “usa” }, { "id": 1, "created_at": "2016-11-13 12:06:02", "updated_at": "2016-11-13 12:06:02", "name": “h_y”, "age": “4yt", “plate#”: “11112jk”, "status": “coming”, "appearan...

php - Laravel 5.2 - Method links does not exist -

i'm passing array $posts view , i'm tryng use pagination have error: method links not exist. (view: c:\xampp\htdocs\app\resources\views\search.blade.php) controller $posts = post::where('visible', 1) ->where('expire_date', '>', $current)->where('delete', 0); $posts->paginate(1); $posts = $posts->get(); return view('search', compact('posts')); view <div class="pagination-bar text-center"> {{ $posts->links() }} </div> change code this: $posts = post::where('visible', 1) ->where('expire_date', '>', $current) ->where('delete', 0) ->paginate(1); return view('search', compact('posts')); your code doesn't work because not save paginate() results variable, $posts = $posts->paginate(1); . also, shouldn't use get() or all() after paginate() .

reactjs - make composed Link with react-router -

the problem when add composed link example <route path="l1/l2" component={comp}/> when navigating link app can't load resources public folder cause app loading resources example : http://localhost:8080/l1/bundle.js instead of http://localhost:8080/bundle.js guess it's problem in webpack configuration couldn't fix here webpack config : var config = { devtool: 'eval-source-map', entry: __dirname + "/app/index.js", output: { path: __dirname + "/public", filename: "bundle.js" }, module: { loaders: [{ test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel', query: { presets: ['es2015','react'] } }] }, devserver: { contentbase: "./public", colors: true, historyapifallback: true, inline: true } all appreciated thank in advance ! it's how load in bu...

c# - Visual studio export: An item with the same key has been added -

Image
i'm having problem exporting project in visual studio. i'm quite new visual studio bear me. making project university assignment , everytime try export error appears: " zip file generation failed following reason: item same key has been added " as can see picture any other project create or have created doesn't show errors exporting them . have visual studio 2013 , 2015 , tried in both, have searched thoroughly , nothing i've found has worked. project written in c# , has lot of different items, cs file, web site , images , css files. don't know should share code runs correctly , doesn't show errors.

CDN caching with App Engine? -

can cache dynamic responses google app engine? here's old question python, official docs pretty light. i see can define static files cache, i'm trying figure out if can cache dynamic requests. example, fetching data doesn't change cloud datastore.

elixir - Build has_one relationship -

i have schemas, looks follow: defmodule busiket.languagecode use busiket.web, :model schema "languages_code" field :code, :string field :text, :string timestamps end end the second schema: defmodule busiket.countrycode use busiket.web, :model schema "countries_code" field :alpha2, :string field :alpha3, :string timestamps end end and third table defmodule busiket.country use busiket.web, :model alias busiket.languagecode alias busiket.countrycode schema "countries" has_one :code, countrycode has_one :lang, languagecode field :text, :string timestamps end end as can see on third schema, field code should depends on country_code schema field code . the lang field should depends on language_code schema field alpha2 . i not know, if schema country designed? the entries in countries should looks like: "ch" | "en" | "swit...