Posts

Showing posts from May, 2015

reporting services - Continuous designed reports in ssrs -

Image
in ssrs have built designed student card students information, calling report1. see folowing screenshot: now, want show whole group of student cards 1 after other. soi built report data set holds personids of 10 students. added tablix peronid col , in second col inserted subreport shows report1. personid col shows right information, subreport shows fixed students information no conection personid. see following image. how connect subreport person id of first col? or, right way show continuous forms? thanks make sure passing personid table data source parameter sub report. check doing this, right-click on sub report while in design mode, , go parameters. there, can see values being passed in. looks sub report using default (or first) personid based on can see.

matrix - Serialize iterator object to be passed between processes in Python -

i have python script calculates eigenvalues of matrices list, , insert these eigenvalues collection in same order original matrix , spawning multiple processes. here code: import time import collections import numpy np scipy import linalg la joblib import parallel, delayed def computeeigenv(unit_of_work): current_index = unit_of_work[0] current_matrix = unit_of_work[1] e_vals, e_vecs = la.eig(current_matrix) finished_unit = (current_index, lowev[::-1]) return finished_unit def run(work_list): pool = parallel( n_jobs = -1, verbose = 1, pre_dispatch = 'all') results = pool(delayed(computeeigenv)(unit_of_work) unit_of_work in work_list) return results if __name__ == '__main__': # create original array of matrices original_matrix_list = [] work_list = [] #basic set can run test in range(0, 100): # generate matrix & unit or work matrix = np.random.random_integers(0, 100, (500, 500)) #in

jquery + ajax replace class -

i trying replace button class ajax, wrong? my button: <input type="button" class="btn btn-default btn-sm addlike" name="{{ answer.pk }}" value="like" ></input> my js: $('.addlike').click(function(){ $.ajax({ type: "post", url: "{% url 'add_like' %}", data: {'answer_pk': $(this).attr('name'), 'csrfmiddlewaretoken': '{{ csrf_token }}'}, datatype: 'json', success: function(response){ alert(response.message); if ( $(this).hasclass('btn-default')) { $(this).removeclass('btn-default').addclass('btn-success'); } else if ($(this).hasclass('btn-success')) { $(this).removeclass('btn-success').addclass('btn-default'); } } }); }) message,

How to stop saving rtsp streaming video in android by using FFMPEG -

i saving rtsp stream using ffmpeg in android. when forcibly stop saving video video file corrupted. there command stop saving rtsp stream video. using ffmpeg library. here command use save streaming video- string path=environment.getexternalstoragedirectory().getabsolutepath(); simpledateformat sdf = new simpledateformat("ddmmyyyy-hhmmss"); string file_path = path + "/recording" + sdf.format(new date()) + ".mp4"; string[] cmd = {"-y", "-i", "rtsp://wowzaec2demo.streamlock.net/vod/mp4:bigbuckbunny_115k.mov", "-c:v", "libx264", "-preset", "ultrafast", "-strict", "-2", "-s", "720*1280", "-aspect", "16:9", file_path }; execffmpegbinary(cmd); you can not interrupt mp4 format directly should change format mkv. file path should this: string file_path = path + "/recording" + sdf.format(new date()) + "

c# - create Database with .net installshield 2015 -

i'm trying create installer file installs database using install shield 2015. i'm following link walkthrough: using custom action create database @ installation since link refers older install shield didn't managed make work. have created install file in main windows form application, can see in below code. public partial class deployinstaller : system.configuration.install.installer { system.data.sqlclient.sqlconnection masterconnection = new system.data.sqlclient.sqlconnection(); public deployinstaller() { initializecomponent(); } private string getsql(string name) { try { // gets current assembly. assembly asm = assembly.getexecutingassembly(); // resources named using qualified name. stream strm = asm.getmanifestresourcestream(asm.getname().name + "." + name); // reads contents of embedded file. streamreader reader = new stream

c# - StringFormat of Datetime object in binding gives back 0 for hour and minute -

