Posts

Showing posts from February, 2013

conflict either by updating the version of the google-services plugin or updating the version of com.google.android.gms to 8.3.0 -

i want use play services 8.4.0 in project giving me error can ?i want use play services 8.4.0 in project giving me error can ? app.gradle compile 'com.google.android.gms:play-services:8.4.0' project.gradle classpath 'com.android.tools.build:gradle:2.0.0-alpha1' classpath 'com.google.gms:google-services:1.5.0-beta2' dependencies { classpath 'com.android.tools.build:gradle:2.0.0-alpha3' classpath 'com.google.gms:google-services:2.0.0-alpha3' } apply plugin: 'com.google.gms.google-services'

PyYAML with Python 3.x -

i've problem using yaml (pyyaml 3.11) library in python 3.x. when call import yaml following error: python 3.4.3+ (default, oct 14 2015, 16:03:50) [gcc 5.2.1 20151010] on linux type "help", "copyright", "credits" or "license" more information. >>> import yaml traceback (most recent call last): file "<stdin>", line 1, in <module> file "/home/mlohr/python-libs/yaml/__init__.py", line 2, in <module> error import * importerror: no module named 'error' error file located in yaml directory, __init__.py yaml use absolute imports. guess that's problem, i#'m not sure. in http://pyyaml.org/wiki/pyyamldocumentation#python3support short path (supposed) python 3 support, i'm not sure if i'm using wrong way. the same issue occurs (that's way found problem) when using python 3 python scripts using yaml. with python 2.7 , 2.6 works without problems. any ...

python - Unable to validate my app on Django -

i reading django documentation , created first app using command: python manage.py startapp books and modified models.py file mentioned in book. from django.db import models class publisher(models.model): name = models.charfield(max_length=30) address = models.charfield(max_length=50) city = models.charfield(max_length=60) state_province = models.charfield(max_length=30) country = models.charfield(max_length=50) website = models.urlfield() class author(models.model): first_name = models.charfield(max_length=30) last_name = models.charfield(max_length=40) email = models.emailfield() class book(models.model): title = models.charfield(max_length=100) authors = models.manytomanyfield(author) publisher = models.foreignkey(publisher) publication_date = models.datefield() then added newly created app 'books' installed_apps list in settings.py file. added 'mysite.books' list , python manage.py validate returned following err...

sql server - How to select the records without duplicating form inner join tables -

from query how can records without duplicate value. need values, if name table , account table c should view when dates field maximum. select a.name , a.dates , b.da , a.id , b.client , b.[address] , b.[city] , b.[state] , b.dot , b.score , b.pay , b.code , b.[country] inner join c on a.account = c.account inner join b on [a].name = b.name c.users = 00 , b.act = 1 order a.dates use distinct ? select distinct a.name , a.dates , b.da , a.id , b.client , b.[address] , b.[city] , b.[state] , b.dot , b.score , b.pay , b.code , b.[country] inner join c on a.account = c.account inner join b on [a].name = b.name c.users = 00 , b.act = 1 order a.dates

linux - Unix: replace variable in file a with value in file b -

i have 2 files in linux, in file there variables these: ${version} ${software_producer} and values of these variables stored in file b: version=1.0.1 software_producer=luc now how can use command replace variables in file values in file b? sed able task? thanks. a simple bash loop suffice: $ cat file 'a' has variable ${version} , has also: ${software_producer} $ cat b version=1.0.1 software_producer=luc $ cat script.bash #!/bin/bash while read line || [[ -n "$line" ]] key=$(awk -f= '{print $1}' <<< "$line") value=$(awk -f= '{print $2}' <<< "$line") sed -i 's/${'"$key"'}/'"$value"'/g' done < b $ ./script.bash $ cat file 'a' has variable 1.0.1 , has also: luc $

android - How to handle GCM Notifications when different GCM notifications receive -

