Posts

Showing posts from January, 2015

What is the maximum number of events per page returned for calendarview endpoint in Office365 Calendar REST Api? -

as suggested in answer question: office365 rest v1.0 api calendar not return recurrences i using calendarview endpoint. here documentation it: https://msdn.microsoft.com/office/office365/api/calendar-rest-operations#eventoperationsgetevents in documentation following link odata query parameters discuss paging of response: https://msdn.microsoft.com/office/office365/api/complex-types-for-mail-contacts-calendar#useodataqueryparameterspageresults however, mentions maximum number of entries per page returned messages or childfolders endpoints, not number of entries per page returned calendarview endpoint. doubt 10 or 50, few events typical calendarview call. can point me documentation outlines value? update: sorry, didn't understand question right. max # of items returned in page 10 if $top isn't specified query parameter, value of $top if $ top specified , $top<=50, , 50 if $top specified query parameter $top>=50 . example: https://outlook.o

javascript - Iron meteor's Route doesn't fire rendered event of the template -

here's case. i'm building template should render chart based on data can identifier. the example show here simplified version of code discribe problem. here html: <head> <title>example</title> </head> <body> </body> <template name="layout"> <a href="/firsttext">first text</a> <a href="/anothertext">another text</a> {{> yield}} </template> <template name="example"> <span id="text">basic text</span> </template> and javascript: if (meteor.isclient) { router.configure({ layouttemplate: 'layout' }); router.route('/:text', function() { this.render('example', { data: this.params.text }); }); template.example.rendered = function() { $('#text').html(this.data); } } this code renders whatever put in url "p" tag. if go on first link text

python - Is it possible to send email from localhost by using flask-mail? -

i using windows os , trying send email localhost using flask-email extension. codes given below: #!/usr/bin/env python # -*- coding: utf-8 -*- flask import flask flask.ext.mail import mail, message app = flask(__name__) mail = mail(app) app.config['mail_server'] = 'smtp.gmail.com' app.config['mail_port'] = 465 app.config['mail_use_tls'] = true app.config['mail_use_ssl'] = false app.config['mail_username'] = "example@gmail.com" app.config['mail_password'] = "783798kljkld" @app.route("/") def index(): msg = message("hello", sender="example@gmail.com", recipients=["to@gmail.com"]) msg.body = "testing" msg.html = "<b>testing</b>" return mail.send(msg) if __name__ == '__main__': app.run(debug=true) when run code in debugging mode, browser gives response "smtpserverdisconnected: connection unexpecte

r - Cramer's V with missing values gives different results -

my questions concern calculation of cramers v detect correlation between categorial variables. 've got dataset missing values, created fake dataset illustration 2 variables , b, 1 of them containing na's. <- factor(c("m","","f","f","","m","f","f")) a2 <- factor(a, levels = c('m','f'),labels =c('male','female')) b <- factor(c("y","y","","y","n","n","n","y")) b2 <- factor(b, levels=c("y","n"),labels=c("yes","no")) df<-cbind(a2,b2) the assocstats function gives me result cramers v: require(vcd) > tab <-table(a,b) > assocstats(tab) x^2 df p(> x^2) likelihood ratio 1.7261 4 0.78597 pearson 1.3333 4 0.85570 phi-coefficient : 0.408 contingency coeff.: 0.378 cramer's v

ios - How do I add padding to a UIButton using the xcode interface builder? -

Image
i'm using 32 point icon button , i'm trying increase tappable area 44 points meet apple's guidelines. can using interface building instead of code? help! yes can. just use height want in button (44x44, per instance) , set icon image, not background.

SQL Server 2008 - error using OVER with GROUP BY -