i create datetime object datetime.now , have property of class. when bind grid view: <gridviewcolumn header="date" width="120" displaymemberbinding="{binding transaction_date1, stringformat=hh:mm}" /> the result 00:00. when debug code see hour, minute etc. properties of datetime object contain non-zero values. think stringformat in case gets hour , minute date object within datetime object has correct dates has 12:00:00 hour. is there way go past , display right hour , minute in window? thank in advance! change this: <gridviewcolumn header="date" width="120" displaymemberbinding="{binding transaction_date1, stringformat='{}{0:hh:mm}'}" /> if want use stringformat custom formatting, have use method provide param index in format string. equivalent to: string.format("{0:hh:mm}", transaction_date1); the 2 curly braces @ start {} instruction xaml parser ignore further

cordova - ionic calling phonegap website -

so, have app developed ionic, found loads fast when testing in us. have users china reported loads slow , stuck on splash page. @ first, thought server issue, after switched chinese server, behaves same. realized because of deviceready fired slow in china, suspecting when ionic/phonegap runs, connect phonegap website, slow in china. i have cordova.js in index.html <!-- cordova script (this 404 during development) --> <script src="lib/ngcordova/dist/ng-cordova.js"></script> <script src="cordova.js"></script> after run ionic build ios, has cordova.js under platforms/ios, doest not have cordova.js under root folder so, want understand how deviceready works, connect phonegap website? if so, how can disable it? should put cordova.js. thanks if don't explicitly specify internet address, cordova takes locally.

ios - NSCoding required initializer in inherited classes in Swift -

