Posts

Showing posts from June, 2015

How to implement a login in Android using Volley? -

i have loginactitvity 2 textfields username , password , login-button. when user presses button, app starts async task. async task implements volleyhandler. checks if login parameters correct , fetches user data (using volley , json). while doing this, progressdialog appears. when async task finished, starts intent mainactivity in onpostexecute method. now question: idea make volley-requests in async task, or have better solution? thanks. you cannot use asynctask. volley care it. can use callback work data , ui. looks this: public class loginactivity extends singlepaneactivity implements downloadcallback { //... public void sendrequest(){ downloader download = new download(this); downloader.download(username, password); progresbar.show(); } public void requestfinish(){ progersbar.dismis(); //... continue } } callback: public interface downloadcallback { void requestfinish(); } in class downloader private requestqueue requestqueue; download...

how to create a training dataset for image processing -

i have dataset of 10 jpeg high quality aerial images txt files containing information each vehicle's bounding box (width, height, angle, x & y axis,...). example: @category:general @image:2012-04-26-muenchen-tunnel_4k0g0010.jpg #format: id type center.x center.y size.width size.height angle 0 30 1319 2338 35 11 56.451578 1 30 1337 2350 42 14 57.817368 2 30 224 3556 61 20 136.967797 how should create database of vehicles train in neural network using caffe ? should use photoshop crop each vehicle , save them 1 one? or can use txt files create different classes of vehicles train in network sth matlab ? with many vehicles not hand. in python can load image numpy array , select boxes data provided in files. can handle angles rotating whole array , select box same way select 'normal' one. if using different programming language should able follow approach need convert jpeg bitmap , somehow array. i don't know caffe required capture exact bound...

lua - Atomically move redis key on expiration -

is there way atomically move redis key 1 place when expires? there's ways of doing in client being notified of redis expire notifications, if no clients running when notification triggered event missed. but if there's way on server (through lua script maybe) can atomic , key exists in 1 place before expiry , other place after expiry. lua scripts cannot triggered keyspace notification. must on client side.

java - Web Service and method with parameters -

i'm using eclipse create webservice manage vehicle. have problem method want use in webservice. sofware return me error when select method need. here error : iwab0398e error in generating wsdl java: java.lang.illegalstateexception: error looking paramter names in bytecode: unexpected bytes in file (i past full trace @ end of message) i don't know why error happens. after few test, notice happens when try use parameters in method. by exemple have same error method 1 : public string test(string lol) { return "a"; } but not 1 : public string test() { return "a"; } it seems i'm missing important point can't find information. can guide me ? here full error trace if can : iwab0398e error in generating wsdl java: java.lang.illegalstateexception: error looking paramter names in bytecode: unexpected bytes in file java.lang.illegalstateexception: error looking paramter names in bytecode: unexpected b...

laravel 5 - How to use bootstrap in sass file in laravel5? -

i using node-module in project , download npm install , wanna use bootstrap on laravel project import in sass file using code @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; when use gulp command , check page source bootstrap not loaded.

Python: how to slice a dictionary based on the values of its keys? -

say have dictionary built this: d={0:1, 1:2, 2:3, 10:4, 11:5, 12:6, 100:7, 101:8, 102:9, 200:10, 201:11, 202:12} and want create subdictionary d1 slicing d in such way d1 contains following keys: 0, 1, 2, 100, 101, 102 . final output should be: d1={0:1, 1:2, 2:3, 100:7, 101:8, 102:9} is there efficient pythonic way of doing this, given real dictionary contains on 2,000,000 items? i think question applies cases keys integers, when slicing needs follow inequality rules , , when final result needs bunch of slices put in same dictionary. you use dictionary comprehension with: d = {0:1, 1:2, 2:3, 10:4, 11:5, 12:6, 100:7, 101:8, 102:9, 200:10, 201:11, 202:12} keys = (0, 1, 2, 100, 101, 102) d1 = {k: d[k] k in keys} in python 2.7 can compute keys (in python 3.x replace it.ifilter(...) filter(...) ): import itertools d = {0:1, 1:2, 2:3, 10:4, 11:5, 12:6, 100:7, 101:8, 102:9, 200:10, 201:11, 202:12} d1 = {k: d[k] k in it.ifilter(lambda x: 1 < x <= 11, d....

Parsing a string with a colon and setting both sides to different variables, C++ -

so trying write simple program takes time input user, , calculates angles between , around hands of analog clock. have run program without parsing , 2 separate inputs wanted parse time @ colon (say, 12:35) , set left side hour variable , right side minutes variable. however, reading examples hard when don't know of lines of code mean. me example , explain each line doing , why use method? this looking for: string time = "12:35"; unsigned int hour, minutes; sscanf(time.c_str(), "%2d:%2d", &hour, &minutes); cout << "hour: " << hour << endl; cout << "minutes: " << minutes << endl;

Changing css property via jQuery -

what i'm trying achieve here when hover on link turn green. what wrong code: <script> $(document).ready(function() { $("a").hover(function() { $(this).css({"background-color": "green;"}); }); }); </script> it's semicolon after green; , works in css, not in javascript, expects color only, no semicolon. $(document).ready(function() { $("a").hover(function() { $(this).css({"background-color": "green"}); }); });

javascript - Scraping React Site with Phantomjs -

i scraping website using react components, using phantomjs in nodejs. with this: https://github.com/amir20/phantomjs-node here code: phantom.create().then(ph => { _ph = ph; return _ph.createpage(); }).then(page => { _page = page; return _page.open(url); }).then(status => { return _page.property('content'); }).then(content => { console.log(content); _page.close(); _ph.exit(); }).catch(e => console.log(e)); problem react content not rendered, says: <!-- react-empty: 1 -->" actual react component should loaded. how can scrap rendered react component? switched pure node-request solution phantomjs fix stuck. update: so dont have real solution yet. switched nightmarejs ( https://github.com/segmentio/nightmare ) has nice .wait('.some-selector') function, waits till specified selector loaded. fixed problems dynamically loaded react components. i think should wait rendering react elements on...

How do I increment or decrement an association field in ruby on rails -

some here folks: have 2 models (category, movie)that related this: category has_many movies, movie belongs_to category add_one belongs_to movie add_one belongs_to :user user has_many :add_one movie has_many :add_one i created table has 2 integer fields want increment , decrement depending on value of field.it has 2 other fields foreign keys. if clicked current user , value 1 should decrement 0 else 1. note: don't want use vote gem....i used on model want create have described here..any please. create_table "add_one", force: :cascade |t| t.integer "ineedone", default: 0, null:false t.integer "ineedonetoo", default: 0, null:false t.integer "user_id" t.integer "movie_id" end routes: resources :category resources :movies member put "addone" => "movies#toaddone" end end end in movie's show page did link_to("add", toaddone_category_mov...

database - How does stackoverflow creates the unique number for questions? -

i curious how stackoverflow creates unique numbers questions. doing similar , curious way better. using auto increment on database or kind of random unique number generator? pros , cons of doing ways ? totally understand question little vague wanting know opinion experts. in application can use guid: globally unique identifier.

Lua Nginx Redis get requested domain? -

so right have piece of lovely code server { listen 80; location /{ set $target ''; access_by_lua ' local key = ngx.var.http_host if not key ngx.log("no request url found") return ngx.exit(400) end local redis = require "resty.redis" local red = redis:new() red:set_timeout(1000) -- 1 second local ok, err = red:connect("<server_ip>", <server_port>) if not ok ngx.log("failed connect reddis server") return ngx.exit(500) end local res, err = red:auth("<pass>") if not res ngx.say("failed authenticate redis server") return ngx.exit(500) end local host, err = red:get(key) if not host ngx.log(...

c# - How to solve the error occurred in password recovery? -

i'm using asp.net c# ef , i'm trying reset password when user forget it. , in there i'm sending email link user's provided email if in database. but it'll give me error @ point member = membership.getuser(foundemail); saying {"an error occurred while attempting initialize system.data.sqlclient.sqlconnection object. value provided connection string may wrong, or may contain invalid syntax.\r\nparameter name: connectionstring"} here code in controller [httppost] [allowanonymous] [validateantiforgerytoken] public actionresult resetpassword(resetpasswordmodel resetpasswordmodel) { if (modelstate.isvalid) { //user user; membershipuser member; using (thefoodycontext db = new thefoodycontext()) { /*var foundemail = (from e in db.users e.email == resetpasswordmodel.email select e....

None SPD Cluster Tables in SAS 9? -

i trying build cluster table have discovered/realised proc spdo not present in base sas version 9 so: proc spdo library = clusters; cluster create mycluster mem = member1; mem = member2; mem = member3; ... quit; is there way build cluster object using base libraries , tables in version of sas? thanks

android - Get date and time of device without any punctuation marks -

i want current time , date of device on android app, without punctuation marks. i mean like: 05112016 , 1946 how can on android app? edit 1# : question isn't duplicate, since answer in suggested duplicate isn't i'm asking. when run code answer , delete punctuation marks "nov52016101232" instead of want "05112016101232". use simpledateformat achieve this. //date simpledateformat sdf = new simpledateformat("ddmmyyyy", locale.english); sdf.format(new date()); //time simpledateformat sdf = new simpledateformat("hhmm", locale.english); sdf.format(new date());

scala - Local Java package management system in Python PIP style? -

i want program in java or other jvm languages scala, kotlin, or groovy. when programming on projects, want have import statements in java/scala/kotlin source files without need state packages second time in gradle/maven build script. instead want work in python, i.e. have import statements @ beginning of source files , done. the packages should automatically included when compiling if packages installed in central local package management system or otherwise error message telling me have install missing package. should work same python , pip respectively. is workflow possible preferably groovy or maven? thanks in advance! the closest can think grape : grape jar dependency manager embedded groovy. grape lets add maven repository dependencies classpath, making scripting easier. simplest use simple adding annotation script: @grab(group='org.springframework', module='spring-orm', version='3.2.5.release') import org.springframework.jdbc.cor...

php - Connecting to react server from another machine -

following instructions @ http://reactphp.org/ , created server: <?php require 'vendor/autoload.php'; $app = function ($request, $response) { $response->writehead(200, array('content-type' => 'text/plain')); $response->end("hello world\n"); }; $loop = react\eventloop\factory::create(); $socket = new react\socket\server($loop); $http = new react\http\server($socket, $loop); $http->on('request', $app); echo "server running @ http://127.0.0.1:1337\n"; $socket->listen(1337); $loop->run(); i started on linux box ip of 192.168.1.200, , appears running: [michael@devserver react]$ php example.php server running @ http://127.0.0.1:1337 [root@devserver react]# netstat -lnp | grep 1337 tcp 0 0 127.0.0.1:1337 0.0.0.0:* listen 25984/php to test it, place http://127.0.0.1:1337/ in browser, machine doesn't have browser. alternative, used curl, , in fact...

c - Counter within a if-statement will not print whats needed -

i'm working create set of values below 1000 , subset them according number size, , count how many in set. counter part not print statement. in advance. #include <stdio.h> #include <stdlib.h> #include <math.h> int n; int arraysize; int randn; int rand(); int countone = 0; int counttwo = 0; int countthree = 0; int countfour = 0; int countfive = 0; int main() { printf("what size of array\n"); scanf("%d", &n); int array[n]; int i; (i = 0 ; < n; i++ ) { randn=rand() % 999; array[i]=randn; } (i = 0 ; < n; i++ ) { printf("%i\n", array[i]); } //the issue starts below here if(0>=array[i] && array[i] <= 199){ for(i = 0 ; < n ; i++){ countone++; printf("%d", countone); } } }

Python Pandas ValueError Arrays Must be All Same Length -

iterates on big list of .mp3 links metadata tags , save excel file. results in error. appreciate help. thanks. #print is_connected(); # create pandas dataframe data. df = pd.dataframe({'links' : lines ,'titles' : titles , 'singers': finalsingers , 'albums':finalalbums , 'years' : years}) # create pandas excel writer using xlsxwriter engine. writer = pd.excelwriter(xlspath, engine='xlsxwriter') # convert dataframe xlsxwriter excel object. df.to_excel(writer, sheet_name='sheet1') #df.to_excel(writer, sheet_name='sheet1') # close pandas excel writer , output excel file. writer.save() traceback (most recent call last): file "mp.py", line 87, in <module> df = pd.dataframe({'links' : lines ,'titles' : titles , 'singers': finalsingers , 'albums':finalalbums , 'years' : years}) file "c:\python27\lib\site-packages\pandas\core\f...

linux - Exposing a TTY device in a docker container with docker for mac -

i'm trying expose arduino that's plugged mac linux instance i'm running in docker mac (no vm). the arduino exposes /dev/tty.usbserialxxx . i'm using node docker image based upon ubuntu. the command i'm running is $ docker run --rm -it -v `pwd`:/app --device /dev/tty.usbmodem1421 node bash docker: error response daemon: linux runtime spec devices: error gathering device information while adding custom device "/dev/tty.usbmodem1421": lstat /dev/tty.usbmodem1421: no such file or directory. if try use --privileged $ docker run --rm -it -v `pwd`:/app --device /dev/tty.usbmodem1421 --privileged node bash root@8f18fdbcf64d:/# ls /dev/tty.* ls: cannot access /dev/tty.*: no such file or directory nothing exposed! i'm using expose serial devices test serial drivers in linux. the problem here largely you're not running docker on mac . you're running linux vm on mac, inside you're running docker. means it's easy expo...

amazon cloudformation - DynamoDB/CF - Subscriber limit exceeded: Only 10 tables can be created, updated, or deleted simultaneously -

i trying create 24 dynamodb tables using serverless.yml when got below error. how circumvent this? serverless: checking stack update progress… .................................................................serverless: deployment failed! serverless error --------------------------------------- an error occurred while provisioning stack: testusertable - subscriber limit exceeded: 10 tables can created, updated, or deleted simultaneously. environment information ----------------------------- os: linux node version: 6.6.0 serverless version: 1.1.0 this seems general issue cloudformation, here workaround in aws forum: https://forums.aws.amazon.com/thread.jspa?threadid=167996 i tried adding dependson still not solve i following error serverlesserror: template format error: unresolved resource dependencies [dev1producttables] in resources block of template putting dependson: "devpolicytable" in quotes not make difference resources: resources: devusertable: ...

asp.net - Get the actual last modified date for the requested page in WebForms -

i want put last modified date of (the .aspx file responsible for) viewed page footer of web forms site. i working on default web forms template visual studio 2015 , building project .net 4.5. in site.master , have modified footer so: <footer> <p> page last updated on: <asp:label id="modyfikacja" runat="server" text="coś nie poszło" /> </p> </footer> and modified page_load() method in site.master.cs so: protected void page_load(object sender, eventargs e) { string _site = server.mappath(httpcontext.current.request.url.absolutepath); modyfikacja.text = "(" + _site + ") " + file.getlastwritetime(_site).tostring(); } unfortunately, doesn't work way through: when go http://localhost:11111 , correctly returns date file path c:\imaginelikeapathheredude\default.aspx , but when go to, say, http://localhost:11111/about , attempts date file path c:\imaginelikea...

c++ - How do I solve "[Error] invalid use of incomplete type 'class SLLNode'" Linked Lists -

hi i'm trying solve error getting when try pass linked list class have. have looked through other questions non of them seem fix problem. i need sllnode stay in listassll because parent other classes dynamicsizematrix supposed have aggregation listassll my dynamicsizematrix.cpp file #include "dynamicsizematrix.h" #include<iostream> #include<string> #include<cassert> #include<cstdlib> #include"listassll.h" using namespace std; dynamicsizematrix::dynamicsizematrix(sllnode* sll,int r, int *c) { rws = r; col = new int [rws]; for(int x=0; x < rws; x++) // sets different row sizes { col[x] = c[x]; } sllnode *node = sll ; // node = sll.head; *info = new sllnode*[rws]; (int x= 0; x< rws;x++) { info[x] = new sllnode*[col[x]]; } for(int x=0;x<rws;x++) { for(int y=0;y<col[x];y++) { info[x][y] = node; ...

html - Why does the float-right element not go all the way to the top? -

Image
i know happens, clarification why, i'm trying better understanding of float mechanic given html <div class="wrapper"> <div class="inner first">1</div> <div class="inner second">2</div> <div class="inner third">3</div> </div> and css .wrapper { width: 500px; height: 500px; margin: 100px auto; border: 1px solid black; } .inner { border: 1px solid black; box-sizing: border-box; } .first, .second { float: left; width: 300px; height: 300px; } .third { width: 200px; height: 200px; float: right; } the third div not float way top right, aligns second div i know happens more specific explanation why (based on rule) good question, have seen people having difficulty understanding this. per question, feel want align '3' top-right in box. inner 500 * 500, , first , second 300*300, since cannot fit total of 600, second 1 go below first one. t...

angularjs - Unable to get a JSON response from my express router using node-Fetch module -

so i'm making post request express search router i'm using node-fetch module call remote api: var fetch = require('node-fetch'); router.route('/search') //performs job search .post(function(req, res){ var area = req.body.area; fetch('https://api.indeed.com/ads/apisearch?publisher=*********&l=' + area) .then(function(res) { return res.json(); }).then(function(json) { console.log(json); }); }) i'm using angular 1 on client side call router , parse returned json: $scope.search = function(){ $http.post('/api/search', $scope.newsearch).success(function(data){ if(data.state == 'success'){ //perform json parsing here } else{ $scope.error_message = data.message; } }); } i'm starting out mean stack , have vague idea of how promises work. issue angular search function not getting json string wa...

Heroku not running collectstatic with Django -

so have django app, i've turned off disable_collectstatic there's no mention of collect static happening. some research showed heroku fail silently if collect static fails, write out during build log when collect static succeeds. did heroku run python manage.py collectstatic , ran correctly. no errors. however, collect static still isn't running on build the catch turned out disable config var, 1 must use: heroku config:unset disable_collectstatic i using wrong command since heroku config displayed initally disable_collectstatic: 1 assumed heroku config:set disable_collectstatic=0 turn off config var. since nothing else seemed off, assumption became next suspect. following heroku docs handling config, ran of heroku config:set disable_collectstatic=false heroku config:set disable_collectstatic=false don't work desired.

javascript - Angular2 with Karma: web-server 404 -

i've managed configure karma , played dummy test success . however, things complicated try implement real test: about configuration: test files (spec) , ts files in app folder. on other hand, js files , js.map files in dist folder. here karma conf file: ... files: [ // system.js module loading 'node_modules/systemjs/dist/system.src.js', // polyfills 'node_modules/core-js/client/shim.js', 'node_modules/reflect-metadata/reflect.js', // zone.js 'node_modules/zone.js/dist/zone.js', 'node_modules/zone.js/dist/long-stack-trace-zone.js', 'node_modules/zone.js/dist/proxy.js', 'node_modules/zone.js/dist/sync-test.js', 'node_modules/zone.js/dist/jasmine-patch.js', 'node_modules/zone.js/dist/async-test.js', 'node_modules/zone.js/dist/fake-async-test.js', // rxjs { pattern: 'node_modules/rxjs/**/*.js...

c# - How to get text inside LongListSelector by clicking a button -

i have longlistselector , datatemplate this: grid has in left textblock , in right button. when press button want text inside textblock near button. idea row index of button , index access specified textblock, don't know how this. if know how can write code or if has better idea i'm open solutions. this xaml: <phone:longlistselector x:name="categorieslist" margin="0,0,-12,0" itemssource="{binding categories.items}"> <phone:longlistselector.itemtemplate> <datatemplate> <grid margin="-2,0,2,17"> <grid.columndefinitions> <columndefinition width="*" /> <columndefinition width="auto" /> </grid.columndefinitions> <textblock x:name="categorytextblock" verticalalignment=...

Decoding bytes to string in python -

i've got row of bytes: '\udcd0\udca0\udcd0\udcbe\udcd1\udc81\udcd0\udcbd\udcd0\udcb5\udcd1\udc84\udcd1\udc82\udcd1\udc8c' if do: b'\udcd0\udca0\udcd0\udcbe\udcd1'.decode("utf8"), i recieve: '\\udcd0\\udca0\\udcd0\\udcbe\\udcd1' i cant decode it, because dont know, how encoded. @ least, can see, not utf-8 , because, symbols expect see, have \x23 -similar representation. how can discover decoder , decode it? p.s. expect see russian symbols there i able print string in way, output "invalid characters." >>> string = u'\udcd0\udca0\udcd0\udcbe\udcd1\udc81\udcd0\udcbd\udcd0\udcb5\udcd1\udc84\udcd1\udc82\udcd1\udc8c' >>> print string ���������������� according charbase.com , first character (u'\udcd0') invalid character. maybe output correct.

mysql - Error (1005) when trying to create foreign key -

i'm trying create basic foreign constraint, i'm getting syntax error. #1005 - can't create table 'my_database'.'#sql-334f_952bc' (errno: 150 "foreign key constraint incorrectly formed") i first create tables , use 'alter table' method create foreign constraint. creating tables: create table `tbl_flights` ( `flight_id` int(11) not null auto_increment `aircraft_id` int(11) not null `date` date not null `auth_by` varchar(255) not null `auth_duration` time not null primary key (`flight_id`) ) ; create table `tbl_aircraft` ( `aircraft_id` int(11) not null auto_increment `registration` char(6) not null `insurance` date not null `awrc` date not null primary key (`aircraft_id`) ) ; creating foreign key/constraint: alter table `tbl_aircraft` add constraint `fk_aircraft_id` foreign key ( `aircraft_id` ) references `my_database`....

c++ - beep not working (linux) -

i'm trying beep, can't. i've tried: #include <iostream> using namespace std; int main(int argc, char **argv) { cout << '\a' << flush; return 0; } i have tried using this: http://www.johnath.com/beep/ doesn't beep. (if run $ speaker-test -t sine -f 500 -l 2 2>&1 on terminal, beeps, beep c++ study low-level sound programming) and able control frequency , duration. unless you're logged in console, cout not refer system console. need open /dev/console , send \a there. #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main() { int s = open ("/dev/console", o_wronly); if (s < 0) perror ("unable open console"); else { if (write (s, "\a", 1) != 1) perror ("unable beep"); } }

c++ - Using move semantic to push element into two containers -

i have read moving semantics , rvalue reference. having class has 2 containers of pointers struct. e.g struct person{ person(int , int a){ id = i; age = } person(person && p){ id = p.id; age = p.id; } int id; int age; } class holder{ private: vector<person*> one; vector<person*> two; } both containers should recieve same person , , 1 should sorted age , id. like void person::insert( int age , int id ){ person* tmp = new person(age , id ); one.push_back(tmp); // sort somehow 1 .. isnt important example two.push_back(tmp); // same sort } but improved using r-value reference , moving semantic? make step faster / better memory cost? , first of make sense it? e.g void person::insert(person*&& p){ one.push_back(p); // sort two.push_back(p); // sort? } i appreciate explanation of concept in case misunderstood move semantic.

C# Entity - SQLite and Unicode (Greek ) -

var q_truck = (from item in datagate.item join belong in datagate.belong on item.belong_id equals belong.id item.plate.startswith(textbox1.text) so problem here when use greek letters .startswith or .contains doesn't work, fetching wrong results. connectionstring has "charset=utf8" in line, string fields nvarchar , model properties of string fields have true in unicode, on modelcontext added modelbuilder.properties<string>().configure(x => x.hascolumntype("nvarchar")) , erased database made new, made string fields, text/string/varchar ... nothing. english , numbers work fine. i have added necessary nuget packages, microsoft.data.sqlite . don't know else do, i'm trying make work 3 days now, no result! sqlite faq : case-insensitive matching of unicode characters not work. the default configuration of sqlite supports case-insensitive comparisons of ascii characters. you need sqli...

OpenCV Crashes when reopening camera on Mac OSX Sierra and displaying -

when reopen webcam in opencv on mac osx sierra, , display images it, nsexceptions. this test code i'm working try figure out error mode. import cv2 cam = cv2.videocapture(0) ret, im = cam.read() cv2.imshow('im', im) cv2.waitkey(1) cam.open(0) ret, im = cam.read() cv2.imshow('im', im) cv2.waitkey(1) cam.open(0) ret, im = cam.read() cv2.imshow('im', im) cv2.waitkey(1) cam.open(0) ret, im = cam.read() cv2.imshow('im', im) cv2.waitkey(1) the error i'm getting is 2016-11-05 18:15:07.075 python[1082:24157] *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'an instance 0x7fca4ac3a6f0 of class avcapturedaldevice deallocated while key value observers still registered it. current observation info: <nskeyvalueobservationinfo 0x7fca4ac42f80> ( <nskeyvalueobservance 0x7fca4ae6df50: observer: 0x7fca4ae6b410, key path: open, options: <new: no, old: no, prior: no> context: 0x7fffc9c9...

html - Printing accents and foreign characters using beautiful soup and python -

i scraping artists discogs.com. unable artist names appear on page. e.g. artist andrés appears andr\xe9s when run code. can explain i'm doing wrong? bs4 import beautifulsoup import requests import urllib2 itertools import chain import codecs headers = { 'user-agent': 'mozilla/5.0 (windows nt 6.0; wow64; rv:24.0) gecko/20100101 firefox/24.0' } all_artists = [] result_pages = 1 #446 def load_artists(): page in xrange(1, result_pages+1): url = url = 'https://www.discogs.com/search/?sort=have%2cdesc&style_exact=house&genre_exact=electronic&decade=2010&page=' + str(page) r = requests.get(url, headers = headers) soup = beautifulsoup(r.content.decode('utf-8'), 'html.parser') [all_artists.append(tag["title"]) tag in soup.select('div#search_results h5 span')] load_artists() all_artists you need us...

html - hexagon shadow css javascript -

i have hexagon <some code here> codepen example how can add element shadow? the result looks result example you can using css3 box-shadow property. example: [your hexagon] { box-shadow: 2px 2px 4px 0px rgba(0,0,0,0.2); }

avr - Attempting to program ATmega88PB Atmel Studio error 0xc0 -

i attempting program atmega88pb using atmel studio 7 , both avrisp , atmel ice debugger. when attempting read device id following error message: failed enter programming mode. ispenterprogmode: error status received: got 0xc0, expected 0x00 (command has failed execute on tool) this on custom board , tried resolder new chip no success. have read issue may due poor connector or clock frequency being high. tried lowering clock speed 8khz no success. when pulled out scope found mosi , sck, , reset pins seem sending properly. however, not seeing response miso line (stays high). does have other ideas attempt debug issue? many thanks. just in case else having issue... running off of 3.3v setup did not realize in order enter programming mode vcc must set 4.5v - 5.5v. isolated vcc 3.3v line, applied 5v , works great.

How do you break a for loop in python using a mouseclick -

i have loop makes rectangle follow path of circle 10 rotations. theta in range(0, 3600): rect.undraw() nrcx=(cent.getx()+(r*(math.cos(math.radians(theta))))) nrcy=(cent.gety()+(r*(math.sin(math.radians(theta))))) c1=point((nrcx-b), (nrcy-b2)) c2=point((nrcx+b), (nrcy+b2)) rect=rectangle(c1, c2) rect.setfill("red") rect.setoutline("red") rect.draw(win) time.sleep(.05) however need when click during loop going, stop , rectangle follow along path in clock-wise instead of counter-clockwise. possible?

angularjs - Can't reach field inside an object in my angular controller -

i'm using factory television show database. wanted send episodes field object angular service keep getting undefined using dot notation , bracket notation. can explain how field. controller angular.module('showapp.controllers', []).controller('showviewcontroller', function($scope, $stateparams, show, $http) { $scope.show = show.get({ id: $stateparams.id }); //get single show.issues /api/shows/:id console.log($scope.show) console.log($scope.show.episodes) }) console output m $promise:d $resolved:true __v:0 _id:"581a5b82ff9e9f10f22afff7" airs_on:array[1] episodes:array[11] genre:array[3] network:"netflix" poster:"https://images-na.ssl-images-amazon.com/images/m/mv5bmtk5ntk1mzg3ml5bml5banbnxkftztcwndaynzy3oa@@._v1._cr25,3,1010,1343_sy1000_cr0,0,752,1000_al_.jpg" program_time:60 rated:"tv-ma" streams_on:array[3] title:"black mirror" yearbegin:2011 __proto__:object undefined you can wait resul...

python 3.x - My program isn't sorting properly -

im making histogram file , got working not sorting them correctly. meaning 100 90 50 etc. here code: from collections import counter data=[] open("data.txt", 'r') f: line in f: line = line.strip() data.append(str(line)) counts = counter(data) key, size in sorted(counts.items()): print('{}: {}'.format(key, int(size) * '*')) this output: 100: ****** 25: ** 50: *** 60: * 65: * 70: ** 75: * 80: **** 85: **** 90: *** any suggestions?? edit: what mean go numerically in order. insted of 100, 25, 50, .... want 100, 90, 85,..... njzk2 absolutely right, thanks! 1 way can : ... line = line.strip() # casting 'int' type before populating in data table.. data.append(int(line)) ... then, can ... # applying reversed reorder ascending order descending order. key, size in sorted(counts.items(), reverse=true): ...

TextView Check if ellipsized doesn't work with android:autoLink="web" -

usually how check if textviews have been ellipsized: viewtreeobserver vto = description_detail.getviewtreeobserver(); vto.addongloballayoutlistener(new viewtreeobserver.ongloballayoutlistener() { @override public void ongloballayout() { layout l = description_detail.getlayout(); if (l != null) { int lines = l.getlinecount(); log.e("linecount=", string.valueof(lines)); log.e("getellipsiscount=", string.valueof(l.getellipsiscount(lines - 1))); if (lines > 0) if (l.getellipsiscount(lines - 1) > 0) //ellipsized } } }); as add android:autolink="web" to textview, doesn't work anymore. i not understand why case. ideas? edit: <textview android:id="@+id/description_detail" android:layout_width="250dp" android:layout_height="wrap_content" android:layout_marginlef...

javascript - How to insert script tag to React -

i'm trying countdown clock in react, problems script tag var product = this.state.productlist.map(function (product, i) { return ( <div classname="col-md-2 col-sm-3 col-xs-6 grid-figure" key={i+1}> <figure> <div classname="rewardimage thumbnail_wrapper"> <img src={product.picture} alt="#"/> </div> <figcaption classname="title">{product.name}</figcaption> <div classname="col-md-5 col-sm-5 col-xs-5 padding-none"> <figcaption classname="price">{product.cost_min}</figcaption> </div> <div classname="col-md-7 col-sm-7 col-xs-7 padding-none"> <figcaption classname="due"><div classname="clo...

javascript - Conditional Formatting datatable DT R -

i big fan of dt package in r. want replicate excel conditionally formatted tables have, finding difficult access styling features. specifically, love able create function allows user call row/column of datatable , apply conditional formmating it, how done in excel. added feature novice r users myself, , speed process else. unlike heat map, conditional formatting important when row/columns not of same type, therefore need each 1 individually. nice able speficify high , low value option markers. i see can create breaks, in follow example on this page # create 19 breaks , 20 rgb color values ranging white red brks <- quantile(df, probs = seq(.05, .95, .05), na.rm = true) clrs <- round(seq(255, 40, length.out = length(brks) + 1), 0) %>% {paste0("rgb(255,", ., ",", ., ")")} datatable(df) %>% formatstyle(names(df), backgroundcolor = styleinterval(brks, clrs)) but not sure how apply individual rows, though seems can call them name, ...

coq - How to understand Setoid definition of category? -

i having trouble understanding following coq definition of categories (defined here ), involves setoid . , don't understand why setoid necessary or role here. class category o `{!arrows o} `{∀ x y: o, equiv (x ⟶ y)} `{!catid o} `{!catcomp o}: prop := { arrow_equiv :> ∀ x y, setoid (x ⟶ y) ; comp_proper :> ∀ x y z, proper ((=) ==> (=) ==> (=)) (comp x y z) ; comp_assoc :> arrowsassociative o ; id_l :> ∀ x y, leftidentity (comp x y y) cat_id ; id_r :> ∀ x y, rightidentity (comp x x y) cat_id }. (* note: no equality on objects. *) the basic notion of categories learned far requires there arrows between objects, the arrows compose (respects associativity) , identity arrows exist , behave. i understand setoid equivalent classes, can't see setoids come in. can please explain definition above , explain difference usual category definition without setoids? let me quote setoids subsection (sect. 2.4) paper j. gross, a. chl...

azure - Application Insight Request Region -

i have application hosted in multiple regions in azure. lately customers complaining slow performance. suspecting issue in 1 of azure regions, trying @ analytics appinsight , see requests column cloud_roleinstance. there way derive region column or other default column? you can use client_countryorregion , client_city columns in analytics. example, running following query amount of requests per region: requests | project client_countryorregion, client_city | summarize count() client_countryorregion, client_city please note these column contain county , city of region, need manually convert specific region. can use azure regions page convert between city/country , datacenter. example, boydton virginia east , san antonio texas south central us. hope helps, asaf

java - How to test an exception scenario with Hamcrest -

i have method named execute() , returns boolean. under normal situations, returns true, if there exception, (say, dataaccessexception) capture exception , return false. i trying figure out how test scenario in exception raised , "false" returned, using hamcrest. so, here is: public boolean execute() { try { ....... return true;} catch (dataaccessexception de) { ....... return false;} } as suppressing dataaccessexception inside execute () method, not able test exception, rather can assert result of method call shown below: @test public void testexecute() { //mock code throw dataaccessexception mokito.dothrow(new dataaccessexception()).when(mockobj).methodname(somemethod); //now call execute method boolean actual = obj.execute(); assertthat(actual, false); }

c - Moving characters in 2d array -

i tried create 8 x 8 checkers game. trying move hyphen ' _ ' in 2d array select character 'x' want. have created if statement detecting hyphen ' _ ' seem code isn't working, need help. new programming. #include <stdio.h> void gameboard(char board[8][8]) { int x, y; for(x=0; x<8; x++) { for(y=0; y<8; y++) { printf("=---="); } printf("\n\n"); for(y=0;y<8;y++) { printf("| %c |",board[x][y]); } printf("\n\n"); } for(x=0;x<8;x++) { printf("=---="); } } void character(char board[8][8]) { int x,y; for(x=0;x<8;x++){ for(y=0;y<8;y++){ if(x<3){ if(x%2 == 0){ if(x%2 == 0){ board[x][y] = 'o'; } if(y%2==1){ board[x][y]= ' '; } } if(x%2 == 1){ if(y%2 == 0){ board[x][y] ...

php - Uploading files in Fine-Uploader, fail to combine/merge chunks after successful upload -

so i've been trying chunked uploading working project i've been working on, i'm pretty new things, in fact intensive purposes can consider me complete noob teaching himself, i'm using manual upload template website, , traditional server side example files gain understanding of how code works , trying piece them functional example me build from. i've been able things working. i've managed uploading regular files files folder if upload file without chunking goes files directory, if use chunking works chunk file , upload folder in chunks directory, cant seem figure out how put chunks , place in files directory my firefox console gives me response , stops after finishing uploading file in chunks regardless of if have chunking success endpoint included in code or not makes me think it's got chunking success endpoint not being set correctly or along lines. [fine uploader 5.11.8] chunks have been uploaded 0 - finalizing....fine-uploader.js:162:21 [fine up...