this query works flawless @ sql server 2014 ( http://sqlfiddle.com/#!6/19de4/1 ), i'm having problems 2008 version, complains "incorrect syntax near 'order'. missing? create table t (id bigint, cliente varchar(100), vendas float); insert t values (1, 'vitor', 234.3); insert t values (2, 'emerson', 456.2); insert t values (3, 'thiago', 6789.3); insert t values (4, 'john', 5423.0); insert t values (5, 'fulano', 3467.8); select *, case when vendas_agrupadas <= 0.7 'a' else (case when vendas_agrupadas <= 0.9 'b' else 'c' end) end "grupo abc" ( select *, sum(vendas) on (order vendas desc) /(sum(vendas) over()) vendas_agrupadas t) asdf; sql server 2008 doesn't support cumulative sums directly. following version subquery should want: select *, (case when vendas_agrupadas <= 0.7 'a' when vendas_agrupadas <= 0.9 'b'

In C++, How Can I Generate A Random Number Based Off Of A Double Value Probability? -

i have event should have 0.5% probability of occurring (not often). how can generate random number based on probability? would sufficient, don't believe srand returns integer... double rate = 0.05; if((srand() % 100) < rate) { std::cout << "event occurred" << endl; } std::mt19937 rng(std::random_device{}()); std::bernoulli_distribution d(0.005); bool b = d(rng); // true 0.5% of time; otherwise false

ios - PFQuery using includekey -

i have 2 tables in parse. activity venues activity holds 2 keys: userid , venueid. want query , retreive venue details in activity table. i'm trying using this: pfquery *query = [pfquery querywithclassname:quoactivityclassname]; [query wherekey:quoactivityfavoritesuserid equalto:[pfuser currentuser]]; [query includekey:quoactivityvenueid]; if (self.objects.count == 0) { query.cachepolicy = kpfcachepolicycachethennetwork; } return query; this retrieves object how grab specific fields in venues table name, address, etc. you can venue returned object pfquery as: venue * venue = object[quoactivityvenueid]; you can do: nsstring * venuename = object[quoactivityvenueid][some_name_id]; nsstring * venueaddress = object[quoactivityvenueid][some_address_id];

What does DateTime now = DateTime.Now; do in C#? -

i found out how current date , time variables (right?) in c# this thread code datetime = datetime.now; string date = now.getdatetimeformats('d')[0]; string time = now.getdatetimeformats('t')[0]; however i'm not sure first line does. after thinking suppose calls current date , time data computer , applies/tells program. by way, i'm noob @ programming , new c#. the first line datetime = datetime.now; takes current time, , stores in variable. reason it's done make sure subsequent calls of getdatetimeformats performed on variable representing same time. if call datetime.now several times, may different time each time make call. for example, if string date = datetime.now.getdatetimeformats('d')[0]; string time = datetime.now.getdatetimeformats('t')[0]; very close midnight, date , time portions may belong different dates.

ruby - PubNub: after enabling Access Manager, unable to publish messages -

i using ruby pubnub sdk on server side , javascript sdk on web front end. after enabling access manager, javascript subscribers had no issues subscribe calls. ruby code returns 403 when "publish" called. i have granted access channel without auth_key (access all). thoughts on cause? turned out forgot granting write access channel.

What is the Grails Artefact Evaluation Order and Context? -

in particular, i'm interested in grails-app/conf set of artifacts: bootstrap, config, datasource, *filters, etc. order important , "context", , don't mean in spring sense, set of variables/symbols available, side-effects, , other info might affect symbol resolution. ideally, can point me @ underlying grails code drives process s.t. can best understand both control flow , symbol resolution.

javascript - Testing XHR with Jest -

i have simple test case: describe ('request', function () { ('should perform xhr "get" request', function (done) { var xhr = new xmlhttprequest; xhr.open('get', 'http://google.com', true); xhr.send(); }); }); the point is: when jest in terminal, seems it's not requesting http://google.com . think happening because jest uses jsdom under hood , haven't capability reproduce http request out of browser itself. suggestions? note: errors appearing, test passing, request isn't being made. there're number of problems: in code example don't create instance of xmlhttprequest. should this: var xhr = new xmlhttprequest() making real requests in tests bad idea. if module depends on data remote server should mock xmlhttpsrequest or use "fake server" (e.g. sinon ). recommend don't make real requests in tests.

ruby - mini_magick initialize error wrong number of arguments (0 for 1) -

i'm experiencing strange behaviour minimagick everything works fine on every develop workations in production this: wrong number of arguments (0 1) if execute service nginx restart i get imagemagick/graphicsmagick not installed only 1 time. every future reload of page arguments error. here's code require 'rubygems' require 'sinatra/base' require 'mini_magick' '/test' minimagick::image.open("/webapps/myapp/testimg.png") end if execute convert: # convert -version version: imagemagick 6.9.0-10 q16 x86_64 2015-03-20 http://www.imagemagick.org copyright: copyright (c) 1999-2015 imagemagick studio llc license: http://www.imagemagick.org/script/license.php features: dpc openmp delegates (built-in): xml zlib any idea?

excel - How to pass value from VBA variable to R in RExcel macro -

i new writing rexcel macros, , have question. taking user input macro through inputbox() . input integer. want pass integer value r. this attempt: option explicit sub kmeansclustering() dim k integer rinterface.putdataframe "mydata", selection rinterface.rrun "testdata <- na.omit(mydata)" rinterface.rrun "testdata <- scale(testdata)" k = inputbox("enter k") ' supply data vba k variable k r variable rinterface.rrun "fit <- kmeans(testdata, k)" rinterface.rrun "aggregate(testdata,by=list(fit$cluster),fun=mean)" rinterface.rrun "result <- data.frame(testdata, fit$cluster)" end sub before using "k" in r must first transfer value r variable (array): rinterface.putarrayfromvba("k_value", k) rinterface.rrun "fit <- kmeans(testdata, k_value)"

node.js - Npm "yo" command error -

i trying use angular-generator when used "yo" command following error: module.js:338 throw err; ^ error: cannot find module 'rx' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:278:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ object.<anonymous> (c:\users\luis\appdata\roaming\npm\node_modules\yo\nod e_modules\inquirer\lib\ui\prompt.js:6:10) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ module.require (module.js:365:17) @ require (module.js:384:17) i try update yeoman using "npm update -g yo" didn't receive answer in command line as per comments: from tutorial page install command should like: npm install -g yo bower grunt-cli gulp worst case, npm install -g rx , see if gets past error.

java - Do I have to use different image sizes on android apps or is there a way to change the image resolution? -

do have use 5 different image sizes on android apps or there other way change resolution of image using bitmap or else? i'm copying 5 different sizes seems there should better way programmatically. it's best load smaller resource smaller screen density , larger resource larger density due how memory larger bitmap has allocate. although need bitmap scale size manage several screen sizes, call bitmap.createscaledbitmap(bitmap src, int dstwidth, int dstheight, boolean filter) another way if drawing bitmap ondraw(), can use drawbitmap() method passing destination rect/rectf image automatically fill.

Having trouble pushing a commit to Git on OSX -

i'm new git user , i'm having trouble getting first commit working. i'm using terminal in osx. i've done far: 1) i've set github account , added repository 2) i've created ssh key , added account 3) i've tested connection domain , github says i've authenticated. 4) i've set repository on local system using: echo "# test" >> readme.md git init git add readme.md git commit -m "first commit" git remote add origin https://github.com/fakename/test.git git push -u origin master and error: ssh: not resolve hostname https: nodename nor servname provided, or not known fatal: not read remote repository. please make sure have correct access rights , repository exists. in ~/ssh director have files id_rsa, id_rsa.pub , known_hosts. have no ssh config file. what missing? thank you. if want use authentication ssh, need use following scheme: git@github.com:<username>/<repository>.git if

