Posts

Showing posts from September, 2010

c# - Can't format code in VS Code -

i've added following keybindings.json file. [ { "key": "ctrl+k ctrl+d", "command": "editor.action.format", "when": "editorhasformattingprovider && editortextfocus && !editorreadonly" } ] my understanding allow me format code pressing ctrl k ctrl d nothing happens in file when do. i've set indent 2 (default in settings , in status bar) code stays @ 4 spaces anyway. how can troubleshoot it?

javascript - Banners are disappearing from webpage. Any suggestions on how to fix this? -

i'm having issue labels @ top of page disappearing after click button. when click "show employees" button, "last name" "first name" , "region name" disappear. here screenshots: before clicking "show employees": https://imgur.com/a/zgu4j after clicking "show employees": https://imgur.com/a/pqkoh i have feeling issue displayemployees js function: function displayemployees(data) { var table = ""; $.each(data.rows, function(index, row){ table += "<div class='row'>\n"; table += "<div class='col1'>" + row.emp_first + "</div>\n"; table += "<div class='col2'>" + row.emp_last + "</div>\n"; table += "<div class='col3'>" + row.region_name + "</div>\n"; table += "<button dbutton = " + row.employee_id + " class = 'deletebutton...

java - Gathering images from Coppermine Photo Gallery -

i'm trying obtain images site using "coppermine photo gallery" image gallery. for example, i'm trying images katygallery.com can't reach final url contains photo. i use java+jsoup, vs2010 visual basic+nsoup 403 error obtaining final url (the 1 .../albums/userpics/example.jpg). i tried work cache / useragent nothing works. someone has hit similar problem? thank you.

python - How to provide (or generate) tags for nltk lemmatizers -

i have set of documents, , transform such form, allow me count tfidf words in documents (so each document being represented vector of tfidf-numbers). i thought enough call wordnetlemmatizer.lemmatize(word), , porterstemmer - 'have', 'has', 'had', etc not being transformed 'have' lemmatizer - , goes other words well. have read, supposed provide hint lemmatizer - tag representing type of word - whether noun, verb, adjective, etc. my question - how these tags? supposed excecute on documents this? i using python3.4, , lemmatizing + stemming single word @ time. tried wordnetlemmatizer, , englishstemmer nltk , stem() stemming.porter2. ok, googled more , found out how these tags. first 1 have preprocessing, sure file tokenized (in case removing stuff left off after conversion pdf txt). then these file has tokenized sentences, each sentence word array, , can tagged nltk tagger. lemmatization can done, , stemming added on top of it. from n...

javascript - Check if class constructor extends another class -

this question has answer here: check if constructor inherits in es6 2 answers how can check if class constructor extends class, without constructing object? ie constructor reference. example class { } class b extends { } var b = b; if(typeof b === b) you can check of instanceof below. class { } class b extends { } class c { } console.log(b.prototype instanceof a); console.log(c.prototype instanceof a); // instance var b = new b(); console.log(b instanceof b); console.log(b instanceof a); console.log(b instanceof c);

c# - How do I access Combobox item MemberValue in windows forms? -

