Posts

Showing posts from June, 2010

Issues in PayPal live transaction via PayPal iOS SDK -

i developing ios application ipad, version 7.x. need perform paypal transaction via application. included paypal ios sdk , referring sample code perform transaction. the sample code placed here there enough funds in customer account also, have proper client id , secret key funds needs transferred. both payee , payer have live accounts. transaction via sandbox account sucess upon debugging code, found able create payment. however, error while payment approved. here error details paypal sdk: request has failed error: unknown_error - system error (unknown_error). please try again later. (400) | paypal debug-id: 3e8087cbf6bd1 [live, paypal ios sdk 2.1.2] is there specific configuration need include in our code making live transaction? or there specific configuration needs done, in 1 of accounts? or there missing sample code provided paypal ios sdk? please advice. the issue not using correct clientid. client id using not associated active app yoiur developer po

neo4j - How to query nodes that have a version property with Cypher? -

i've got nodes represent maven artifacts, e.g.: create (n:module {artifactid:"com.my.test", version:"1.0.0"}) return n.artifactid, n.version; someone got idea how query nodes in range of e.g. [1.0.0, 2.0.0]? split version 3 properties version_major, version_minor, version_micro, if results in easier query. if storing version string can rely on lexicographical sort order query: match (n:module) n.version >= "1.0.0" , n.version <= "2.0.0" return n

javascript - Prevent other people from emitting socket info -

i have node socket server running on same vps website is. there way can prevent other "websites" or other node projects connecting socket server , emitting data? my website , node project have same ip address. for example: (client side html) <script> var socket = io.connect('localhost') //localhost example socket.on('example', function(data) { console.log(data) ; }); socket.emit('sendtoserver', 'hello world'); </script> i want code right here usable website (or ip) edit: if there isnt within socket.io, there way can authenticate socket server make ip can emit things if you're concerned it, should consider allowing authenticated users. otherwise trying ban explicit ip addresses , maintaining list isn't feasible.

xaml - windows phone 8 longlistselector loop through all childs -

in app, have longlistselector , set "datacontext = list" in event phoneapplicationpage_loaded. inside longlistselector, have code: <datatemplate> <stackpanel margin="5,10" > <border borderthickness="1" cornerradius="5"> <grid margin="10,8" tap="grid_tap_1" x:name="gridpasta" tag="{binding id_pasta}"> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="60"/> </grid.columndefinitions> <textblock foreground="black" horizontalalignment="stretch" text="{binding nm_pasta}" grid.column="0" textwrapping="wrap" verticalalignment="top" texttrimming="wordellipsis" fontsize="24"/> <border background=&quo

linux - Change swappiness for docker container -

i using docker containerize bunch of services. times, containerized services heavily swaps. i've changed vm.swappiness 1 via sysctl on host system. docker's memory cgroup still have old (default) value of 60. therefore, particular containers' cgroups have same value, parent. sysctl vm.swappiness > vm.swappiness = 1 cat /sys/fs/cgroup/memory/docker/memory.swappiness > 60 cat /sys/fs/cgroup/memory/docker/${container_id}/memory.swappiness > 60 all attempts change swappiness manually (by echoing desired value memory.swappiness file) fails permission denied . subject: how can restrict containers swappiness? i using ubuntu 12.04 kernel 3.13 , docker version 1.1.2 native execution driver (not lxc) of version 0.2 . kernel loaded cgroup_enable=memory swapaccount=1 . if upgrade 3.18 kernel or later, restriction preventing modification cgroup memory.swappiness parameter in child/hierarchy cgroups removed. linux kernel patch removed restriction can

java - Transparent Frame works correctly in Windows, but not in Linux -

the following code results in transparent window in windows (8.1), opaque window in ubuntu (14.04). how can achieve transparent window red outline in ubuntu 14.04? my goal create undecorated window 'rounded (transparent) edges', setopacity() method won't since affect full window, though work on both operating systems. public static void main(string[] args) { jframe f = new jframe(); f.setundecorated(true); f.setbackground(new color(0,255,0,0)); f.setsize(512, 512); f.add(new jpanel() { @override protected void paintcomponent(graphics g) { g.setcolor(color.red); g.drawrect(0, 0, 511, 511); } }); f.setvisible(true); } i've found source of problem. related having multi-monitor setup in ubuntu. regardless, here's solution--which cause work on favored monitor: add following code before setvisible() call: f.setlocationrelativeto(null); i think reason failed because frame

javascript - refocus cursor after click -

this stylistic thing maybe has has worked them shows ingenuity. so, after click div has onclick event, cursor left blinking @ spot clicked. doesn't harm anything, what's way move cursor out of way somewhere? had thought of "focusing" on hidden input seems hacked. <div onclick="dosomething()">click here</div> (if click cursor somewhere within words click here) and shows (at least in firefox) when have "always use cursor keys navigate within pages" checked under preferences > advanced. may not notice unless turn on.

c - corrupted unsorted chunks while calling free() -

*** glibc detected *** ./a.out: free(): corrupted unsorted chunks: 0x00000000007646b0 *** *** glibc detected *** ./a.out: malloc(): memory corruption: 0x00000000007635a0 *** i'm getting above error. i'm sure i'm not using memory after freeing. why above error ? all heaps, store kinds of meta-data inside itself. when malloc or free, heap perform book-keeping functions on heap. if detects totally unexpected in meta-data, crash. normal heap operations highly unlikely cause such problems, program cause. since program has access memory in process including heap meta-data, program have accidentally overwritten of meta-data. a cause writing beyond end of allocated buffer. write allowed , extremely corrupt heap meta-data. when detected heap, program abort.

