Posts

Showing posts from May, 2014

office interop - Reply twice from outlook add in itemadd event -

i need reply twice outlook add-in item_add event, once mail arrives , once more after processing. code registered callback looks below: void items_itemadd(object item) { outlook.mailitem mail = (outlook.mailitem)item; outlook.mailitem reply = mail.reply(); // add stuff reply body , subject reply.send(); marshal.releasecomobject(reply); // processing few seconds reply = mail.reply(); // update reply body , subject reply.send() // release reply object } the problem have 2 replies sent out @ end after processing complete. there way send first reply , not wait till end? note, run code event handler. handler should return control flow outlook process replies. you can try use syncobjects property of namespace class force synchronization. public sub sync() dim nsp outlook.namespace dim sycs outlook.syncobjects dim syc outlook.syncobject dim integer dim strprompt integer set nsp = application.getnamespace("mapi") s

pip - Cannot install or use scrapy on OS X -- blocked by proxy (I think) -

so having tough time should easy. @ work have lot of annoying proxies etc. , i'm pretty sure that's involved here. anyhow, when try install scrapy, "connection reset peer" in middle of downloading libxml, 37% of way in: root@rcmac (~ ): pip install scrapy requirement satisfied (use --upgrade upgrade): scrapy in /library/python/2.7/site-packages/scrapy-0.24.5-py2.7.egg requirement satisfied (use --upgrade upgrade): twisted>=10.0.0 in /system/library/frameworks/python.framework/versions/2.7/extras/lib/python (from scrapy) requirement satisfied (use --upgrade upgrade): w3lib>=1.8.0 in /library/python/2.7/site-packages (from scrapy) collecting queuelib (from scrapy) using cached queuelib-1.2.2-py2.py3-none-any.whl collecting lxml (from scrapy) /library/python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: insecureplatformwarning: true sslcontext object not available. prevents urllib3 configuring ssl appropriately , may cause ssl

c# - How to load image in image control of ASP.NET from database? -

i have created new folder in project , save images in folder. store path in database. now want load image in asp.net image control unable so. here code storing path. if (imgupload.hasfile) { string filename = imgupload.filename; string filepath = server.mappath("~/images/facultypics/"); int filelength = imgupload.postedfile.contentlength; string fileextention = path.getextension(filename); fileextention = fileextention.tolower(); string link = "~/images/facultypics/" + filename; //this link stored in database if (filelength < 1048576) { if (fileextention == ".jpg" || fileextention == ".png" || fileextention == ".gif" || fileextention == ".bmp") { imgupload.saveas(filepath + filename); bal.pic = link; } else { lblmessage.text = "only image files allowed"; } } else { lbl

javascript - With jQuery 'draggable', the text wraps for some reason when colliding with container. Why? and how to fix? -

i'm trying design page there task list on left , many boxes (one each employee) on right can dispatch tasks quickly. i don't know if relevant, use bootstrap. here list's markup : <div class="col-md-3"> <div class="panel panel-default"> <div class="panel-heading"> <div class="panel-title">tasks</div> </div> <div class="panel-body panel-body-table"> <div id="unassigned_1" style="margin-left:0px">task 1</div> <div id="unassigned_4" style="margin-left:10px">task 1.1</div> <div id="unassigned_8" style="margin-left:20px">task 1.1.1 long name can test</div> <div id="unassigned_9" style="margin-left:20px">task 1.1.2</div> <div id="unassigned_5" st

java - Position of elements in Panel GWT -

i want know if it's possible position different elements in panel horizontalpanel example. in java code, have horizontalpanel 2 elements, 1 image , 1 label. i want image in left of panel , label in middle. for example: horizontalpanel pheader = new horizontalpanel(); image moviedata = new image(); moviedata.seturl("http://i.myegy.to/images/1c58b25ce86e.original.png"); label titlehead = new label ("movies"); pheader.add(moviedata); pheader.add(titlehead); how can place these both elements? thank help. mickey74 you can use setcellhorizontalalignment : pheader.setcellhorizontalalignment(moviedata, hashorizontalalignment.align_left); pheader.setcellhorizontalalignment(titlehead, hashorizontalalignment.align_middle);

scripting - How to get a prompt for information using a batch file? -

i have .bat file named runrda.bat contains: @echo off rda -v %1 -i "c:\me\rda-tools-1.7.0.ra1\input" -o "c:\me\rda-tools-1.7.0.rc1\output" which can run navigating following folder example: c:\rda> and entering command c:\rda>runrda 848 so batch file takes input number , runs command. as can see requires step of navigating specific folder c:\rda before running .bat file. wondering if there way double click open .bat file when cmd opens need enter input number , hit enter, without having navigate mentioned directory, therefore eliminating navigation step. if can understand target, next code snippet lead solution: @echo off setlocal set "param=%1" if not defined param set /p "param=please enter input number: " if not defined param goto :donothing pushd c:\rda rda -v %param% -i "c:\me\rda-tools-1.7.0.ra1\input" -o "c:\me\rda-tools-1.7.0.rc1\output" echo done %param% popd goto :donext :donoth

arrays - JSON to angular select with ng-options -

i attempting json encoded response ajax request select statement using angular ng-options. not have control of php source of json response comes from. the response in form: {"a":"col1","b":"col2","c":"col3","d":"col4"} i using simple select dropdown , need populate above json utilizing index set value , value set dropdown text. example below. <select ng-model="selecteditem" ng-options="item item in items"> options should result in this: <option value="a">col1</option> <option value="b">col2</option> <option value="c">col3</option> ... i unsure missing format of json response it'll used in ng-options. i've tried forms of ng-options no avail. i've tried format response json.parse, json.stringify, .eval(), etc. considering json_encoded array correct object when hit angular funct

mysql - Execute query in python -

i have simple table ****************** mid | title 1 | pqr 2 | abc ****************** now code have written append data table is import mysqldb db = mysqldb.connect("localhost", "root", "a", "project") cursor = db.cursor() sql = "insert project.movie(mid, title) values(%d, %s)" % (21,'aman') cursor.execute(sql) but above code generates error traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/lib/python2.7/dist-packages/mysqldb/cursors.py", line 159, in execute query = query % db.literal(args) typeerror: %d format: number required, not str i have passed number , not in quotes why there error ? your real issue here quite not putting quotes around inserted string. izkata remarked, shouldn't doing python-side wise due sql injection. sql-side, entire query must in string format when being executed, must use %s every

android - What is the frame rate of screen record -

i using adb screenrecord functionality record video of game. know default bitrate 4mbps. frame rate? how can know frame , how change it? the frame rate variable, not fixed. every time screen updated, 1 frame recorded. if screen not updated, no frame recorded. therefore there no setting frame rate, because it's determined how system updates screen. on devices maximum of 60fps. if want record @ lower rate, or have fixed-rate video, need use ffmpeg convert it. some more information can found on bigflake page . to see in action, can enable --bugreport flag in screenrecord v1.2 (first shipped in android 5.0 "lollipop"). gives each individual frame number , timestamp. can see in action in this video .

angularjs - 404 not found on API route for MEAN application? -

in application when 1 of forms submitted, function called... $scope.submit = function() { $scope.message = ""; var params = { ... }; subscriber.create(params) .success(function(data) { ... }); }; which in turn calls subfactory create method, posts '/mail'. subfactory.create = function(subdata) { return $http.post('/mail', subdata); }; upon attempting post '/mail' error post http://localhost:8080/mail 404 (not found) . cannot figure out how resolve because have this... apirouter.route('/mail') .post(function(req, res) { ... }); and far i'm aware should able find '/mail'. full apirouter located here , , full server.js file located here . when setup api routes in server.js, routed /api , routes added router begin there. therefore, /mail route located @ /api/mail server.js // routes // ======== // api route // ------------- var apirout

android - Series of buttons horizontally -

Image
i new android development , appreciated, want display 2 rows of 6 buttons shown in image below, tried following code, when run it, doesn't show app( blank screen appears), first linearlayout horizontal , second 1 vertical <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="5dp" android:layout_marginright="5dp" > <button android:id="@+id/button01" android:layout_width="0px" android:layout_height="wrap_content" android:layout_weight=".2"

ErrorPageFilter ERROR in log when trying to handle Exception in a spring-boot app -

i've made small spring-boot application , i'm trying add own exception handling. i'm having problem error in log though app works expected. configuration: tomcat 8 (standalone) spring-boot version 1.2.3 war packaging the exception handler looks follows: @controlleradvice public class globalexceptionhandler { @responsestatus(httpstatus.not_found) @exceptionhandler(notfoundexception.class) @responsebody errorinfo handlenotfoundrequest(httpservletrequest req, exception ex) { return new errorinfo(req.getrequesturl().tostring(), ex); } } my controller throws exception: @requestmapping(value = "/{id}", method = requestmethod.get, produces = {"application/json"}) public @responsebody hashmap environment(@pathvariable("id") long id) { hashmap<string, object> map = new hashmap(); environment env = environmentservice.getenvironment(id); if(env == null) throw new notfoundexception("environment not found: &q

java - Android - Shared element transitions with calling activity finish() -

i'm working on making application more material , i'm stuck on how implement shared element transitions. have activity starts b , calls finish() in order remove stack. in case have element want share between 2 activities, once passed b, no longer matters. if don't call finish() after startactivity(ctx,intent, bundle) exit/enter animation works perfectly. however, if call finish, there's ugly flicker before animation starts. is there i'm overlooking or not possible trying do? you can finish activity in onstop function, if want happen when transition b create flag , set after call startactivity(ctx,intent, bundle): @override public void onstop() { super.onstop(); if(mshouldfinish) finish(); } make sure when done activity b call finish() , not finishaftertranstion() since activity no longer there after finishing activity a, shared element in b might hang in screen if press back. set transitionname null in activityb.onenteranimation

anova - Nesting success (binomial glmm) in r -

i running glmm using glmer() in r: glmer(survive ~ fyear + site + fyear * site.x + (1|fyear), family = binomial(link = logexp(shaffer.sub$exposure)), data = shaffer.sub) where survive 0 or 1 depending if nest successful or not. here can see data looks like: structure(list(id = structure(1:7, .label = c("1", "2", "3", "4", "5", "6", "7"), class = "factor"), year.x = structure(c(1l, 1l, 2l, 3l, 3l, 3l, 3l), .label = c("1994", "1995", "1999"), class = "factor"), survive = structure(c(1l, 2l, 2l, 2l, 2l, 2l, 1l), .label = c("0", "1"), class = "factor"), fyear = structure(c(1l, 1l, 2l, 3l, 3l, 3l, 3l), .label = c("1994", "1995", "1999"), class = "factor"), site.x = structure(c(1l, 2l, 1l, 1l, 1l, 2l, 1l), .label = c("n", "s"), class = "facto

amazon s3 - Using two policies together in a single S3 bucket -

i new amazon s3 , created first bucket. need 2 important policies implemented on bucket follows: first, policy allowing downloads own website (via http referrer) secondly, want make objects in bucket public. i have got 2 different codes of policies needs, can't put them achieve said goals. please me joining these policies achieve want. for allowing referrer downloads: { "version": "2012-10-17", "id": "http referer policy example", "statement": [ { "sid": "allow requests originated www.example.com , example.com", "effect": "allow", "principal": "*", "action": "s3:getobject", "resource": "arn:aws:s3:::bucket/*", "condition": { "stringlike": { "aws:referer": [

c# - How does Application.dataPath work in Unity when you move the project to an iOS build -

my unity game using application.datapath access levels within game. question why application.datapath not work when move project ios mobile platform. check out: http://answers.unity3d.com/questions/132753/how-do-i-read-xml-on-iphone.html i ran similar problem when trying read xml file. moved files resources folder , used resources.load("yourfile") instead.

java - Input event app issues -

i'm working through input event app. app has textfield , button. information entered sent receiver app handles action , must able write textview in main activity. explanation not confusing. this built main app from: http://developer.android.com/guide/topics/ui/ui-events.html this built receiver from: http://developer.android.com/training/sharing/receive.html the main app loads layout blank. receiver crashes on load. can't figure out why, assistance appreciated. mainactivity.java (main app) package com.miller.main; import java.util.list; import android.app.activity; import android.content.intent; import android.content.pm.packagemanager; import android.content.pm.resolveinfo; import android.os.bundle; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; public class mainactivity extends activity { protected void oncreate(bundle savedinstancestate, bundle savedvalues) { super.oncrea

c# - WPF DataGrid SelectAll Checkbox with two-way binding -

i'm binding datagrid list, has boolen property "isselected". public partial class mainwindow : window { list<baselineentity> _blrecs; public mainwindow() { initializecomponent(); _blrecs = new list<baselineentity>(); _blrecs.add(new baselineentity{entityid = "yada_yada_1", isselected = false}); _blrecs.add(new baselineentity{entityid = "yada_yada_2", isselected = false}); _blrecs.add(new baselineentity{entityid = "yada_yada_2", isselected = false}); changedblrecsgridview.itemssource = _blrecs; } } where class baselineentity defined as: internal class baselineentity { public string entityid {get; set;} public bool isselected { get; set; } } the xaml this <datagrid name="changedblrecsgridview" itemssource="{binding _blrecs, mode=twoway, updatesourcetrigger=propertychanged}" autogeneratecolumns="false"> <datagrid.columns>

How would you design this in Android? A split screen with a button -

Image
i'm not sure whether use relativelayout and/or linearlayout design following screen! mind helping me out? the correct answer can found here: how can add new "floating action button" between 2 widgets/layouts the easiest option (since have button overlay) use relativelayout linearlayout nested inside (assuming guy squatting different widget 1 containing text). if image of guy sqatting , text in same widget, have replace linearlayout widget. children of relativelayout take higher precedence on z axis. can have relativelayout with: <relativelayout android:height="match_parent" android:width="match_parent" > <linearlayout android:height="match_parent" android:width="match_parent" > <imageview android:src="some_source" android:height="0dip" android:width="match_parent" android:layout_weight

How to send simple data from javascript to java application -

i trying send simple message javascript. want receive data in java program (server), can't seem figure out how obtain message in java. here javascript: if (window.xmlhttprequest) { xmlhttp = new xmlhttprequest(); } else { xmlhttp = new activexobject("microsoft.xmlhttp"); } xmlhttp.open("post", ip, true); xmlhttp.setrequestheader("content-type", "application/x-www-form-urlencoded"); xmlhttp.send("posx=" + posx + "&posx = " + posx); i have 2 questions regarding this. is above fastest method send simple string data javascript java program or can recommend alternative solution? how can receive above post request javascript java? i hope can me out. appreciated as i've never done this, don't know if there fastest method, way java application has listen on tcp port 80 , should it. should send http response. edit: have come 2 things after diving proble

javascript - Get text value from .txt file -

i have script gets value .txt file, have done number value works perfectly, when want .txt file, text , not number "nan" error know stands "not number", how change work can value text in .txt file? my script. <div class="displaynamecurrent"> display name: <span id="displaynamedisplay"></span> </div> <script type="text/javascript"> var read = new xmlhttprequest(); read.open('get', 'displaynamefile.txt', false); read.send(); var displayname = parseint(read.responsetext) document.getelementbyid("displaynamedisplay").innerhtml = displayname; </script> if don't want convert text integer, don't run parseint on it.

c# - How do I return 2 values for this method? -

this current code: public static double calculatetip(double totalexpense) { const double tip1 = 0.15; return totalexpense * tip1; } //calculation tip 2 public static double calculatetip2(double totalexpense) { const double tip2 = 0.20; return totalexpense * tip2; } how can possibly combine 2 1 method? program runs perfect , according instruction professor, used 5 methods instead of 4. apparently must able combine two, otherwise wouldn't wants 4 methods in instructions. final output of program looks this tip calculator please enter total: clear console tip calculator total before taxes , tip: 50.00 (user input obviously) taxes : $4.50 tip 15%: $7.50 total including taxes , 15% tip: $62.00 tip 20%: 10:00 total including taxes , 20% tip: $64.50 consider using tuple tuple<double, double> calculatetip(double totalexpense) { const double tip1 = 0.15; const double tip2 = 0.20; retu

node.js - NodeJs giving me a Object #<Object> has no method -

i have class along helper class defined: function classa(){ this.results_array = []; this.counter = 0; this.requestcb = function(err, response, body){ if(err){ console.log(err); } else{ this.counter++; var helper = new classahelper(body); this.results_array.concat(helper.parse()); } }; }; function classahelper(body){ this._body = body; this.result_partial_array = []; this.parse = function(){ var temp = this.parseinfo(); this.result_partial_array.push(temp); return this.result_partial_array; }; this.parseinfo = function(){ var info; //get info this._body return info }; }; nodejs gives me following error: typeerror: object #<object> has no method 'parseinfo' i cannot figure out why can't call this.parseinfo() inside classahelper's parse method. if can explain possible solution. o

database - LibreOffice Base - Hyperlink Macro -

how 1 create macro hyperlinks data fields corresponding folders on local directory in libryoffice base? example: client named "jimmy" entered in database. invoice documents located in path "/directory/path/to/jimmy". db admin needs ability click on jimmy's id data field , corresponding folder. this macro; however, needs update entire database , there hundreds of client records directory structure that's based on db data. example: client "a" documents in "/person/something/a" client "b" in "/person/something/b" if skilled , willing assist in writing vb macro accomplishing appreciated.

ios - Xcode 6.3 bot will not code sign the app and there is not an install button -

Image
i following warning build service issue in new bot created in xcode 6.3: bot issue: warning. build service error. issue: no code signing identities found: no valid signing identities (i.e. certificate , private key pair) matching team id on server, can build app, make archive , sign , put on device. tried removing developer account , adding back; same results. want able install app , save archive. i able server make build changing project settings. changed code signing identity ios developer, deleted bot , made again, time worked. here's looks now:

regex - Regular expression to match name value pairs -

Image
i'm trying come regular expression match name=value pairs. pet=dog (valid) pet=dog&fruit=apple (valid) pet=dog& (invalid - & must followed name value pair) pe t=dog (invalid - space in name) pet=d og (invalid - space in value) pet=dog&&fruit=apple (invalid - 2 & signs) pet=dog=cat&fruit=apple (invalid - 2 = signs before new name value pair) pet==dog (invalid 2 = signs) you can use regex this: ^\w+=\w+(?:&\w+=\w+)*$ working demo

vb6 - Folding/Collapsing functions and subroutines in Visual Basic 6 -

do know if there's way fold/collapse functions , subroutines (and better yet: ifs , whiles) in visual basic 6 ide? @ least plugin or similar? i have deal files of thousands of lines , no cropping it's impossible (it's old app off course). please note it's not vb.net, it's vb6.0 thanks! no, in visual basic 6 ide no fold/collapse functions. instead? use ctrl + arrow up or ctrl + arrow dn skipping between functions use list of functions in upper right corner instead of scrolling toggle procedure view / full module view 2 buttons in bottom left corner must-to-have: install scroll wheel fix vb6 , scroll source mouse wheel (nirvana!)

.net - Can't compile a VS2013 WinForms project after adding a dll reference -

i have working vs2013 vb.net 3.5 project. when add , use 3rd party dll, project stops compiling. dll working in .net 4.0 windows forms project. the error is warning 95 namespace or type specified in imports 'stages.stagesgateway' doesn't contain public member or cannot found. make sure namespace or type defined , contains @ least 1 public member. make sure imported element name doesn't use aliases. c:\users\pvarma\documents\visual studio 2013\projects\safelink\safelink mas dev\stagesfunctions.vb 1 9 safelink mas dev the compile fails @ imports stages.stagegateway statement. how can fix error please?

c - How can I simulate a process running? -

so want create process , keep running amount of time, before calling sigint on , killing it. so have done created struct pcb (process control block), , when have process running set mypcb->status = run //run defined 0, suspend 1, etc basically have function manages processes, , might have in function startprocess(processnum); wait 10 seconds killprocess(processnum); so in startprocess function call fork, , in child process (when fork() == 0), want keep process running indefinitely. know can done using execvp, don't want switch context exe file, want keep process running, or @ least make seem child process still alive can go , call sigint on pid in killprocess function. note store pid of each process in mypcb->pid so dont need pass anything, need way keep process running can go , kill after. hopefully question makes sense, want know how can keep process running without doing anything, can kill later. thanks! it sounds you're trying make pro

r - How to drop non-unique rows based on multiple columns -

i have data frame: data.frame(name= c("b","d","d","e"),date=as.date(c("2015-01-01","2015-01-02","2015-02-02","2015-03-02")),s=c("e","b","b","g"),num=c(1,2,2,3)) name date s num 1 b 2015-01-01 e 1 2 d 2015-01-02 b 2 3 d 2015-02-02 b 2 4 e 2015-03-02 g 3 and want drop rows not unique in case above want drop rows 2 & 3 because have same values name , date , s & num . results be: name date s num 1 b 2015-01-01 e 1 2 e 2015-03-02 g 3 any ideas? if understand correctly have remove rows seen duplicated df1[!duplicated(df1) & !duplicated(df1, fromlast = true) ,] using data: df1 <- data.frame( name= c("b","d","d","e"), date=as.date(c("2015-01-01","2015-01-02","2015-01-02","2015-03-02")), s=c(

ios - Change variable of other view controller Swift -

i have modal segue 1 view controller has table view. when user selects cell in table view, want view controller dismissed , in presenting view controller, variable changed contents of cell selected. how can change variable in view controller programatically? (without using prepareforsegue method, since not doing segue, dismissing view controller) this sounds bit of strange pattern (selecting table view moves forward in navigation) can way. create protocol called cellselectnotification needs method identifies selected cell (perhaps takes indexpath, keep implementation simple). make parent view controller conform protocol , give view controller presenting table view reference parent cellselectnotification delegate. when table view has cell selected notify parent of selected index path through delegate method defined, allow view controller dismissed. this general way of allowing objects should not have references each other communicate - delegate pattern says "i n

java - IF statement not being executed -

i trying execute code if spot in string array equal string value pass in. know array storing correct values , method obtaining correct value threw param (i made sure). when param value matches value in array, if statement nevers gets hit. below code public void checkwordforletter(string c) { int letterspotindex = 0; int spotnumber = 1; for(int = 0; < (wordletters.length); ++) { system.out.println(wordletters[i]); if(wordletters[i].equals(c)) { system.out.println("letter being looked @ in array is: " + c); letterspot[letterspotindex] = spotnumber; letterspotindex = letterspotindex + 1; spotnumber = spotnumber + 1; } } } if spot in string array equal string value pass in i believe want use contains instead of equals . if misunderstood statement, , want use equals perhaps want compare using tolowercase() on each side. it's hard tell without kn

Loop using count + modulo (when applicable) in Ruby -

to break long migration of data, i'm using query limited groups of 100, processing 100 records. something this... count = model.where("conditions").count count = count / 100 count = count+1 if count%100 != 0 count.times #do data migration steps .limit(100)... end is there shortcut or better way of doing count based on whether or not there remainder when dividing 100? feels i'm forgetting easy way (besides rounding seems slower, maybe it's not). yes. supported rails, not have roll own code finding batches of records. the easiest use find_each , seamlessly loads 1000 records @ time: model.find_each |model| # ... end the underlying mechanism find_in_batches default batch size of 1000. can use find_in_batches directly, not have to, find_each sufficient: model.find_in_batches(batch_size: 100) |batch| batch.each |model| # ... end end

php - Function to generate Friendly URL Strings is not removing Commas -

i have function returns me friendly url string. public static function geturlfriendlystring($str) { // convert spaces '-', remove characters not alphanumeric // or '-', combine multiple dashes (i.e., '---') 1 dash '-'. $_str = preg_replace("[-]", "-", preg_replace("[^a-z0-9-]", "", strtolower(str_replace(" ", "-", $str)))); return substr($_str, 0, 40); } anyway, if have example string: "product vitamins, protein, , lot of stuff" the resulting string is: "product-with-vitamins,-protein,-and-a-lot-of-good-stuff" as can see doesn't remove commas string :/ , knowledge regular expressions null . you left out delimiters around regexp, used [ , ] delimiters. result, weren't being treated character class operators. if want compress multiple - one, regexp /-+/ , not [-] . public static function geturlfri

Swift 1.2: 'self' used before super.init call -

i have code: class someviewcontroller : uiviewcontroller { let deferred : ()->() required init(coder adecoder : nscoder) { deferred = { self.dosomething() } super.init(coder: adecoder) } func dosomething() { // things.... } } in swift 1.2 fails compile error: 'self' used before super.init call in pre-1.2 days, can address in number of ways such implicitly unwrapped conditionals. approach won't work longer. i've seen other answers reference 2-stage initialization or lazy decorator, both sacrifice immutability of property. surely must solvable in swift 1.2, i'm out of ideas. here's interim workaround: private(set) var deferred : ()->() = { } required init(coder adecoder : nscoder) { super.init(coder: adecoder) self.deferred = { self.dosomething() } } my thinking is, okay, did "sacrifice immutability of property", public perspective property remains immutable because

python - Can the Pyramid framework be run on a CGI server -

ok, cgi sow outdated, , no 1 likes it, have customer needs new site, on shared hosting, , not wish change hosting providers. doing back-end of site in python, , researching python framework options can run cgi(no 1 wants use cgi module). far, seems django can run on cgi, terrible. flask , bottle seem run on cgi(at least supported), wondering if pyramid framework can. if not, guess using flask. can pyramid running on cgi? if performance against running flask r bottle under cgi? see solution here, shows how use wsgi on cgi https://www.python.org/dev/peps/pep-0333/#the-server-gateway-side

How do I make vim open a browsed file location in the current window even if it's open elsewhere? -

suppose browse directory in vim typing :e some/dir/ . vim take me list of directories , files. if select some.file either open file if not open, or take me tab/window file open how disable 2nd option, vim open file in window if open elsewhere? can force behaviour manually typing :e some/dir/some.file how make happen when select file? i running vim 7.4

javascript - Hide Div After Click? (But what if the Div Is a banner?) -

i'm making webpage , want make multi-ads space. clicking in banner(it's link opened normally), want banner hidden , 1 shown. problem's banners out of control!! when click on it, shown in new window (normally), no changes considering div containing banner must replaced next div containing next banner. i need control displaying divs clicking under banners. you can see in webpage: http://allaroundtheworldtv.eu5.org/test/new2a.html in example, timer start when clicking in div out of banner space. want, timer start when click on ad-banner. or solution pass directly next banner. plz me that!! want possible!! and think you. if banner in iframe (generally work this) can't make such actions. because in domain , dom object. if serving banners html, possible basic "onclick" event of div.

android - How to make Drawerlayout hamburger icon from not clicking ? -

i want disable hamburger button . should visible not clickable . note tried setdrawerindicatorenabled(false) . disable whole hamburger icon .i dont want that. want hamburger icon visible greyedout or gone clicking during network operation ? try use view.setclickable(boolean) on drawerlayout instance. doesn't change looks, make view not touchable (or touchable on setclickable(true) ). drawerlayout.setclickable(false);

swift - How do you sort dates in a dictionary? -

i having trouble trying sort following dictionary, printed in oldest date first order when printed. var daytotaldictest: [string:int] = [ "04-09-2015" : 4, "04-10-2015" : 6, "04-07-2015" : 8, "03-28-2015" : 10, "12-10-2014" : 12, "12-10-2015" : 12, ] edit/update: xcode 8.2.1 • swift 3.0.2 extension string { static let shortdateus: dateformatter = { let formatter = dateformatter() formatter.calendar = calendar(identifier: .iso8601) formatter.locale = locale(identifier: "en_us_posix") formatter.datestyle = .short return formatter }() var shortdateus: date? { return string.shortdateus.date(from: self) } } let daytotaldictest: [string:int] = [ "04-09-2015" : 4, "04-10-2015" : 6, "04-0

Terminating while loop with a pushbutton Matlab -

i have uitable , function returns id of item once user clicks on respective row. id global variable, used on various functions. idea create array user chosen items uitable, terminated when save playlist clicked. ex. if user chooses items id's 5, 7, 9 in succession , clicks 'save playlist' button, want array hold 5 7 9 i thought best way using while loop. while loop should check if save button has been clicked. have global variable changes once program goes 'save playlist' button callback function. the problem once user chooses id, array keeps on iterating until user chooses id, , keep on iterating etc etc until save button clicked. ex: user clicks on id 5, array record 55555555555555... recurring until user clicks on ex. id 7: 555555555555557777777777, since program keeps on looping , looping without pausing. the code looks this: while (keeprunning) idvec = [idvec id]; end keeprunning global variable , initialized value of 1 in opening functi

php - Fetch id from Mysqli -

i've been trying add modal popup whenever click button update records have stored in database i'm having trouble getting id <?php //open new connection mysql server $mysqli = new mysqli('localhost','root','','pizzeria'); //output connection error if ($mysqli->connect_error) { die('error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error); } //mysqli select query $results = $mysqli->query("select id, navn, indeholder, pris pizza"); print '<tr>'; while($row = $results->fetch_asso

c# - Drag Files Directly Onto Form Not Control -

is possible drag files directly onto windows form or have onto control on windows form? have been using below code quite time, requires drag onto listview public form1() { initializecomponent(); this.load += new eventhandler(form1_load); } void form1_load(object sender, eventargs e) { this.listview1.allowdrop = true; this.listview1.columns.add("file name"); this.listview1.dock = dockstyle.fill; this.listview1.smallimagelist = this.imagelist1; this.listview1.view = view.details; this.listview1.dragenter += new drageventhandler(listview1_dragenter); this.listview1.dragdrop += new drageventhandler(listview1_dragdrop); } void listview1_dragenter(object sender, drageventargs e) { if (e.data.getdatapresent("filedrop") && (e.allowedeffect & dragdropeffects.copy) == dragdropeffects.copy) { e.effect = dragdropeffects.copy; } } void listview1_dragdrop(object sender, drageventargs e) { if (e.data.getdatapresent("filedr

wpf - TextBlock inside DataGridTemplateColumn does not refresh if source changed -

there textblock inside datagridtemplatecolumn , bound viewmodel property (guest.firstnames), displays value correctly. however, when property in viewmodel changed, change not reflect in view. here relevant code roomslot public class roomslot : entitybase { [required] public guest guest { get; set; } } guest public class guest : entitybase { private string _firstnames; [required(errormessage = "firstnames required")] public string firstnames { { return _firstnames; } set { _firstnames = value; notifyofpropertychange(() => firstnames); } } public list<roomslot> roomslots { get; set; } } view <!-- datagrid.datacontext = observablecollection<roomslot> --> <!-- datagridtemplatecolumn.datacontext = roomslot --> <datagridtemplatecolumn header="guest" width="auto" > <datagridtemplatecolumn.celltemplate> <datatemplate> <stackpanel o

Error in import statement Java -

following import statements in code. classes importing in same package comm . package comm; import wikilinksreducer; import wikipagelinksmapper; import xmlinputformat; import rankcalculatemapper; import rankcalculatereduce; import rankingmapper; am getting following errors when compile code: wikipageranking.java:2: '.' expected import wikilinksreducer; ^ wikipageranking.java:2: ';' expected import wikilinksreducer; ^ wikipageranking.java:3: class, interface, or enum expected import wikipagelinksmapper; ^ wikipageranking.java:4: '.' expected import xmlinputformat; ^ wikipageranking.java:4: ';' expected import xmlinputformat; ^ wikipageranking.java:5: class, interface, or enum expected import rankcalculatemapper; ^ wikipageranking.java:6: '.' expected import rankcalculatereduce; ^ wikipageranking.java:6: ';' expected import rankca

PHP Service Account Accessing a Google Calendar -

i having trouble trying list events of specific google calender using php. wondering if see working example? i've looked @ documentation here , isn't working me. if give working example of service account listing events of calender, awesome! check link spunmonkey.com/display-contents-google-calendar-php . issue google calendar? not able retrieve events in calendar? getting error while retreiving? can try request here developers.google.com/google-apps/calendar/v3/reference/events/…. please post code , error if have any?

javascript - Use ActionLink instead of pure JS for a non-submit button in a form -

i'm looking way display 3 buttons in form using methods htmlhelper or ajaxhelper, is, no javascript in view if @ possible. the scenario here follows: got form buttons submit, preview , cancel (think "create new blog post"). view far is @using (html.beginform()) { <fieldset> ... <div id="preview-content"></div> ... <input type="submit" value="submit" /> <input type="button" value="preview" id="preview-button"/> @html.actionlink("cancel", "index", new { area = "blog" }, new { @class = "button" }) ... </fieldset> } <script type="text/javascript"> $('#preview-button').click(function () { $.ajax({ url: '@url.action("preview", new { area = "blog" })', type: 'post', data: { title:

Learning to implement a Linked List Stack class in C++ -

i want implement linked list using stack. here class: class linkedliststack { public: linkedliststack(); void push(int x); void pop(); int peek(); private: struct node { int data; node *next; }; node *head; node *tail; }; my implementation far: linkedliststack::linkedliststack() { m_headptr = 0; m_tailptr = 0; } void linkedliststack::push(int x) { struct node* newnode = (struct node*) malloc(sizeof(struct node)); newnode->data = x; newnode->next = head; head = newnode; } void linkedliststack::pop() { struct node* newnode = (struct node*) malloc(sizeof(struct node)); newnode->data = null; newnode->next = head; head = newnode; delete newnode; } int linkedliststack::peek() { return head->data; } as of now, push , peek seem working, pop not work. please help. want keep implementation/style same, want fix error make work. i think wrote pop method wrong.