i trying access combobox item's value. item's value of type myclass list<myclass> myiitemslist = getmyclassitemsmethod(); if (myiitemslist .count > 0) { (int = 0; < myiitemslist .count; i++) { list<myclass> selectedmyclassitems = myiitemslist .findall(x => x.myclassnumber == i); string itemtext = "myclass " + ; mycombobox.items.add(new { itemtext, valuemember = selectedmyclassitems}); } } here sample code. trying access valuemember. when select item in combobox, able selected item. var ddlmyclassselecteditem = mycombobox.selecteditem; in debug watch windo, able see valuemember item has items list, don't know how access/retrieve them. lets discuss you've done. how retrieve members of little interest, although way mycombobox.displaymemeber = "display"; mycombobox.valuememeber = "value"; mycombobox.datasource = getmyclassitemsmethod().orderby(c => ...

playing video in Centos using opencv python -

i following tutorial opencv play video on centos . opencv tutorial see code below , doesn't throw errors not show videos being played. if use image display program works fine tells me x11 forwarding part working fine . [root@hadoop1 basic-motion-detection]# more demo1.py import numpy np import cv2 cap = cv2.videocapture('/home/admin/example_02.mp4') while(cap.isopened()): ret, frame = cap.read() gray = cv2.cvtcolor(frame, cv2.color_bgr2gray) cv2.startwindowthread() cv2.namedwindow("preview") cv2.imshow('preview',gray) if cv2.waitkey(1) & 0xff == ord('q'): break cap.release() cv2.destroyallwindows()

hadoop - What is the is the difference between -copyFromLocal and -put -

this question has answer here: difference between hadoop fs -put , hadoop fs -copyfromlocal 5 answers is possible explain difference between -copyfromlocal , -put command in hadoop. not able find document says difference between 2 commands. well 1 can explain if there difference , don't think there is. @ code below copyfromlocal extends put no additional functionality. public static class copyfromlocal extends put { public static final string name = "copyfromlocal"; public static final string usage = put.usage; public static final string description = "identical -put command."; } https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/copycommands.java

java - Vigenere Cipher Decryption with part of message known -

so working on vigenere cipher right , know ending encoded message benediction, "your friend, joe". therefore, need extract key used rotate each letter by. key numerical string such each letter in message rotated forward number of times equal corresponding digit (ie: 1234 rotate first index 1, 2nd index 2, etc). have found "key" associated benediction, how extract actual key "key" since key loops if run out of indices key, such when translate benediction "key" so: 825122082512208 //the actual key 8251220, don't know how in general case. much appreciated, thanks.

database - How to get and sort data from this MYSQL query -

update: question updated people undestand better i have following tables create table if not exists `post` ( `id` int(11) not null auto_increment, `heading` text not null, `content` longtext not null, `date` timestamp not null default current_timestamp, `thumb` text null, primary key (`id`)) engine = innodb auto_increment = 15 default character set = latin1; create table if not exists `tags` ( `id` int(11) not null auto_increment, `tagname` text not null, primary key (`id`)) engine = innodb auto_increment = 12 default character set = latin1; drop table if exists `tagsinpost` ; create table if not exists `tagsinpost` ( `tid` int(11) null default null, `pid` int(11) null default null, constraint `post_ibfk_1` foreign key (`pid`) references `post` (`id`) on delete cascade on update cascade, constraint `tagsinpost_ibfk_1` foreign key (`tid`) references `tags` (`id`) on delete cascade on update cascade) engine = innodb def...

javascript - I still get the pyramid of doom when using promises, what am I doing wrong? -

i using inquirer library node.js , still pyramid of doom when using promises, doing wrong? just fyi inquirer library api basically: inquirer.prompt([ question1, question2, question3, ... questionx ]).then(function(answers){}); where answers hash, keys represent each question. nothing out of ordinary here. anyway, using api, getanswerstoprompts().then(function(answers){}) , seems more convenient keep nesting promises inside previous one...like so: function run (rootdir) { return watchhelper().then(function (answers) { return choosedirs({ allowdirs: answers.allow, originalrootdir: rootdir, onlyonefile: false }).then(function (pathstorun) { assert(pathstorun.length > 0, ' need select @ least 1 path.'); return getoptions(availableoptionsforplainnode).then(function (answers) { const selectedopts = answers[ 'command-line-options' ]; return localorglobal().then(function (answers) { co...

java - Sphere raytracing - specular highlights -

Image
i having trouble getting lighting model correct spheres. specifically, can't specular highlights spheres correct. here seeing when raytrace spheres: now, specular highlights should little more these: as understand, lighting model (for these diffuse spheres) looks this: where c r color of sphere, c a ambient component of light, c l color of light, n normal @ point of intersection on sphere, l direction of light, c p color of specular highlight, e eye/look from, r reflection vector off surface of sphere, , p in exponent refers phong constant/exponent (how tight/loose lightlight is). here process: public color calculateilluminationmodel(vector normal, scene scene) { //c = cr * ca + cr * cl * max(0, n \dot l)) + cl * cp * max(0, e \dot r)^p vector lightsourcecolor = getcolorvector(scene.getlight().getlightcolor()); //cl vector diffusereflectancecolor = getcolorvector(getmaterialcolor()); //cr vector ambientcolor = getcolorvector(scene.getlight(...

swift - Tab bar not working when clicking second tab -

Image
i having problem tab bar controller! upon simulation of project, tab bar controller appears, first tab selected, , showing view have put in first tab (so correct). when click on second tab, takes me xcode , displays "thread 1: signal sigabrt" @ top of appdelegate class. have no idea why happening other maybe isnt linked correctly. can go on steps link view controller second tab of tab bar controller? thanks! all have in storyboard of second scene 2 labels, switch, slider, , button. because need worry values of switch , label, 2 things have connected code using outlets. 1. tab bar controller 1 view controller 2. add second view controller uilabel 3. ctrl + drag tab bar controller second view controller 4. choose relationship segue -> view controllers 5. tab bar controller 2 view controllers 6. result 7. access labels etc., create file second view controller, in example secondviewcontroller.swift inherits uiviewcontroller import u...

sql server - Creating a Trigger to update -

i trying create trigger populate column row being updated. here did, it's not working: create trigger psl_cases_address on dbo.psl_cases after insert, update begin if update(permit_no) /*if column not affected skip*/ begin update psl_cases set address = ( select top 1 permits.address permits left outer join psl_cases on psl_cases.permit_no=permits.permitsid psl_cases.psl_casesid=psl_casesid ) dbo.psl_cases.psl_casesid = psl_casesid; end end; any ideas might doing wrong? i think looking for create trigger psl_cases_address on dbo.psl_cases after insert, update begin if update(permit_no) /*if column not affected skip*/ begin update psl_cases set psl_cases.[address] = permits.[address] inserted inner join psl_cases on inserted.[permit_no] = psl_cases.[permitsid] i...

Linking to fftw with Xcode -

i have followed instructions here install fftw3 on mac: http://www.fftw.org/doc/installation-on-unix.html i'm creating code in c in xcode. once i've installed fftw, how use in xcode? is, how tell xcode fftw exists? i've tried #include , error stating fftw3.h cannot found. thank you!

cocoa - Swift 3 Load xib. NSBundle.mainBundle().loadNibNamed return Bool -

i trying figure out how create custom view using xib files. in question next method used. nsbundle.mainbundle().loadnibnamed("cardview", owner: nil, options: nil)[0] as! uiview cocoa has same method,however, method has changed in swift 3 loadnibnamed(_:owner:toplevelobjects:) , returns bool , , previous code generates "type bool has no subscript members" error, obvious, since return type bool. so, question how load view xib file in swift 3 first of method has not been changed in swift 3. loadnibnamed(_:owner:toplevelobjects:) has been introduced in macos 10.8 , present in versions of swift. loadnibnamed(nibname:owner:options:) has been dropped in swift 3. the signature of method is func loadnibnamed(_ nibname: string, owner: any?, toplevelobjects: autoreleasingunsafemutablepointer<nsarray>?) -> bool so have create pointer array of views on return. var toplevelobjects = nsarray() if bundle...

MySQL: how to trim the content of a cell to make SELECT output more readable -

i have mysql table 6 columns. of columns contain long json strings have newlines , spaces. when list content of table select statement, output messy. is there command (or default setting can change), limit output of each column first few meaningful characters, each row show single line regardless of cell content? like: +---------------------------+-------------------------+---------+-----------+--------------+----------+ | jsondata | column2 | column3 | column4 | column5 | column6 | +---------------------------+-------------------------+---------+-----------+--------------+----------+ | { "text":[{"user_id":"3","| abcdefabcdefabcdefabc | 3 | abcabca | txt | { "email"| +---------------------------+-------------------------+---------+-----------+--------------+----------+ i don't know settings can permanently change in db, should format output describe it: selec...

functional programming - Coq: Prove equality of two factorial functions using induction -

i want prove 2 factorial functions equivalent in coq using induction. the base case n = 0 easy, however, induction case more complicated. see, if rewrite (visit_fac_v2 n' (n * a)) n * (visit_fac_v2 n' a) , done. however, translating idea coq causes me troubles. how 1 go proving in coq? fixpoint fac_v1 (n : nat) : nat := match n | 0 => 1 | s n' => n * (fac_v1 n') end. fixpoint visit_fac_v2 (n : nat) : nat := match n | 0 => | s n' => visit_fac_v2 n' (n * a) end. definition fac_v2 (n : nat) : nat := visit_fac_v2 n 1. proposition equivalence_of_fac_v1_and_fac_v2 : forall n : nat, fac_v1 n = fac_v2 n. proof. abort. a typical thing when proving direct-style function , accumulator-based equivalent equal state stronger invariant ought true value accumulator may hold. you can specialise value function called obtaining statement interested in corollary of more general one. the general statement here follows:...

java - Streaming HTTP responses with Jetty AsyncProxyServlet -

i have server streams various things such log output on long-lived http responses. however, when using jetty's proxy servlets, haven't been able stream response (it buffers whole response before sending). using overriding plain proxyservlet class, following appears work: @override protected void onresponsecontent(httpservletrequest request, httpservletresponse response, response proxyresponse, byte[] buffer, int offset, int length, callback callback) { super.onresponsecontent(request, response, proxyresponse, buffer, offset, length, callback); try { response.getoutputstream().flush(); } catch (ioexception e) { log.warn("error flushing", e); } } however, doing when overriding asyncproxyservlet doesn't work. (full source code here .) so, 2 questions: when using proxyservlet , flushing after each bit of content received way go? is there way make work asyncproxyservlet ? got working. proper approach works whe...

Should I care about providing asynchronous calls in my go library? -

i developing simple go library jsonrpc on http. there following method: rpcclient.call("mymethod", myparam1, myparam2) this method internally http.get() , returns result or error (tuple). this of course synchron caller , returns when get() call returns. is way provide libraries in go? should leave user of library make asynchron if wants to? or should provide second function called: rpcclient.callasync() and return channel here? because channels cannot provide tuples have pack (response, error) tuple in struct , return struct instead. does make sense? otherwise user have wrap every call in ugly method like: result := make(chan asyncresponse) go func() { res, err := rpcclient.call("mymethod", myparam1, myparam2) result <- asyncresponse{res, err} }() is there best practice go libraries , asynchrony? the whole point of go's execution model hide asynchronous operations developer, , behave threaded model blocking operati...

reactjs - parse error handleDismissClick = e => -

syntaxerror: /users/mumuhou/github/web/react/examples/basic-commonjs/index.js: unexpected token (7:21) while parsing file: /users/mumuhou/github/web/react/examples/basic-commonjs/index.js my code: 'use strict'; import react, { component, proptypes } 'react' import reactdom 'react-dom' class app extends component { handledismissclick = e => { e.preventdefault() } render() { var elapsed = math.round(this.props.elapsed / 100); var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' ); var message = 'react has been running ' + seconds + ' seconds.'; return <p>{message}</p>; } } var start = new date().gettime(); setinterval(function() { reactdom.render( <app elapsed={new date().gettime() - start} />, document.getelementbyid('container') ); }, 200); i have config es2015 class app extends component { handledismissclick = e => { ...

command line interface - Limiting PHP execution time under CLI -

i run large number of php scripts via cli executed cron in following format : /usr/bin/php /var/www/html/a15432/run.php /usr/bin/php /var/www/html/a29821/run.php in instances there problem once of files whereby execution of file enters loop or not terminate due error in particular script. what achieve if either of above occurs, php cli stops executing script. i have searched , indications need use command, have entered @ beginning of each file, not seem making difference. ini_set('max_execution_time', 30); is there other way can better protect server 1 (or more) of these rogue files cannot allowed bring down server entering kind of infinite loop , using of servers resources trying process file? make problem worse, these files can triggered every 5 minutes means @ times, there loads of same files trying process. of course realise correct solution fix files there better error handling , never allowed enter state, @ moment i'd understand why doesn't work ...

c# - Failed to get schema for this query Visual Studio 2015 -

i have page in program has datagridview object on it. populated query selects data database table called docs. the table has 4 columns: applicant_name doc_id doc_name doc_contents i'm trying add delete query user delete document table when select , hit 'delete' button. when try create delete query, "failed schema query" message , can't understand why. my query looks this: delete docs (doc_id = @param3) could explain why i'm getting error? are using data binding load adapter, if yes pz check if insert update delete statement generated adapter.

jquery - dynamically detect change to span element -

i have span elements dynamically generated ajax response. trying detect change span value using below code , seems work in jsfiddle fixed elements not in real scenario data dynamically generated. span values updated setinterval function number increment trying detect. the steps taking - appreciate advice on why code not working? for elements id containing "minutes" <- these span elements get id's detect change in elements id's step 2 when change detected, span element value check if span value greater 00 i.e. 01 (this minute value) if condition step 5 met apply css if condition step 5 not met remove css $('[id*="minutes"]').each(function() { spanid = $(this).attr('id'); console.log(spanid); $("#"+spanid).on('change',function(){ spanval = $(this).text(); id = $(this).attr('id').charat(0); if(spanval > 00) { $('#results').text(span); ...

javascript - How to load google images within my site using api? -

i trying implement what on page having error on console: www.google.com/jsapi?key=abqiaaaar19eul_kzsycbnymjsjbphss8zuuzs-phhbad9skttjftv728xq8ncr0mwfbq0ita4r2wzc7rtuwuq:22 parser-blocking, cross-origin script, https://www.google.com/uds/?file=search&v=1&output=nocss%3dtrue , invoked via document.write. may blocked browser if device has poor network connectivity. i tried follow this answers on google image search says api no longer available . i trying display images based on given string using jquery or javascript , ajax. note: set own key , cx yes, api no longer available , won't able use anymore. however, still have options: as may have stated, google custom search best option. indeed, cannot use js code have. once have app key , cx code in hands, thing have call request proper params handling response. let's see: https://www.googleapis.com/customsearch/v1?q=java&cx=your_cx_code&key=your_app_key&num=1&star...

visual studio 2015 - Reenable Message Prompt 'Number of occurrences replaced' -

in visual studio text editor, pressed [ctrl+h] find , replace words on code, after clicking [replace all] message box prompts "x occurrence(s) replaced" check box @ bottom reads "always show message". i accidentally unchecked box , clicked ok. want message prompt back. how do this? go tools -> options -> environment -> find , replace -> check 'display informational messages'.

android - How to write mock gps provider affect whole system apps -

i see in market there many mock location application apply whole system. (it means when use google map, uber ...) display new location. i have followed tutorials. here sample code: public class mainactivity extends appcompatactivity { locationmanager mlocationmanager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mlocationmanager = (locationmanager) getsystemservice(location_service); setupmocklocations(locationmanager.gps_provider); setupmocklocations(locationmanager.network_provider); setupmocklocations(locationmanager.passive_provider); } private void setupmocklocations(final string providername) { new thread(new runnable() { @override public void run() { (; ; ) { mlocationmanager.addtestprovider(providername, false, //requiresnetwork, ...

My sorting algorithm in python freezes sometimes during runtime, can someone take a look? -

basically i've been trying is, i'm picking out smallest , largest unsorted list, appending them new list, popping smallest , largest old unsorted list , doing process on , on until end sorted list. please take @ code . import random import time stack = [] #sorted list numbersarray = [] #unsorted list usersize = int(input("how many digits want in array? ")) #numberofinputs limit = 0 counter = 0 while limit <= usersize: numbersarray.append(random.randint(0,20)) #randomly input numbers array limit = limit + 1 print(numbersarray) #prints current unsorted array start_time = time.time() #starts clock subtractor = 0 #used later in code changing index while len(numbersarray) != 0: = 0 largest = numbersarray[i] size = len(numbersarray) -1 smallest = numbersarray[i] while (i < len(numbersarray)): if numbersarray[i] >= largest: largest = numbersarray[i] index = elif numbersarray[i] <= smallest: sm...

html5 - How to correctly decide what should be a component in Angular 2? -

i find angular 2 components nice, can write down our own html elements suited app building, however, since i'm getting started angular 2, feel i'm using them wrong way around. the way i've been using components, , i've seem other people doing, make 1-1 correspondence between components , views. in other words, each view of app, 1 creates 1 component , use router trigger active component. so in setting 1 have components this: dashboard component - dashboard view user profile component - user profile view sales list component - sales list view sale editor component - sale editor view, used both adding new sale or updating one and forth. mean, works, feel wrong way use components. seems me somehow components should more granular that. how should 1 correctly decide must component in angular 2? should 1 make 1-1 mapping between components or view? if not, right way decide components need build? this question opinion based , not fit so. your ab...

Using gdf file with netlogo nw extension -

i have loaded gdf file using nw extension in netlogo. how can limit number of turtles? attached code wrote: exextensions [ nw ] breed [ orgs org ] directed-link-breed [ likes ] setup ca nw:load-gdf "d://netlogowork/j14clean.gdf" orgs likes end

mysql - c# Auto populate result of a textboxt.Text from database, base on 2 different combo box -

namespace training { public partial class addingnewdata : form { public addingnewdata() { initializecomponent(); fillcombo1(); fillcombo2(); autopopulatedays(); } string original_city, destination_city; void fillcombo1() { string constring = "datasource=localhost;port=3306;username=root;password=root"; string query = "select * itemdelivery.fee group orig_city;"; mysqlconnection condatabase = new mysqlconnection(constring); mysqlcommand cmddatabase = new mysqlcommand(query, condatabase); mysqldatareader myreader; try { condatabase.open(); myreader = cmddatabase.executereader(); while (myreader.read()) { string storig = myreader.getstring("orig_city"); combobox1.items.add(storig); } } catch (exception ex) { messagebox.show(ex.message); } } void fillcombo2() { string constring = "datasou...

javascript - In async.until(test, function, callback) test function is not getting invoked repetitively -

while using async.until() function observed test not getting invoked repetitively though returning false. result function not getting invoked perform next task. var resultreceived = false; async.until(function(){ console.log("checking result : "+resultreceived); return resultreceived; }, function(callback){ try{ //do resultreceived = true; }catch(err){ resultreceived = false; } }, function(result){ console.log("===================="); console.log(result); callback(result); }); the reason see test function invoked once because never advance past first iteration. in order move 1 iteration next, need invoke callback in second function pass async.until . here modified example show test function being invoked each iteration: var iteration = 0; async.until(function(){ console.log("checking iteration : " + iteration); return iteration > 5; }, function(...

go-mysql connection refused when connecting to kubernetes mysql service -

i have problem when connecting mysql instance go app using standard package. connection string/log [13 nov 16 13:53 +0000] [info] connecting mysql.. root:awsomepass@tcp(a-mysql-0:3340)/db?charset=utf8&parsetime=true&loc=local 2016/11/13 13:53:25 dial tcp 10.108.1.35:3340: getsockopt: connection refused i tried grant privileges on *.* 'root'@'%' grant option; here how make connection, basic, string concatenation only db, err := sql.open("mysql", "root:awsomepass@tcp(a-mysql-0:3340)/db?charset=utf8&parsetime=true&loc=local") if err != nil { log.fatal(err) } i can ping service, connect mysql-client different pod. # can connect without port service / # mysql -u root -h a-mysql-0 -p enter password: welcome mariadb monitor. commands end ; or \g. mysql connection id 11 server version: 5.7.16 mysql community server (gpl) copyright (c) 2000, 2016, oracle, mariadb corporation ab , oth...

mysql - Stored procedure to calculate price and time difference SQL -

i'm trying create stored procedure updates price in stock table. enter image description here basically, price_rent depends on different between rent.date_rent , date andrent.return * stock.price_x_day. if difference between rent.date_rent , date andrent.return exceeds 30 days client must pay penality. important feature updating of quantity in stock. can me?

php - How to values in MySQL with bash script -

i trying create bash script entering values in mysql database. ultimate goal gather data hard drives smartmontools, getting many errors decided break down , start simple. total noob @ bash / mysql. test database contains table user , date. bash script: usr=$user date=$(date +%y%m%d) mysql -hlocalhost -uuser -ppw -dtest<<eof insert testtbl (user, date) values('$usr', $date); eof exit this error message get: ./ysmartmon: line 4: syntax error near unexpected token `(' ./ysmartmon: line 4: `mysql -hlocalhost -uuser -ppw -dtest<<eof insert testtbl (user, date) values('$usr', $date);' what doing wrong? ` need rid off? how do that? break line after << eof , this: mysql -hlocalhost -uuser -ppw -dtest << eof insert testtbl (user, date) values('$usr', $date); eof this << eof construct called here-document , can read more in man bash . search in man bash , type /here-doc , press enter.

python - Django smart select many to many field filter_horizontal/filter_vertical does not allow chaining -

hi doing project in django 1.10. project using django-smart-select chaining input in admin panel. works fine. many many fields chaining if use filter_horizontal/filter_vertical chaining not work more. there no solution in there github page. how can solve problem? there app this? i have same problem , solved in fork library: https://github.com/jorgecorrea/django-smart-selects can see in readme version, way use in horizontal mode mi fork: models.py from smart_selects.db_fields import chainedmanytomanyfield class publication(models.model): name = models.charfield(max_length=255) class writer(models.model): name = models.charfield(max_length=255) publications = models.manytomanyfield('publication', blank=true, null=true) class book(models.model): publication = models.foreignkey(publication) writer = chainedmanytomanyfield( ...

python - missing 1 required positional argument: 'queryset' -

i attempting update extended user model profile in admin.py actions. have been researching couple hours , have come short. receiving pc_add_1() missing 1 required positional argument: 'queryset' error, please help. class profileadmininline(admin.stackedinline): model = profile class profileadmin(useradmin): list_display = ['username', 'email', 'first_name', 'last_name', 'is_staff', 'rewards_punch_card', 'rewards_tier', 'credits'] list_select_related = true inlines = [profileadmininline] actions = ['pc_add_1', 'pc_add_2', 'pc_add_3', 'pc_add_4', 'pc_add_5', 'pc_add_6', 'pc_add_7', 'pc_add_8', 'pc_add_9'] def rewards_tier(self, user): return user.profile.rewards_tier def rewards_punch_card(self, user): return user.profile.rewards_current def pc_add_1(...

numpy - Animation of circles on python -

i trying circles appear 1 one in random locations on plot, interval of 1 second. if circles overlap, overlapping circles need added clusters , change colours depending on cluster belong to, or if touch left or right side of 'box'. new python , therefore struggling project. clusters need continue growing until there 5 circles in cluster. therefore, struggling create function continue create circles until condition met. here code have written far import numpy.random nr import scipy sp import pylab plt import itertools matplotlib.animation import funcanimation radius = 0.05 number_of_disks = 10 coordinates = nr.uniform(size=(number_of_disks, 2)) print coordinates plt.close('all') fig = plt.figure() ax = plt.gca() #plot of disks coordinate in coordinates: ax.set_aspect('equal', adjustable='box') circle = plt.circle((coordinate[0], coordinate[1]), radius, alpha = 0.4, color='b') ax.add_artist(circle) plt.show() disks = [] overla...

angularjs - How to update angular ng-class when a variable changes? -

i want ng-class update when variable in controller changes. reason, triggered on page load , whilst variable change, ng-class not update reflect this. here code triggers variable change: <a class="cs-mobile-menu__close-icon" ng-click="switchmobilemenu('right')"> </a> here code want change depending on variable: <div class="right-menu__user" ng-class="{ 'animate': true, 'animate--leave': !isrightmenuopen}"> {{user.firstname}} {{user.lastname}} </div> here corresponding code controller: $rootscope.isleftmenuopen = false; $rootscope.isrightmenuopen = false; $scope.switchmobilemenu = function(direction) { if (direction === 'left') { $scope.isleftmenuopen = !($scope.isleftmenuopen); } else { $scope.isrightmenuopen = !($scope.isrightmenuopen); } }; it seems ng-class set on initial ng-click ...

sql server - Update database using strongly typed DataSet -

i have database sql server 2014. made stored procedure selects several fields. until fine. returns datatable bind datagridview . problem when want update datatable . made stored procedure update. (my update works fine in sql server). reason when update visual basic, updated dataset not database! reason, looks not connect database. i know can use sqlconnection.open() , sqlconnection.close() i'm working "disconnected ado.net" when call updatecommand , it's supposed connect directly database, didn't! doing wrong? p.s. sorry bad english. here part of code: 'initialize command command.commandtype = commandtype.storedprocedure command.commandtext = "dbo.update" command.parameters.add(new sqlparameter("@idinventory", sqldbtype.int, 1, table.columns(0).caption)) command.parameters.add(new sqlparameter("@idproduct", sqldbtype.int, 1, table.columns(1).caption)) command.parameters.add(new sqlparameter("@code", s...

angularjs - How to add focus on the cancel label of the popup? -

i have popup function. has template pop up. has 1 delete , cancel button. want have focus on cancel button when popup opens. how can that? $scope.popup = function(funcname){ alert_template({ id: '', title: '', scope: $scope, template: '<div class=""><span>delete selected item?</span></div>', success: { label: 'delete', fn: function(){ //do } }, cancel: { label: 'cancel', fn: //do } }); versions of js differ may or not need # identify object. javascript: document.getelementbyid('cancel').focus(); jquery: $('#cancel').focus();

c - How can I convert char[] array to char* -

i want convert char[] array char* string in c programing language. here did. can't reach solution . please me. here code: #include <stdio.h> void fnk(char *chr){ printf("%s",chr); } int main(){ char charfoo[100]; int i=50; gets(charfoo); for(int j=0;j<i;j++){ fnk((char*) charfoo[j]); } } i think mean following fnk( &charfoo[i]); take account better write loop following way for( int j=0; charfoo[j]; j++ ) { fnk( &charfoo[j]); } also function gets unsafe , not supported more c standard. instead use function fgets example fgets( charfoo, sizeof( charfoo ), stdin ); in case loop can like for( int j=0; charfoo[j] != '\0' && charfoo[j] != '\n'; j++ ) { fnk( &charfoo[j]); } if want output 1 character in function function should defined like void fnk(char chr){ printf("%c",chr); } and called like fnk( charfoo[j]);

c# - HttpClient aborting simple get request -

Image
i doing simple request httpclient. have issues aborting before request complete. fiddler shows request should return 200, shows request aborted. diffenitally not hitting default 100s timeout. there hidden setting missing? var new_client = new httpclient(); var req = await new_client.getasync("http://a20.skout.com/support/captchamobile/?sid=e91af660-0b3d-4c2f-bbdd-249506b9c440"); req.ensuresuccessstatuscode(); image of fiddler request. showing sucessful 200 status code aborted client. update1: use sid try "36598189-0f2f-45b9-a794-385a5d5e11c8" update2: having problem url " http://api.recaptcha.net/challenge?k=6lc2qn8saaaaaee8_r2alf4hu1v_x34nuv1mzw-w " update3: manage response new_client.getasync("http://a20.skout.com/support/captchamobile/?sid=e91af660-0b3d-4c2f-bbdd-249506b9c440").result . unsure why works not await. guess has done syncronously. leave question incase has more vaild answer.

sqldatetime - Need assistance in calculating Due Date using SQL Server Functions -

am trying calculate due date using invoice date following constraints will have 2 text boxes 1 enter day of month , enter day before due month if day of month 4 , day before due month 5 have calculate values subtracting 4 , 5 if subtracted value -ve 1 , if invoice date entered 11/13/2016 due date must 12/04/2017 (here 04 day of month) if day of month 15 , day before due month 5 , subtracted value 10 (not negative) invoice date entered 11/13/2016 means due date must 12/15/2016 (here 15 day of month) if invoice date less or equal subtracted value ie 10 invoice date 11/09/2016 invoice date must 11/15/2016 note above constraints must satisfy leap year while calculating fue dates please me new bee sql server functions the code have tried declare @invoicedate datetime ='02/01/2016' ,@tenantid bigint=29 ,@paymenttermid bigint=2 begin declare @duedate datetime declare @actualduedate bigint declare @calculateddate datetime declare @pay...

how to access Excel API through Graph Explorer with personal account -

trying access excel api using office 365 personal account through microsoft graph explorer . not working. tried in graph explorer after login in office 365 personal account https://graph.microsoft.com/v1.0/me/drive/items please suggest how working. excel rest api not supported consumer accounts @ point in time, have on our roadmap , hope enable soon.

python - AWS Lambda function with lots of scheduled events -

i’ve created dynamodb table populated hostnames want ping using aws lambda. every time new entry added dynamodb table, want new scheduled job added lambda function specified hostname. example, if have 100 hostnames in dynamodb table, have 100 scheduled jobs @ various intervals executing lambda function. there way execute this? aws lambda functions can triggered many different event sources , including direct invocation via api call , schedule within amazon cloudwatch events . it appears goal is: at regular time period for each entry in given dynamodb table execute lambda function rather creating 100 schedules 100 entries, create single entry: when schedule fires... run lambda function reads table for each entry in table, call new lambda function , passing in desired hostname retrieved database this way, require one schedule automatically fire off other tasks based upon number of entries in database table. please note there default limit of 100 concurr...

C# Problems 2 For Drawing And 1 For Float Digit Count -

Image
c# programs making these two also program gets float numbers inputs , counts digits separately 1 output one's before "." , 1 output after "." one's .

Bat file that alters specific xml element optimization -

i have batch script updates httptransport element httpstransport specific binding name, in case: custombinarybinding. how can write in more elegant , efficient way. bat file: @echo off setlocal enabledelayedexpansion set "search=httptransport" set "replace=httpstransport" set "bindingname=custombinarybinding" set intextfile=c:\users\tudor\desktop\batch\web.config set outtextfile=c:\users\tudor\desktop\batch\webtemp.config echo start (for /f "delims=" %%i in (!intextfile!) ( set "line=%%i" /f tokens^=1^,2^,3^ delims^=^<^"^= %%a in ("%%i") ( if "%%b" equ "binding name" if "%%c" equ "custombinarybinding" ( set "insidecorrectbinding=y" ) /f "delims= " %%m in ("%%b") ( if "%%m" equ "httptransport" ( set ...