javascript - grunt dalekjs-task does not close chrome after execution -

hey have following grunt task: module.exports = { options: { browser: ['chrome'], reporter: ['console', 'html'], dalekfile: false }, gui: { src: [ 'tests/gui/login.js', 'tests/gui/navbar.js' ] } }; the problem dalek task not kill chrome instance after executing test. any ideas why? edit: happens when error found during tests. system specs: win7, 64 bit dalek specs: cli tools --> 0.0.4, dalekjs local install --> 0.0.8 cheers izocan that interesting, can specify environment & open issue on @ github; suppose bug. please add reduced testcase. 1 test & stripped down contents of gruntfile, can reproduce this. please post link newly created issue here, people can keep track.

linux - . / instead of / in crontab -

i'm having error while trying execute sh in crontab (or in normal shell) . made user xuser, , in home directory make symbolic link /opt/app /opt/app --> drwxrwxr-- xuser test in folder save serveral sh , jar. now in crontab of user or in shell if tried execute this: ./opt/app/bin/ind.sh -bash: ./opt/app/bin/ind.sh: no such file or directory the sh file #!/bin/sh export java_home=/usr/java/latest/ export path=$path:$java_home export path=$path:$java_home/bin java -jar /opt/app/bin/ind.jar if put space between . / works . /opt/app/bin/ind.sh : command not found error: unable access jarfile /opt/app/bin/ind.jar ( access sh seems problem pass jar hahaha ) someone notice problem?? thanks !!! there big difference, when put space between . , / . no more part of file path alias of source , means "execute content of file in current shell". // execute in subshell ./foo/bar/baz.sh // execute in shell . ./foo/bar/baz.sh // not same file p

gradle - Reference a path outside the project directory -

learning gradle, , running issue. i'd add jar files tomcatee directory compilation classpath, , tomcatee directory lives outside project hierarchy on file system. example, tomcatee directory "c:/servers/tomcatee/". want define property "tomcardir" , add tomcatdir + '/lib/' build path, gradle insists on appending project directory start. how specify absolute path this? i found error. in gradle.properties file, had path tomcat directory enclosed in single quotes. removing them, gradle started treating absoolute file path.

android - How to support layout for xhdpi and xxhdpi devices? -

i facing layout problem support xhdpi , xxhdpi devices. far know, android has no support layout-xxlarge or layout-xxhdpi. android use layout-xlarge support both xhdpi , xxhdpi. reason, facing problem. problems 2 types. 1 top margin issues. there way set top margin both xhdpi , xxhdpi devices. can't use layoutparams or viewgroup.marginlayoutparams. reason using linearlayout define weightsum of children linearlayout. inside children linearlayout, using relativelayout layout. the reason of android 3.2, layout-xlarge, large, normal, small deprecated, , new identifiers introduced, can find here supporting multiple screens | android developers declaring tablet layouts android 3.2 for first generation of tablets running android 3.0, proper way declare tablet layouts put them in directory xlarge configuration qualifier (for example, res/layout-xlarge/). in order accommodate other types of tablets , screen sizes—in particular, 7" tablets—android 3.2 introduces new

php - separating relationships and model functions in Laravel -

everytime i'm writing laravel model gives me feeling of messy code. have relationships , other model functions specially when using domain driven design. though separating relationships , functions. example have user class extends eloqeunt: class user extends eloquent{} and inside class have register functions , password hashing functions etc. also, can declare relationships so: class user extends eloquent{ function post(){ return $this->hasmany('post'); } } for reason smells funky me. solution create entities folder , inside create user folder hold 2 files 1 userrelationship hold of the relationships class: class userrelationship extends eloquent{ function post(){ return $this->hasmany('post'); } } and second actual user class write of functions , class extend userrelationship class instead of eloquent: class user extends userrelationship{ public static function register($email, $pass

javascript - How can I hide filter options in an accordion? -

let's use codepen example: http://codepen.io/desandro/pen/nfrte what if wanted hide filtering options toggling .active class (that display: block, vs display:none default styling)? when on own, accordion behind isotope masonry layout. isotope masonry part bump down. i've tried: $container.isotope('reloaditems').isotope('layout'); after toggle class. thanks.

c# - AuthenticationManager.GetExternalLoginInfoAsync() returns null after nuget update -

after updating nuget packages of mvc5 application (that has been working correctly until now) authentication manager used verify users facebook login returning null. i'm developing solution in visual studio 2012 , using latest webtools. [allowanonymous] public async task<actionresult> externallogincallback(string returnurl) { var logininfo = await authenticationmanager.getexternallogininfoasync(); if (logininfo == null) { return redirecttoaction("login"); } } after googling around, have discovered facebook api has been changed, there no solution how nuget pacakages working mvc5 application. please can guide me on how working again. i have tried following request coming facebook null. adding <system.web><authentication mode="none" /></system.web> <system.webserver><modules><remove name="formsauthentication" /></modules></system.webserver> setting httpcon

jquery - Should I use Ajax POST or GET to create an element in the DB and getting the created ID with Node.JS? -

