Posts

Showing posts from January, 2012

javascript - Angular $templatecache name conflicts -

we have single page application structure multiple html templates. multiple developers pushing own submodules app , during bundling process (webpack) pushing these templates $templatecache. inevitably of apps partials happen have same names (dashboard, nav, section etc) , angular overwriting templates. is there way avoid name conflicts during angular template caching process? or there gulp-grunt etc plugin create unique template names , match-replace them in htmls? well, try out longer names won't conflict... dashboard, nav, section generic , conflict try: dashboard-for-admin-page, nav-for-submodule-alpha-0, section-right-of-main-page, etc the way team have folder structure each module complex names example: /partials ----/global-partials --------/header-global.html --------/footer-global.html ----/main-page --------/index-for-main-page.html --------/partial-header-on-main-page.html --------/left-pane-on-main-page.html ----/about-us-page ----/cart-page

javascript - Creating a CSV file from a Meteor.js Collection -

i've written code far , can list of records show on webpage, need able csv (comma separated values) file. right page shows list follows: name address description bob 1 street journalist bill 2 street fireman etc... anyway can have meteor create csv file download, instead of showing webpage html markup? based on how serve file using iron router or meteor itself? html: <template name="blah"> <a href="{{pathfor 'csv'}}">download csv</a> </template> js: // example collection var dummydata = new mongo.collection("dummydata"); // create sample data if (meteor.isserver) { meteor.startup(function() { var dummydatacursor = dummydata.find(); if (dummydatacursor.count() === 0) { for(var i=1; i<=100; i++) { dummydata.insert({name: "name" + i,address: "address" + i, description:"description" + i}); } } }); }

OpenXava Impossible to execute Add files action Member not found in model -