Do 'side inputs' in Cloud Dataflow support reading from BigQuery views? -

Image
tried point side-input bigquery view, instead of directly bigquery table. not produce error, returns 0 rows. view works fine inside bigquery. for example, given view referencing table 'types_test' 1 row: in bigquery, works fine: but using view side-input in dataflow return 0 rows: info: reading bigquery table <removed>:cpt_7414_playground.view_test mar 20, 2015 11:10:08 pm com.google.cloud.dataflow.sdk.io.bigqueryio evaluatereadhelper info: number of records read bigquery: 0 do side-inputs support views in bigquery, or need else use view side-input? found in faq's, views not supported. http://goo.gl/zvntnp

java - Formatting an array list into a specific format -

the program writing sort hospital record comes in text file. format of text file lastname,firstname,age,roomnumber, : franklin,benjamin,74,18 hamilton,alexander,25,6 thatcher,margaret,65,3 nixon,richard,45,7 and has printed format, user specify how sorted. format when sorted last name: last first age room coolidge calvin 24 27 franklin benjamin 74 8 hamilton alexander 50 123 nixon richard 45 7 i have been stuck on trying find way store lines , still able print out lines in order keep information together. program has called through command-line , @ same time program called user must specify input file first argument (args[0]) , how sort second argument (args[1]). have tried few different ways keep getting stuck in same place, best way approach this? current code btw. , comment blocks old code have tried , keep around, in case. import java.io.*; import java.util.*; public class patientrecord { public static voi

java - Executable Jar with Dependency on dll -

i attempting deploy swing application uses dll facilitate database connection (using sqljdbc4 jar depends on sqljdbc_auth.dll). deployment strategy creating executable jar file. problem cannot functions rely on sqljdbc_auth.dll work in executable jar create. i can project working fine in eclipse using of following methods: reference folder containing dll in build path configuration specifying native library location on source folder put dll in c:\windows\system32 directory add following vm argument referencing relative path of dll folder in project "-djava.library.path=path/to/dllfolder" the 4th method have tried load dll directly in code via following line. system.load("c:/users/me/desktop/sqljdbc_auth.dll"); have been unsuccessful approach , following error. mar 20, 2015 4:18:44 pm com.microsoft.sqlserver.jdbc.authenticationjni <clinit> warning: failed load sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path however, error doesn&

Working with binary in Python, Splitting numbers -

i have module takes 2 x 8bit numbers in decimal format, specific structure each number must start same 4 bits = 0011 followed varible 8 bits followed 4 bits ignored set 0000 so caculate 16bit number simple enough the varible number * 16 shift 4 bits left, , adding 12288 = 0011|000000000000 give me desired result. so if input number 19 example 19 x 16 + 12288 = 12592 = 0011000100110000 the next step split in 2 x 8 bit numbers 00110001 | 00110000 = 49, 48 how in python can go 12592 49,48 efficiently. never worked in binary in script bit new. cheers to first 8 bits, shift right 8 bits. 0011000100110000 >> 8 == 00110001 to last 8 bits, mask 0b11111111 , i.e. 255 . 0011000100110000 & 0000000011111111 ------------------- 0000000000110000 code example: in [1]: n = int("0011000100110000", 2) in [2]: n out[2]: 12592 in [8]: n >> 8, n & 255 out[8]: (49, 48)

How to use webrtc insde google chrome extension? -

Image
i have developped google chrome extension. i trying integrate webrtc feature inside: navigator.getusermedia = navigator.getusermedia || navigator.webkitgetusermedia || navigator.mozgetusermedia; console.log("step1"); navigator.getusermedia({audio: true, video: true}, function(stream){ console.log("step2"); $('#myvideo').prop('src', url.createobjecturl(stream)); window.localstream = stream; console.log("step3"); }, function(error){ console.log(error); }); i got error: step1 navigatorusermediaerror {constraintname: "", message: "", name: "invalidstateerror"} any idea ? do need special permission use webrtc inside extension ? , possible access webrtc in extension ? regards here screenshot of call "popup" (extension = popup + background) in order use webrtc or speech recognition api in background page of chrome extension, need open page extension in ta

C Preproccessor Pointer Swizzling -

i'm trying avoid problem in static table whereby 1 table references references original table. compiler complains definition of 1 of table members not being found. work around problem, i've been mocking test code, along these lines work? i'm attempting possible? below code reference: #define swiztblmax 256 #define term( name , ...) \ static cli_term name { __va_args__ }; swizzle_tbl[__counter__] = { &name, "name" }; typedef struct cli_term { char* name; cli_term* parent; cli_term* child; }cli_termt; typedef struct swiz_ent { cli_term* t; char* n; }swiz_ent; static swiz_ent swizzle_tbl[swiztblmax]; static cli_term* swizzle(const char* n) { int i; for(i=0;i<swiztblmax;i++) { if(strcmp(n,swizzle_tbl[i].n)==0) return swizzle_tbl[i].t; } return null; } term( ct_show_test, "test", swizzle("ct_show"), null ) term( ct_quit, "quit", null, null ) term( ct_show, &q

javascript - jquery function applying css to image -

well code: (function($) { var images = $( "img" ); $("div.featured-card-box").find(images)[1].css("display", "none"); }); it supposed apply css image doesn't work , i'm new have no idea what's wrong. big answers! your code looks little more complicated necessary: 1) note jquery [1] second image because starts counting @ 0. dom object instead of jquery one, not able use jquery methods on (like trying do). 2) jquery, can access images using same method css selectors: $("div.featured-card-box img")[1] assuming want second image in div class of "featured-card-box" hidden, should trick: $("div.featured-card-box img:eq(1)").hide(); although, equally replace .hide() .css('display','none') edit: here's fiddle: https://jsfiddle.net/vf8d9ske/

vbscript - Search Keyword and rename entire file using VBS -

i spent quite bit looking around. did find 1 method extremely close looking replaces keywords. dim sname dim fso dim fol ' create filesystem object set fso = wscript.createobject("scripting.filesystemobject") ' current folder set fol = fso.getfolder("f:\downloads") ' go thru each files in folder each fil in fol.files ' check if file name contains underscore if instr(1, fil.name, "[wizardry] tv show bob - 13") <> 0 ' replace underscore space sname = replace(fil.name, "[wizardry] tv show bob - 13", "tv show bob s03e13") ' rename file fil.name = sname end if next ' echo job completed wscript.echo "completed!" but said, issue repalces keywords. want replace entire file name want. most of files have group tag before hand this: [wizardy] tv show bob - 13 i want make sure group tag gone can copy file over. unless there way pull file name of current file renamed. any ap

camera - upload captured image to cloudinary in android -

i want upload captured picture image cloudinary have error in statment : cloudinary.uploader().upload(is, cloudinary.emptymap()); java.lang.noclassdeffounderror: org.apache.commons.lang.stringutils i want ask should pass @ define name of pic first the uri , convert string path convert real path inputstream so, pass cloudinary uploading statement private static final int camera_request = 1888; private imageview imageview; textview tv; string s="aa"; map config = new hashmap(); cloudinary cloudinary; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.camera); config.put("cloud_name", "dkepfkeuu"); config.put("api_key", "key"); config.put("api_secret", "secret"); cloudinary = new cloudinary(config); tv=(textview)findviewbyid(r.id.textview); this.imageview = (imageview)