i want add new element in database , i'd created id. (using node.js) at moment, use ajax post add element in db can't figure how returning id. should use or there way id post ? best practive ? here's code samples: client script: ajaxpost('/newelement', element, function(iddb) { alert(iddb); //it says undefined }); function ajaxpost(path, data, callback) { $.ajax('http://'+ url + path, { type: 'post', data: json.stringify(data), contenttype: 'application/json', success: function() { if ( callback ) callback(); }, error : function(xmlhttprequest, textstatus, errorthrown) { if ( callback ) callback(); } }); } server app.post('/newelement', function(req, res) { querydb.insertelement(client, req.body, function(err, iddb) { if (err) { console.error(err); res.end(); } else { console.log(iddb); //i have returned id here...

Postgres-XL backwards compatible with PostgreSQL? -

is postgres-xl backwards compatible postgresql? if so, setup required take advantage of automatic sharding? is postgres-xl production-ready or merged core? not sure mean backwards compatible. can not take postgres-xl tables , use them in postgres if asking. use standard postgres engine data nodes can use standard postgres drivers , tools it, have connect coordinator nodes. while possible day merged in not count on it, , long way off.

How to select rows from a table where a word appears? (MySQL + PHP) -

i have make search keywords part of computer science work. i have names , descriptions of several dvd's. the user has search word, , displayed names of dvd's word appeared in either title or description. let's columns in table "dvd title" , "description", , word person has entered $keyword. how select rows in mysql $keyword appears @ least once in either columns "dvd title" , "description". thanks reading. appreciated. you create full text index on columns, isn't want do. you need wildcards, , wildcards compare keyword instead of =. wildcard in mysql % select * mutable dvdtitle '%keyword%' or description '%keyword%'; as using php variable , creating string, you've got of own homework.

python 3.4 spirograph error -

from turtle import* math import* def xcord(r,r,p,t): x= (r-r) * cos(t) - (r+p) * cos((r-r)//r*t) def ycord (r,r,p,t): y= (r-r) * sin(t) - (r+p) * sin((r-r)//r*t) def t_iter(r,r,p): t=0 down() goto(xcord(r,r,p,t),ycord(r,r,p,t)) while (t < 2 * pi): t = t+.01 xcord(r,r,p,t) ycord(r,r,p,t) up() return def main(): r=100 r=4 p=int(input("please enter number between 10 , 100: ")) if p < 10 or p > 100: input(" incorrect value of p!") t_iter(r,r,p) input("hit enter close porgram") bye() main() i error: traceback (most recent call last): file "c:/users/coscio/desktop/spirals.py", line 31, in <module> main() file "c:/users/coscio/desktop/spirals.py", line 27, in main t_iter(r,r,p) file "c:/use

javascript - How to specify a city to Moment.js? -

anyone knows how can specify city calculate dst in moment.js? because in brazil cities change dst rule can't use detault timezone calculate it. my work date , city user select, , need calculte de utc date. i'm going countries, in brazil know issue, want know if there way that. you need moment-timezone plugin. for example: moment.tz("2014-10-01 12:00:00", "america/sao_paulo").utc().format("yyyy-mm-dd hh:mm:ss") or: moment.tz("2014-10-01 12:00:00", "america/sao_paulo").toisostring() keep in mind brazil has multiple time zones. it's invalid ask "the time in brazil" - have know where in brazil accurate answer. this wikipedia entry describes brazil's time zones in detail, , has table lists corresponding tz identifiers. also, make sure supply date , time - not date. otherwise, conversion utc meaningless.

Get a smooth CSS steps animation-ending -

i'm using css animations animate sprites many keyframes inline in png file. @keyframes rotate { {background-position: 0 0;} {background-position: -2560px 0;} } .rotate{ animation: rotate 0.75s steps(20) infinite; } i use js add or remove .rotate on user interaction. animations work well, when removing .rotate, sprite go it's initial state. when remove .rotate, want sprite animated until comes initial state. @ moment animation stops. i read steps(number [, start | end]), don't know if can me.

java - Jetty WebSocket api vs the standard JSR 356 API -

jetty 9 supports both it's own jetty websocket api standard jsr 356 api, assume historical reasons (jetty's api precedes final jsr 356 ). i've looked on basic documentation of both apis, examples. both apis seem complete , rather similar. however, need choose 1 on other new project i'm writing, , i'd avoid using api might deprecated in future or might turn out less feature-rich. so there important differences between 2 except obvious fact 1 standardized? implementor of both on jetty here :) the jetty websocket api came first, , jsr-356 api built on top of it. the jsr-356 api few things jetty websocket api not, such as decoder's automatic bin/text object conversion encoder's automatic object bin/text conversion path param handling (aka automatic uri template method param mapping) however, jetty websocket api can things jsr-356 api cannot. websocketcreator logic arbitrary creation of websocket endpoint, access httpservletreque

split or slice a single expect/telnet session into two parts in Python/TCL -

when use concept of multi thread open 2 telnet session connect uut. what thinking instead of opening 2 telnet sessions can use single telnet session split 2 halfs, big room splitted walls. possible python or tcl languages? thanks malli

ruby on rails - force_ssl in production.rb - how to override in controller to just be http -

