Posts

Showing posts from January, 2013

angular - Jasmine test for simple Angular2 component not working -

i have simple component: @component({ selector: 'messages', styleurls: ['messages.component.scss'], templateurl: 'messages.component.html', }) export class messagescomponent implements oninit { constructor(private dataservice: dataservice) {} public getone(): number{ return 1; } } i'm trying run test can't work please help: describe('component: messagescomponent', () => { let component: messagescomponent; beforeeach(() => { testbed.configuretestingmodule({ declarations: [messagescomponent], }).compilecomponents(); const fixture = testbed.createcomponent(messagescomponent); component = fixture.componentinstance; }); it('should have defined component', () => { expect(true).tobetruthy(); }); }); (i'm using webpack if relevant) this error get: error: test module uses component messagescomponent using ...

java - Can I access a string resource from string.xml into an activity in Android? -

this question has answer here: android: how string resources using name? 11 answers i creating android application need use ip of server in many different activities access php files. every time connect new network, manually change ips in activities. my question is, can declare string resource in values-->strings.xml, , change there, modifications done @ once? i know can access string resource in xml file using " @string/my_string_var", my_string_var variable name actual string. can use string resource in of activities, this: final string ip = @string/final_ip; it work fine you (your activity context).this.getresources().getstring(r.string.final_ip); or simple in activity getresources().getstring(r.string.final_ip);

sockets - How do I get multiple clients to connect to the same source in python? -

i made class in python has socket in it. when try run multiple instances of same class error: error: [errno 10056] connect request made on connected socket i can see error saying, though classes independent of each other when run. wouldn't interfere. here's code i'm using: class bot(): host = "localhost" port = 6667 s = socket.socket() def connect(self): self.s.connect((self.host, self.port)) then when create bots: bots = [] def setup_bot(): global bots _bot = bot() _bot.connect() bots.append(_bot) if __name__ == "__main__": in range(5): setup_bot() sleep(1) print "done setting up" how able work? make socket s instance variable instead of setting on class. bot instances share same class attributes , thus, same socket. class bot(): host = "localhost" port = 6667 def __init__(self): self.s = socket.socket() ...

javascript - How to give option to print a bootstrap table? -

my question simple , limited , want print bootstrap table having id ("mytbl") how can make possible javascript / jquery ?(i dont want use plugins) i newbie in using jquery , bootstrap please help <script> $(function () { $('button[type="submit"]').click(function () { var pagetitle = 'page title', stylesheet = '//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css', win = window.open('', 'print', 'width=500,height=300'); win.document.write('<html><head><title>' + pagetitle + '</title>' + '<link rel="stylesheet" href="' + stylesheet + '">' + '</head><body>' + $('#mytbl')[0].outerhtml + '</body></html>'); win.document.close(); win.print()...

Cannot find the management option in the Kaa Sandbox,updated kaa to 0.10.0 -

i have kaa 0.10.0,cannot find sandbox management in earlier version may update sandbox address. in case, have sandbox management page described in documentation . try clean cache in browser. investigate logs located in /var/log/kaa/ directory details. troubleshooting guide helpful.

c# - 'MongoDB.Driver.MongoClient' does not contain a definition for 'GetServer' ...first argument of type 'MongoDB.Driver.MongoClient' could be found -

i'm trying familiar writing mongodb c# programs. i've set code following suggestions http://mongodb.github.io/mongo-csharp-driver/1.11/getting_started/ i'm trying run program getting error "'mongodb.driver.mongoclient' not contain definition 'getserver' , no extension method 'getserver' accepting first argument of type 'mongodb.driver.mongoclient' found". may help? thanks in advance, tien. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using mongodb.bson; using mongodb.driver; //additionally, add 1 or more of these using statements: //using mongodb.driver.builders; //error rebuilding when statement active: "using generic type 'mongodb.driver.builders<tdocument>' requires 1 type arguments //using mongodb.driver.gridfs; using mongodb.driver.linq; //using mongodb.driver.mongoclient; //error rebuilding when statement active "a usin...

android - Activity doesn't show RecyclerView - Databinding -

i tried databinding recyclerview, main_activity doesn't show recyclerview content objects. dont know point of failure is. advice. here simple code class: user public class user { private string name; private int age; public user(string name, int age) { this.name = name; this.age = age; } public string getname() { return name; } public void setname(string name) { this.name = name; } public int getage() { return age; } public void setage(int age) { this.age = age; } } class: useradapter public class useradapter extends recyclerview.adapter<recyclerview.viewholder> { private activity host; private arraylist<user> items; public useradapter(activity activity, arraylist<user> items) { this.host = activity; this.items = items; log.i("useradaptername", items.get(0).getname().tostring()); //log shows gordon } @override public useradapter.itemviewholder oncreateviewholder(viewgroup parent, int viewtype) { ...

reactjs - props.params in Enzyme test -

im trying test component makes getjson request in componentwillmount lifecycle method. has following code: api.getjson(`users/${this.props.params.id}`) .done((result) => { this.setstate({user: result}); }); as can see uses props.params.id make request. issue im having in test. when run npm test returns cannot read property of undefined, undefined being props.params . how can object in enzyme? this 1 way using enzyme mocha: - install jsdom npm install --save-dev --save-exact jsdom jsdom-global - load jsdom on before statement (inside describe) before(function () { this.jsdom = require('jsdom-global')() }) after(function () { this.jsdom() }) - in test use mount this: const somedata = {data1:'yyyyyy'}; const wrapper = mount(<yourcomponent yourprop={somedata} />); in case " yourprop " should params, way can pass data properties. hope help.

android - Native Express ads in alpha testing -

i have app in alpha testing channel of google play store , want show native ads in app. okay use live native ads while app in alpha testing. document states during development , testing, use test ads documentation is against google admob policy use live ads while app in google play store available limited users(in alpha testing)? have read developers using live ads in alpha/beta testing using ads in alpha/beta testing need clarify this. appreciated. only clicking against admob policy during development , testing time. else ok.

java - How to change selected item in navigation drawer when return on main activity from other activity? -

here problem: i have main activity navigation drawer; opened other activity clicking on current item (let x-item) in navigation drawer; after doing stuff in other activity, close , go main activity , navigation drawer; instead of other item selected x-item. how set selected other item in navigation drawer when go main activity? current situation i want make shown in picture

javascript - d3 - how to resize an individual state map drawn from a full US clipPath -

i'm working d3 framework , i'm curious how/if it's possible go making individual county level state map created clippath of state boundaries responsive without having redraw map scratch. i tried adjust width , height attrbutes of svg using: d3.selectall(".ismap").attr("width", width).attr("height", width * 1.5); d3.selectall(".ismap").selectall("path").attr("d", path); however did not return expected result (a small blip of land display on resize event). anyway here i'm at: var $width = $(window).width(); var $height = $width * .8; var width = $width, height = $height; var projection = d3.geo.albers(); var path = d3.geo.path().projection(projection); var svg = d3.select('.map-wrapper').append("svg").attr("width", width).attr("height", height).attr("class", "state-map ismap"); d3.json("map_json/us_county_land.json", function(...

html - jquery changing visibility using attr doesn't work -

i wanted post picture , upon picture; so when hover on , 1 placed inside pop up; , switched it's visibility hidden , , tried through jquery (when first hovered) have visibility changed visible. checked , , found out visibility property did change : , image not visible. $("div.main>table td>img").mouseenter(function() { try { $(this).parent().find(".play").attr("visibility", "visible"); } catch (e) { window.alert(e.message); } }); $("div.main>table td>img").mouseleave(function() { $(this).parent().find(".play").attr("visibility", "hidden"); }); div.main>table td { position: relative; top: 0; left: 0; } div.main>table td>img { transition: box-shadow 0.3s, opacity 0.5s; position: relative; } div.main>table td>img:hover { cursor: pointer; } div.main>table { margin: auto; } .play { transition: opacity 0.5s...

c# - cannot implicitly convert type 'float' to 'int' -

when try run following code gives error " cannot implicitly convert type 'float' 'int' ". i have done lot of searches, , sadly wasn't able find such error. int sum1, cols, rows; float h, twoends, x; sum1 = (h - ((cols) * x) + twoends)) / (cols + 1); the errors puts clear cannot implicitly convert type 'float' 'int' so have float result can't converted implictly sum1 of type int . try converting/casting explicitly : sum1 = (int) ((h - ((cols) * x) + twoends)) / (cols + 1));

javascript - Keep a list of ids in Redux store -

storing redux objects in store key/id makes them better lookup, more modified, deleted, etc. it's more efficient. entities: { 3f9kwr2: { first: 'john' last: 'johnson' }, zyr4oll: { first: 'tina' ... i have noticed many people storing list of ids in reducer ( example ). in case above, array ['3f9kwr2', 'zyr4oll'] . this redux recipe suggests keeping list of ids solely keep original order of data (how ordered in api response, example). if keeping original order not important, storing list of ids server purpose? no, not serve purpose. list of ids can retrieved in example object.keys(state.entities) , except know nothing order. if not care order, there no difference between doing , maintaining separate list of ids.

php - Multiple vars in .htaccess -

i want create user's page, twitter, have more options, like: site.com/u/user want create multiples, like: site.com/u/user , site.com/u/user/photos , try it: rewriterule ^u/(.+)$ perfil/?user=$1 [l,qsa] rewriterule ^u/(.+)/t$ perfil/?user=$1&t=1 [l,qsa] but doesn't works, can me? forgot, founded it, lol, found here http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html just change (.*) ([a-za-z0-9_-]+)

Alamofire not working well with swift 3 -

Image
i have project written swift 2. updated swift 3, i'm using alamofire , swiftyjson updated cocoapods , fixed project issues, after got error alamofire the following binaries use incompatible versions of swift: also have these warnings this pod file this see in terminal after pod update update pods updating local specs repositories cocoapods 1.2.0.beta.1 available. update use: `sudo gem install cocoapods --pre` [!] test version we'd love try. more information, see https://blog.cocoapods.org , changelog version @ https://github.com/cocoapods/cocoapods/releases/tag/1.2.0.beta.1 analyzing dependencies downloading dependencies using alamofire (4.0.1) using dropdown (2) using sidemenu (2.0.5) using swiftyjson (3.1.1) generating pods project integrating client project sending stats pod installation complete! there 4 dependencies podfile , 4 total pods installed. [!] `ehtamiapp [debug]` target overrides `embedded_content_contains_swift` build setting defined in ...

javascript - events load and ready not firing -

this code: $(document).on('ready load click',function(){ console.log('hiihuhu') }) i included jquery script above. problem click event firing load or ready event not. don't see error in console. problem? which version of jquery using according jquery docs $(document).on( "ready", handler ), deprecated of jquery 1.8 , removed in jquery 3.0. note if dom becomes ready before event attached, handler not executed. $( window ).load(function() { alert("hello"); }); $(document).ready(function(){ $(document).on('click',function(){ alert("in click event"); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div>hello</div> window onload: :is fired when content including images has been loaded document.ready : fired after html document loaded so guess cannot combine 3 events ready,load , cl...

C++ search "regex operators" with regex -

im using regex in c++ , want regex_search * , + symbols, wont work, cause regex symbols. (using namespace std) string s = "15 * 12"; regex rx("*"); bool flag = regex_search(s, rx); and terminating uncaught exception of type std::__1::regex_error: 1 of *?+{ not preceded valid regular expression. how can fix that? you need escape special characters using '\'. if specify in c++ string constant need add 2 '\' "\*".

c# - Is it possible to create an extension method that is called when the object is created? -

i cannot modify object working , need method want called when object created. thinking extension method here, don't know if possible but, if is, how? edited: my static class has main object supposed create: ecuversion ecu; i call method class: ecu = convertautodetect.convert(rawdata, ecu, response); and platform looking ecu object. my method return ecuversion object. object contains collection besides lot of other things , working respective collection is: icollection<autodetectstep> autodetectsteps { get; set; } autodetectstep class has 4 childs , on 1 of it's childs needed extension method called when child created. i have create many childs , add them collection, also, never instantiated object because static in there. so suitable use factory pattern ? no, not possible. if unreliable because depend on whether included relevant extension using or not. that's general problem of extension methods here it's worse never cause comp...

C++ Read in data types string, int double from a file. Put each line of data into a vector of objects -

data file: candy, 1.99, 26 chips, 2.55, 22 //my attempt read in each line creating new object line while (getline(infile, line, '\n')) { istringstream ss(line); ss >> name >> price >> amount; products newproduct(name, price, amount); item.push_back(newproduct); } right getting name , price of first line. how can read in entire line storing 3 values lines in file? you've got handle comma after price: char comma; ss >> name >> price >> comma >> amount; just clarify: name read first comma. stream reads double - finds comma , stops here. request read int got is... comma. need rid of proceed. update: #include <iostream> #include <string> #include <sstream> int main() { std::istringstream file("xxx, 23.0, 11\nyyy, 99.3, 100"); while (!file.eof()) { std::string line; std::getline(file, line); std::istringstream...

scala - Concurrent tasks on a Spark executor -

what determines how many tasks can run concurrently on spark executor? maybe kind of thread pool , shared memory resources? what parameters control behavior? does mean code used in executors should written thread-safe? what determines how many tasks can run concurrently on spark executor? spark maps number tasks on particular executor number of cores allocated it. default, spark assigns 1 core task controlled spark.task.cpus parameter defaults 1. does mean code used in executors should written thread-safe? no. working rdds or dataframe/set aimed work locally inside transform, without sharing global resources. should think thread-safety when have global resource execute in parallel inside single executor process, can happen when multiple tasks executed on same executor.

amazon web services - What is the Best way to Expose Data from an AWS RDS Mysql DB? -

i have mysql database on aws rds. i in need of accessing , looking information on daily basis of data in database via external crm. in ideal scenario, create api on lambda have access rds instance , have front facing api crm api hit , lookup , work mysql data. my question is... best way it? there sort of service out there facilitates me creating api or need create api scratch... any suggestions? bunch! you have create own aws lambda app, there framework - serverless framework make whole endeavour easier! this tutorial on accessing rds aws lambda might well.

Can not start apache -

when start apache2 fails , error. last change in /etc/apache2/mods-enabled/dir.conf file, put index.php first of list. however, have reinstalled apache default files , error keep being. job apache2.service failed because control process exited error code. see "systemctl status apache2.service" , "journalctl -xe" details. and when inside journalctl, details shows next: apache error log i dont know how can solve problem, tried servername localhost @ httpd.conf file , tips keep failing. thanks ok, solved it. problem had nginx container listening apache want too. solution is: processes listening @ port 80 sudo lsof -i:80 and then, kill processes sudo kill -9 processes thanks

matlab - How do I display the code of a function when using publish? -

function [ distancec_s ] = xsol (xrange,source1ou2,nbzeros) y = zeros(1,nbzeros); capteur = [xrange(:),y(:)]; distancec_s = calcul_distance(capteur,source1ou2); end how display code in main.m? teacher said write "<include >name_fonction.m</include >" , nothing works. things have tried: xsol.m xsol <include>xsol.m</include> "<include>xsol.m</include>" when publish main.m on pdf, want code of xsol.m displayed after code executes.

how to incorporate parallel python with django -

i wondering if there way incorporate pp (parallel python) django. great because have multiple computers , want use them better handle requests. paralel python litle bit different tasks, , purposes better use nginx loadbalancer.

SQL JOIN AND GROUP BY -

i pulling data 5 columns there 2 joins , need group 1 of columns. i'm getting error when try group @ end. need sort of sub query? select territory_t.territoryid, territory_t.territoryname, customer_t.customerid, order_t.orderid, product_t.productid territory_t, customer_t, order_t, product_t, doesbusinessin_t territory_t.territoryid = doesbusinessin_t.territoryid , customer_t.customerid = doesbusinessin_t.customerid group orderid order territoryid desc, customerid the customer table , orders table both have customerid. need query on them first, use group by, , join other tables?

reactjs - It's necessary to connect every React Component with redux even when using Provider? -

my app index start with: reactdom.render( <provider store={store}> <router history={browserhistory}> <route path="/" component={app}> <indexroute component={main} /> <route path="/search" component={moviesearch} /> <route path="/movies" component={movielist} /> </route> </router> </provider>, document.getelementbyid('root') ); my main.js: render() { return (<div>{this.props.children}</div> )} when access uri: /movies movielist props stay undefined until connect component store. correct? need connect every component store access state? can't props main parent props without this? i need call mapstatetoprops , mapdispatchtoprops access state , actions ? this default/good practice? the answer is, yes unless have layout component, need connect each component work redux ....

C program to calculate change -

i trying write program calculate change, doesn't seem work. think problem owed 1/ paid 1; when tried print there values got nothing (0). ? #include <stdio.h> int main() { double owed, paid; int dollars, quarters, dimes, nickels, cents, remainder, owed1, paid1; printf("how did customer have pay ?\n"); scanf("%f",&owed); printf("how did customer pay ?\n"); scanf("%f",&paid); owed1 = owed * 100; paid1 = paid * 100; int change = paid1 - owed1; dollars = change / 100; remainder = change % 100; quarters = remainder / 25; remainder = remainder % 25; dimes = remainder / 10; remainder = remainder % 10; nickels = remainder / 5; remainder = remainder % 5; cents = remainder; printf("%d",dollars); printf("dollars:%d, quarters:%d, dimes:%d, nickels:%d, cents:%d", dollars , quarters , dimes , nickels , cents ); return 0; } you're using %f in scanf, format specifier float, variables doubles. shoul...

Python: My Return statement always returns None -

this question has answer here: python script returns unintended “none” after execution of function 1 answer this function able take in binary number string , convert decimal number. reason, function returns none , can not understand why happening. if provide me explanation appreciated. total = 0 power = 0 def binarytodecimal(binarystring): global total, power n = len(binarystring) - 1 if n < 0: return total else: if binarystring[n] == '1': total += (2 ** power) power += 1 binarytodecimal(binarystring[:-1]) the final line needs return binarytodecimal(binarystring[:-1]) . @ moment you're returning total last call, none of preceding calls returning anything.

python - Seaborn pairplot: how to change legend label text -

i'm making simple pairplot seaborn in python shows different levels of categorical variable color of plot elements across variables in pandas dataframe. although plot comes out want it, categorical variable binary, makes legend quite meaningless audience not familiar data (categories naturally labeled 0 & 1). an example of code: g = sns.pairplot(df, hue='categorical_var', palette='set3') is there way change legend label text pairplot? or should use pairgrid, , if how approach this? since don't provide full example of code, nor mock data, use own codes answer. first solution the easiest must keep binary labels analysis , create column proper names plotting. here sample code of mine, should grab idea: def transconum(morph): if (morph == 's'): return 1.0 else: return 0.0 compactgroups['morphnum'] = compactgroups['morphgal'].apply(transconum) second solution another way overwrite label...

rails - call json api and parse one value in response -

i'm calling json api , retrieving result every single time: { "@enddate": "2016-11-05", "@metric": "sessions", "@startdate": "2016-11-05", "@generateddate": "11\/5\/16 6:14 pm", "@version": "1.0", "day": { "@date": "2016-11-05", "@value": "8174" } } i want number 8174 in variable in rails, how do this? assign json response response variable response = { "@enddate": "2016-11-05", "@metric": "sessions", "@startdate": "2016-11-05", "@generateddate": "11\/5\/16 6:14 pm", "@version": "1.0", "day": { "@date": "2016-11-05", "@value": "8174" } } parse it parsed_response = json.parse(response.to_josn) after parsing parsed_respo...

Reading from a file with delimiters and saving into an object c++ -

i'm writing program beginner c++ class read strings file , store them object in vector. file uses ',' delimiter , have whitespaces within strings. have working using bunch of getlines, wondering if there way clean code or possibly optimize it. while getline(ifs,s){ string stream ss(s); getline(ss,str1,','); getline(ss,str2,','); getline(ss,str3,','); //i take these variables , pushback onto vector using object's //constructor } i have that, wondering if theres better way it. been looking overloading extraction operators, think run issue of not being able overload whitespace delimiter >> generally, use tokenizer this. boost.tokenizer great, beginner c++ class, you'll want go strtok() http://en.cppreference.com/w/cpp/string/byte/strtok tokenize input data using strtok() , loop on tokens.

data structures - The Elm / functional way of passing props to components -

i'm new elm , functional programming. i'm building expense tracking app has model this: initialmodel = { expensetransactions = [ { date = date.fromstring "2016/10/23" , transactions = [ { id = 1 , amount = 17.54 , description = "stuff" , category = 3 } , { id = 2 , amount = 15.0 , description = "things" , category = 4 } ] } ], expensecategories = dict.fromlist [ ( 1, "rent" ), ( 2, "groceries" ), ( 3, "eating out" ) ] } in view, i'm using renderexpensestable function, in turn calls renderexpensesforoneday function, in turns calls renderexpensesrow function. what want keep storing transaction's category number, , reference name view doing expensecategories[t...

jqxtreegrid - JQX Treegrid - how to select rows of a jQX Treegrid using TreeGrid API -

i using jqx treegrid in application. want disable inbuilt row selection feature , select row or cell using jqx treegrid api. i able disable inbuilt row selection feature rows not getting selected when click on row. how can use api select row. please help.

swift - Custom protocols -

im getting error "class declaration cannot close on value 'viewcontainer' defined in outer scope" i created procotol called networkresponse have 2 methods on sucessresponse , onerrorresponse. then have class called callback extends networkresponse , forced implement methods. here function : public func login (callback : callback, viewcontroller : uiviewcontroller) { let callbackinstance: networkresponse = { class callback : callback { override func onsucessresponse(response : nsdictionary){ viewcontroller.dismiss(animated: true, completion: nil) } override func onerrorresponse(message : string, code : int){ print("error") } } return callback() }() postpath(callback: callbackinstance as? callback) } i want dismiss controller anonymous class. any recomendation ? ...

MySQL Finding most frequent value in multiple columns -

i have table this: votingid president_vote vice_president_vote senator_vote ... 1000 1023 1102 1042 1001 1102 1047 1102 1002 1023 1047 1042 ... so need find person(id) has votes each position, outcome ideally looks this president_vote vice_president_vote senator_vote ... 1023 1047 1042 there 5 columns in table possible find frequent value each column , brutally cross join them all. however, lets assume there 5000 columns exist in table. how can write query find out frequent value appears in each columns together? thanks!

c - word scramble with pointers in an array. Crashes when run -

i new arrays pointers, , trying make array of pointers word scramble game allows 3 tries guess word before game ends. basically, have created function scrambles string. then, string sent new string, shown user. user enters guess. getting no signal compiler on wrong.. crashes when run. believe error when sending pointer method. please tell me why error happening? thanks. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <ctype.h> void scramble(char *strings) { int length = strlen(strings), i, randomnum; char temp; for(i = 0; < length/2; i++) { randomnum = rand()%length; temp = strings[i]; strings[i] = strings[length - randomnum]; strings[length - randomnum] = temp; } } int main() { int i, tries, numwords; char *words[] = { "pumpkin", "cantalope", "watermelon", "apple", "kumquat" }; char *scramwords...

.htaccess - htaccess redirect everything on domain to a single page -

i'm attempting replace entire website single landing page on different domain. of following domains: example.com www.example.com example.com/page-1 example.com/sub/page-2.html should redirect to: new-domain.com/landing-page currently , i'm using following .htaccess file (no other content in file): rewriteengine on rewritecond %{http_host} ^(www.)?example.com$ rewriterule ^(.*)$ http://new-domain.com/landing-page/ [r=301,l] additional details: i'm set on godaddy deluxe linux hosting package. example.com "primary" domain of package, not addon domain. default directs root of server space (this .htaccess file in root). i have several other addon domains, redirecting traffic server not option. new-domain.com hosted on same server space addon domain. the problem i'm running example.com redirecting new-domain.com - not new-domain.com/landing-page . other example urls listed above redirect intended. any ideas why non-www domain base won...

php - Two Similar CSS files in a website -

i have 1 css file(reset.css) in main page index.php. inside index.php, loading php page(secondary.php). css in reset.css not getting applied on secondary.php (now sure why happening.) i have 2 questions here : 1.) why secondry.php not taking reset.css styles. 2.) resolve issue, ok me place similar reset.css file in secondary.php ? any highly useful. code including secondary.php $("#tab2_load").load('seconday.php'); first, add id style tags so: <link id="someid" rel="stylesheet" href="refresh.css" /> next, in javascript add following function: function reloadstyle(s){ $('#someid').attr('href',s); } now after line $("#tab2_load").load('seconday.php'); call function reloadstyle() reloadstyle( 'refresh.css?v='+math.random(0,100) );

javascript - How do I hide a button with data-status = 'Processing' using JQuery -

here code after processed: <button class="btn btn-icon btn-danger command-delete" id="delbutton" aria-describedby="tooltip779899" type="button" data-original-title="delete sales order" data-toggle="tooltip" data-target="#modaldelete" data-placement="top" data-row-id="34" data-status="processed"><span class="zmdi zmdi-delete"></span></button> i need hide button when data-status = "processed" any appreciated! $("button[data-status='processed']").hide(); you can select element(s) based on 1 of it's attribute.

javascript - How to set height div css for 16:9 aspect ratio in portrait mode for Ionic 2 -

Image
suppose have div on top of ion-content. i'm trying set height of div getting width of device , calculate aspect ratio 16:9 youtube app. however, have no idea how achieve using css. now, have. div { width: auto; max-height: 40%; <-- how set height 16:9 background: black; div.img { width: 360px; max-height: 202.5px; } what wanted: you need use simple css style 56.25% = 16:9 aspect ratio .img { width: 100%; height: 56.25vw; }

ios - Storyboard - dynamically change height of UIView -

Image
popup1 popup2 is possible create single popup in storyboard & dynamically change - decrease/increase height when error occurs (as shown in popup2) i expect correct approach create such view. one way achieve using vertical uistackview in interface builder. example, have simple stack view set contains 2 labels: now, in view controller can set error label hidden or not , stack view dynamically take care of rest. e.g: without hiding anything: hiding error label: [_errorlabel sethidden:yes];

How to retrieve flickr images descriptions from jSON data in Jquery -

Image
i'm working on retrieve image titles json data highlited on attachment or here: http://www.flickr.com/photos/un_photo/27405307493/\" title=\"aerial view of bentiu protection of civilians site, south sudan\"> i need grab text after "title=\". the data flickr.the issue code doesn't retrieve descriptions. any please highly appreciated. // working json data function getjsondata() { // let's retrieve images flicker var flickrapi ="http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?"; $.getjson( flickrapi, { tags: "bentiu", //images tags space needle tagmode: "any", // images format: "json" //results in json format }, successjsonfn); } // working json data function successjsonfn(result) { $.each(result.items, function(indx, item){ //create i...

json - Bluemix Visual recognition service working with curl command for custom classifiers but returning result for default classifer with node application -

i trying visual recognition service, trained sample images , created custom classifier. when testing curl command working fine , returning result classifier mentioned in params.json. same not working node application, seems neglecting params.json while processing. params.json {"classifier_ids": ["<classifierid>"] } curl command working. curl -x post -f "images_file=@virt.jpg" -f "parameters=@params.json" "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classify?api_key=<api_key>&version=2016-05-20" below node application code returns result "default" classifier var visual_recognition = new watson.visualrecognitionv3({ api_key: 'api_key', version_date: '2016-05-20' }); var params = { images_file: fs.createreadstream('virt.jpg'), parameters: fs.readfilesync('params.json'), }; even tried 1. putting threshold 0.0 params.json 2. using json....

javascript - scrolltofixed bottom with angular ng-repeat -

i using angular-scrolltofixed plugin , works great. the problem starts when try put limit options bottom bar $('.footer').scrolltofixed( { bottom: 0, limit: $('.footer').offset().top } ); the 'limit' variable being calculated before page being rendered (ng-repeat etc) , result limit attribute not right. try this, script loads after entire document loads <html> <head> </head> <body> <!-- write code --> <script> //add angualar js script here </script> </body> </html>

Does a docker container launched from Docker-in-Docker container inherit orphan/zombie reaping from the docker-in-docker container? -

i have docker image x built alpine:3.4 has tini ( https://github.com/krallin/tini ) installed zombie pid-1 reaping. x has docker installed inside (and docker socket volume mounted). suppose container c run x creates new container n , n's image created alpine. question n's image need have tini installed in it? or "inherit" zombie/orphan process reaping c?

scala - shapeless convert case class to HList and skip all option fields -

i have next class: case class foo(a: option[int], b: option[string], c: option[double]) as can see, fields optional, want convert class hlist or tuple, like val f1 = foo(some(1) , none, some(3d)) val f2 = foo(none, "foo") val result1 = f1.to[int::double::hnil] // => 1::3d val result2 = f2.to[string::hnil] // "foo" is possible, without reflection? it might possible existing type classes in shapeless (something nattrel , removeall ), i'm not 100% sure of that, , case i'd write own type class: import shapeless._ trait optionalpieces[l <: hlist, s <: hlist] { def apply(l: l): option[s] } object optionalpieces extends lowpriorityoptionalpieces { implicit val hniloptionalpieces: optionalpieces[hnil, hnil] = new optionalpieces[hnil, hnil] { def apply(l: hnil): option[hnil] = some(hnil) } implicit def hconsoptionalpiecesmatch[h, t <: hlist, s <: hlist](implicit opt: optionalpieces[t, s] ): optional...

mysql - How to select records that contains IDs but not contains only IDs from this same list -

i want have selected records contains selected ids doesn't contains these ids same lists. my sql code: select question_id, person_id `answers` `person_id` in ('9', '18') results: 2, 9 2, 18 4, 9 4, 18 5, 18 6, 9 expected results: 5, 18 6, 9 full sql query: select id, name questions id not in ('3', '13') , exists (select `id` `answers` `answers`.`question_id` = `questions`.`id` , `person_id` in ('9', '18')) order rand() limit 1 you try using group , having select question_id, person_id `answers` person_id` in ('9', '18') group question_id having count(distinct person_id) = 1 selecting rows person_id in set match 1 value

python pandas to_datetime change format -

my input text based, e.g. column "closeddate" = "2016-10-31 16:54:18" with: df.closeddate = pd.to_datetime(df.closeddate).dt.date i format "2016-10-31", i.e. keeping date part , dropping time, works fine far, need "31.10.2016". what best , "elegant way accomplish that? tried adding "format = "%d%m%y" doesn't work. thanks

html - How To Arrange CSS3 Hexagons in 2-3-2 tree order -

Image
trying create gallery of hexagons, searched on internet , found examples, , created gallery-like this (this test hosting site, , galley designed me referring links) i'm using code : #hexgrid { overflow: hidden; width: 60%; margin: 0 auto; padding: 0.866% 0; font-family: 'raleway', sans-serif; font-size: 15px; } #hexgrid:after { content: ""; display: block; clear: both; } .hex { position: relative; list-style-type: none; float: left; overflow: hidden; visibility: hidden; outline: 1px solid transparent; /* fix jagged edges in ff on hover transition */ -webkit-transform: rotate(-60deg) skewy(30deg) translatez(-1px); -ms-transform: rotate(-60deg) skewy(30deg) translatez(-1px); transform: rotate(-60deg) skewy(30deg) translatez(-1px); } .hex * { position: absolute; visibility: visible; outline: 1px solid transparent; /* fix jagged edges in ff on hover transition */ } .hexin { display...

ruby on rails - Arel, nested NamedFunction -

i'm trying compose query via arel: select round(unix_timestamp(curtime(4)) * 1000) table1 using http://www.scuttle.io/ return simply: table1.select( arel::nodes::namedfunction.new( 'round', [ arel::nodes::namedfunction.new( 'unix_timestamp', [arel::nodes::namedfunction.new('curtime', [4])] ) * 1000 ] ) ) but rails app doesn't accept it, giving me: nomethoderror (undefined method `*' #<arel::nodes::namedfunction:0x0000000c7471e0>): there's way fix it? i've never used part of arel, , can't test right now, i'm guessing instead of * need use arel::nodes::multiplication : arel::nodes::multiplication.new( arel::nodes::namedfunction.new( 'unix_timestamp', [arel::nodes::namedfunction.new('curtime', [4])] ), 1000 )

java - How to update Litview item when Spinner seleted -

Image
i have problem can not fix now. create apps, there 1 spinner , 1 listview, , use baseadapter load information on listview on spinner . and now, when seleted spinner item , listview item turn on image. public class countries implements serializable{ public string nameconutry; public string moneycountry; public string flag; public countries(){} public countries(string namecountry, string moneycountry, string flag){ this.nameconutry = namecountry; this.moneycountry = moneycountry; this.flag = flag; } public void save(context p_context) { sharedpreferences w_sp = p_context.getsharedpreferences("countries", activity.mode_private); sharedpreferences.editor w_editor = w_sp.edit(); w_editor.putstring("ctry_cd", nameconutry); w_editor.putstring("curr_name", nameconutry); w_editor.commit(); } public static countries load(context p_context) { countries countries = null; sharedpreferences w_sp = p_context.gets...