Returning a pointer to array of fixed sized arrays C++ -

i tried searching everywhere, because such perplexing question, wasn't able find looking for. trying create function/method don't know how specify return type, should be: double(*)[3] i want able use query one: double r[3][3]; query ( &output, r ); but instead of r[3][3] , have vector std::vector<double> r_vect (9); , this: query ( &output, reinterpret_cast<double(*)[3]> (r_vect.data()) ); which mess, wanted implement function make readable, say: returntype cast ( const std::vector<double>& r_vect ) { return reinterpret_cast<double(*)[3]> (r_vect.data()); } but can't specify return type. used typedef, , works: typedef double desiredcast[3]; desiredcast* cast ( ... ) { ... } but still curious how without typedefs. you should typedef complicated return types these, rather require reader untangle them. (or redesign don't have complicated types!) but can follow pattern. declare variable of type do d

sql server - How can one get visual studio to do a simple change instead of a drop/add when altering database table columns? -

simply put: i trying use visual studio database project update sql server database i change names of table columns using refactoring tool once column names changed schema comparison before making final changes database however , notice drop column who's name has been changed , re-adds (this leads data loss don't want) how can change settings in someway make simple change not drop/add when changing names of columns see this renaming columns. not sure vs diff code generation, might have modify generated script yourself.

java - Custom Unchecked Exceptions -