Image
in production.rb, have config.force_ssl = true and provide exceptions. looks should work (can't find how 3.2.19): class apiitemscontroller < applicationcontroller force_ssl except: :get_item_test but doesn't. i've seen rails 3.2 force_ssl except on landing page don't want adding gems such trivial thing. how work? edit 1 you not able make specialized exceptions using config.force_ssl = true because rails uses rack-ssl , sets strict-transport-security header . don't want disable landing pages, anyway, google uses ranking signal .

java - Restart Timer after .cancel() -

how can restart timer after called .cancel method ? timer declared in oncreate method. timer.scheduleatfixedrate(new timertask() { @override public void run() { --standby_zaehler; if(standby_zaehler < 0) { rndm_groesse = stand_by.length; random_zahl = r.nextint(rndm_groesse); speakout(stand_by[random_zahl]); (;;) { standby_zaehler = r.nextint(60); if (standby_zaehler >= 15) break; } } } }, 1000, 1000); somewhere else call timer.cancel(); but want start again after cancel dont know how . there way ?

c++ - Can someone please tell me what is wrong with this logic? -

i solving question on hackerrank. following question (in brief): there exist n robbers trying rob bank. can stay there atmost g minutes. 2 robbers can enter vault @ time. a[]={a_1,a_2,...,a_n} is user specified array such that a_i is time the i_th robber wishes stay in vault. a heist successful if robbers wish. given n,g, a[]; the output must "success" or "failure". my logic follows: sort(a) in descending order define slot1 , slot2 1st , 2nd person in vault respectively slot1=slot2=g fill in slot1 , slot2 sorted a, such whenever robber finished in slot, next 1 takes place if robbers can accommodated, success, else failure. i try having double pass. first, add time robbers want, halve , round up. that's ideal time. (at point, check if 1 of robbers at/over amount; if so, that's limit.) then, try fit robbers time frame. if can fit them evenly, you're good. otherwise, increase time , try again.

ios - Spontaneous Swift Compiler Errors -

Image
my project had 0 errors/warning xcode 6 beta 1 - xcode 6 beta 6. when updated beta 7, xcode started telling me have 170 errors in project. spritekit methods/objects/properties. still giving me errors on actual release of xcode 6. know these things shouldn't problem, because have had absolutely no trouble building in past exact same code. give example: this kind of stuff happening on project. have uninstalled/reinstalled xcode betas, release several times, no avail. biggest project yet, , i'm incredibly upset can't figure out. hate have rewrite whole project in objective-c. called apple developer support, , things recommend had tried , didn't work. can't seem find else having similar problems online. thanks help. i bet it's implicitly unwrapped optionals turned "normal" optionals. try appending implicitly unwrapped optional operator ! in each line physicalbody referenced, such as: blocksprite.physicalbody!.categorybitmask = ...

objective c - iOS: Get time of app launch -

is possible determine time current app launched moment launch screen first shown? want ensure launch screen shown minimum amount of time. this creates perception app less responsive , bad user experience. technical standpoint, drop breakpoints or nslog s in each of delegate methods on uiapplicationdelegate see order fire in, , run application in time profiler see what's spending time. there wwdc sessions on reducing time user tapping app icon until time when app launched , ready user interaction. best user experience comes making time near-zero possible. users not enjoy looking @ company logo, , prohibited hig.

How to define a Module that is a function in Typescript -

i'm looking way write valid definition file debug in js call: var debug = require('debug')('http') then use like: debug('my debug message'); i have no clue how define debug.d.ts support pattern. wellcome. thanks for use in typescript you'll have separate out call 2 parts so: import debugmod = require('debug'); var debug = debugmod('http'); the definition file ( debug.d.ts ) this: declare module "debug" { function dbg(s:string):(s:string) => void; export = dbg; }

javascript - Canvas tainted eventhough image has Access-Control-Allow-Origin header -

i using cdn server images site here: http://north.fuelthemes.net/ the cdn has "access-control-allow-origin: *" set images. however canvas still tainted. the images used background images.

Adding dynamic rows using jquery -

iam using jquery dynamically add multiples rows in view here code // start counter new row ids // setting number // of existing rows $(".datepick").datepicker(); var newrownum = 0; // bind click event "add" link $('#addnew').click(function() { $(".datepick").datepicker("destroy"); // increment counter newrownum = $(producttable).children('tbody').children('tr').length + 1; // entire "add" row -- // "this" refers clicked element // , "parent" moves selection // parent node in dom var addrow = $(this).parent().parent(); // copy entire row dom // "clone" var newrow = addrow.clone(); // set values of inputs // in "add" row empty strings $('input', addrow).val(''); // insert remove link in last cell $('td:last-child', newrow).html('<a href="" class="remove&

asp.net - Legacy web apps - Determining forward compatibility with modern browsers? -

we have on 200 web applications. used both internally , our external employees. our company's standard has been ie8. planning on changing , adopting ie 10 or 11. also, our external employees may use application in preferred browser (ff, opera, safari, diff. versions, etc.). i know of services such browershots , these check if layout consistent across browsers , tell nothing if functionality still working or not. there other way efficient preliminary check compatibility newer browsers instead of having full out regression test? if checks fail, regression tests can follow , refactoring necessary. we can use tools citrix appdna or modern.ie , iect tool combination explore strategy , update applications

javascript - Disconnect socket.io and send the disconnect reason -

i need disconnect users server using code: socket.disconnect('user disconnected because of ....'); but when handle disconnect event on user side don't see disconnect reason socket.on('disconnect', function(reason){ console.log('user 1 disconnected because '+reason); }); i using node server side , browsers client side, idea how send disconnect reason? it seem there no way such thing can trick using emit function before closing socket code in server side: socket.emit('closereason','user disconnected because of ....'); socket.disconnect(); code in client side: socket.on('closereason',function(reason){ ... });

