Posts

Showing posts from June, 2013

ios - Swift3 center UIbutton -

ok, have added button .swift storyboard, have added following code viewcontroller.swift @iboutlet weak var hellobutton: uibutton! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. hellobutton.frame.origin.x = view.frame.size.width / 2 } however when test on iphone 5s moves right of screen , not make centered. unsure need make button centered. yes first helloworld app, , maybe on head, understand web programing, , understand make center automaticilly need have screen view width total , button width. need button divide screen view width 2. for example in css this #button{margin:0 auto;} but not html or css. it's swift3 try this: hellobutton.center.x = view.frame.width/2 yours not correct because origin.x first point (top left) of button view, not center of view, can change it's background color different color see it also, variable name should lowercase, followed code conv

java - Spring Data + MongoDB somehow extremely slow after upgrade to macOS Sierra -

after upgrading macos sierra, communication between spring data , mongodb somehow extremely slow, not usable. concretely, collection of interactions database took ~100 ms, takes ~10 minutes. i'm using recent stable versions of driver , spring data: mongodb java driver <dependency> <groupid>org.mongodb</groupid> <artifactid>mongodb-driver</artifactid> <version>3.3.0</version> </dependency> spring data mongodb <dependency> <groupid>org.springframework.data</groupid> <artifactid>spring-data-mongodb</artifactid> <version>1.9.3.release</version> </dependency> furthermore, have installed mongodb using homebrew. mongod --version : db version v3.2.9 git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c openssl version: openssl 1.0.2h 3 may 2016 allocator: system modules: none build environment: distarch: x86_64 target_arch: x86_64 i not su

javascript - how to get western number pattern (seperated with commas) -