okay guys i've been trying figure out past day or so. homework assignment has me creating both unchecked , checked exceptions. checked exceptions believe must handled before compiling (with try & catch or throwing next thing calls it. unchecked exceptions don't understand how custom ones work. caught @ runtime , don't need thrown or encased try & catch if they're custom how ide or whatever know for? example: 1 of custom unchecked files supposed trigger if user adds pokemon party full, how tell ide that's needs happen? exception file looks like: public class partyisfullexception extends runtimeexception { public partyisfullexception() { super(); } public partyisfullexception(string message) { super(message); } } and want implement in method, idk how it. realize can't throw them because user won't expecting them , therefore won't try catch them. public void addtoparty(string name) throws partyisfullexcept

excel - Public function using a Select Case statement spits out #VALUE! errors -

based off of statement in book, calculating whichever pv=nrt value choose select case letter. public function athing(solvefor string, v1 single, v2 single, v3 single, v4 single) variant dim p single dim v single dim n single dim r single dim t single select case solvefor case "p" n = v1 r = v2 t = v3 v = v4 athing = n * r * t / v case "v" n = v1 r = v2 t = v3 p = v4 athing = n * r * t / p case "n" p = v1 v = v2 r = v3 t = v4 athing= p * v / (r * t) case "r" p = v1 v = v2 n = v3 t = v4 athing = p * v / (n * t) case "t" p = v1 v = v2 n = v3 r = v4 athing = p * v / (n * r) case else athing = "can't find varialbe solve for, again" end select end function if put number in select case's place, returns else case. if place case's letter inside, returns #value! error, meaning somehow have incorrect input somewhere. the functi

javascript - How to simulate namespaced events or unbind individual events WITHOUT jQuery? -

i have framework lazyloads ads when scrolled viewport. when page loads, check see in view , load them. if not in view, create scroll event , namespace each 1 can bind , unbind them individually: if (adisinview("ad1") == false) { $(document).on("scroll.ad1", function() { if (adisinview("ad1") == true) { displayad("ad1"); $(document).off("scroll.ad1"); } }); } this way it's easy set scroll.ad1, scroll.ad2, etc., binding , unbinding them individually. this only part of code dependent on jquery. don't want load 50 kb file can have namespaced events. how can using addeventlistener , removeeventlistener? can't use window.removeeventlistener("scroll"); because unbind of scroll events, , namespacing ("scroll.ad1") doesn't exist natively. i haven't found other posts on exact topic. i've heard few people mention jquery source code create

All physical memory is mapped into virtual address of kernel? -

i studying device driver recently, , reminded of concepts of virtual memory. although attended computer architecture classes when student, however, speaking, virtual memory complicated concepts confused me. ee guy, so, please explain view of big picture distinguish concept. can dig technique details myself. when talking virtual memory, talking memory allocation method process. process 1 virtual memory serves, right? 32-bit system 4gb address space, 0-3g assigned user space virtual address, , 3-4g space assigned kernel. called 3g/1g division, post listed below: http://users.nccs.gov/~fwang2/linux/lk_addressing.txt however, post illustrated all physical memory mapped kernel space , , nothing user space. confused me. list part in post here: # thus, in 3g/1g split, kernel has virtual address space of 1gb. remember access physical address, need virtual address start with, kernel. if don't special, 1gb virtual address limits physical space kernel can access 1gb. okay, mayb

c# - SignalR Hub + JSON.NET TypeNameHandling: Error resolving type specified in JSON 'System.Linq.Enumerable WhereSelectEnumerableIterator`2 -