android - altbeacon reference application cannot find Beacons -

i trying use altbeacon/android-beacon-library. started reference app . followed instruction setup app, still cannot find beacon around. tried locate app, cannot find beacons neither. don't think there wrong radbeacons, since can configure them app on iphone. android phone tried moto x(android 4.4.4) , samsung s3(android 4.4.2), installed apps on both phones, neither of them works. looked log of library, follows: 09-10 15:46:02.571: d/btgatt.btif(1990): btif_gattc_upstreams_evt: event 4096 09-10 15:46:02.571: d/btgatt.gattservice(1990): onscanresult() - address=3d:ac:95:c9:1c:d5, rssi=-64 09-10 15:46:02.571: d/beaconservice(11355): got record 09-10 15:46:02.577: d/wifistatemachine(924): handlemessage: x 09-10 15:46:02.577: d/beaconparser(11355): not matching beacon advertisement. (was expecting ac. bytes see are: 0201061aff4c000215078701d2fa844b429c161417dabc159d00010001c20000000000000000000000000000000000000000000000000000000000000000 also tried install other apps google

python - Duplicate/Archive entry in Django to another model -

i have been @ 2 days , i'm hoping can point me in right direction. trying duplicate entry in table/model model mirrored fields, creating archived version. want happen when user calls update view. what have tried far setting pk none , trying find way move previous version mirrored/archive model. after couple of hours of research gave on path. next thought answer lie pre_save receiver can't find way access model instance save archive model. @receiver(pre_save, sender=instrumentannual) def archive_calc_instance(sender, instance, **kwargs): stored_id = getattr(instance, 'id', none) e = instrumentannual.objects.filter(id = stored_id) archive = instrumentannualarchive(e.field_name, e.another_field_name...) archive.save() as far can tell should work e contains first field model. is there can done code achieve goal or there more 'django' way solve this? i.e. sort of official archive feature? thanks in advance. with of @igor&#

php - MYSQL Group By same id? -

i have following 2 tables : table 1: user id s_id first_name last_name ---------------------------------- 1 2 test test 2 2 hello test 3 2 hello 4 1 john smith table 2: section id section_name ------------------- 1 first 2 section 3 other section based on above 2 tables , write mysql query : select user table , group them s_id ( same s_id) , how that? i s_id = 2 grouped array or object controlled s_id? loop through s_ids , print out first , last name? here example of output: $sections = array['my section'](array('first_name'=>'test' , 'last_name'=>'test'), array('first_name'=>'hello' , 'last_name'=>'test'), array('first_name'=>' now' , 'last_name'=>'hello'))

javascript - Automatically scroll down browser window when div grows -

this question has answer here: javascript mechanism autoscroll bottom of growing page? 6 answers so have div footer on page lets has height of 200 pixels. div has button reveals html objects within div , therefore increases height of div, lets say, 400px. so div 200px 400px , aligned bottom of page. problem when div expanded browser doesnt automatically scroll down window in order show div. result, see top 200 pixels of div ( original size ) , have manually scroll down browser window in order see complete div. is there way using html css can make browser automatically scroll down when div expands? if not, guess possible javascript @ least.. i don't know solution html , css, try javascript solution: div = document.getelementbyid('#your_div'); div.scrollto(0,div.scrollheight); take at: scroll automatically bottom of page .

r - for loop and applying condition to ignore limited data -

i have data.frame in format data.frame': 566171 obs. of 10 variables: $ id : factor w/ 120 levels "2200100","2200200",..: 1 1 1 1 1 1 1 1 1 1 ... $ year : int 1950 1950 1950 1950 1950 1950 1950 1950 1950 1950 ... $ yday : int 1 2 3 4 5 6 7 8 9 10 ... $ date : date, format: "1950-01-01" "1950-01-02" ... $ t_max : atomic -17.2 -23.9 -25 -22.8 -19.4 -19.4 -11.1 -15.6 -17.8 -20.6 ... ..- attr(*, "long.name")= chr "daily maximum temperature" ..- attr(*, "units")= chr "°c" $ rain : atomic 0 0 0 0 0 0 0 0 0 0 ... ..- attr(*, "long.name")= chr "total rainfall" ..- attr(*, "units")= chr "mm" i wrote following loop subset data: library (seas) uniq <- unique(unlist(mdata$id)) (i in 1: length(uniq)){ data_1 <- subset(mdata, id == uniq[i]) d1 <-mksub(data_1)

iOS UITextField.inputView error -

im trying add custom inputview tableviewcell input field, when so, mixed view in app , app crashes. have watched previous solutions haven't found working me. can me that? #pragma mark - tableview data source - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { // return number of sections. return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { // return number of rows in section. return self.taskquestionobjects.count; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { // dequeue custom cell here taskmanagerquestionandanswertableviewcell *cell = [tableview dequeuereusablecellwithidentifier:taskquestionanswercellidentifier]; taskmanagerquestion *questionobject = self.taskquestionobjects[indexpath.row]; cell.taskquestionlabel.text = questionobject.title; cell.taskanswertextfield.inputview = [[[nsbundle mainbundle] loadn

cmd - Access denied error for accessing MySQL database -