my value coming in input 3440.00 , need show 3,440.00 more example: 10,05,000.00 should 1,005,000.00 i got data spring mvc thymeleaf <input type="text" class="form-control inputdata" id="abcd" th:value="${selecteddetails.abcd}" readonly="readonly"/> js is: $(document).ready(function() { var a=$("#abcd").val(); console.log(a); function *format(a)* { console.log(acquisitioncost); return a.tolocalestring("en", { usegrouping: true,}); } i hope problem in javascript. how call method format? help please. please check below snippet. function format1(n) { n = parsefloat(n); return n.tofixed(2).replace(/./g, function(c, i, a) { return > 0 && c !== "." && (a.length - i) % 3 === 0 ? "," + c : c; }); } $(document).ready(function(){ var = $("#abcd").val(); console.log(format1(a)); }); <script src=&

How do I replace columns with fewer than x values with NA in R -

i have matrix columns have 10 rows. want replace values in each column has fewer 10 rows. how accomplish in r? thanks you can try this df[df==""] <- na name dist 1 0 2 <na> 3 100 4 2 5 1 6 4 7 <na> 8 1 9 1 #data df <- data.frame(name = rep("a",9), dist = c(0,"",100,2,1,4,"",1,1))

How to submit the Ionic frame work form in Laravel 5.2 controller using post request -

this ionic view <form name="profileform" novalidate ng-submit="submit()"> <div class="row row-center"> <div class="col text-center"> <div class="hero" style="background-image: url('img/profile-bg1.jpg');"> <div class="content"> <div class="avatar" style="background-image: url(http://203.193.173.125:8001/assets/images/{{userprofile.image}});"></div> <h3><a class="light">{{userprofile.name}}</a></h3> <h4>{{userprofile.mobile}}</h4> </div> </div> </div> </div> <div class="row row-center"> <div class="col"> <label class="item item-input"> <span clas

json - Android List View load more items when scroll to bottom and add footer loading view -

Image
i using list view custom rows each item has 2 images , text field. when user scroll bottom: i want load more data web-service . add loader in list view footer. currently doing in way listview.setonscrolllistener(new abslistview.onscrolllistener() { @override public void onscrollstatechanged(abslistview view, int scrollstate) { } @override public void onscroll(abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount) { if (postadapter == null) return; if (postadapter.getcount() == 0) return; int l = visibleitemcount + firstvisibleitem; if (l >= totalitemcount && !refreshlayout.isrefreshing()) { listview.addfooterview(footer); dataifinternet(0); } } what do: when user scroll bottom , part of last item comes visible it start loading data. add footer view. bu

java - Are actions allowed in MVVM? Android -

if mvvm data binding , cannot view.dothis() , otherwise it's mvp, how invoke actions on views? suppose have view has snackbar . view controlled viewmodel . how viewmodel supposed show snackbar without going snackbar.show() ? in mvvm, viewmodel captures state of view. view observes viewmodel changes , updates itself. thus, communication between view & viewmodel happens through change of values (as against method calls in mvp). since snackbar global behaviour (like toast), can implemented @ activity/fragment level. so, can make messagehelper interface , pass viewmodel dependency. activity implement , display snackbar . example: itemviewmodel consumes interface activity base class implements interface however, possible there view specific behaviour cannot implemented @ activity level. such cases, can make use of databinding.observable trigger event. example, lets want animate particular view. can create bindingadapter @bindingadapter({"shaket

Could not resolve host on cURL request PHP -

i'm starting build first api, after succesful testing on localhost(mac os x el capitan) uploaded digitalocean server running ubuntu 16.04. i've both tried run curl request localhost , server api stored , both of them return "could not resolve host" error error number 6. code: on api side just echo "200";exit; on client side $token = 'this session token'; $url = "http://xx.xx.xx.xx/api/index.php"; $data = array('username'=>'username','password'=>'password'); $datajson = json_encode($data); $message = $url . $datajson . 'put'; $publishthis = base64_encode( hash_hmac('sha256', $message, 'secret key', true) ); $len = 'content-length: ' . strlen($message); $ch = curl_init(); curl_setopt($ch, curlopt_url, urlencode($url)); curl_setopt($ch, curlopt_httpheader, array('content-type: application/json',$len, 'authorization: ' .

arduino - How to use pwm.h -

how can use esp8266 library pwm.h? if include library in arduino project, error: undefined reference pwm_init i need 40khz sine wave ultrasonic sensor , analogwrite works bad @ high frequencies. sorry, if answer obvious, have been googling problem few hours , can't find useful. edit i think correct pwm.c file . have put it? tried adding file project doesn't work. guess has dependencies other files in library. how add c library arduino project? , why not included in esp8266 core library if there header pwm.h? the libpwm.a part of esp8266 sdk, if installed esp8266 addon arduino boards manager , library should in : .arduino15/packages/esp8266/hardware/esp8266/<sdk version>/tools/sdk/lib/libpwm.a in order use pwm, should include in sketch pwm.h forcing c mangling : extern "c" { #include "pwm.h" } then in order link libpwm.a should customize link command creating custom plateform configuration file .arduino15/packages/esp

html - My links are not valid 404 - but they work -

Image
i'm making html email, , both mail-tester.com , apsis (used mailsending) says links not valid. mail-tester.com says it's due 404 error. but links seems work perfectly, , there no redirects on landing pages. i've tried without " http://www ." without "http://" , " https://www ." nothing works. one of links are: http://www.pieces.com/ch/de/pc/taschen/ does know what's going on? i ran quick test , shows http://www.pieces.com/ch/de/pc/taschen/ redirecting , goes in redirection loop. i used php code below run test , displays 302 status. <?php $ch = curl_init(); curl_setopt($ch, curlopt_url, 'http://www.pieces.com/ch/de/pc/taschen/'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_header, 1); $response = curl_exec($ch); curl_close($ch); var_dump($response); output above code string(1482) "http/1.1 302 found date: thu, 22 sep 2016 12:08:19 gmt content-type: text/html;charset=u

sql server - Sqlserver group by pending days period -

i have table structure below, state application_count pending_days _________________________________________ tn 10 0 tn 20 1 tn 60 2 tn 10 3 mh 40 1 mh 50 3 mh 20 5 mh 30 8 i want sum application_count based on state , pending_days period. have group pending_days 0 1 days, 1 3 days, morethan 3 days expected output: state application_count _________________________ tn 30 tn 70 mh 40 mh 50 mh 50 give additional column, group_num using case expression based on condition of pending_days column. then find sum group group_num , state columns. query select t.[state], sum(t.[application_count]) [application_count] from( select [group_num] = ( case when [pending_days] between 0 , 1 1 whe

c# - .net Serializing XML in a compact, human-readable way -

i'm serializing structure results in output: <nachrichtenkonfiguration> <elemente> <element> <typ>bool</typ> <bezeichnung>gut</bezeichnung> </element> <element> <typ>int</typ> <bezeichnung>dauer</bezeichnung> </element> </elemente> <name>teiledaten</name> </nachrichtenkonfiguration> and rather this: <nachrichtenkonfiguration name="teiledaten"> <elemente> <element typ="bool" bezeichnung="gut"/> <element typ="int" bezeichnung="schleifdauer"/> </elemente> </nachrichtenkonfiguration> is possible make xmlserialzer / xmlwriter (use attributes instead of nested elements)? greetings, tim ok got it, need add [xmlattribute]-tag on corresponding declaration. here's how. if have class called "person" , hav

c# - How to mock function returning void task -

i have function public task dosomethingasync(); which want mock testing purposes. what right way implement return value of such method. if return task<int> or something, use task.fromresult<int>(5); i public async void dosomethingasync() { //implementation } this lacks await operator , (at least resharper) underlined. what correct way return task here? all need return task , (surprise! :-)) task<t> derives task , it a task . see reference . so return bool (or else): return task.fromresult(true); you return completed task using: return task.completedtask; (note: above available of .net 4.6)

haskell - What is the purpose of the extra result parameter of atomicModifyIORef? -

the signature of modifyioref straightforward enough: modifyioref :: ioref -> (a -> a) -> io () unfortunately, not thread safe. there alternative adresses issue: atomicmodifyioref :: ioref -> (a -> (a,b)) -> io b what differences between these 2 functions? how supposed use b parameter when modifying ioref might read thread? as stated in comment, without concurrency you'd able write like modifyandreturn ref f = old <- readioref ref let !(new, r) = f old writeioref r new return r but in concurrent context, else change reference between read , write.

c++ - Load Gdk Pixbuf from string -

in program want use image file without being present on local hard drive. so, used xxd -i generate unsigned char[] containing image data , embedded in program. but stuck trying load gdk::pixbuf (or gtk image) this, since dont seem find function that. that sounds job gdk::pixbuf::create_from_data . note array not string, might explain why had problems finding this. it's in "image data in memory" category isn't hidden, on other hand. edit2 : changed same function's gtkmm api wrapper, after comment.

php - Using functions within a Laravel controller -

i have standard laravel controller function on 350 lines of logic number of different on-page elements. of logic taken out put within it's own function need pass variables laravel controller used within view. does laravel recommend standards this? or can create function within controller , pass final variables in php? example of current controller, split logic here own function , return values new function getindex() function. class pubscontroller extends controller { public function getindex() { //date helpers $datethismonth = carbon::now()->startofmonth()->todatestring(); $datelastmonth = carbon::now()->submonth()->startofmonth()->todatestring(); $datenextmonth = carbon::now()->addmonth()->startofmonth()->todatestring(); } } controllers php class, can use functions within them same other class. example, if have line of logic calculates total before passing index view, this: public function i

ado.net - Deleting row from DataRow[] in C# -

i have datarow array datarow[] drrequest 5 rows. iterating each row using foreach , deleting rows using foreach (datarow dr in drrequest) { dr.delete(); but afterwards drrequest.length returning 5 instead of 0. i can't use datatable , need use datarow[] datarow.delete doesn't remove row datatable . marks row "will deleted datasource if use dataadapter , call dataadapter.update". if want remove use remove : foreach (datarow dr in drrequest) { dr.table.rows.remove(dr); }

javascript - Get back the mongo ObjectID when using $http POST in Angular -

i have mean stack application using $http.post add objects mongo database persisting in local array. there way of returning generated objectid (._id) attribute when post it? i trying keep "pointers" in local array can them later. i don't know how mean stack mongo driver working in many cases, when call insert passing javascript object, driver after successful insert modify object new generated objectid or _v field. generation of objectid in cases done driver , not mongodb server. so in many cases returning same object post call give objectid. maybe can print object after insert on console see if driver doing work or not. if it's doing can return same object response. if isn't doing so, bad luck.

javascript - How Can I execute a PHP function inside a Script tag? -

so have function css looks this function include_css($css="") { include(site_root.ds.'includes'.ds.'stylesheets'.ds.$css); } and in header use call it <style type="text/css"><?php include_css('public.css'); ?></style> i similar function call javascript file load in ckeditor function include_javascript($js="") { include(site_root.ds.'includes'.ds.'ckeditor'.ds.$js); } but bit of code doesn't work <script type="text/javascript"><?php include_javascript('ckeditor.js'); ?></script> the tool bar doesn't show when doing way. show when use website. <script src="//cdn.ckeditor.com/4.5.11/standard/ckeditor.js"></script> why doesn't work same way style tag? since doesn't work there similar way put php script tag? i put php code inside of script tags instance set initial value of javascript variable. th

macros - Using injected values -

i'm trying use injected values like: quote var!(state) = "something" unquote(block) do_something_else_with(state) end i know it's evil, want fun. possible access state after block may or may not have done it? yes, block , do_something_else_with both need use var!(state) macro hygiene doesn't end giving state different name in resulting code. here's example: defmodule main defmacro with_state(do: block) quote var!(state) = "something" io.inspect {:before, var!(state)} unquote(block) io.inspect {:after, var!(state)} end end def main with_state io.inspect {:inside_before, var!(state)} var!(state) = "else" io.inspect {:inside_after, var!(state)} end end end main.main output: {:before, "something"} {:inside_before, "something"} {:inside_after, "else"} {:after, "else"}

angularjs - Firebase simple query date range ... doesn't work -

i have array keys : ['-ksh1rj8bgbowkdwdn0j', '-ksh0b8mfpcb2_zi8h3q', ...]; and each key, know if "ts_exp" expiration timestamp between yesterday , tomorrow both timestamps. var yesterday = moment().subtract(1, 'day').format("x"); var tomorrow = moment().add(1, 'day').format("x"); foreach(... key){ var rootref = firebase.database().ref('demandes').child(key) .orderbychild('ts_exp') .startat(yesterday) .endat(tomorrow); rootref.once("value", function(messagesnapshot) { console.log(messagesnapshot.val()); // return null }); } what's wrong query? this null (but have "demande" have "ts_exp" between 2 values). did .indexon "ts_exp" in firebase rules also. thank data structure : -demandes ----- -ksh1rj8bgbowkdwdn0j ---------- ts_exp : 14123123123, ---------- title : "pipo1

c - VS2015 linker error with python extension -

i'm trying build own python (3.5.2) c extension depends on zlib. gcc on linux works can't seem make work on windows 64-bit. i installed zlib dll according instructions: installing zlib1.dll ==================== copy zlib1.dll system or system32 directory. using zlib1.dll microsoft visual c++ ========================================= 1. install supplied header files "zlib.h" , "zconf.h" directory found in include path list. 2. install supplied library file "zdll.lib" directory found in lib path list. 3. add "zdll.lib" project. my setup.py: from setuptools import setup, extension cython.build import cythonize setup( ext_modules=cythonize([extension("esp", ["bethlib/esp.pyx", "bethlib/c_esp.c", "bethlib/linked_list.c"], libraries=["zdll"], include_dirs=["include"], library_dirs=["lib"])]), ) trying build python setup.py bdist_w

pagination - Paginated request using python-asana API -

i trying export tasks of asana work-spaces using python-asana api. @ point exists after giving following error message. traceback (most recent call last): file "export.py", line 56, in <module> index, task in enumerate(tasks): file "build\bdist.win32\egg\asana\page_iterator.py", line 58, in items file "build\bdist.win32\egg\asana\page_iterator.py", line 54, in next file "build\bdist.win32\egg\asana\page_iterator.py", line 43, in __next__ file "build\bdist.win32\egg\asana\page_iterator.py", line 74, in get_next file "build\bdist.win32\egg\asana\client.py", line 104, in file "build\bdist.win32\egg\asana\client.py", line 75, in request asana.error.invalidrequesterror: invalid request: pagination token has expired. i read solve need make paginated requests. tried passing offset request following: tasks = client.tasks.find_all({'project' : project['id']}, limit=50) but,

How do I group all my functions in Python into one function? -

i using turtles module creating u.s. flag. user decides size of flag , size using create width , length. i trying group/compress of subfunctions 1 huge function user can type draw_usaflag(t, w) ## t = turtle w = size , carry out task of 5 functions have. for example have 2 subfunctions: draw_rectangle(t, w) , draw_stripes (t, w) ; want group these 2 subfunctions 1 function called draw_usaflag(t, w) use user inputted size (w) throughout of functions. appreciated! thanks! quite simply, make function calls others: def draw_rectangle(t, w): # ... def draw_rectangle(t, w): # ... def draw_usaflag(t, w): draw_rectangle(t, w) draw_stripes(t, w) this assumes don't return anything, whatever works side-effects on other object. if e.g. return image, need changing depending on exact structure of system.

How to make equal space between words - python -

(sorry bad english) im working @ cmd. want thing: file_name dir file_name_3 dir file_name_545 dir file_name_llk dir instead of doing thing: file_name dir file_name_3 dir file_name_545 dir file_name_llk dir i tryied in loop: print data.ljust((20 - len(data) + 20)) if len(data) <= 20 else (data[0:17] + '...').ljust(20)), 'dir' but thing not working becase there letters bigger another, 'ljust' words makes not possible. use format strings. "{:20}{}".format(data,"dir") the same ljkust() data.ljust(20) + "dir" see help(str.ljust) understand ljust

ionic3 - Ionic2 LoadingController spinner animation not working -

i trying show loading animation using ionic2 long service progress report: this.loading = this.loadingctrl.create({ content: 'please wait...', spinner: 'ripple' // <<------ correct? }); this.loading.present(); the result text box without spinner. this 09/22/2016 ionic2 using latest beta (11) , cannot find example above anywhere. future feature documented not yet implemented? i talking ionic2 loadingcontroller documentations here is ripple custom spinner? otherwise, can check by default available spinners here : ios ios-small bubbles circles crescent dots the spinner name should passed in spinner property, , optional html can passed in content property. if not pass value spinner loading indicator use spinner specified mode . set spinner name across app, set value of loadingspinner in app's config. hide spinner, set loadingspinner: 'hide' in app's config or pass spinner: 'hide' in

makefile - Can I bypass requirement by CMAKE to provide separate compiler and linker while making module for custom Language? -

i trying make cmake module generating makefiles compile sbcl (steel bank common lisp) project. there tool generate executable sbcl, called buildapp not seem involve compiling objects , linking them in executable generic c/c++ programs built. here example makefile works building lisp program executable. and here example of bare minimum example make similar task go language. what seems last thing missing in "cmake lisp language module" implement piece of code in golang example (in cmakegoinformation.cmake): if(not cmake_go_compile_object) set(cmake_go_compile_object "go tool 6g -l -n -o <object> <source> ") endif() if(not cmake_go_link_executable) set(cmake_go_link_executable "go tool 6l -o <target> <objects> ") endif() example above not use 'go build' compile , link in 1 step other compiler / linker. in case don't think need separate compiler/linker steps , go simple step in example 1. question -

ruby on rails - Deploy Angular 2 app to Heroku -

in past bundled angular 1 , rails apps , typically used heroku, has worked great me. i'm on angular 2 want separate out angular , rails code. i've created basic angular 2 app via angular-cli, haven't been able figure out how deploy heroku. i'm not using expressjs or that. figure out yet? ok came solution. had add basic php backend, it's pretty harmless. below process. first setup heroku app , angular 2 app. create heroku app set heroku buildpack heroku/php heroku buildpacks:set heroku/php --app heroku-app-name create project via angular-cli add index.php file /scr below snippet <?php include_once("index.html"); ?> add procfile /scr below snippet web: vendor/bin/heroku-php-apache2 added /deploy .gitignore now used npm package push tarballs heroku here's simple package upload tarball, https://www.npmjs.com/package/heroku-deploy-tarball npm heroku-deploy-tarball --save i'm using tar.gz create ta

azure app service plan memory abstraction -

does azure app service(specifically app service plan) offering provide memory abstraction? https://azure.microsoft.com/en-us/pricing/details/app-service/ if create app service 2 standard skew instances(1 cpu 1.75 giga bytes memory), mean have 2 * 1.75 giga bytes memory @ app's disposal? can create jvm has heap size of 2 gig in plan instance? if specify 2 instances within app service plan, that's get: 2 instances, each having spec of size chose app service plan. not bridgeable single virtual double-size instance. so, no - cannot combine resources of 2 instances. if need more memory, you'd need choose larger instance size.

C# .Net Deserialization $type Not Working -

i'm trying deserialize json using $type property. however, error stating "type specified in json not resolved. i'm not sure i'm doing wrong. appreciated. my json { movies: [ { $type:"rtmoviepagewithslides", title:"reservoir dogs", slides:[ {$type:"rtcharacterpage", title:"mr. orange", img:""}, {$type:"rtcharacterpage", title:"mr. blonde", img:""}, {$type:"rtcharacterpage", title:"mr. white", img:""}, {$type:"rtcharacterpage", title:"mr. pink", img:""}, {$type:"rtcharacterpage", title:"nice guy eddie", img:""}, ] } { $type:"rtmoviepagewithsubpages", title:"jackie brown", pages:[ {$type:"rtactorpage",

c++ - Simple read a double array from file -

i have double numbers in file (one on each line) trying read c++ array. using below code, below error while running: segmentation fault: 11 #include <iostream> #include <fstream> #include <string> #include <vector> using namespace std; int main () { string line; ifstream myfile ("temp2.csv"); std::vector<double> myarray; int index = 0; if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line); cout << line << endl; // myarray[index++] << line; myarray[index++] = atoi( line.c_str() ); } myfile.close(); } else cout << "unable open file"; return 0; } you can't myarray[index++] = atoi( line.c_str() ); it empty vector. either need push_back elements it. or initialize sufficient memory. this should work: #include <iostream> #include <fstream> #

Can we deploy an asp.net mvc 4 app to docker with windows container? -

all demo saw lately oriented asp.net core (i not sure how it's stable , functional, didn't contain asp.net features), windows server 2016 support containers (and docker), should able deploy asp.net mvc 4.0 app ? yes. you can use microsoft/windowsservercore or microsoft/iis base image, install full asp.net , run 'legacy' .net apps in containers on windows. can windows 10 , server 2016 tp5, rtm (expected next week @ ignite) should more stable. i've shown dockerizing old nerd dinner showcase app . end docker image that's 3gb won't benefits of having small, efficient image - can run app in container, , that's starting point breaking down monoliths. for reference, dockerfile compiled asp.net app looks like: from microsoft/iis run ["powershell.exe", "install-windowsfeature net-framework-45-aspnet"] run ["powershell.exe", "install-windowsfeature web-asp-net45"] add web-app/ c:\\web-app expose 808

ios - FIRMessaging Delegate Error -

i tried add firmessagingdelegate xcode gives error cannot find protocol declaration firmessagingdelegate. i imported firebasemessaging , gives no errors. checked pods , seems fine. installing firebase (3.2.1) using firebaseanalytics (3.2.0) using firebaseinstanceid (1.0.6) installing firebasemessaging (1.1.0) how try implement; #import <uikit/uikit.h> #import <usernotifications/usernotifications.h> #import <messageui/messageui.h> #if defined(__iphone_10_0) && __iphone_os_version_max_allowed >= __iphone_10_0 @import usernotifications; #endif @import firebase; @import firebaseinstanceid; @import firebasemessaging; @interface appdelegate : uiresponder <uiapplicationdelegate, unusernotificationcenterdelegate, firmessagingdelegate> i not find solution, reason error? pods updated tried again. works without problem.

linux - gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now -

i have bash script creates tar.gz , encrypts sends drive. cannot open .tar.gz afterwards. here process... bash script encrypts. #!/bin/sh # tar automysqlbackup directory tar -zcf "red-backup-$(date '+%y-%m-%d').tar.gz" /var/lib/automysqlbackup/ # encrypt tar openssl aes-256-cbc -a -salt -in "red-backup-$(date '+%y-%m-%d').tar.gz" -out "red-backup-$(date '+%y-%m-%d').tar.gz.enc" -pass 'pass:mysecretpwd' # remove original tar rm -rf "red-backup-$(date '+%y-%m-%d').tar.gz" # upload google drive gdrive upload --file "red-backup-$(date '+%y-%m-%d').tar.gz.enc" -p "jofhriout849uioejfoiu09" then download file , use sudo openssl aes-256-cbc -e -in red-backup-2016-09-22.tar.gz.enc -out red-backup-2016-09-22.tar.gz i enter passphrase file twice , file called red-backup-2016-09-22.tar.gz when try sudo tar -zxvf red-backup-2016-09-22.tar.gz and gzip: stdin: not

node.js - How to change timezone in heroku nodejs dashboard? -

i wondering if of had experience in changing timezone in heroku dashboard. have heard there 2 methods. setting 1 of config vars(in settings) tz like: key: tz argument: "america/los_angeles" or putting in nodejs script: proccess.env.tz = "america/los_angeles" is there should doing different change app's time in heroku and/or nodejs? thank much! the 2 alternatives said same, setting on different place (heroku config vars on first case, , code on second), question how change on heroku dashboard, i'd go first answer. the thing should different, argument heroku config vars, should without quotes

r - Include archived CRAN package in package -

i'm creating r package, , rely on falsy package, has been archived cran. with non-archived package, 1 typically add name of package imports list in description file. how 1 import package that's been archived cran? note: after contacting gábor seems reason falsy archived due potentially dangerous inconsistencies between native , falsy notions of falsehood. not plan unarchive package. this: falsy <- false truthy <- true is_falsy <- function(object) { is.null(object) || identical(object, false) || identical(object, 0l) || identical(object, 0.0) || identical(object, 0+0i) || identical(object, "") || identical(object, as.raw(0)) || identical(object, logical()) || identical(object, integer()) || identical(object, double()) || identical(object, complex()) || identical(object, character()) || identical(object, raw()) || identical(object, list()) || inherits(object, "try-error&qu

wordpress - A form is displaying as filled in, instead of blank, using PHP -

i using add on wordpress , appears php code somehow calling admin e-mail autofill form supposed show blank. unfortunately me, php way on head , don't want break everything. <div class="form-group"> <label for="stc-email"><?php _e( 'e-mail address: ', 'stc_textdomain' ); ?></label> <input type="text" id="stc-email" class="form-control" name="stc_email" value="<?php echo !empty( $email ) ? $email : null; ?>"/> </div> i want form blank, it's autofilling admin e-mail on wordpress account. i've targeted line of code, think has bit: value="<?php echo !empty( $email ) ? $email : null; ?>"/> but don't think !empty is working, nor null, out please?

php - Blank page diagnose. IF problems -

what i'm trying add elevatezoom gallery , create little squares based on result mysql(if photo1 set location square1 appears , if photo2 set location , square 2 appears , if photo3 empty , nothing appears(you idea) the problem , after next edits , i'm getting blank page. this whole code . <?php use_helper("staticurl");?> <div class="product_image"> <?php $href = url_for($product->getrouteurl(esc_raw)); if ($sf_context->getactionname() == 'view') { $href = static_url_for($product->generatephotopath('large',esc_raw)); } ?> <a <?php echo $sf_context->getactionname() == 'view' ? 'class="lightbox"' : ''; ?> href="<?php echo $href;?>" title="<?php echo $product; ?>"> <img src="<?php echo static_url_for($product->generatephotopath(esc_raw)); ?>" alt="<?p

c# - How can I check whether there is conflict in time from string like 6:00 PM to 9:00 PM -

i building exam datesheet. i'm having issues in finding conflicts between time.. i have list of strings stores time intervals like- list<string> times = new list<string>(); times.add("6:00 pm 9:00 pm"); times.add("10:00 1:00 pm"); now suppose, if want add below time list, first want check not conflict time there. so, in below case, should not added. if(notconflict("5:00 pm 7:00 pm")) times.add("5:00 pm 7:00 pm"); but following can added since there no conflict. if(notconflict("2:00 pm 5:00 pm")) times.add("2:00 pm 5:00 pm"); i cannot use datetime here because old system , time being stored above. , being used @ many places. this should work: private static tuple<datetime, datetime> parsedate(string datetimes) { var split = datetimes.split(new[] { " " }, stringsplitoptions.none); var time1 = datetime.parseexact(split[0], "h:mm tt",

mysql - Left join - how to be more efficient? -

i wrote query difficult read , im afraid efficiency might bad. can query written more efficiently in terms of matching consumerid's each table consumerdata.consumerid? select consumerdata.consumerid, signupdate, city, state, year(dob), topaffiliate, activestatus, lastuseddate, (select sum(achload.transactionamount) achload achload.consumerid = consumerdata.consumerid) total_ach, (select sum(billpay.transactionamount) billpay billpay.consumerid = consumerdata.consumerid) bill_pay, (select sum(recharge.transactionamount) recharge recharge.consumerid = consumerdata.consumerid) revenue, (select count(cash.consumerid) cash cash.consumerid = consumerdata.consumerid) cash__txns, (select sum(moneytransfer.transactionamount) moneytransfer moneytransfer.consumerid = consumerdata.consumerid) transfer, (select sum(moneytransfer.commissionfeeamount) moneytransfer moneytransfer.consumerid = tbl_accounts_consumerdata.consumerid) commission_fee, (select count(interchangetransactio

javascript - How to disable Opera's right-click drag gestures programmatically? -

window.addeventlistener("contextmenu", function(e) { e.preventdefault(); return false; }); while above code overrides "right click menu" intended, seems, opera have right-click gestures, when hold down "right-click" button, , swipe left, browser goes back in game "right click" utilised, results in unintentional back/forward events repeatedly i'm looking programmatic solution fix issue, there events fired can caught , prevented? ps. i'm aware there old questions try solve same issue: how disable opera mouse gestures? - if there still no programmatic solution issue, add warning game nudge people use chrome instead why not this? var w = window; $(w).mousedown(function () { if (w.opera || navigator.useragent.match(/opera|opr\//)) $(this).bind("mousemove", function () { return false; }); } }); note: right click captured mousedown.

android - Scrollview moves focused editText out of view when its numeric right aligned -

Image
i put 5 edittext in linearlayout in horizontalscrollview. when edittext right aligned , has number inputtype, scrollview scrolls right when edittext got focus, if means edittext go out of view i did different tests , seems happens when edit text right aligned , input type number. all left aligned, inputtype number : works all right aligned, inputtype default(text): works all right aligned, 1st 1 number: scrolls end all right aligned, inputtype number: scrolls end the scrollview scrolled left , keyboard hidden, when tap on 1st edittext scrollview scrolls right, hidding edittext focused edit : problem occurs on device nexus 7 (2012) 6.0.1 , emulator nexus 7 5.1 , 4.4.2. working fine on device galaxy tab3 4.4.2 if want try, layout <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="mat

firebase - Cloud Messaging or REST API? -

i using firebase cloud messaging send message app. thinking using send data app server, not sure if there advantage in using on classic http rest api. i better of sticking classic http api send message devices server, or using firebase upstream message better in ways? the "official" advantage of upstream fcm message, @ least on android, no additional network connection needed, resulting in performance , battery-saving benefits, , possibly easier implementation. depending on how authenticate users see potential simplification in case of fcm, may not need separate authentication mechanism compared rest api.

python - Display Pandas DataFrame in csv format -

i have pandas dataframe q2 looks this: studentid subjects 6 323 history 9 323 physics 8 999 chemistry 7 999 history 4 999 physics 0 1234 chemistry 5 2834 physics 1 3455 chemistry 2 3455 history 10 3455 mathematics 3 56767 mathematics i want find out student has taken courses , display on screen. gb = q2.groupby(('studentid')) result = gb['subjects'].unique() c1=pd.dataframe({'studentid':result.index, 'subjects':result.values}) c1 looks this studentid subjects 0 323 [history, physics] 1 999 [chemistry, history, physics] 2 1234 [chemistry] 3 2834 [physics] 4 3455 [chemistry, history, mathematics] 5 56767 [mathematics] however, desired output following: 32

ios - Calling two NSURLSessionTask completion blocks one after another? -

i have following setup uses afnetworking make calls server. have used example found on internet include completion block know when call has finished. file "fcengine.m" - (void)fetchbusinessprofile:(nsstring *)userid useraccesstoken:(nsstring *)useraccesstoken completion:(void (^)(nsdictionary *json, bool success))completion { /// validate user token again user id. nsdictionary *parameters = [[nsdictionary alloc]initwithobjectsandkeys:useraccesstoken,@"user_access_token", userid,@"user_id", nil]; afhttpsessionmanager *manager = [afhttpsessionmanager manager]; afhttprequestserializer *serializer = [afhttprequestserializer serializer]; manager.requestserializer = serializer; manager.responseserializer = [afjsonresponseserializer serializerwithreadingoptions:nsjsonreadingallowfragments]; [manager post:@"" parameters:parameters progress:nil success:^(nsurlsessiontask *task, id resp

c# - TFS Visual Studio 2015 Load Test Intranet WebSite Setup -

Image
what trying accomplish run load of 6000 vusers on web page. cannot figure out how call load controllers. cannot find clear documentation next call load tests , assign work multiple load controllers. since internal company. cannot use vsts load controllers. based on these pages https://blogs.msdn.microsoft.com/edwinh/2016/04/21/guide-to-get-started-with-visual-studio-web-load-testing-and-automation-2/ https://msdn.microsoft.com/library/dn250793(v=vs.120).aspx#anchor_3 you can install load controllers on other servers. have done this. i connected load controller in load settings file. but, how attached 2 or more load controllers? i tried build test using solution test settings file. don't see way attach many load controllers. if run test build runs.. have no info see if ran test. load tests need more resources can run directly visual studio can use controller , agents. 1 controller can used load test can control many agents. see here brief idea of how works.

python - Why does logging not work when running a Flask app with werkzeug? -

so here copy paste example reproduces problem. import logging flask import flask werkzeug.serving import run_simple werkzeug.wsgi import dispatchermiddleware def app_builder(app_name, log_file): app = flask(app_name) app.debug = true handler = logging.filehandler(log_file) handler.setlevel(logging.debug) app.logger.addhandler(handler) return app def _simple(env, resp): resp(b'200 ok', [(b'content-type', b'text/plain')]) return [b'root'] if __name__ == "__main__": app = app_builder(app_name='app', log_file='app.log') @app.route('/') def index(): return '<a href="/app/error">click error</a>' @app.route('/error') def error(): 1/0 return 'error page' app2 = app_builder(app_name='app2', log_file='app2.log') @app2.route('/') def index(): return &

javascript - window.print stuck because of long-polling -

i have website uses signalr , has print button. my clients’ browsers chrome 32/36 don’t support web sockets, signalr uses long-polling. since request returns once every 60 seconds, when user clicks print button doesn’t work until request finished. is there work-around this? maybe cancel request somehow? p.s.: ctrl + p work fine.

How to fix "Headers already sent" error in PHP -

Image
when running script, getting several errors this: warning: cannot modify header information - headers sent ( output started @ /some/file.php:12 ) in /some/file.php on line 23 the lines mentioned in error messages contain header() , setcookie() calls. what reason this? , how fix it? no output before sending headers! functions send/modify http headers must invoked before output made . summary ⇊ otherwise call fails: warning: cannot modify header information - headers sent (output started @ script:line ) some functions modifying http header are: header / header_remove session_start / session_regenerate_id setcookie / setrawcookie output can be: unintentional: whitespace before <?php or after ?> the utf-8 byte order mark specifically previous error messages or notices intentional: print , echo , other functions producing output raw <html> sections prior <?php code. why happen? to understand why hea