i'm working signalr trying .net client calls methods .net on signalr hub. situation objects being transmitted aren't simple value types (string, int, double, etc); can dtos such generic<< t >> or other non-trivial things. need them deserialized same object type when serialized. accomplish this, believe need set json.net typenamehandling "all". believe need on both client , server. making change typenamehandling on client seems work smoothly, when make change on server, error on server @ connection time, before of requests processed. here how change json.net settings on server: class startup { public void configuration(iappbuilder app) { var serializer = new jsonserializer() { tracewriter = new consoletracewriter(), typenamehandling = typenamehandling.all, }; // register signalr can pick globalhost.dependencyresolver.register(typeof(jsonserializer), () => serializer); app.u

Django Rest Framework - business action specific views? -

i have basic model based view uses model serializer: class actionitemtextserializer(serializers.modelserializer): assignee_name = serializers.charfield(source='get_assignee_name') class meta: model = actionitem fields = ('id', 'created_by', 'created_date', 'project', 'portfolio', 'name', 'description', 'parent', 'priority', 'status', 'assignee', 'assignee_name', 'wf_get_actions') #depth = 1 class actionitemviewset(viewsets.modelviewset): queryset = actionitem.objects.all() serializer_class = actionitemtextserializer so when go /actionitems/ list of them , when go /actionitems/5/ details individual action item. my action items can have specific actions associated them - how go extending have following: get /actionitems/5/assign , model view action item id=5 additional data (i can add via view's serializer suppose)

list - Python recursive no 'in' work around -

so recursive function in list , see if item repeated in list already. ex. l = [1,2,3,4,3] return true. i've completed im not allowed use 'in' function dont know work around. edit: built in functions allowed use len , , index , splice operators. def has_repeats(l): if l == []: return false elif l[0] in l[1:]: return true else: return has_repeats(l[1:]) return false you may consider using recursion compare list in reversed order indexes same, since index @ default returns first occurrence, this: def has_repeats(l): if len(l) <= 1: return false if l.index(l[-1]) != len(l) - 1: return true return has_repeats(l[:-1]) usage: has_repeats([1, 2, 3, 4, 3]) true has_repeats([1, 2, 3, 4, 0]) false so check index of last item len(l) - 1 same l.index should return first occurrence, if don't match, there duplicate before last item, , recursively.

ios - Cordova app suddenly has no console log in Xcode -

Image
my cordova app has been output console.log fine in console of xcode. 1 day (not sure happened), shows blank. followed instructions here nothing works xcode 4 - debug area no longer shows console output (nslog) here have: this shows blank: update 1 i tried old codebase , no console log either. looks xcode configuration specific. messed randomly , automatically. i found out deployment device , start may take minute. if open app manually right after deployed, different instance , no debug available in xcode. have wait xcode run app show console info.

What is the correct way (if any) to use Python 2 and 3 libraries in the same program? -

i wish write python script needs task 'a' , task 'b'. luckily there existing python modules both tasks, unfortunately library can task 'a' python 2 only, , library can task 'b' python 3 only. in case libraries small , permissively-licensed enough convert them both python 3 without difficulty. i'm wondering "right" thing in situation - there special way in module written in python 2 can imported directly python 3 program, example? the "right" way translate py2-only module py3 , offer translation upstream pull request (or equivalent approach non-git upstream repos). seriously. horrible hacks make py2 , py3 packages work not worth effort.

Creating a Class in C#, which file should I use? -

as told in question before, i'm starting learn c# , right i'm beginning classes theory, when going create class found there 2 'templates' [i'm using xamarin on mac], 1 under c# -> general, , other 1 in c# -> monogame. both seems pretty same, want know 1 should use, or differences between both? this 1 located in general: using system; namespace application { public class stack { public stack () { } } } and 1 in monogame: using system; using system.collections.generic; using system.linq; using system.text; using microsoft.xna.framework; using microsoft.xna.framework.audio; using microsoft.xna.framework.gamerservices; using microsoft.xna.framework.graphics; using microsoft.xna.framework.input; using microsoft.xna.framework.input.touch; using microsoft.xna.framework.storage; using microsoft.xna.framework.content; using microsoft.xna.framework.media; namespace application { class stack { } }

How can I hard coded comments area to be shown in particular pages in wordpress? -

in sites use static page front page, , did other static pages show special static content (and embedded object) page sin particular want have comment area shows. my question is: how enable comments -preferred hard code- in particular pages? @ least having same category? i using wordpress 4.1 , avada theme. well can disable comments on over website going settings discussion , uncheck box says, allow people comment on new articles. remove comments on new pages , posts (starting now). when create new page/post click on button on top says "screen options" . check box says "discussion". have new field in post can enable/disable posts individually. if want through code, 1 way create separate files each page e.g page-contact.php, when goes contact page, file served, can clone of page.php , needs comment part removed. way goto page.php , wrap comments code condition if(is_page('contact') || is_page('about')){ // code show comments. comme

CSS background image won't scale -

i'm trying learn html , css. right i'm trying make background image fill browser window no matter size. i've googled 100 times , every page pretty says same thing. copied code , isn't working me. when set browser smaller size, background image repeats itself. don't want want fill window. here's css. html { background-image:url(background.jpg); background-size: 100%; background-image: no-repeat-y; } before did 100%, tried using cover instead , didn't work either. image fullscreen when window maximized when resize image repeat. to scale, css want scale needs inside container itself, namely body inside html container; try this: html { width: 100%; height: 100%; margin: 0; padding: 0; } body { background-image:url(background.jpg); background-size: 100% 100%; background-repeat: no-repeat-y; }

javascript - Parse.com Push not working on Windows Phone 8.1 -

we using parse push notifications on android , ios , works fine! i working on windows 8.1 app, , cannot work. app universal app developed in javascript/html/css. i followed guide using parse dlls in javascript project. https://parse.com/questions/windows-8-javascript-app-push-notifications added new project windows runtime component project , added helper class. downloaded parse sdk , added reference parse.dll , parse.winrt.dll in project. reference , call helper method in new project, in startup of app (in onactivated event). public void initializeparse(string appid, string key) { parseclient.initialize(appid, key); } public void subscribetoparse() { parsepush.subscribeasync(""); } tried both .net-key , client key in above. activated toast notification app. published app windows phone store, , added keys there parse push settings. i can see phone registers parse because can choose use segment windows when pushing. the number of devices mo

linux - Icinga2 cluster node local checks not executing -

Image
i using icinga2-2.3.2 cluster ha setup 3 nodes in same zone , database in seperate server idodb. cent os 6.5. installed icingaweb2 in active master. configured 4 local checks each node including cluster health check described in documentation. installed icinga classi ui in 3 nodes, beacuse not able see local checks configured nodes in icinga web2. configs syncing, checks executing & 3 nodes connected among them. configured local checks, specific node alone not happening , verified in classic ui. a. local checks executed 1 time whenever - 1 of node disconnected or reconnected - configuration changes done in master , reload icinga2 b. after that, 1 check hapenning in 1 node , remaining not. i have attached screenshot of node classic ui. please me fix , in advance.

How do you call a singleton class method from Objective C in a Swift class? -

i have following objective c code need swift class : in logger.m - + (logger *) log { static logger *sharedlog = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ sharedlogger = [[self alloc] init]; }); return sharedlogger; } - (void) printstring:(nsstring *) s { nslog(s) } which in logger.h - + (logger *) log; - (void) printstring:(nsstring *) s; now, have code bridged in swift project - loggeruserapp i'm trying use above print method singleton log shared class method. i've tried - logger.log().printstring("string") // compiler error. use object construction logger() logger().log().printstring("string") // compiler error. logger().log.printstring("string") // compiler error. logger.printstring("string") // not call log can tell me might going wrong? i can't reproduce example completely, @ first sight, should work: logger.log().printstring("string") since

oracle - sql error ora-00933 sql command not properly ended delete -

i try delete data 3 tables, using join. have error : sql error: ora-00933: sql command not ended 00933. 00000 - "sql command not ended" this query: delete news join news_author on news_author.news_id=news.news_id join author on news_author.author_id=author.author_id news_id=16; how can solve problem? can try this.. delete news news ns join news_author na on na.news_id=ns.news_id join author ar on na.author_id=ar.author_id news_id=16;

angularjs - Angular - Place scripts in its own import file -

the idea have thin index.html file, right essay of script tags in development mode this <html> <body> <script></script> <script></script> <script></script> <script></script> <script></script> <script></script> <script></script> <!-- etc --> </body> i thought using <html> <body> <link rel="import" href="imports.html" </body> with imports.html looking like <script></script> <script></script> <script></script> <script></script> <script></script> but kinds of injector errors. main question approach work adjustments? yes, use gulp browserify let use require tags nodejs, , build dependency chain 1 bundled file, can uglify , gzip dramatically lower load time. gulp has many modules this. i'd recommend browser-sync too. i split load

java - Abort a RecursiveTask with a given result? -

i'm facing following problem: i interate on concurrenthashmap of recursiveaction dividing , conquering map. the problem need return first result found specific criteria or if nothing found need return null when "split-tasks" done. for (due fact i'm using recursiveaction instead of recursivetask) i'm able call method , "return;" when task found match thats smells bad. all solutions tried implementing recursivetask needed go through whole map (doing splits) until return value. is there possibility return given result , cancel task prevend furthing processing using recursivetask? perhaps old so answer help. it's form of "short circuit" , need yourself. or can use package another.

Remove var from links using htaccess redirect -

i have read lot of answers not find solution. at moment made redirect in htaccess: redirect 301 /best-verkocht?p=1 https://website.nl redirect 301 /best-verkocht?p=2 https://website.nl redirect 301 /best-verkocht?p=3 https://website.nl the result following link made: https://website.nl/?p=1 what best , easy way rid of var? redirect 301 /best-verkocht https://website.nl? if need limit matches p values 1, 2, , 3, you'll need use mod_rewrite: rewritecond %{query_string} ^p=(1|2|3)$ rewriterule ^best-verkocht$ https://website.nl [l,r=301]

phpthumb - Modx phpthumbof have no effect on image -

<img src = "[[+tv.img:phpthumbof=`w=180&h=150`]]"> this construction returns image original size i tried create phpthumbof/cache 777 i tried reinstall phpthumbof imagemagick installed in php "phpthumb:...allow...docroot..." enabled in config i tried "pthumb", same result i think way attempting use issue, can either try: <img src = "[[!phpthumbof? &input=`[[+tv.img]]` &options=`&w=180&h=150`]]"> or change tv output type "image" then: [[+tv.img:phpthumbof=`w=180&h=150`]] should work. i think might happening tv output path & phpthumbof can't path needs actual image input ~ it's getting ignored.

Django & TastyPie: request.POST is empty -

i'm trying post using curl: curl --dump-header - -h "content-type: application/json" -x post --data '{"item_id": "1"}' http://www.mylocal.com:8000/api/1/bookmarks/ however, request.post empty. below modelresource code: class bookmarkresource(modelresource): class meta: queryset = bookmark.objects.all() resource_name = 'bookmarks' fields = ['id', 'tags'] allowed_methods = ['get', 'post', 'delete', 'put'] always_return_data = true authorization= authorization() include_resource_uri = false def determine_format(self, request): return "application/json" def obj_create(self, bundle, **kwargs): request = bundle.request try: payload = simplejson.loads(request.post.keys()[0]) except: payload = simplejson.loads(request.post.keys()) anybody kno

php - Laravel send value from dropdown list to controller -

i have following code in view page <form action="{{ action('answercontroller@handlecreate') }}" method="post" role="form"> <div class="form-group dropdown"> <label for="question">question</label> <select id="question" class="drop" name="question"> @foreach($questions $question) <option value="{{$question->question}}">{{$question->question}}</option> @endforeach </select> </div> in controller have following code $question = question::wherequestion(input::get('question'))->first(); $n = $question->id; they give me error @ $n=$question ->id telling trying property of non-object instead of using question text value , query id afterwards why don't set id value beginning? <select i

concurrency - Go: invoking methods concurrently isn't working for me -

this question has answer here: what's wrong golang code? 2 answers i'm new go. i'm trying out example want perform concurrent call method. isn't working me (i don't see output). based on "effective go", says concurrency supported methods , functions. doing wrong? thanks, -srikanth package main import ( "fmt" ) type hello struct { int } func (h *hello) myprint (value string) { go func() { fmt.println(value) } () } func main() { h := &hello{100} go h.myprint("need go") } your main exits , process dies before goroutine has chance print output.

ios - NSCollectionView Swift -

i have ios app uses uicollectionview . creating app mac trying use nscollectionview not sure should start. trying add code below not seem available. going wrong? thanks func collectionview(collectionview: uicollectionview, numberofitemsinsection section: int) -> int { return 30 } func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { let cell = collectionview.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) projectscellcollectionviewcell cell.textlabel.text = "\(indexpath.section):\(indexpath.row)" return cell } thanks. i have followed quick start guide , stuck @ part: -(void)insertobject:(personmodel *)p inpersonmodelarrayatindex:(nsuinteger)index { [personmodelarray insertobject:p atindex:index]; } -(void)removeobjectfrompersonmodelarrayatindex:(nsuinteger)index { [personmodelarray removeobjectatindex:index]; } -(void)setpersonmodelarr

javascript onclick get image name without path -

i need copy name of image (name + extension) src attribute without path.. html: <input type="text" id="result" /><br /><br /> <img src="../some_folder/some_folder/photo_name.jpg" onclick="getname()" id="img1" /> js: function getname() { document.getelementbyid("result").value = document.getelementbyid("img1").src; } this code clones full path of image.. path not static, can not cut rest of "src".. in advance you should try code: var filename = fullpath.replace(/^.*[\\\/]/, ''); your js function be: function getname() { var fullpath = document.getelementbyid("img1").src; var filename = fullpath.replace(/^.*[\\\/]/, ''); // or, try this, // var filename = fullpath.split("/").pop(); document.getelementbyid("result").value = filename; }

c# - int.Parse not throwing an exception -

i have custom control contains textbox. custom class has 3 properties, minvalue, maxvalue, , value, defined so: public int value { { return int.parse(text.text); } set { text.text = value.tostring(); } } public int maxvalue { get; set; } public int minvalue { get; set; } when textbox inside custom class loses focus, following method run: void text_lostfocus(object sender, eventargs e) { value = value > maxvalue ? maxvalue : value; value = value < minvalue ? minvalue : value; } if textbox has string larger 2,147,483,647, text stays same when focus lost, , no exception thrown. why exception not thrown, , how can make set values higher int32.maxvalue maxvalue , , values lower int32.minvalue minvalue ? first, there different integer data types in c#. e.g. int32 range -2,147,483,648 2,147,483,647 int64 range -9,223,372,036,854,775,808 9,223,372,036,854,775,807 it's technical not possible have greater range usin

javascript - Optimizing CSS/JS imports for Static website using common a JS document -

coming server side programming background, might noob question. currently have css laid out below , js in similar fashion. <link type ="text/css" href="css/bootstrap.min.css" rel="stylesheet"> <link type="text/css" href="css/custom.css" rel="stylesheet"> <link type="text/css" href="css/template.css" rel="stylesheet"> but have around 40-50 html pages remaining coded , dropped in , pages share same css/js more or less.so, how avoid boilerplate typing.can below var navbar = ['<div class="hi-icon-wrap hi-icon-effect-9 hi-icon-effect-9a" text-align="">', '<a class="hi-icon hi-icon-fa-home" style="text-decoration:none!important" href="index" title="blah"></a>home', '<a class="hi-icon hi-icon-fa-wrench" style="tex

c - Binary Search Tree Nothing Getting Printed -

i'm trying create unbalanced binary search tree given input sequence of (unsorted) integers. approach has been recursively find right place each individual node , allocate memory , define data it. i'm unable debug program despite having scrutinized properly,i can't seem identify problem. input follows: 11 15 6 4 8 5 3 1 10 13 2 11 the expected output should have been post-order , in-order traversals,but strangely nothing getting printed(except newline i've given in between). note: question closely linked bst related question asked,but approach entirely different , challenges i'm facing. hence think twice before going neck , closing down topic. #include <stdio.h> #include <stdlib.h> #include <string.h> #define arrmax 100 /***pointer-based bst implementation, developed abhineet saxena***/ /***the data-type declaration***/ typedef struct node{ int data; struct node* parent; struct node* leftchild; struct node* rightchild; }node; typ