hi i'm trying play around mysql database , i'm not sure how should go in creating database or tables. surfed internet stack overflow 1 hour , tried few solutions ended nothing below errors. forgot password too. please unable create new database command create user 'user1'@'localhost'; welcome mysql monitor. commands end ; or \g. mysql connection id 4 server version: 5.6.19 mysql community server (gpl) copyright (c) 2000, 2014, oracle and/or affiliates. rights reserved. oracle registered trademark of oracle corporation and/or affiliates. other names may trademarks of respective owners. type 'help;' or '\h' help. type '\c' clear current input statement. mysql> show databases; +--------------------+ | database | +--------------------+ | information_schema | | test | +--------------------+ 2 rows in set (0.00 sec) mysql> create user 'newuser'@'localhost' identified 'password'

unicode - ContainsRune giving strange results -

i'm running code in go playground: fmt.println(strings.containsrune("\xa0", '\xa0')) i'm wondering, why output false ? according docs , says: containsrune returns true if unicode code point r within s. it seems me code point there, seems strange give false response. "\x0a" not unicode code point. fmt.println(strings.containsrune("\u00a0", '\u00a0')) works, expected.

cmd - Batch Script - Next Largest Number After X? -

ok, i'm making .bat file , i've made of it. need make batch file search in folder next largest number after x , next largest number after , want number stored variable, e.g. : have folder files: 2.txt, 4.txt, 6.txt, , 8.txt. if x=2, find next largest number, four, next largest number after that, 6. , '6' or '6.txt' saved variable can use later. if files 10, 20, 30 , 40.txt , x=10, outcome '30' or '30.txt' stored variable. i have tried googling , have found questions 'find largest numbered text file.' question next largest , 1 after that. thanks in advance helps me! thank you! not tested: @echo off set "root_dir=." set "number=15" pushd "%root_dir%" /f "delims=" %%f in ('dir /b^|findstr /i /r "[0-9]*[^a-za-z]\.txt$"') ( if %%~nf gtr %number% ( set "next=%%~nxf" goto :break_for ) ) :break_for echo %next%

java - Enabling cors in dropwizard not working -

i'm working on dropwizard application , js ui interacte api. need load json data update views have enable cors in dropwizard before that. did staff seems not working because dropwizard returns allways 204 no content. @override public void run(final bgconfiguration configuration, final environment environment) throws exception { final map<string, string> params = new hashmap<>(); params.put("access-control-allow-origin", "/*"); params.put("access-control-allow-credentials", "true"); params.put("access-control-expose-headers", "true"); params.put("access-control-allow-headers", "content-type, x-requested-with"); params.put("access-control-allow-methods", "get, post, put, delete, options"); environment.servlets().addfilter("cors", crossoriginfilter.class).setinitparameters(params); } the bug here filter hasn't been configured url p

php - PDO prepare stops script without giving error -

i looked on solutions couldn't find any. checked code , can't seem find errors it. try { $handle = new pdo("mysql:dbname=" . database . ";host=" . server, username, password); $handle->setattribute(pdo::attr_errmode, pdo::errmode_exception); $handle->setattribute(pdo::attr_emulate_prepares, false); } catch (exception $e) { trigger_error($e->getmessage(), e_user_error); exit; } $senddata = $handle->prepare("insert 'posts' (body, user, comments, likes, username, datetime) values(:body, :userid, 'none', 'none', :username, :datetime)"); $senddata->bindparam(':body',$this->body); $senddata->bindparam(':userid',$this->userid); $senddata->bindparam(':username',$this->username); $senddata->bindparam(':datetime',$this->datetime); $senddata->execute(); i determined code stops before reaches "bindparam" part. stops right after

How to use API KEY with YouTube in angularjs and list videos in a playlist? -

i want list bunch of videos youtube in mobile app using angularjs. preferrably i'd list videos of user/channels specific playlist. i've gotten api key google developer console don't understand how , use it. in documentation go on oauth method. https://developers.google.com/youtube/v3/code_samples/javascript#authorizing_requests tried using example code straight documentation message saying have authenticate first. i'd appreciate this. how authenticate using api key , secondly how make request videos in playlist. ps. i'm newbie developer , i'm using angularjs , ionic framework first learning project. i'm fresh out of codeschool's courses in css, jquery, javascript, backbone , angular. ds. thanks! 1. how use api if want videos of channel need use youtube api v3 . use youtube.search.list with parameters : part=id, snippet channelid=id of channel order=date type=video how find id of youtube channel ? you can find id of channel

Cygwin + WMIC Pagefile Setup -

i've been trying modify pagefile size on drive using cygwin majority or our servers have access cygwin , not straight cmd. here's overview of trials, note last command successful cannot run requires first type 'cmd' command interactively , cannot done via script (as far get): administrator@dock ~ $ wmic pagefileset name='d:\\pagefile.sys' set initialsize=10000,maximumsize=20000 error: description = invalid query administrator@dock ~ $ cmd /c "wmic pagefileset name='d:\\pagefile.sys' set initialsize=10000,maximumsize=20000" error: description = invalid query administrator@dock ~ $ powershell -c "wmic pagefileset name='d:\\pagefile.sys' set initialsize=10000,maximumsize=20000" invalid format. hint: <assignlist> = <propertyname>=<propertyvalue> [, <assignlist>]. administrator@dock ~ $ cmd microsoft windows [version 6.3.9600] (c) 2013 microsoft corporation. rights reserved. c:\cygwin\home\admini