i'm experimenting openxava files stereotype , embedded class , finding strange error. first of all, if create record , attach bunch of files before saving first time, works. if i, however, first create record (temple), leave in embedded record (library) blank, save (saves successfully, says), go edit it, following message: "impossible execute add files action: member library.documents not found in model temple" i have not been able find useful via google on this. is i'm doing wrong or error in openxava library. i'm using: openxava version 5.1.1 tomcat comes it: apache tomcat version 7.0.50 oracle 11g here's temple , inner library class: package org.openxava.zen.model; import javax.persistence.*; import org.openxava.annotations.*; @entity public class temple { @id @column(length=3) @generatedvalue @readonly private int id; @version private integer version; @column(length=50) private string name; @stereotype(&quo

Google Cloud Print from Web -

i wrote script prints test pages url on web-site, , every time press print button, dialog frame choosing printer appears . want avoid because account synchronized printer. window.onload = function() { var gadget = new cloudprint.gadget(); gadget.setprintbutton( cloudprint.gadget.createdefaultprintbutton("print_button_container")); // div id contain button gadget.setprintdocument("url", "test page", "https://www.google.com/landing/cloudprint/testpage.pdf"); } you use oath , html button rather gadget accomplish this. requires using google developer console oauth permissions. then need authorize cloud print service. the following set of functions use in google apps scripts, can adapted. first thing log url link can go in order authorize cloud print service. function showurl() { var cpservice = getcloudprintservice(); if (!cpservice.hasaccess()) { logger.log(cpservice.getauthorizationurl()); } } in foll

java - Why can't I add an object to a HashSet -

i trying populate hashset in constructor penny objects i'm not sure how this. have written keep getting error messages. public pocket(int numofpennies){ hashset penniesset = new hashset<penny>(); while( penniesset.size() <= numofpennies){ penniesset.add(penny); } you're not adding object set rather trying add type, , won't work or compile. instead of penniesset.add(penny); try // assuming penny has default constructor penniesset.add(new penny()); also, add collection using loop, not while loop, since know prior starting loop how many times want loop. are sure want use hashset hold pennies? hashsets used when want have no duplicates in collection, wouldn't 1 penny equivalent another? in other words, shouldn't true: pennya.equals(pennyb) . of course depend on how define equals(...) , hashcode() penny class. would different collection such arraylist more logical?

javascript - Getting data from Google Chrome Webview to Caller/Parent window -

i'm working on chrome kiosk application (so packaged app limitations apply) that's web browser deployed chrome devices. i'm looking support screenshots, , i'm using html2canvas this, need store them uploaded later on. i'm calling html2canvas using webview.executescript{file:} callback. in callback i'm executing actual html2canvas call webview.executescript({ file: "kiosk/html2canvas.js" }, handlehtml2canvasinjected); function handlehtml2canvasinjected(event) { var webview = document.queryselector('webview'); webview.executescript({code: "html2canvas(document.body).then(function(canvas){ //whatever });"}); } i can append canvas object body , see screenshot working. however, need returned caller. i've tried use localstorage, seems webviews storage , caller's storage 2 different things. it boils down fact need able communicate "stuff" between webview , window created webview. loa

google apps script - GmailApp.search doesn't filter the labels -

i try send attachments google drive account have problem search of gmailapp.search. i have camera in home sends email every 5 minutes same subject , each message has attached file that's name day-time.jpg first think in search label , of process, put new label mark , don't repeat message, receive message. i tried test many ways , received message has label:processed. function () { //all message of camera have label googledrive var threads = gmailapp.search("has:attachment -label:processed label:googledrive", 0, 5); var folder = getfolder(drivefolder); (var x=0; x<threads.length; x++) { var message = threads[x].getmessages(); for(var y=0; y<message.length; y++) { var desc = message[y].getsubject() + " #" + message[y].getid(); var att = message[y].getattachments(); (var z=0; z<att.length; z++) { try { if (check) { var name = att[z].getname(); i

datagrid - Javascript data grid with auto adjusting row height -

i javascript ui library can create data grid supports variable row height. i.e. each row can have different row height automatically adapts fit content, , lets text wrap next line. i have seen people looking feature in many free libraries(e.g. slickgrid ), took me quite while find viable alternatives. prefer ones free commercial use, consider paid products. i looked in detail, , found following results: of alternatives, have found 1 free commercial use - [dojox datagrid][1], not clear how use custom editors (most commercial ones offer this). there quite few viable alternatives require payment commercial use: dhtmlxgrid, jquery easyui datagrid, jqwidgets, wijmo grid widget, jidetable, , sencha extjs grids. of these, best dhtmlxgrid http://dhtmlx.com/docs/products/dhtmlxgrid/ - free version gpl, pro version $199. more detailed notes below: dhtmlxgrid supports wrapping, rich text, many data sources, event handlers, custom editors. looks has solid documentation ,

c# - Calculating NDVI index from Tiff images? -

i have problem ndvi calculating. use libtiff.net , i'd calculate ndvi 2 tiff images. i read many documents (for example: http://en.wikipedia.org/wiki/normalized_difference_vegetation_index ). i need spectral reflectance measurement property ndvi. unfortunately can't these property tiff tag's.. spectral reflectance measurement tag? how can calculate ndvi bitmiracle libtiff?

javascript - Set the combobox default value before binding -

how set selected value of kendo combobox if upon initializing , before databound. tried attach in databound event model set undefined or null after databound. code @ databound // set defaul value here $scope.$on("kendorendered", function (event, widget) { $scope.gender = 2; }); databound: function () { console.log($scope.gender); // $scope.gender empty this.value(2); // 2 here female } there fiddle testing click here thanks in advance

Grails Spring Security integration with WebSphere Global Security -

i developed grails application uses spring ldap , spring security authentication using ldap. working great. trying make work websphere 8.5 application global security settings. i have configured websphere global security ldap information , test connection , login works ldap users. want integrate same grails. i tried few options it's not going anywhere , did not find information online.

javascript - Adding Veritcal Scrollbar to Horizontally aligned parent panel -

a panel horizontal alignment containing 2 child panels. height of 1 of them changes dynamically. want add vertical scrollbar on parent panel when child panel overflows. if using default layout parent panel vertical. working. in case of horizontal alignment, not. can please help? using gwt.

css - All bootstrap breakpoints deprecated? -

looking @ variables.less (and googling around), looks of bootstrap's breakpoint less variables deprecated. correct? know should using instead if want assign styles based on bootstrap's screen-size breakpoints? using bootstrap v3.1.1 less. thanks. //== media queries breakpoints // //## define breakpoints @ layout change, adapting different screen sizes. // small screen / phone //** deprecated `@screen-xs` of v3.0.1 @screen-xs: 480px; //** deprecated `@screen-xs-min` of v3.2.0 @screen-xs-min: @screen-xs; //** deprecated `@screen-phone` of v3.0.1 @screen-phone: @screen-xs-min; // small screen / tablet //** deprecated `@screen-sm` of v3.0.1 @screen-sm: 768px; @screen-sm-min: @screen-sm; //** deprecated `@screen-tablet` of v3.0.1 @screen-tablet: @screen-sm-min; // medium screen / desktop //** deprecated `@screen-md` of v3.0.1 @screen-md: 992px; @screen-md-min:

xmpp - Sending a message to Google Talk/Chat Hangouts from GAE -

although google document describes simple way gae app send message talk/chat user, apparently feature has been discontinued. there method gae app send message talk/chat user? as aside: sms'es real phones sent google voice number, each sms received received email in gmail account. , sender of email 18888888888.19999999999.somegibberishchars-@txt.voice.gmail.com , 1888... gv number , 1999... sender of sms. can reply sms sender sending mail email address. email address not expire, ie can still send sms'es using months later. is there similar way deliver messages talk/chat sending specially formatted email address?

html - JavaScript onChange Event to use current row values only -

Image
an extension of previous calculators, time @ onchange or addeventlistener functions run code without using submit buttons. i having hard time trying figure out how can have event fire once either 'h' or 'extra room factor' fields have been changed. want row being edited / changed fire event, not entire table. trying figure out how can 'find' row / cell calling function , use in script other values required. the script uses json data determines how table set out. the code should values l, w , h , multiply them together. should multiply room factor , write result 'total room m3' field. (no rep post images) uh, have code in fiddle current code relies on json details. can't post fiddle link due low rep! jsfiddle fiddle link json file thanks! function init() { var url = "http://localhost/javascript/comcool/working/data.json"; var request = new xmlhttprequest(); request.open("get", url); request.send(n

c# - Calculating a percentage from an observableArray with Knockout -

i have nested observablearray of tasks, grouped categories, , i'm trying calculate completion percentage. right now, think computed value way go, i'm trying use per code below. @ point i'm trying return observed field, , display in view. the problem is, i'm not getting values returned. approaching wrong way? @model dto <div data-bind="with: tasksbycategory"> <div class="summarygroup" data-bind="template: {name: 'categorytemplate', foreach: tasksbycategory}"></div> </div> @section scripts{ <script src="~/scripts/viewmodel/details.js"></script> <script src="~/scripts/moment.js"></script> <script src="~/scripts/bindings/date.js"></script> <script type="text/html" id="categorytemplate"> <h3 data-bind="text: category_name, click:$parents[$parents.length - 1].showhide"&

c++11 - vector adds CSV column data into vector rows while transfering CSV file's data into c++ vector -

i trying add csv file 2d array vector i.e: vector of vector. following program works there small problem, for example add following csv data: 1.4,23.44,24.4,3.0 2.3,4.3,44.5,6.6 3.4,33.2,5.4,3.65 i have used following code: void table::addtabledata(string filename) vector<vector<float> > vec; ifstream file(filename.c_str()); bool first = false; if (file) { string line; while (getline(file,line)) //reading data line line { istringstream split(line); float value; int col = 0; char sep; while (split >> value) // { if(!first) { // each new value read on line 1 should create new inner vector vec.push_back(std::vector<float>()); }

c# - Error when inserting multiple json string -

this code work can can insert 1 json string sql db. if json string multiple insert 1 json string, error usp_insert_schedule has many arguments specified. can give me links of tutorial or guide me @ least. using newtonsoft.json; //object root public class jobt { public string empid { get; set; } public string status { get; set; } } private void insrt_jstring() { iscedule isc = new iscedule(); //sql stored proc string query = isql.stored_procedure_sch_add; //sql class insert iemp usr = new iemp(query); string barc = txtbarcode.text.trim(' '); string ddate = isc.get_date(); //http://get w/ barc & ddate param string input = isc.jvalue(barc, ddate); string input = @"{""empid"":""b14"",""status""}{""empid"":""b15"",""status"":""morning""}"; var output = input.

javascript - getElementsByClassName get single element -

i need add eventlistener function on every div class, tried this: var = document.getelementsbyclassname('linkto'); (var = 0; i<a.length;i++) { a[i].addeventlistener('click',function(){ console.log(a); }); } but gives me divs. divs generated in foreach loop: @foreach($faqs['my_stay'] $faqheading) <div class="row lowboarder linkcolor-darkblue linkto"> {{ link_to('#div'.$faqheading->id,$faqheading->heading) }} </div> @endforeach is there way determine div clicked on? try below, "this" inside click function refer clicked div for (var = 0; i<a.length;i++) { a[i].addeventlistener('click',function(){ console.log(this.innertext); }); }

java - How to append StringBuilder to textarea while replacing the previous string builder that was there? -

so string.append , string2.append stringbuilder objects made load words text file faster, problem when switch radio button occurrence , alphabetical adds text area instead of replacing previous list. ideas on how fix this? for(superstring word : ss) { count++; string.append(integer.tostring(count)+ " "+ word+ "\n"); string.tostring(); } if(occurrence.isselected()) { textarea.settext(""); textarea.append(" "+filename+" has wordcount: "+words.size()+ "\n-------------------------\n\n"); textarea.append(string.tostring()); } for(superstring word : ss2) { count2++; string2.append(integer.tostring(count2)+ " "+ word.tostring()+ "\n"); } if(alphabetical.isselected()) { textarea.settext(""); textarea.append(string2.tostring()); } you may looking replacerange() , "simply delete if new string null or empty." can insert() new text @

sql - Join error: #1052 - Column 'TaskID' in field list is ambiguous -

trying join these 3 tables getting #1052 - column 'taskid' in field list ambiguous. please help select p.projectcolor,timecardid,username,taskname,taskid,max (punch), totalhours,running,lastupdate t_timecard e, t_task a, t_project p e.taskid = a.taskid , p.projectid = a.projectid group punch order punch desc; learn use explicit join syntax. problem caused because column same in both tables. yes, = suggests have same values, have explicit: select p.projectcolor, timecardid, username, taskname, a.taskid, max(punch), totalhours, running, lastupdate t_timecard e join t_task on e.taskid = a.taskid join t_project p on p.projectid = a.projectid group p.projectcolor, timecardid, username, taskname, a.taskid, totalhours, running, lastupdate order max(punch) desc; your group by should mention columns not in aggregation columns. by way, doubt query want. should ask question sample data , desired results, if case. don't edi

mysql - The process order of SQL order by, group by, distinct and aggregation function? -

query like: select distinct max(age), area t_user group area order area; so, process order of order by, group by, distinct , aggregation function ? maybe different order same result, cause different performance. want merge multi-result, got sql, , parsed.so want know order of standard sql dose. this bigger group by/aggregation/order by. want have sense of how query engine creates result set. @ high level, means creating execution plan, retrieving data table query's working set, manipulating data match requested result set, , returning result set caller. simple queries, or queries matched table design (or table schemas well-designed queries you'll need run), can mean streaming data table or index directly caller. more often, means thinking @ more detailed level, follow these steps: look @ query determine tables needed. look @ joins , subqueries, determine of table depend on other tables. look @ conditions on joins , in clause, in conjunction indexes, dete

css - class+element over-riding class+class -

ok have following code: <div class="something"> <div class="something-else"> <h2>heading</h2> <p>some text</p> </div> </div> when try style it, css rule in style sheet won't let me so. other style sheet has like: .something h2 { color:green; } i'm trying override with: .something .something-else { color:red; } is first rule more specific? because thought 2 classes win in situation. 2 classes + h2 work you have select h2 in case

javascript - How to test a MySQL syntax using Math.js parser -

i allow user specify mysql calculated field in web form field might read like: (bldgfuelcostelectricity * assetmotorsize) * if(bldgfield1>bldgfield2,bldgfield1-bldgfield2,0) * 24 at run time substitute other table columns camelcase parameters, before let user save expression part of report template, test function validity using math.js doesn't if() construct. math.js allow function name overrides, cannot make work particular case of if because that's reserved word. how can test mysql function valid using math.js when mysql has functions have javascript equivalents? you need careful testing mysql syntax parser of math.js, syntaxes differ. have define syntax support , explicitely test this. what can math.js parse expressions expression tree , anaylise them. traversing on tree, can validate syntax. example: var node = math.parse('3 * x + 2'); node.traverse(function (node, path, parent) { switch (node.type) { case 'operatornode': cons

google chrome - HTML mailto subject and body display plus sign(+) instead of space in mail client -

it's happening in - samsung galaxy note3 & 4 - google chrome browser v39.xx i using link , when click it's launch mail client href="mailto:info@gmail.com?subject=network%20issue" result: subject=network+issue how remove plus(+) sign? your original approach should work... reason comes mind behind not working perhaps encodings being mixed along way? take @ these threads better idea of mean: mailto special characters special characters in utf8 mailto: subject= link , outlook i experimented base64 approach answer in second link unable remedy issue :-\ tested on gmail, inbox, , mailbox - same results describing above. maybe getting messed @ android layer in terms of how link being handed off mail client of choice?

java - how to get parameter values of json array in servlet that is sent from ajax -

i want send html table data using ajax servlet can save mysql database, therefore question is, prepared html data array , sent servlet ok, problem while in servlet how can each value save database. code. <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> script type="text/javascript"> $(document).ready(function () { //launch code after whole dom loaded $("form").submit(function (event) { // function process submitted table var a={}; var tabledata = []; // store rows' data array $("#admintable") // select table id .find(".tablerow") // select rows class .has(":checked") // select rows checked checkboxes .each(function () { // each selected row extract data var tablerow = {}; var jrow = $(this);

java - need elaborate info on IBM DB2 error tokens while getting DataAccessException via hibernate -

i using ibm db2 , hibernate in java application. whwnever end dataaccessexception in application getting stacktrace follows dataaccessexception: {}com.ibm.websphere.ce.cm.duplicatekeyexception: [jcc][50053][12311][3.65.102] t2zos exception: [jcc][t2zos]t2zospreparedstatement.readexecuteinternal:nativeexecute:9943: db2 engine sql error, sqlcode = -803, sqlstate = 23505, error tokens = ix6040uc;000001136e errorcode=-803, sqlstate=23505 @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:80) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:57) @ java.lang.reflect.constructor.newinstance(constructor.java:540) i able make sense out of items in stacktrace 000001136e in error tokens.what signify? the manual contains explanation sqlcode -803 : an inserted or updated value invalid because index in

angularjs - How to find when a specific character is typed in textarea -

we have requirement show drop down when user enters "@". i planning have directive following: app.controller('mainctrl', function($scope) { $scope.values = ['@']; $scope.valuesentered = false; }); app.directive('identifier', function ($parse) { return { scope: { values: '=values' }, link: function (scope, elm, attrs) { elm.bind('keypress', function(e){ var char = string.fromcharcode(e.which||e.charcode||e.keycode), matches = []; angular.foreach(scope.values, function(value, key){ if(char === value) matches.push(char); }, matches); if(matches.length !== 0){ $scope.valuesentered = true; } }); } } }); will ok ? here simple directive made allow specify expression evaluate when given key pressed or 1 of array of keys pressed. note one-way street. there

perl - Read from CSV file into array, parse through array, access second element of each line -

i'm extremely new programming in perl, , new programming world in general. i'm trying write program opens csv file, reads array, , parses through using split(). each field of csv file contains 4 things: $full_name, $user_name, $password, $con_password my problem need access second element of each line (user_name). need put user names array can work that. i've done split, don't know how make sure second element of each line. this have: #!/usr/bin/perl use cgi qw(:standard); use strict; use warnings; print "content-type: text/html\n\n"; $file = '/home/2014/amosqu/public_html/cgi-bin/members.csv'; open(my $csv, '>>', $file) or die "could not open '$file' $!"; #i these values form in html file $full_name = param('full_name'); $user_name = param('user_name'); $password = param('password'); $con_password = param('con_password'); #array store user names @user

hibernate - hbm2ddl.auto is not working -

i have created 1 entity class emp, using hbm2ddl.auto create tables, below entity related table creating properly, before table in database more tables there, if use property hbm2ddl.auto create need drop total schema(total tables) , created entity related table freshly, old tables not deleted. tables there , new table created, not getting create functionality can please clarify doubt. used version 3.6.4. emp.java @entity @table(name="employe") public class emp { @id int empid; string ename; public int getempid() { return empid; } public void setempid(int empid) { this.empid = empid; } public string getename() { return ename; } public void setename(string ename) { this.ename = ename; } } configuration.cfg.xml <property name="connection.driver_class">com.mysql.jdbc.driver</property> <property name="connection.url">jdbc:mysql://local

n to n grid coming read only Dynamics CRM 2013 -

i placed n:n grid of contact entity on leaseapplication custom entity, have 1:n grid of contact also. so, new n:n grid coming read only.any ideas? this security role issue. in order associate contacts leaseapplications user must have append permissions on both entities. it appears must have create permission on child entity (so if on leaseapplication must have create privilege on contact in order create new n:n relationship). microsoft has recognized bug. read more here .

uilabel - IOS Label and View constraints height -

Image
i confused constraints ios, i've read lot of articles, stuck, when tried set height constraints of uiview according uilabel content height. know common question, don't understand solutions. thought main thing in question constraint priority , can't set them properly. in 1 case, height of uiview wont change 0, , in other uilabel height not make sense. so. i've got: uiview height constraint, , descendants constraints (below) uiimageview height=32, width=32, top=10, left=10, bottom>=10 uilabel left uiimageview = 10, top=10, right=10, bottom=10 and want: if got text place in uilabel , want dynamic height of uiview according height of content size of uilabel . and if there no text place in uilabel , want set height of uiview equals 0 (hide uiview totally). uiimageview - icon. if there no text, must shrink 0, if there text, must have height 32, top constraint 10, bottom constraint more or equals 10. upd: fix problem, adding height co

recursion - Getting all combinations recursively [Python] -

consider dictionary: { "a": [ ["b"], ["c"] ], "b": [ ["d"], ["e"] ], "c": [ ["h"] ], "d":[["i"],["j"]] } i want find possible paths lead not in dictionary keys. example a = [ [b], [c] ] we can expand to a = [ [b, d, i],[b, d, j], [b, e], [c, h] ] i trying come recursive solution can't work fully. suggestions how approach problem? you can find path following function ,but dont post code , dont know try self dont know have problem , couldn't explain thing till tell try , code : def find_all_paths(graph, start,path=[]): path=path+[start] if not graph.has_key(start): return [path] paths = [] nodes in graph[start]: n in nodes : if n[0] not in path: newpaths = find_all_paths(graph, n[0], path) newpath in newpaths: p

javascript - Node.js selenium webdriver - Get browser capabilities inside test? -

i'm using selenium webdriver on node.js (currently via webdriverio, don't mind switching webdriverjs or wd). i run tests on different browsers , want save results of each test along information browser, example: test 1 - chrome - 199 assertions, 0 failures, 0 skipped test 1 - ie9 - 199 assertions, 0 failures, 0 skipped etc.. how can "desiredcapabilities" object within test? or how can pass test available? edit i found browser.desiredcapabilities returns requested capabilities object, realize need "actual capabilities" used (for example if ask ie8 on machine has ie11 ie11 desiredcapabilities object shows version=8). i'm looking way actual used browser capabilities, documented on selenium wiki : if session cannot support capability requested in desired capabilities, no error thrown; read-only capabilities object returned indicates capabilities session supports. using webdriverjs (which mentioned switch to), can

Which channel will be chosen when AudioFormat.CHANNEL_IN_MONO is set for AudioRecord in Android Apps? -

recently, use samsung sm-g7200 mobile phone record speech in android application. however, when use audioformat.channel_in_stereo, there no valid speech recorded in left channel audiorecord class. maybe left channel broken down. when use audioformat.channel_in_mono, recorded speech valid. therefore, channel chosen when audioformat.channel_in_mono set audiorecord in android apps? in other words, how android know 1 channel available , broken down? i have read android audiorecord source code, have not found answer. based on experience of our colleagues, if audioformat.channel_in_stereo available, average value of left channel , right channel can considered audio data in audioformat.channel_in_mono mode.

python - How to use lambda as method within a class? -

here trying do class baseclass(object): successify = lambda x: "<success>%s</success>" % x errorify = lambda x: "<error>%s</error>" % x def try1(self): print successify("try1") def try2(self): print self.successify("try2") but neither of methods seem work.. >>> baseclass().try1() traceback (most recent call last): file "<stdin>", line 1, in <module> file "<stdin>", line 5, in try1 nameerror: global name 'successify' not defined >>> baseclass().try2() traceback (most recent call last): file "<stdin>", line 1, in <module> file "<stdin>", line 7, in try2 typeerror: <lambda>() takes 1 argument (2 given) how use lambdas methods within class? use lambda self, x: "...%s..." % x

c# - Volatile IEnlistmentNotification and TransactionScope.AsyncFlowEnabled = true -

apart .net 4.5.1 there new option on transactionscope enables use async flow. allows write following client code using(var txt = new transactionscope(..., transactionscopeasyncflowoption.enabled) { await sender.sendasync(); } so far good. when need implement volatile ienlistmentnotification i'm struggling that. let's imagine following scenario, assumption: underlying infrastructure async bottom top public class messagesender : isendmessages { public async task sendasync(transportmessage message, sendoptions options) { await sender.sendasync(message); } } so want achieve introduce volatile ienlistmentnotification this: internal class sendresourcemanager : ienlistmentnotification { private readonly func<task> oncommit; public sendresourcemanager(func<task> oncommit) { this.oncommit = oncommit; } public void prepare(preparingenlistment preparingenlistment) { preparingenlistment.prepared();

ios - Unrecognized selector sent to instance with Swift -

i'm trying make slideshow app swift have problem, in main.storyboard add 1 imageview , 1 button, when user click on button slideshow animate. i wrote code @ viewcontroller.swift @iboutlet var imageview: uiimageview! @iboutlet var animatebtn: uibutton! @ibaction func animatebtnclicked(sender: uibutton) { startanimation() } var imagelist:[uiimage]=[] override func viewdidload() { super.viewdidload() in 1 ... 3{ let imagename="\(i).jpg" imagelist.append(uiimage(named: imagename)!) } } func startanimation()->(){ if !imageview.isanimating() { imageview.animationimages=[imagelist] imageview.startanimating() animatebtn.settitle("stop animation", forstate:uicontrolstate.normal)} else { imageview.stopanimating() } } at appdelegate.swift didn't write code. but app crashed when clicked button , show message error 2014-12-02 09:54:55.693 #4 animation photo[921:613] -[swif