i have class foo conforms nsobject , nscoding want able persist nskeyedarchiver want create class bar, subclass of foo conform nsobject , nscoding . having problem understanding how create required convenience init?(coder adecoder: nscoder) in subclass. so class foo... class foo: nsobject, nscoding { let identifier:string init(identifier:string) { self.identifier = identifier } override var description:string { return "foo: \(identifier)" } func encodewithcoder(acoder: nscoder) { acoder.encodeobject(identifier, forkey: "identifier") } required convenience init?(coder adecoder: nscoder) { guard let identifier = adecoder.decodeobjectforkey("identifier") as? string else { return nil } self.init(identifier:identifier) } } then class bar ... class bar:foo { let tag:string init(identifier:string, tag:string) { self.tag = tag super.init(identifier: identifier) } override

javascript - Return array of string paths to every deep property within an object -

this question has answer here: fastest way flatten / un-flatten nested json objects 10 answers i have ugly 1mb+ json object numerous deep properties including nested arrays containing nested objects etc. i'm looking function can return array of string "paths" every property in given object. ['obj.propa.first', 'obj.propa.second', 'obj.propb'] all of searching far has turned solutions going other direction. eg: taking path strings , fetching property values. my gut says there has better way reinventing wheel. thanks in advance! example behavior: var ugly = { a: 'a', b: ['b1', 'b2'], c: { c1: 'c1', c2: ['c2a', 'c2b'], c3: { c3a: 'c3a', c3b: [['c3b']], }, c4: [{c4a: 'c4a'}], } }; getpaths = function(obj) {

hibernate - GWT requestfactory validate entities on external server -

im usign gwt 2.7.0 request factory. edit: im not using client side validations, server side validations (hibernate annotations) the entity im trying edit called "article.java". in normal scenario, edit article on client side articleeditor (extends editor). when article reaches server, validations excecuted. if validation goes wrong, client side receive "set < constraintviolation < ? > > oerrors " can use in editorframework show errors on form. in particular case have 2 servers : a = 1 using gwt edit valueproxy (pojos) (does not persist entity). b = other has access database (hibernate), accesed via stateless ejb. i made copy of article(do not contain hibernate annotation, simple pojo) called "persistentarticle.java" (contains hibernate annotation logic). bothe classes have same attributes , methods. after article edited, reaches server side a, send object via ejb message server b. in b create instance of persistentarticle arti

c# - SOAP Service missing sent 'parameters' -

php: $client = new soapclient($wsdl); $arrayofstring = array(0 => "first", 1 => "second"); $header = new soapheader($wsdl, 'authenticationheader', $authentication); $client->__setsoapheaders($header); $values = $client->getinfo(array($arrayofstring)); print_r($values); that's invokes in c# [webmethod(enablesession = true)] [soapheader("serviceauthenticationheader")] public inforesponse getinfo(list<string> text) { } after invoke method - parameter ( list<string> text ) null . ideas, because day watched, tested every methods internet, not effect!? thank you!

php - Concrete5 5.6.x - Setting Attribute Type Associations programmatically in a package controller -

Image
i'm setting package concrete5 5.6.x adds bunch of user attributes on install. 1 of them uses image/file attribute comes concrete5. when install concrete5 not add image/file attribute type user attributes default (see screenshot below). when package goes add new attribute won't install because it's not available there. doesn't error out, nothing. in dashboard can go in , check boxes make available: it's not realistic tell people first before installing package. there must way programmatically can't find in forums or anywhere. here's code controller function now: private function addusersattr($pkg){ loader::model('user_attributes'); $img_att = attributetype::getbyhandle('image_file'); // set user $user_att_coll = attributekeycategory::getbyhandle('user'); if (!$user_att_coll->allowattributesets()) { $user_att_coll->setallowattributesets(attributekeycategory::aset_allow_single); } //

REST API Accept header json/pdf -

i'm working api, think doing wrong implementation of rest api. we have following endpoints get v1/{organizationid}/invoices get v1/{organizationid}/invoices/{guid} when first, invoices, if second endpoint, without accept: application/json header, response first endpoint instead. the company, provides api, says reason because second endpoint can give both json , pdf output, seem pdf be get v1/{organizationid}/invoices/{guid}/pdf besides that, if send malformed guid , full blown html 404 error page instead of, e.g., blank page or error message. to sum up is 2. endpoint handled properly? is valid make pdf output json/xml? shouldn't new endpoint instead? is html allowed error response, malformed request? some people don't categorize rest-based questions "right" , "wrong", go ahead anyway: no, second resource should return representation of second resource, is, invoice, never collection of invoices. yes, ok potentiall

database - Extend ASP Identity Role to add group(company) -

how can extend asp identity 2.2 roles, to support isolated roles in own groups , such company1, company2 etc. i trying scope , limit roles company, such each company can administer own roles , have named roles - under company purview only. i looked around , not find simpleway extend roles in samples, while shows how extend user profiles easily, fails on roles side of house!

java - Count number of word in string which is having html tags -

consider following string has html tag "<p>article</p> <p>article</p> <p>article</p> <p>&nbsp</p>"; now want count number of word contained in above mentioned string it produce worong output instead of 3 word count displays 4 word count it consider <p>&nbsp</p> word wrong please correct following program string str = "<p>article</p> <p>article</p> <p>article</p> <p>&nbsp</p>"; org.jsoup.nodes.document dom = jsoup.parse(str); string str2 = dom.text(); system.out.println(str2.split(" ").length); what changes should made correct output? thanks in advance. as benjamin mentioned in comment, after &nbsp, should add semicolon ( ). if not add it, cannot parse based on instructions because thought "one element", not want.

battery use high android -

i have developed android application continuously sync server after 10 seconds interval of time. fine consumes high battery. i have not implemented such many features: - location update - 2 or 3 threads - 1 service but not understanding how can optimize battery usage , decrease usage. performance matters pretty keeping phone alive @ 100% time. start syncing in 5 mins or more or implement gcm

mapping - How to read in only a subset of polygons from a shapefile in matlab -

i trying read in subset of polygons shapefile have. using 'shaperead' read in shapefile, can't seem pull out polygons want. know should using 'selector' pair value arguments, exampl online doesn't make sense me: s = shaperead('concord_roads.shp','selector',... {@(v1,v2) (v1 >= 4) && (v2 >= 200),'class','length'}) there 'station number' attribute in shapefile identifies each of polygons. want able specify polygons map (based on previous clustering analysis). wanted_stations = [...]; % defined [s,c] = shaperead(filename,'selector',{@(v1) any(ismember(wanted_stations,v1)) ,'station_number'}); % assuming attribute name 'station_number' basically, each polygon, shaperead assigns value of attribute 'station_number' v1, evaluates anonymous function. values of wanted_stations vector incorporated function defined.

javascript - File is not a valid web archive error on downloading html as .doc -

i using jquery.wordexport.js , filesaver.js convert , export part of page word document. downloaded document gives "file not valid web archive" on office 2011 on mac. ideas issue might here? it simple function , far can tell, no edits needed make plugin work. $("#dat_save_download").click(function (event) { $(".doc-margins").wordexport(); }) fiddle link

android - How do I access the main thread after a background thread completes in RxJava? -

i have observable io processing on background thread: progressbar.setvisibility(view.visible); observable.create(new onsubscribe<file>() { @override public void call(subscriber<? super file> subscriber) { inputstream inputstream = null; fileoutputstream outputstream = null; try { if (environment.getexternalstoragestate().equals(environment.media_mounted)){ url url = new url(downloadurl); urlconnection conn = url.openconnection(); inputstream = conn.getinputstream(); file savedir = environment.getexternalstoragepublicdirectory(environment.directory_downloads); file downloadedfile = new file(savedir, filename); outputstream = new fileoutputstream(downloadedfile); byte[] buffer = new byte[4096]; int bytesread = -1; while ((bytesread

python - How Do I Keep Total Time with Multiple Duplicate Entries? -

i attach code, importing csv file start times/end times picking cases of particular item. cases go "cart", identified id number. want find total time pick cases. format of time hh:mm:ss and, initially, using datetime module not figure out documentation, ended converting times seconds, subtracting end/start each case, , adding duration total time. in end, converted total time hours. had number of cases picked total, , divided total time in hrs cases picked per hr. correct logic? got number very, low: 7.99 cases/hr, leads me believe timing/duration code incorrect (already checked quantity correct). #instantiate totaltime 0 totaltime = 0 #every line/row in file; assume opened above line in lines: #if there different case pick, find start time if taskid != entrylist[0]: #this doesnt duplicate times timestart = entrylist[7] colonstartindex = timestart.find(":") hourstart = int(timestart[0:colonstartindex]) minutestart = in

java - How i can change tag name in spring batch xml -

i have spring batch project create xml file, return this: <units> <pojo.unitgen> <event>z_receiving_result</event> <type>receipt</type> <internaldeviceid>6</internaldeviceid> <imei>990000223446789</imei> </pojo.unitgen> <pojo.unitgen> <event>z_receiving_result</event> <type>receipt</type> <internaldeviceid>2</internaldeviceid> <imei>992000123456789</imei> </pojo.unitgen> </units> how can change tag 'pojo.unitgen' 'unit' this itemwriter: <!-- write extracted receiving data xml file --> <bean id="iwreceiving" class="org.springframework.batch.item.xml.staxeventitemwriter" scope="step"> <property name="resource" value="file:${report.pathtosave}${report.fil

xml - Android crashing nothing in logcat -

https://github.com/benireydman/slide_menu-slide_menu if see if can crash logs help. i tested out , keeps crashing when run function. i have removed function , ran app can certainty cause of it. put function involved in, left out detail unimportant. public void function(){ if(this >= that1){ button1.setenabled(false); } else { button1.setenabled(true); } if(this >= that2){ button2.setenabled(false); } else { button2.setenabled(true); } if(this >= that3){ button3.setenabled(false); } else { button3.setenabled(true); } if(this >= that4){ button4.setenabled(false); } else { button4.setenabled(true); } } <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/buttongray"></item> <item android:drawable="@drawable/buttonclick" android:state_pressed=&quo

opengl es - How to capture android camera to 2 screen views and stream over wifi direct in realtime? -

i building android app need capture camera preview , display on 2 views on display (one view flipped , rotated in picture example dual view ). in addition need stream captured video preview on direct wifi device. these 3 activities need happen in real time , there great importance video latency should small android platform capable on every device (on samsung a8, max frame rate fullhd capture 30fps, 4 buffers android uses in camera-to-screen pipeline, latency between source image , display around 120ms fine device). i tried using normal textureview camera , camera2 api did not find way display 2 different instances of camera preview. i tried using opengl lets me display 2 instances of view don't know how capture byte stream sending on wifi. implemented direct wifi link, not sure how produce streaming source opengl. my question android technologies can achieve these multiple requirements @ once? gary

Error in loop with python -

i have list lst = [1, 2, 3, 4, 5, 6, 3, 5, 3] , every iteration, elem == 3 want print strings before that, while elem not 3 again. want 2 3: 0 1 1 2 6 3: 3 4 4 5 5 6 8 3: 7 5 but don't know, how go previous string for i, el in enumerate(lst): if lst[i] == 3: print i, el -= 1 but it's inly elem-1 something this? lst = [1, 2, 3, 4, 5, 6, 3, 5, 3] previous = [] i, el in enumerate(lst): if lst[i] == 3: print i, el,":" p in previous: print p[0] , p[1] previous = [] else: previous.append((i,el))

android - Best Collection for managing producer-consumer byte array -

i'm using bytebuffer producer offers array of bytes store. have thread looks through bytebuffer searching byte sequence (a start code) determine if have complete message or not. if find complete message, extract byte array , fire event various listeners. way producer sends me data, in chunks. i have lot of gyrations make bytebuffer thread safe , doesn't seem elegant @ all. is there better way this? i suggest priorityblockingqueue . java.util.concurrent package meaning, can safely accessed different threads. fifo implementation. put bytes inside collection , wait them in different thread.

How to serialize JSON object array with 2 or more items in vb.net -

i'm having trouble creating json object dimensional array. see code i'm using, , if can, please me output string json object: { "title":"the title", "subtitle":"some subtitle here", "category_id":"your category", "price":10, "currency_id":"real", "available_quantity":1, "buying_mode":"buy_it_now", "listing_type_id":"bronze", "condition":"new", "description": "description", "video_id": "youtube_id_here", "warranty": "12 months", "pictures":[ {"source":"http://www.yourimage/1.jpg"}, {"source":"http://www.yourimage/2.jpg"}, {"source":"http://www.yourimage/3.jpg"} ] }

sql server - SQL select from table where quantity is not negative -

how do select * salesorder quantity positive number? (i want exclude orders negative order quantities...) how about select * salesorder quantity >= 0

indexing - Choosing element from array in VHDL -

i have component receives array: library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.index_pkg.all; entity update_reg port ( index : in integer; number_data : in array_integer(9 downto 0); output_number : out integer; ); end update_reg; architecture behavior of update_reg begin process1 : process(index, number_data) begin output_number <= number_data(index); end process; end architecture; the purpose have @ component's output array's element specified index. built following tb test behaviour: library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.index_pkg.all; entity tb_update_reg end tb_update_reg; architecture rtl of tb_update_reg component update_reg port ( index : in integer; number_data : in array_integer(9 downto 0); output_number : out integer ); end component; signal tb_index : integer; signal tb_number_data : array_integer(9 downt

amazon web services - How to make 'aws ecr get-login' across regions? -

i have docker registry in aws ecr in region 'us-east-1'. works fine on ec2 instances launched in 'us-east-1'. when launch instance in 'eu-central-1' , try run $(aws ecr get-login --region us-east-1) i following response error response daemon: https://acc-id.dkr.ecr.us-east-1.amazonaws.com/v2/ : net/http: request canceled (client.timeout exceeded while awaiting headers) if run aws ecr get-login --region us-east-1 i see following response docker login -u aws -p xxxx -e none https://acc_id.dkr.ecr.us-east-1.amazonaws.com ec2 instance has following policy iam-role: "effect": "allow", "action": [ "ecr:getauthorizationtoken", "ecr:batchchecklayeravailability", "ecr:getdownloadurlforlayer", "ecr:getrepositorypolicy", "ecr:describerepositories",

swift - How can Upside Down orientation be continually detected on an iPhone in viewWillTransitionToSize:coordinator: on iOS 9? -

i’m handling rotation changes in viewwilltransitiontosize:coordinator: on iphone ios 9.1 , i’m able detect upside down orientation if device turned upside down, right side up, after starting app first time. further rotations upside down not result in further detections of upside down orientation. i’m using following code in view controller: override func viewwilltransitiontosize(size: cgsize, withtransitioncoordinator coordinator: uiviewcontrollertransitioncoordinator) { super.viewwilltransitiontosize(size, withtransitioncoordinator: coordinator) i have orientations checked off in general tab of xcode project. i followed suggestion in accepted answer rotation behaving differently on ios6 , implemented own custom navigation controller. class mynavigationcontroller: uinavigationcontroller { override func shouldautorotate() -> bool { return true } override func supportedinterfaceorientations() -> u

mysql - Performance implications of allowing alias to be used in HAVING clause -

i made bit of fool out of myself earlier today on this question . question using sql server, , correct answer involved adding having clause. initial mistake made think alias in select statement used in having clause, not allowed in sql server. made error because assumed sql server had same rules mysql, allow alias used in having clause. this got me curious, , poked around on stack overflow , elsewhere, finding bunch of material explaining why these rules enforced on 2 respective rdbms. did find explanation of performance implications of allowing/disallowing alias in having clause. to give concrete example, duplicate query occurred in above-mentioned question: select students.camid, campus.camname, count(students.stuid) studentcount students join campus on campus.camid = students.camid group students.camid, campus.camname having count(students.stuid) > 3 order studentcount what performance implications of using alias in having clause instead of re specifyi

Plotting multiple lines from columns of Dataframe (python/pandas)? -

i have large (~1 million) data set looks this... age wavelength luminosity 1 96 100 1 97 150 1 98 100 2 96.5 90 2 97 160 2 97.5 120 ... i have in dataframe , want plot wavelength vs luminosity age groups. how plots each age on 1 graph? you can use pandas.core.groupby.dataframegroupby.plot in[1]: import pandas pd in[2]: import numpy np in[3]: dataset = pd.dataframe({"age": np.random.random_integers(1, 5, 100), "wavelength": np.random.uniform(90, 100, 100), "luminosity": np.random.random_integers(5, 15, 100) * 10}) in[4]: dataset.groupby("age").plot(x="wavelength", y="luminosity", kind="scatter") out[4]: age 1 axes(0.125,0.1;0.775x0.8) 2 axes(0.125,0.1;0.775x0.8) 3 axes(0.125,0.1;0.775x0.8) 4 axes(0.125,0.1;0.775x0.8) 5 axes(0.125,0.1;0.775x0.8) dtype: object

c# - Azure Notification Hub: Schedule Mobile App API -

Image
i have xamarin.forms app azure mobile app api (.net) , trying implement push notification feature. basically we're going generate transactions using scheduled jobs during day, , notify respective users if transaction belongs them. how can create job execute api trigger notification in azure? saw azure article , not sure put code , publish azure. or create console application , create webjob in azure @randeepsingh, there 2 ways scheduling job using webjobs or using azure scheduler. for using webjobs, can create & deploy console app notification api webjob, , set trigger webjob. as reference, there article listed helpful document resources. you can follow figure below add webjob mobile app. for using azure scheduler, can create web api in mobile app scheduled job calling via scheduler. can refer tutorial know how use azure scheduler.

javascript - Detect mouse is near circle edge -

i have function gets mouse position in world space, checks see if mouse on or near circle's line. the added complication how ever circle transformed @ angle it's more of ellipse. can't see code detect mouse near border of circle , unsure going wrong. this code: function check(evt){ var x = (evt.offsetx - element.width/2) + camera.x; // world space var y = (evt.offsety - element.height/2) + camera.y; // world space var threshold = 20/scale; //margin edge of circle for(var = 0; < obj.length;i++){ // var mainangle related transform var x1 = math.pow((x - obj[i].originx), 2) / math.pow((obj[i].radius + threshold) * 1,2); var y1 = math.pow((y - obj[i].originy),2) / math.pow((obj[i].radius + threshold) * mainangle,2); var x0 = math.pow((x - obj[i].originx),2) / math.pow((obj[i].radius - threshold) * 1, 2); var y0 = math.pow((y - obj[i].originy),2) / math.pow((obj[i].radius - threshold) * mainangle, 2);

Java Swing - How can I make next and previous buttons to display variables of objects in an array? -

everyone. i've made array of custom class "human" create "city." each human has randomly generated name , age. want use next , previous buttons scroll through each human , view information. how go doing this? here source code: jamiescity.java: package jamiescity; import javax.swing.*; import net.miginfocom.swing.miglayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; public class jamiescity { public static void main(string[] args) { jamiescity j = new jamiescity(); j.createmaingui(); } city newcity; public void createmaingui(){ jframe startgui; startgui = new jframe(); startgui.setsize(485, 85); startgui.setlocationrelativeto(null); startgui.settitle("jamie's city"); startgui.setlayout(null); startgui.setdefaultcloseoperation(jframe.exit_on_close); startgui.setresizable(false); jbutton create;

Cannot use javascript function after script loaded using jQuery -

i'm trying programmatically load local javascript file - papaparse library , , use 1 of functions: $.getscript("./content/scripts/papaparse.js", function () { console.log("papaparse loaded successfully"); papa.parse(file, { skipemptylines: true, header: false, complete: completecallback }); }); the script loaded successfully, calling parse method throws error: referenceerror: papa not defined within papaparse library, papa defined follows: (function (global) { "use strict"; var papa = {}; papa.parse = somefunction; . . global.papa = papa; } if helps, entire code called typescript file. doing wrong? as castro pointed out in answer here according offical documentation of jquery's getscript the callback of getscript method fired once script has been loaded not executed. that means when getscript 's callback function called target script being loaded in current page context

python - How to set a time limit to a task if not excute within a certain time then just remove it in celery -

i'm using celery(rabbitmq broker) many tasks every minute.since task little time-consuming, tasks in queue may accumulate leads newest come task not excute in time. how can deal it? i think find in document: expiration add.apply_async(args=[10, 10], expires=60) task expires @task(expires=50)

casting - Swift compiler error contradicts warning when declaring lazy property -

var rawdata: nsdictionary! lazy var nativedata: nativedata? = { return nativedata(jsondictionary: self.rawdata [nsobject : anyobject]) }() results in error: 'nsdictionary!' not convertible '[nsobject : anyobject]'; did mean use 'as!' force downcast? ok then... lazy var nativedata: nativedata? = { return nativedata(jsondictionary: self.rawdata as! [nsobject : anyobject]) }() which gives warning: forced cast 'nsdictionary!' '[nsobject : anyobject]' succeeds; did mean use 'as'? interestingly if remove lazy , declare nativedata regular optional, can as cast fine: obj.nativedata = nativedata(jsondictionary: obj.rawdata [nsobject : anyobject]) is bug in compiler? (xcode 7.3 (7d175)) update it gets stranger. here's contained case. // // a.swift // import foundation class nativedata { init(jsondictionary: [nsobject : anyobject]) { } } func == (lhs: a, rhs: a) -> bool { retur