When trying to fetch Google Calendars in iOS, console shows weird api#channel conflicts. How to solve? -

i trying build app fetch google calendar information such calendars, events etc running big problem. this code: #define googleclientid @"client id" #define googleclientsecret @"secret" #define googleauthurl @"https://accounts.google.com/o/oauth2/auth" #define googletokenurl @"https://accounts.google.com/o/oauth2/token" nsstring *const kkeychainitemname = @"calendar panel: google calendar"; - (instancetype)initwithviewcontroller: (uiviewcontroller*) viewcontroller; { self = [super init]; if (self) { _viewcontroller = viewcontroller; } return self; } - (bool)issignedin { nsstring *name = [self signedinusername]; return (name != nil); } - (nsstring *)signedinusername { // email address of signed-in user gtmoauth2authentication *auth = self.calendarservice.authorizer; bool issignedin = auth.canauthorize; if (issignedin) { return auth.useremail; } else { r

ssis - Dynamic Flat File Connection to import new file everyday -

i have create job imports data .csv file database table everyday. have created job , works fine long filename same. the file comes in everyday has different name, trying set dynamic flat file connection. have 1 file load everyday not trying use each loop container , also, not @ script task. i trying see if there other way achieve using ssis. i have created variable path "c:\daily files\" @[user::myfilepath]. using variable in connectionstring expression property of flat file connection manager. but not work. error saying cannot open datafile. can tell me missing here? if need create connection manager file changes name everyday, have write kind of expression so. on other hand, easier way out use each loop container not care name of file long give *.csv in qualifying field.

sql - PHP + Oracle Soft Parsing Dynamically Sorted Queries -

i have php site oci connection oracle 11g database. bind variables in queries don't have hard parsing increases performance. lets want able sort output dynamically clicking button on page. understand can't bind variables order cause in oracle query, can build if statement in php , assign $orderby variable depending on order button clicked. understanding though each time when order clause changes, hard parse required , statements run slow. can this? please help! this 1 of queries: select * v_sopi_purchase_order contractor = :contractorname this can if pseudocode: if (clicked search contractor) { $orderby = "order contractor"; } elseif (clicked search customer) { $orderby = "order customer"; } etc. thank in advance! maksim

Bash Redirecting Output From Multiple Functions to A File -

i trying make script redirect output couple of functions file. here code looks like. #!/bin/bash touch /var/log/test.log results=/var/log/test.log outputformat() { echo "this outputformat" >> results } outputparsefull() { echo "this outputparsefull" >> results outputformat; } outputparsefull; after running this, /var/log/test.log created file blank. want file contain following this outputparsefull this outputformat one line must each function. doing wrong here? you're writing file named results , not using filename in variable $results . echo "this outputparsefulll" >> results should echo "this outputparsefulll" >> $results

logging - Python: Write stdout to log file; output is hexadecimal not ascii -

i'm working on script call executable i/o files. i'm using subprocess , trying shell out exe , stdout log file. problem output simple ascii file , i'm getting hexadecimal file. learning program python (or language matter) so, i'm assuming there type of formatting can don't it. i've done fair bit of searching on site , others haven't i'm using subprocess for. "outradcorr" need on most...any ideas? more code on request. import system modules import os, sys, string, traceback, time, datetime import params subprocess import popen, pipe, stdout ...some code here..... write stdout log file rad_log_file = open(dsfolder + '\\radcorr.log', 'w') # loop through files in raw file list run radiometric correction rawfiles in rawfolderlist: # define file base rawbase = rawfiles.split(".")[0] print ('\nprocessing file: %s \n')%( rawbase ) # define variables raw file process radcorr ra

session cookies - Linkedin authentication request error -

so i'm implementing option login linkedin account, find request error saying: request error we’re sorry, there problem request. please make sure have cookies enabled , try again. or follow link return home page. so did digging , found error pops if don't have cookie linkedin called jsessionid. created when go linkedin.com, not extension authentication page. have explanation , solution? thanks here work around: link approved solution it provides java implementation, , point out more version of library using. hopefully helps.

php - Proguard and Gson - Convert variable name inside arraylist -

in debug, code works fine. when release apk proguard 5, proguard offuscate variables, , when try "jsonify", resulting string offuscated, , so, php script doesn't understand anything. here's code: arraylist lcapturas=...; if (lcapturas != null) { gson gson = new gson(); type listofcapturaobject = new typetoken<list<captura>>() { }.gettype(); json = gson.tojson(lcapturas, listofcapturaobject); } and json string [{"j":"2014-09-10 17:35:25","e":"2014-09- 10","f":"19.3641107,-99.1785061","d":28809,"c":85,"b":2705,"a":1,"l":1,"m":0}] i guess must proguard not offuscate captura objects. there way of disabling option? or how should do??? i resolved issue : -keep class com.pkg.vo.myclass { *; } for each class need keep variable names. stackoverflow didn't

sql - Pass Database Name as a parameter to an Inline Function -