i using gcm notification in app.i parse data in " onmessagereceived " method unique "url" corresponding gcm message.when receive single notification every thing fine,but when receive multiple notifications problem occurs when tap notification last received notification url loads. public void onmessagereceived(string from, bundle data) { string message = data.getstring("message"); string country = data.getstring("country"); string url = data.getstring("url"); string description = data.getstring("description"); string id = data.getstring("id"); } i url gcm notification intent intent = new intent(this, detailview.class).putextra("url", url); taskstackbuilder stackbuilder = taskstackbuilder.create(this); stackbuilder.addparentstack(mainscreen.class); stackbuilder.addnextintent(intent); pendingintent pendingintent= stackbuilder.getpendingintent( 0, pendingint...

nsautoreleasepool - PyObjc autorelease pool -

edit: advice. i'm still not clear on how autorelease pools handled. here's actual code: import platform, time if (platform.system().lower() == "darwin"): appkit import nsspeechsynthesizer foundation import nsautoreleasepool [class's init function] def __init__(self): if (platform.system().lower() != "darwin"): raise notimplementederror("mac os x speech not available on platform.") self.ve = nsspeechsynthesizer.alloc().init() [function throws errors normally] def say(self,text,waitforfinish=false): pool = nsautoreleasepool.alloc().init() self.ve.startspeakingstring_(text) if (waitforfinish == true): while (self.ve.isspeaking() == true): time.sleep(0.1) del pool if load python console , merely import module, fails traceback: traceback (most recent call last): file "<stdin>", line 1, in <module> file "audio/__init__.py", line 5, in <m...

Can't get single checkbox to render in Flask WTF -

Image
i've been searching long time examples on how use checkboxes flask wtf, seems either there no example or there complex ones involve list of checkboxes. i did find 1 example in miguel's blog here , i'm not able checkbox render. here's did: first off, form class: class loginform(form): email = textfield("email address", validators=[validators.required()]) password = passwordfield("password", validators=[validators.required()]) remember_me = booleanfield("remember me", default = false) submit = submitfield("login") and in template: <form class="form-signin" role="form" action="{{ url_for('login') }}" method="post"> {{ form.hidden_tag() }} <div class="form-group"> {{ form.email.label }} {{ form.email ( ** {'class' : 'form-control'} ) }} </div> <div class="form-group">...

math - Numerical problems of computing exponential numbers (from Gaussian PDFs) -

i have list of small exponential values (for example exp(n) , n<-300 ), generated gaussian pdfs. i want compute how each of them proportional sum, example following python-like pseudo-code does: s = 0 # sum of values n in exponents: s += exp(n) n in exponents: k = exp(n)/s # want compute k each n the problem is, since values of n small, summation s turns out 0 sometimes, , i'll division-by-zero error. i know 1 thing can add constant value (say 300) n prevent underflow, it'll cause overflow in other cases. how can solve this? i don't know whether i've expressed myself clearly, if of these doesn't make sense or grammar mistakes, please correct me. in advance. as observed, can subtracting constant value m n . to avoid overflow, not choose fixed m , such m = - 300 . instead, choose m maximum of n . every normalized exponential value @ 1 , hence normalized sum @ number of exponents, should reasonably small.

java - Spinner<Integer> bind to IntegerProperty -

i want use fx8 spinner control, want bind source integerproperty int min = 0; int max = 5000; int step = 500; integerproperty integerproperty = new simpleintegerproperty(); spinner<integer> spinner = new spinner<>(min, max, step); i understand binding set via binding valueproperty in value factory. expects property<integer> , cannot find way cast between integerproperty , property<integer> . obviously below generates compiler error: spinner.getvaluefactory().valueproperty().bindbidirectional(integerproperty); do need manually assign change listener both directions? surely there neater solution using valueproperty , cannot have been unforeseen situation. you can wrap objectproperty: objectproperty<integer> objectprop = new simpleobjectproperty<>(min); integerproperty integerproperty = integerproperty.integerproperty(objectprop); spinner<integer> spinner = new spinner<>(min, max, step); spinner.getvaluefactor...

java - Ant build makes disk used up to 100% -

i sorting out ways increase speed of ant building job. my project contains hundreds of java classes, each ant job of jar building tomcat requires me 1 2 mins. and discovered whenever ant building job being executed, disk percentage on windows task manager boost 100%. i use collegue's computer try, using same version of ant, tomcat, , jdk on same project, @ meantime 10 secs used building jar in computer. opened task manager, discovered disk percentage boosted up, 9x%. but in case, it's 100%. is there way lower disk usage during ant building? or there other way improve ant build speed? i know not satisfying answer, it's ant hits specs of machine. if feels slow user, means machine specs underpowered development tasks. i not know if cached i/o appears i/o in windows task manager, in case means i/o slower ant (cpu). still using rotational storage? maybe replace ssd. also check if you're running out of ram. if run out of ram, i/o increases due page ...

css - How to Pass Parameters with Commas in Less -

i have mixin takes name of shape , coordinates. wondering how pass in coordinates if coordinates contains commas? .clip-path(@shape @coords) { -webkit-clip-path: @shape(@coords); -moz-clip-path: @shape(@coords); clip-path: @shape(@coords); } .foo { .clip-path(polygon, 0 0, 0 100%, 100% 0); /* trying achieve: clip-path: polygon(0 0, 0 100%, 100% 0); */ } note: second comments made torazaburo. please don't use less mixins way add prefixes. more simpler use prefixing tool autoprefixer or prefix-free. that said, below few ways in can achieve output looking for: .clip-path(@shape, @coords) { -webkit-clip-path: ~"@{shape}(@{coords})"; -moz-clip-path: ~"@{shape}(@{coords})"; clip-path: ~"@{shape}(@{coords})"; /* use interpolation display output */ } .foo { .clip-path(polygon, ~"0 0, 0 100%, 100% 0"); /* pass values 1 single string */ } or, use advanced @rest variable option...

ios - Swift Crash libobjc.A.dylib objc_msgSend -

Image
i use crashlytics crashes of app in appstore. users getting crash cannot seem repro on machine (neither few friends tested app through testflight). logs fabric: thread : crashed: com.apple.main-thread 0 libobjc.a.dylib 0x181d09bdc objc_msgsend + 28 1 foundation 0x18304be20 __nsthreadperformperform + 340 2 corefoundation 0x182640efc __cfrunloop_is_calling_out_to_a_source0_perform_function__ + 24 3 corefoundation 0x182640990 __cfrunloopdosources0 + 540 4 corefoundation 0x18263e690 __cfrunlooprun + 724 5 corefoundation 0x18256d680 cfrunlooprunspecific + 384 6 graphicsservices 0x183a7c088 gseventrunmodal + 180 7 uikit 0x1873e4d90 uiapplicationmain + 204 8 <app name> 0x1000b2f0c main (appdelegate.swift:14) 9 libdispatch.dylib 0x18210e8b8 (missing) i can't seem understand means , searched other q...

arrays - Using linked lists in javascript -

are there adventage of using linked lists in javascript? main adventage on arrays (for example) can insert element @ random index without moving every element , not limited size arrays. however, arrays in js dynamically expanded, shrink, , arrays faster access data. can use array.prototype.splice() method (indeed linked lists still faster one) insert data. are there advantages (speed , on) of using linked lists on arrays in javascript then? code of basic linked lists using js. function list() { this.head = null; this.tail = null; this.createnode=function(data) { return {data: data, next: null } }; this.addnode=function(data) { if (this.head == null) { this.tail = this.createnode(data); this.head = this.tail; } else { this.tail.next = this.createnode(data); this.tail = this.tail.next; } }; this.printnode=function() { var x = this.head; while (x != null) { console.log(x.data); x = x.next; } ...

ruby - How can I read multiple documents from a YAML file? -

i want make yaml file consists of hashes. however, cannot iterate on it. when try load yaml file with: yaml.load_file('yamlfile.yml') it returns first hash in file. here example file create: --- :reach_hypo: true :liquid: true --- :reach_hypo: true :liquid: false --- :reach_hypo: true :liquid: true if load above file, get: {reach_hypo: true, liquid: true} the workaround have found add hashes array, write yaml file. there better way, such yaml method, iterate on yaml file? read multiple yaml documents single file streams you can use yaml::load_stream read multiple documents single file. example: require 'yaml' array = [] yaml.load_stream(file.read 'test.yml') { |doc| array << doc } array #=> [{:reach_hypo=>true, :liquid=>true}, {:reach_hypo=>true, :liquid=>false}, {:reach_hypo=>true, :liquid=>true}]

java - Context with BackgroundTask and Facebook -

i have problem android application. if access "app account" it's ok. otherwise if access facebook account credential, context null. how solve this? below code. thank in advance. login.java : public class login extends appcompatactivity { context ctx; private loginbutton loginbuttonfb; private textview info; private callbackmanager callbackmanager; edittext et_name, et_pass; string login_name, login_pass; static final string username = "user_name"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); facebooksdk.sdkinitialize(getapplicationcontext()); setcontentview(r.layout.activity_login); callbackmanager = callbackmanager.factory.create(); loginbuttonfb = (loginbutton)findviewbyid(r.id.login_button_fb); loginbuttonfb.setreadpermissions("user_friends"); et_name = (edittext) findviewbyid(r.id.user_name); et_pass = (edittext) findviewbyid(r.id.user_pass); ...

java - (compile:compileIncremental) javac returned nonzero exit code -

i m working on ubuntu:15.10 export java6_home=/usr/lib/jvm/java-7-openjdk-ppc64el git clonehttps://github.com/fasterxml/jackson-module-scala.git && \ cd jackson-module-scala && \ sbt 'set resolvers += "sonatype oss snapshots" @ " https://oss.sonatype.org/content/repositories/snapshots "' test i following stack trace root@a5d741c5478f:/fasterxml/jackson-module-scala# sbt 'set resolvers += "sonatype oss snapshots" @ " https://oss.sonatype.org/content/repositories/snapshots "' test [info] loading project definition /fasterxml/jackson-module scala/project [info] updating {file:/fasterxml/jackson-module-scala/project/}jackson-module-scala-build... [info] resolving org.fusesource.jansi#jansi;1.4 ... [info] done updating. [info] compiling 1 scala source to /fasterxml/jackson-module-scala/project/target/scala-2.10/sbt-0.13/classes... [info] set current project jackson-module-scala (in build file:/f...

forms - Format of ESAPI encode in an output with DecimalFormat -

i'm working through several forms outputs user , i've applied #esapiencoder.encodeforhtml()# without issue far i'm thrown whether correct way of typing out encode when decimalformat part of it. #esapiencoder.encodeforhtml(decimalformat(hrstotalleave))# would correct method? or it: #decimalfomat(esapiencoder.encodeforhtml(hrstotalleave))# this page using coldfusion if helps @ all. i believe want encode values @ outermost level, #esapiencoder.encodeforhtml(decimalformat(hrstotalleave))# way go. using second example , attempting use format functions on encoded strings potentially lead issues well.

python - Write to NSLog and file PythonObjC -

i'm trying modify script additionally print log file. uses nslog() . i'm still learning python... anyways, here's have far: # cocoa_keypress_monitor.py bjarte johansen licensed under # license: http://ljos.mit-license.org/ appkit import nsapplication, nsapp foundation import nsobject, nslog cocoa import nsevent, nskeydownmask pyobjctools import apphelper import sys class appdelegate(nsobject): def applicationdidfinishlaunching_(self, notification): mask = nskeydownmask nsevent.addglobalmonitorforeventsmatchingmask_handler_(mask, handler) def handler(event): try: nslog(u"%@", event) open("/users/zachary/downloads/foo.txt", "a", 0) myfile: myfile.write(u"%@", event) except keyboardinterrupt: apphelper.stopeventloop() def main(): app = nsapplication.sharedapplication() delegate = appdelegate.alloc().init() nsapp().setdelegate_(delegate) apphelper.r...

javascript - Defining a Class in ES2015, what is the constructor method and why is it essential? -

i in process of learning es2015 , i'm not understanding classes. understanding define class this: class parent { constructor() { // ... } } and subclass this: (where super() must invoked run constructor parent class). class subclass extends parent { constructor(name, description, url) { // subclass must call super invoke parent's constructor method super(); } } what constructor method, why important, , why parents constructor needs invoked when creating instance of subclass? when create new instance of class, constructor method called arguments passed through. in function, put code construct instance of class, initializing properties. class person{ constructor(name){ this.name = name; } sayhi(){ alert(`${this.name} says hello!`); } } let person = new person('jerry');//this param send constructor method person.sayhi(); the result of code alert saying "jerry says hello!". although, constructor method...

Java configuration for int-jms:outbound-channel-adapter from spring integration -

i trying convert xml based configuration java based configuration. can please let me know java annotation based configuration following <jms:outbound-channel-adapter channel="requestchannel" connection-factory="testconnectionfactory" destination-name="${jms.queuename}" message-converter="messageconverter"/> i tried having @ reference doc . not able understand how map above xml annotation config. @serviceactivator(inputchannel="requestchannel") @bean public messagehandler outbound(jmstemplate jmstemplate) { jmssendingmessagehandler handler = new jmssendingmessagehandler(jmstemplate); handler.setdestinationname(...); ... return handler; } @bean public jmstemplate jmstemplate(connectionfactory jmsconnectionfactory) { ... template.setmessageconverter(converter()); return template; } then add connec...

java - Convert W3C TimeZone to device TimeZone android -

what have i have date string server in w3c date format 2016-02-13t09:53:49.871z my problem when post message server , shows 5 hrs before instead of now what want i wanted server timezone converted device timezone , irrespective of region , user see local time format i solved , if 1 needs can refer code public string convertw3ctodevicetimezone(string strdate) throws exception { simpledateformat simpledateformatw3c = new simpledateformat("yyyy-mm-dd't'hh:mm:ss.sss'z'", locale.us); simpledateformatw3c.settimezone(timezone.gettimezone("gmt")); date dateserver = simpledateformatw3c.parse(strdate); timezone devicetimezone = timezone.getdefault(); simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd hh:mm:ss"); simpledateformat.settimezone(devicetimezone); string formatteddate = simpledateformat.format(dateserver); return formatteddate; ...

javascript - Jquery Works only once for alert of Bootstrap I am showing on page Asp.net -

i want work every time. every time click on save button without refreshing page. here code. jquery code in admin.master: <script> $(document).ready(function () { $("#successalert").hide(); $("#sucess").click(function showalert() { $("#successalert").alert(); $("#successalert").fadeto(2000, 500).slideup(500, function () { $("#successalert").alert('close'); }); }); }); settings.aspx code <div class="modal" id="menuiconmodal" tabindex="-1" role="dialog" aria-labelledby="mylargemodallabel"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"> <span aria-hidden=...

asp.net - How to get the file path using key from webconfig file -

i have json file stored in d drive. have mentioned same in web config file. please refer below code <appsettings> <add key="inputfilepath" value="d:\products.json"/> </appsettings> when try file path using below code, getting null value. string filepath = configurationmanager.appsettings["inputfilepath"]; please can 1 me on this you need call this string filepath = configurationmanager.appsettings["inputfilepath"].tostring();

.net - How to eliminate for each loop? -

i using following code excel.exe starting time. (following code okey) each prog process in system.diagnostics.process.getprocessesbyname("excel") label100.text = prog.starttime.tostring next but need more professional code. so, how eliminate each loop? best wishes. you can store result of process.getprocessesbyname , check if it's length >= 1 : dim excelprocs = system.diagnostics.process.getprocessesbyname("excel") if excelprocs.length >= 1 label100.text = excelprocs(0).starttime.tostring() else messagebox.show("error") end if or use enumerable.firstordefault linq method: dim excelproc = system.diagnostics.process.getprocessesbyname("excel").firstordefault() then can check if excelproc isnot nothing before use it: if excelproc isnot nothing label100.text = excelproc.starttime.tostring() else messagebox.show("error") end if

android scrollview child setAlpha - Scrolling jurky -

i using scrollview, within scrollview have linearlayout fews imageview childs, i'm facing issue whenever, doing cellseatlayout.setalpha(0.3f) ; scrollview child , scrollview scrolling g et stcuk means smoothness gone, , remove alpha using cellseatlayout.setalpha(1); scrollview working fine below code how using setalpfa() refreshing scrollview childs //check enable/disable if(data.isenabled){ cellseatlayout.setalpha(1); //cellseatlayout.setenabled(true); } else { cellseatlayout.setalpha(0.3f); //cellseatlayout.setenabled(false); }

java - How can I transform a List of List (multidimensional List) to an Array of Array(multidimensional Array)? -

i have written code, @ run time have error: [ljava.lang.object; cannot cast [[ljava.lang.string; please me, thanks!!! public java.util.list<string> concatall(java.util.list<java.util.list<string>> mergedlist) { java.lang.string [][] mergedarray = (string[][])mergedlist.toarray(); iterator<java.util.list<string>> itr = mergedlist.iterator(); java.util.list<string> list1 = itr.next(); java.lang.string [] firstarray = (string[])list1.toarray(); int totallength = firstarray.length; (string[] array : mergedarray) { totallength += array.length; } string[] result = arrays.copyof(firstarray, totallength); int offset = firstarray.length; (string[] array : mergedarray) { system.arraycopy(array, 0, result, offset, array.length); offset += array.length; } java.util.list<string> finallist = ar...

haskell - HDBC-postgreSQL bytea fields get returned as SqlByteString hex strings -

when select bytea fields filled binary data in postgres database using hdbc-postgresql driver (version 2.3.2.3), come out as: sqlbytestring "\x<hex representation of binary data>" that is, returns bytestring contains string containing \x followed hex representation of binary data. inconvenient, dreadfully inefficient , makes no sense me. is there reason why doesn't return sqlbytestring containing byte string actual binary data inside it? there missing, or how configure driver that? thanks this longtime known issue library. see this bug example. the broader problem getting raw bytes requires fair amount of cleverness postgres api doesn't make obvious. have call entire query binary rather text output (which arguably better anyway, require rewrite of portion of binding layer). you can see where pqexecparams called , note called last parameter of 0, postgres docs means comes in text. , postgres means funny hex representation see. if...

Android: Share to Messenger.. unfortunately stopped -

i tried send id of image activity activity. unfortunately stopped. couldn't find solution. main activity. kept image id in class utils. gridview.setonitemclicklistener(new adapterview.onitemclicklistener() { public void onitemclick(adapterview<?> parent, view v, int position, long id) { intent intent=new intent(mainactivity.this,sendactivity.class); intent.putextra("id",utils.thumbnail_ids[position]); startactivity(intent); } }); and sendactivity tried share image messenger: intent intent = getintent(); position=getintent().getextras().getint("id"); now code share messenger: private void onmessengerbuttonclicked() { // uri can reference file://, content://, or android.resource. here use // android.resource sample purposes. uri uri = uri.parse("android.resource://com.example.amit.bengalistickerfun/drawable/" + ...

scanner in java not working on my machine -

public class collectiontest { public static void main(string args[]) { //create scanner instance input user scanner scanner = new scanner(system.in); system.err.println("please enter first number add : "); int number = scanner.nextint(); system.out.println("enter second number add :"); int num = scanner.nextint(); //adding 2 numbers in java calling method int result = add(number, num); system.out.printf(" addition of numbers %d , %d %d %n", number, num, result); } public static int add(int number, int num){ return number + num; } } i wonder what's wrong code.when run program on new laptop works fine. on old pc gives error. please me out.thnx in advance.d check pc's java version. java scanner included specific version.java.util.scanner introduced in version 1.5 ("java 5"). make sure have same java version 1.5 or higher on o...

ios - Swift / How to parse the correct element from a web blog with NSXMLParser -

i'm trying download specific information web blog following code: func parser(parser: nsxmlparser, didstartelement elementname: string, namespaceuri: string?, qualifiedname qname: string?, attributes attributedict: [string : string]) { if elementname == "item" { currentevent = eventposts() return } if elementname == "eventdate" { parsedelement = "eventdates" } } func parser(parser: nsxmlparser, foundcharacters string: string) { let str = string.stringbytrimmingcharactersinset(nscharacterset.whitespaceandnewlinecharacterset()) if parsedelement == "eventdates" && str != "" { if currentevent.eventdates.isempty { currentevent.eventdates = str print(currentevent.eventdates) } } the issue is, parser downloads 1 element " eventdates " web bl...

ios - Multiple dialogs are created when chatting Quickblox -

while creating chat dialog group. e.g user creating dialog , user b want use dialog. scenario occurring user create 1 dialog , user b create dialog. not able chat each other because of 2 different dialogs. below code using create dialog :- -(void) movetochatview:(qbchatdialog *)chatdialog objfriend:(friend *)objfriend { [qbrequest createdialog:chatdialog successblock:^(qbresponse *response, qbchatdialog *createddialog) { // success, } errorblock:^(qbresponse *response) { }]; } edit :- there method createorjoinroomwithname?? to if want add user in groupchat need update group dialogue. qbchatdialog *updatedialog = [[qbchatdialog alloc] initwithdialogid:@"53aac645535c12bd3b008a40" type:qbchatdialogtypegroup]; updatedialog.pushoccupantsids = @[@"300", @"301", @"302"]; updatedialog.name = @"school friends"; [qbrequest updatedialog:updatedialog successblock:^(qbresponse *responce, qbcha...

node.js - How to interpret this jade code into HTML? -

i'm learning jade , following tutorial on user account creation. i using jade html converter, program can't seem figure out bit of code: #user h1.text-center.login-title welcome #{user.firstname}. check details below: div.signup-wall ul.user-details li username ---> #{user.username} li email ---> #{user.email} li first name ---> #{user.firstname} li last name ---> #{user.lastname} specifically, #{user.firstname} part confusing. mean, , how 1 translate html? it's templating engine variable, it's supposed injected while rendering jade html, done server this: app.render('login.jade', { user: { username: 'xyz' } }) if you're trying convert (login.jade) pure html (login.html) chances can't translated because pure html isn'...

ios - use same app icon as previous version -

Image
in itunes connect website, went upload new version of ios app , noticed there empty placeholder app icon. i assume doesn't make sense developers have upload new app icon every version. how can use old app icon? i found out apple forces app icons not have transparencies. my icon contained alphas. i had remove alpha doing file->export mac preview unchecking alpha , uploading exported .png itunes connect. the transparency reason why icon removed, because have used icon during many updates before, apple no longer allows icons transparency. as stated in stackoverflow post.

android - Alarm not going off when it should -

i'm working on alarmmanager ; i've created alarmmanager (based on tutorial) can set go off @ specific time, problem here set time , click ok button in timepickerdialog alarm goes off no matter when should. however, toast shown when it's supposed to. what missing? here code: androidtimeactivity.java public class androidtimeactivity extends activity { notificationcompat.builder mbuilder; timepicker mytimepicker; button buttonstartsetdialog; textview textalarmprompt; timepickerdialog timepickerdialog; final static int rqs_1 = 1; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textalarmprompt = (textview)findviewbyid(r.id.alarmprompt); buttonstartsetdialog = (button)findviewbyid(r.id.startsetdialog); buttonstartsetdialog.setonclicklistener(new onclicklistener(){ @override public void onclick(view v) { textalarmprompt.settext(""); opentimepickerdialog(false); ...

python - Can someone explain this recursive for me? -

i code leetcode. class solution(object): def mypow(self, x, n): if n == 0: return 1 if n == -1: return 1 / x return self.mypow(x * x, n / 2) * ([1, x][n % 2]) this code used implement poe(x, n) , means x**n in python. i want know why can implement pow(x, n) . it looks doesn't make sense... i understand if n == 0: , if n == -1: but core code: self.mypow(x * x, n / 2) * ([1, x][n % 2]) is hard understand. btw, code works on python 2.7. if want test on python 3, should change mypow(x*x, n / 2) * ([1, x][n % 2]) to mypow(x*x, n // 2) * ([1, x][n % 2]) the recursive function compute power (most integer , non negative or -1 , power) of number, might have expected (something x = 2.2 , n = 9 ). (and seems written python 2.x (due n/2 having expected result of integer instead of n//2 )) the initial returns straight-forward math. if n == 0: return 1 if n == -1: return ...

php - Check if a user has voted for the maximum number of items he can vote for -

table items id maxvotes parent type 10 2 9 heading 11 0 10 item 12 0 10 item table votes userid votedfor parent 1 11 10 1 12 10 2 12 10 i'm trying check if item exists, , if user has voted maximum number of items permitted under heading. in example above, table items contains items. table votes contains votes cast users. table items type : heading specifies maximum number of items user can vote col : maxvotes . in case, it's 2 . in table votes user 1 has voted on 2 items , can vote no more items under heading. user 2 can vote 1 item more. it goes on that. the way current (using php), to: select id, parent items id = 11 //the item exists. select maxvotes items id = parent // gives me maximum items user can vote for. select count(votedfor) votes votes userid = 1 // this'll give me 2. user 1 can vote no more, user 2 can vote once mor...

php - Cron mail function with Content Type text/html -

there possibility add content type cron command? i'm doing this: /usr/local/bin/php /usr/home/login/domains/domain/public_html/cron/script.php > | mail -s "content-type: text/html; charset=utf-8" "topic" example@example.com but not working... the -a option mail command allows specifying header - you're passing content-type subject argument. try this: mail -a "content-type: text/html; charset=utf-8" -s "topic" example@example.com

arrays - Efficient reduction of multiple tensors in Python -

i have 4 multidimensional tensors v[i,j,k] , a[i,s,l] , w[j,s,t,m] , x[k,t,n] in numpy, , trying compute tensor z[l,m,n] given by: z[l,m,n] = sum_{i,j,k,s,t} v[i,j,k] * a[i,s,l] * w[j,s,t,m] * x[k,t,n] all tensors relatively small (say less 32k elements in total), need perform computation many times, function have little overhead possible. i tried implement using numpy.einsum this: z = np.einsum('ijk,isl,jstm,ktn', v, a, w, x) but slow. tried following sequence of numpy.tensordot calls: z = np.zeros((a.shape[-1],w.shape[-1],x.shape[-1])) s in range(a.shape[1]): t in range(x.shape[1]): res = np.tensordot(v, a[:,s,:], (0,0)) res = np.tensordot(res, w[:,s,t,:], (0,0)) z += np.tensordot(res, x[:,s,:], (0,0)) inside of double loop sum on s , t (both s , t small, not of problem). worked better, still not fast except. think may because of operations tensordot needs perform internally before taking actual product (e.g. permuting axes). i wonde...

c# - Is there any way to support secured connections by using "SocketActivityTriger"? -

while developing uwp application have strange issue establishing ssl/tls connection. i use streamsocket establish ssl/tls connection , work fine. socket.enabletransferownership(taskid,socketactivityconnectedstandbyaction.wake); await socket.connectasync(hostname, port, socketprotectionlevel.tls12); after transfer socket ownership "socketactivitytrigger," found data recieve socketactivity wrong. await socket.cancelioasync(); socket.transferownership(socketid); but if use plain socket establish connection, thing work fine. is known problem? because can't find solution in develop guidelines. or i'm doing wrong?

javascript - Passing key press event from HTML element to python? -

i have html page displayed qwebview control in pyqt. html page consists of 'input' element given below <html> <body> <input id="username"></input> </body> <html> the code snippet of python part display above html given below view = qwebview() view.load('myview.html') view.show() i handling key events of qwebview in python part below def keypressevent(self, event): print event.key() this works fine; , can see key fired in qwebview. once click in input element , try edit few values, keys not getting in keypressevent. internally handled in html element think. want pass key events python part simultaneously; thinking of little bit hacking kind of work accomplish this. any solution appreciated. thanks in advance i'd try using qwebview @ qwebelement receive html input. documentelement = view.page().currentframe().documentelement() input = docume...

scriptella - FatalBeanException while using with spring - when calling etlexecutor.execute() - No Internet -

i have spring based app uses scriptella etl. works fine when connected internet. if not, etlexecutor.execute() throws below exception saying org.springframework.beans.fatalbeanexception: unable load group definition: group resource name [classpath:scriptella/driver/spring/beanfactory.xml], factory key [scriptella.driver.spring.factory]; nested exception org.springframework.beans.factory.beandefinitionstoreexception: ioexception parsing xml document class path resource [scriptella/driver/spring/beanfactory.xml]; nested exception java.net.unknownhostexception: www.springframework.org @ org.springframework.beans.factory.access.singletonbeanfactorylocator.createdefinition(singletonbeanfactorylocator.java:444) @ org.springframework.beans.factory.access.singletonbeanfactorylocator.usebeanfactory(singletonbeanfactorylocator.java:368) @ scriptella.driver.spring.etlexecutorbean.getglobalthreadlocal(etlexecutorbean.java:163) @ scriptella.driver.spring.etlexecutorbean.setcon...

laravel wordpress blog install at blog.example.com how? -

i want install wordpress blog alongside laravel website, @ address http://blog.example.com . have read online examples wordpress installed @ http://www.example.com/blog , conditions added nginx config file. understand lot easier if install wordpress http://blog.example.com , 301 redirects? explain how go doing this? thanks.

Send packet from server to a specific client using TCP c# -

i writing client-server application. client sends udp broadcast message out trying locate server, server sends udp broadcast message out identifying location. when client receives message identifying servers location attempts connect server using socket.connect(remoteendpoint). the server listens these tcp requests on listening socket , accepts requests using listensocket.accept(). clients details stored in array (including ip , port number) the client sends message server information username , password user entered. the server checks database username , password , depending on result sends tcp message (this breaks) client sent request check u&p using listening socket. trying use below code send tcp message not work error. tcpsocket.sendto(message, clientsarray[i].theirsocket.remoteendpoint); i'm not sure method using. but in c# there 2 common classes can use server : tcpclient & socket in tcpclient ... //start server int32 port = 13000; ipadd...