i trying make inline function can used in few dozen stored procedures rather placing code in every single one. function can called various databases need able pass database name parameter. in case, parameter @dbname. here code: create function [dbo].[fn_units] ( @inreportcontrolid int, @dbname varchar(30) ) returns table return ( prep ( select * ( select rtrim(cp.label) + 'reportunit' type, rtrim(cu.label) value, rc.reportcontrolid, curr.symbol, curp.prefix, curp.factor @dbname.corpconventionunit ccu inner join @dbname.corpunit cu on ccu.nunitid = cu.corpunitid inner join @dbname.corpproduct cp on ccu.corpproductid = cp.corpproductid inner join phdreports.phdrpt.reportcontrol rc on ccu.corpconventionid = rc.conventionid inner join @dbname.corpunit cu2 on cu2.corpunitid = cu.corpbaseunitid inner join @dbna

c - what does "representable" mean in C11? -

according c11 wg14 draft version n1570 : the header <ctype.h> declares several functions useful classifying , mapping characters. in cases argument int , value of shall representable unsigned char or shall equal value of macro eof . if argument has other value, behavior undefined. is undefined behaviour?: #include <ctype.h> #include <limits.h> #include <stdlib.h> int main(void) { char c = char_min; /* let assume char signed , char_min < 0 */ return isspace(c) ? exit_failure : exit_success; } does standard allow pass char isspace() ( char int )? in other words, char after conversion int representable unsigned char ? here's how wiktionary defines "representable" : capable of being represented. is char capable of being represented unsigned char ? yes . §6.2.6.1/4: values stored in non-bit-field objects of other object type consist of n × char_bit bits, n size of object of type, in bytes

c++ - Passing my compar function to std::multiset with C++11 -

i have std::multiset, stores std::pair. want first attribute have no constraint on uniqueness, want second 1 unique. so, decided pass own function multiset, in order achieve (if not please let me know). based on this answer, wrote similar function fails, , have no idea why (no idea of λ - , greek :) ). auto f = [](std::pair<float, int>& a, std::pair<float, int>& b) { return (a.first < b.first && a.second != b.second); }; error: error: expression ‘#‘lambda_expr’ not supported dump_expr#<expression error>’ not constant-expression sorry, unimplemented: non-static data member initializers error: unable deduce ‘auto’ ‘<expression error>’ i think cannot pass lambda (runtime construct) template parameter (compile-time construct). using struct operator() works instead: #include <set> struct my_compare { bool operator() (const std::pair<float, int>& a, const std::pair<float, int>& b) { return (

visual studio - Possible to store build configuration in a file other than solution file? -

i work solution has lot of projects in it. created new build configuration speed working it. to speed compiling, set of projects not build in new build configuration. speed debugging, set of projects build release in new build configuration. this great, until have check in change project file, or latest else's changes project file. painful merge changes, or shelve , unshelve them constantly. is possible store build configuration in separate file? ideas workarounds welcome. to answer question directly: no cannot store config in seperate file. unless seperate files solution file of course. there workarounds, stored locally on machine (too long comment i'm posting answer anyway): i set of projects not build in new build configuration just build them once, unload projects not built again. these settings stored in .suo file. if insist on keeping seperate build configuration: ask team if it's ok push source control, maybe others can benefit well? or writ

azure - How can I perform unattended oauth / openid authentication to WebAPI? -

imagine client , service application registered in windows azure. the client console , runs unattended on-premise (e.g. performing tests overnight) service webapi service protected oauth , accessed using openid connect, hosted in azure. how can client authenticate service without sort of user login interaction (i.e. app authenticates service using adal .net)? i tried adal .net daemon webapi sample still pops authentication dialog... thanks! [ edit ] here's code show very how communicate client. app ids etc. correct. var authcontext = new authenticationcontext("https://login.windows.net/common"); var result = await authcontext.acquiretokenasync(serviceappid, clientcredential); var client = new httpclient { baseaddress = new uri("https://localhost:44301/"), }; client.defaultrequestheaders.authorization = new authenticationheadervalue( authenticationheaderscheme.bearer, result.accesstoken); var response = await client.g

python - Round, align and print list of floats with format() -

i need write several floats file using format() method. want round floats given number of decimal places and write them aligned @ same time. here's mwe: a = 546.35642 b = 6785.35416 c = 12.5235 d = 13.643241 line = [str('{:.2f}'.format(a)), str('{:.4f}'.format(b)), str('{:.5f}'.format(c)), str('{:.3f}'.format(d))] open('format_test.dat', "a") f_out: f_out.write('''{:>10} {:>15} {:>16} {:>15}'''.format(*line)) f_out.write('\n') this gets job done seems awfully convoluted me. there better way using format() ? you can add .#f in format alignment. with open('format_test.dat', "a") f_out: f_out.write('''{:>10.2f} {:>15.4f} {:>16.5f} {:>15.3f}'''.format(a, b, c, d)) f_out.write('\n')

Facebook "pre-filling" policy unclear with regards to empty message and the link parameter -

i'm trying publish_actions permissions approved iphone app , been denied twice. first time because, policy says not to, populating message parameter automatically when posting user's wall using graph api. removed message field entirely , kept link parameter. the app rejected again same message figured i'd try definitive answer here before 3 strikes on app submission. both 2.3 platform policy video , written policy explicitly not pre-fill message parameter nothing link parameter. beyond not pre-filling of message parameter must provide way user enter message? if not clear in policy. graph api publish documentation: https://developers.facebook.com/docs/graph-api/reference/v2.1/user/feed#publish "pre-fill" video: https://developers.facebook.com/docs/apps/review/prefill i rejected 3 times same response - can not pre-populate message field. second , third submission, not pre-populating message field. of course expecting facebook reviewer operate