Posts

Showing posts from July, 2011

snmptrapd can't forward the received traps to a different port on the same host -

i attempting configure snmptrapd trap forwarding.with current configuration, snmptrapd receiving , logging incoming traps, it not appear forwarding them. contents of snmptrapd.conf file follows: disableauthorization yes traphandle default /usr/sbin/snmptthandler authcommunity log public forward default 127.0.0.1:1062 when run snmptrapd follows: snmptrapd -f -le -d i can see traps being received follow result, received 67 byte packet udp: [191.50.2.21]49801->[191.50.3.75]:162 0000: 30 41 02 01 00 04 08 54 4e 50 49 47 50 29 2a a4 0a.....uspigp)*. 0016: 32 06 08 2b 06 01 06 03 01 01 05 40 04 c0 a8 06 2..+.......@.... 0032: 0c 02 01 04 02 01 00 43 04 3d f3 fc 72 30 14 30 .......c.=..r0.0 0048: 12 06 0a 2b 06 01 04 01 09 02 01 05 00 40 04 b9 ...+.........@.. 0064: 5e 6f 01 when send test trap localhost, sending 96 bytes udp: [127.0.0.1]:1062->[0.0.0.0]:0 0000: 30 5e 02 01 00 04 06 70 75 62 6c 69 63 a4 51 06 0^.....public.q. 0016: 09 ...

retrofit - JSON syntax for date time -

Image
my server return json string seems syntax not right. (i use retrofit json show jsonsyntaxexception @ expirestime field. ). check me: {"messageid":1,"message":"new","expirestime":"fri mar 04 02:12:39 gmt+00:00 2016","senderid":2,"userid":1} this image when call api browser: update: please take @ old question: here the entire string needs 1 line. have 2 lines why throwing error you. output should like: {"messageid":1,"message":"new","expirestime":"fri mar 04 02:12:39 gmt+00:00 2016","senderid":2,"userid":1} similar questions: multiline strings in json can json value contain multiline string

javascript - Receiving Error Code 3, http_status null, body null, exception state 2 -

i working on ionic project uploading videos/images. every time on initial run, uploads without hitch. but, on second file upload , thereafter - receive error: error: {"code":3,"source":"file:///storage/emulated/0/android/data/com.ionicframework.videocap/files/videolocal.mp4","target":"/upload.php","http_status":null,"body":null,"exception":"state: 2"} the code such, var options = new fileuploadoptions(); options.quality=10; options.filekey="file"; options.filename="videodame.mp4"; options.chunkedmode=false; options.mimetype="video/mp4"; options.trustallhosts=true; var headers={'connection':'close'}; options.headers = headers; $cordovafiletransfer.upload("http://76.181.104.114/dame/upload.php", videomp4, options).then(function(result) { console.log("success: " + json.stringify(result.response)); ...

mvvmcross - Deploy Xamarin app with Microsoft intune -

i need confirmation above. recently, have built app using xamarin , mvvmcross visual studio 2013. now @ deployment stage. possible use microsoft intune on air deployment android devices? meaning, can use microsoft intune deploy xamarin based app hundreds of android devices through mobile network. there known issues? will there issue mvvmcross framework?

ruby - Rails: Group result set by combination of multiple columns -

i have table called negotiations this id seller_id buyer_id property_id 1 4 190 33123 2 4 190 33123 3 5 191 34000 4 5 191 34000 5 6 200 35000 i can fetch doing negotiation.all i want fetch everything, grouped seller_id - buyer_id - property_id combination. in above example want return 3 groups. is possible in rails application? you can use enumerable#group_by : negotiation.all.group_by{|x| [x.seller_id, x.buyer_id, x.property_id]}

android - Click notification action button programmatically -

Image
how can click notification action button programmatically (another application notif, not my)? can click normal button using the button.performclick() method. have accessibility service listen incoming notification (and notification service listener android 5.0+), so,there way that? for example, click turn on battery saver or share/delete pragmatically

codenameone - StateMachineBase.java not updated when designer.jar saves theme file -

statemachinebase.java not updating. i've tried moving file designer should re-create it, i've tried running command line (no error messages displayed). is there can troubleshoot designer.jar , statemachinebase.java file? the designer.jar file has last modified date of sept 1, 2015. work in intellij idea given i'm running designer command line, assume helps eliminate ide equation. what steps can take troubleshoot this? files or settings affect behavior of designer writes statemachinebase.java file? here contents of codenameone_settings.properties file: # #fri mar 04 17:16:27 est 2016 codename1.ios.appid=obfuscated.ca.zettabot.trainingtool codename1.ios.release.provision= codename1.arg.rim.obfuscation=true codename1.j2me.nativetheme=nbproject/nativej2me.res codename1.arg.ios.project_type=ios codename1.arg.ios.interface_orientation=uiinterfaceorientationportrait\:uiinterfaceorientationportraitupsidedown\:uiinterfaceorientationlandscapeleft\:uiinterfaceorient...

java - Spring Eureka server does not find context-path in client url -

when client application registered spring eureka server client id appears @ dashboard, link url contains hostname , port without context-path of client. if create spring boot client application without setting context-path, mean default root context, eureka server can access actuators available in there. is there way inform eureka server it? tried set health , info properties, did not work. if eureka client setup via spring's @enableeurekaclient , client default health check , status check /health , /info respectively. (these paths may default values beyond spring @enableeurekaclient setup, unfamiliar @ point in time). you can override these defaults setting following properties: eureka.instance.statuspageurlpath eureka.instance.healthcheckurlpath the spring cloud documentation contains information, plus more.

Clear All UILocalNotification from Notification Drawer in iOS9 using ObjectiveC -

in application firing alarm notification, if user ignores after user launch application @ time want clear notification notification drawer fired , not yet seen or tapped. how can achieve this? tried: [[uiapplication sharedapplication] setapplicationiconbadgenumber:0]; [[uiapplication sharedapplication] cancelalllocalnotifications]; but cancelling future local notifications.

c++ - Given camera matrices, how to find point correspondances using OpenCV? -

Image
i'm following this tutorial , uses features2d + homography. if have known camera matrix each image, how can optimize result? tried images, didn't work well. //edit after reading materials, think should rectify 2 image first. rectification not perfect, vertical line on image 1 correspond vertical band on image 2 generally. there algorithms? i'm not sure if understand problem. want find corresponding points between images or want improve correctness of matches use of camera intrinsics? in principle, in order use camera geometry finding matches, need fundamental or essential matrix, depending on wether know camera intrinsics (i.e. calibrated camera). means, need estimate relative rotation , translation of camera. then, computing epipolar lines corresponding features found in 1 image, need search along lines in second image find best match. however, think better rely on automatic feature matching. given fundamental/essential matrix, try luck correctmatche...

Redirect traffic from Facebook to specific page using .htaccess? -

i'm trying redirect traffic coming facebook specific page. in .htacess file have: rewritecond %{http_referer} ^http://(www\.)?facebook\.com rewriterule ^$ /wouldyouratherquestions.php [l] but doesn't seem working. i'm new .htacess, doing wrong here? your rewritepattern ^$ matches homepage only, if want redirect requests ,change ^$ ^(.*)$ in pattern : rewritecond %{http_referer} ^https?://(www\.)?facebook\.com rewritecond %{request_uri} !^/wouldyouratherquestions.php rewriterule ^(.*)$ /wouldyouratherquestions.php [l] rewritecond %{request_uri} !^/wouldyouratherquestions.php condition rule avoids rewriting destination itself.

html - cannot center align canvas -

i have been googling solutions no avail. want center-align canvas . have tried float="center" , text-align="center" , margin-top: 100px stage didnt align center in browser. appreciated. <body onload="main();"> <canvas id="shooter" width="320" height="480" align="center"> browser not support html5 canvas tag. </canvas> you center align by: #shooter { margin: auto; display: block; } make sure parent container have 100% width. here's pen. http://codepen.io/asim-coder/pen/anpwob

algorithm - Combining integer vectors -

i have vector of length k each element 2-by-m matrix mapping between indices. elements integers set {1,2,...,mn}, there no duplicates within given 2-by-m matrix, , know m , n are. want efficient way of finding n-1 of these 2-by-m matrices such combining these mappings gives me of elements in {1,2,...,mn}. make things more concrete, assume m=n=3 , vector is 4 3 6 2 7 5 4 6 3 1 9 8 9 1 8 6 2 7 7 8 3 2 1 4 i want algorithm output 4 3 6 2 7 5 1 8 9 which found combining first 2 mappings.

angularjs - Is there a better way of doing 'element[0]' -

in link function of directives, i'm having element[0] select actual element. there more elegant way this? for example, directive <canvas my-directive></canvas> . var link = function (scope, element) { var ctx = element[0].getcontext('2d'); // maybe element.first().getcontext('2d') instead? };

cube - (SSAS) Need to use the total of a calculated measure in other calculations irrespective of - whether they qualify or not -

i have dimension categorizes labor direct , indirect have measure [indirect hours] comes indirect employees , others remain blank. , measure [direct hours] comes direct employees , others remain blank. i want create calculated measure [indirect hours]/[direct hours] , show in front of direct employees. currently showing blank there. appreciated edit: labortype | directhrs | indirecthrs | calculation_expected direct 10 <blank> (1+2+3+4)/10=1 direct 20 <blank> (1+2+3+4)/20=0.5 direct 30 <blank> (1+2+3+4)/30=0.33 direct 40 <blank> (1+2+3+4)/40=0.25 indirect <blank> 1 <blank> indirect <blank> 2 <blank> indirect <blank> 3 <blank> indirect <blank> 4 <blank> ...

Issues syncing over UNET in Unity3d -

i'm trying sync player's position , rotation on network. i've got things partially working. i have 2 players host , remote. when looking @ host's screen see correct location local , network player. when on remote see correct location local not networked player. this sync script: using unityengine; using unityengine.networking; using system.collections; [requirecomponent(typeof(rigidbody))] [requirecomponent(typeof(networkidentity))] public class syncrigidbody : networkbehaviour { public float positionlerpspeed = 10f; public float positionthreshold = 0.0025f; public float rotationlerpspeed = 10f; public float rotationthreshold = 2f; private rigidbody _rigidbody; private vector3 _requestedpos; private vector3 _lastpos; private quaternion _requstedrot; private quaternion _lastrot; void start () { _rigidbody = gameobject.getcomponent<rigidbody> (); if (!islocalplayer) { _rigidbody.iskine...

jsp - How to get the selected value of select option using java code -

i'm studying java web. , now, have question that. code in jsp file: <select id="ddlfruits" name="ddlfruits" onchange="getselectedtextvalue()"> <option value="0">banana</option> <option value="1">apple</option> <option value="2">mango</option> <option value="3">orange</option> </select> <script type="text/javascript"> function getselectedtextvalue() { var t = document.getelementbyid("ddlfruits"); var fruitsid = t.options[t.selectedindex].value; <% // how value of fruitsid in here??? // fruitsid. %> } </script> how selected value of select option (variable : fruitsid ) in <% // java code %>. used code: request.getparameter("fruitsid "). returned null. advance!

javascript - amStock Charts Multiple Datasets: Get names of all the Dataset selected for comparing -

i want load multiple datasets using json in datasetcompared event. need update datasets selected comparison in datasetcompared event. i don't find documentation anywhere list(array) of selected datasets comparing in datasetcompared event of chart. amcharts internally in many examples unable figure out how understands datasets load. does have idea how list of selected datasets comparing in datasetcompared event ? you can use chart's property maindataset find reference main selected data set, , compareddatasets list of references data sets selected comparison. now, if using in datasetcompared event, might need delay actions related bit. compareddatasets array updated after event triggered. i.e.: chart.datasetselector.addlistener( "datasetcompared", function( event ) { settimeout(function() { ( var = 0; < event.chart.compareddatasets.length; i++ ) { console.log( event.chart.compareddatasets[ ].title ); } }, 10); } )...

linux - Download file with the name from last part of directory referred instead of real file name using wget or curl(Wget is prefered) -

lets say, http://mobile.example.com/vid/flying-birds page on link http://mobile.example.com/vid/22 exist, when click on link, redirects http://v-cdn-r.example.com/mp4/x/y/dfile.mp4?ir=880&int=06 , file name dfile.mp4?ir=880&int=06 downloaded. i want have file name flying-birds (from first page url). have tried doing wget function, --default-page=name with command wget -r -l1 --default-page=name http://mobile.example.com/vid/flying-birds but downloaded file name 22 (from 2nd link) instead of expected flying-birds i have more 1 links , each link has different keywords flying-birds. in simple, there lots of directory different-different directory name. you can try that: wget -r -l1 -o $(basename http://mobile.example.com/vid/flying-birds) http://mobile.example.com/vid/flying-birds see post how wget file correct name when redirected? .

redux - Access State inside of mapDispatchToProps method -

i have written container component using redux , implementation mapdispathtoprops looks this const mapdispatchtoprops = (dispatch, ownprops) => { return { onchange: (newvalue) => { dispatch(updateattributeselection('genre', newvalue)); dispatch(gettabledata(newvalue, ownprops.currentyear)); } } } the problem in order gettabledata need state of other components. how can access state object in method? you can use redux-thunk create separate action creator function has access getstate , rather defining function inside mapdispatchtoprops : function dotableactions(newvalue, currentyear) { return (dispatch, getstate) => { dispatch(updateattributeselection('genre', newvalue)); let state = getstate(); // logic based on state, , then: dispatch(gettabledata(newvalue, currentyear)); } } let mapdispatchtoprops = (dispatch, ownprops) => { return { onch...

php - Why SUM(`column`) returns a string instead of an integer? -

i'm using laravel , have query selects using db::raw() sum() of column: db::raw("sum(points) game_points") i have installed mysqldn , afaik laravel uses pdo . but game_points string, no matter type of column is. ( it's integer column ) also if do: db::raw("count(id) foo_bar") foo_bar returned integer. it's neither laravel or pdo issue. according manual , sum() returns decimal value exact-value arguments ( integer or decimal ). , way represent decimal type in php string .

Google Drive AppData Not Permitting Insert -

using google drive api v2 rev 75 attempting insert file appdata folder, insertion fails with: com.google.api.client.googleapis.json.googlejsonresponseexception: 403 "the current scope not allow use of appdata folder" the scope " https://www.googleapis.com/auth/drive.appdata " specified in api console though, i'm little stuck. the insertion code goes: file file = new file(); file.settitle("myfile"); file.setdescription("configuration file"); file.setmimetype("text/plain"); file.setparents(arrays.aslist(new parentreference().setid("appdata"))); try { file file1 = service.files().insert(file, bytearraycontent.fromstring("text/plain", "some settings")).execute(); } catch (ioexception e) { log.severe("an error occured: " + e); return null; } the authorisation code use follows detailed in dredit [sample]( https://code.google.co...

haskell - cabal build --ghc-option=-ddump-minimal-imports does not produce import files for main -

ddump-minimal-imports valuable tool. cannot make work executable , test-suites in cabal file. in cabal file have: test-suite testdatas6fortestdataitem type: exitcode-stdio-1.0 main-is: datas6testdataitemtest.hs build-depends: base -any, time, monads-tf, default-language: haskell2010 hs-source-dirs: ., srcexe ghc-options: -threaded -ddump-minimal-imports i find imports files modules in dist folder, nothing tests , mains. due error on part? intentional behaviour? the result of technical limitations? thank help! i suspected emitted, not might expect, ran experiment , confirmed this. forked kazu's test example package added minimal import flags cabal file so: test-suite doctest type: exitcode-stdio-1.0 ... ghc-options: -threaded -ddump-minimal-imports test-suite spec type: exitcode-stdio-1.0 ... ghc-options: -threaded -ddump-minimal-imports and files ...

Android Facebook login without native app or dialog -

i developing application in want login via facebook. want do. after splash screen login screen there on user name , password edit text. after entering credential on clicking on custom login button user should authenticate face book in background. if user authenticated directly goes on next activity. without open native facebook app or dialog or browser new facebook sdk. please guide me if type login possible , give valuable suggetions. you should not that! facebook sdk there reason. if user enter facebook credentials, in edittext, can lead account theft.

c++ - Accept multiple types using one stringstream function parameter -

i need implement own stream class error writing cout . here im going create separate class , overload << operator accept basic data types. simple idea fallow. program not compiled. error error c2679: binary '<<' : no operator found takes right-hand operand of type 'const wchar_t [20]' (or there no acceptable conversion) #include <iostream> #include <string> #include <sstream> class errorwriter { public: std::wstringstream& errorwriter::operator<<(std::wstringstream& ss){ //write file //write console return ss; } }; int main(){ errorwriter eout; eout << l"this first error"; eout << l"\nthis second error" << 1 << 2.5 << true; } so question how accept basic type argument using 1 function parameter (i not need write multiple operate overloader each data type). how other streams cout , stringstream implement this wstringstream ca...

symfony - installing aws API on symfony2 -

i working on project under symfony 2.1 need install , use aws api (for using cloud php/curl). follow these insctructions choose composer installing sdk ('cause symfony use composer). the download of sources file have worked, , in vendor directory got aws sources. in code source, classes of amazon returns error ("fatal error : class [...] not found [...]" so think problem comes symfony dont load sources files. try search on internet, , try find way alone (looking on files etc ...) but didnt find way load sources files. try add on appkernerl build directory of sdk. nothing happens. try require_once file named (phar-stub.php, in build directory). error show up. can me please, you may use symfony2 bundle wraps offical aws sdk - https://github.com/seferov/aws-bundle after configuring bundle, can call aws clients simple this: // ... public function indexaction() { $ec2 = $this->get('aws.ec2'); // ... }

javascript - Create a link for all mobile devices that opens google maps by default -

Image
create link mobile devices opens google maps business location? <a href="geo:37.6894694,-121.000303">google map</a> - link goes location , redirect mobile google app, no mark business address. <a href="http://maps.apple.com/maps?q=business address">google map</a> - link goes location, not redirecting google app, instead mobile wants choose use. i need link redirect google app , mark google business address. <a href="geo:37.6894694,-121.000303?q=37.6894694,-121.000303(the name want show)">google map</a> use q parameter () showing marker name it works android devices, i'm not sure works ios devices. read more: https://developers.google.com/maps/documentation/android-api/intents#overview https://developer.android.com/guide/components/intents-common.html

visual studio - Different version info for different builds? -

i have c++ project in visual studio. project results in several different builds, , different builds report different file descriptions , product names. version numbers, menus, dialogs, etc same, don't want use different resource file. is there way override individual items of resource information, or split off file? there doesn't seem way split version block in resource editor - it's or nothing. alternatively, should script resource editor post-build rewrite 1 or 2 items of version info builds? can find few gui resource editors on net, none scriptable build events. i found nice little open-source command-line utility, called verpatch. able update resource information on compiled exe, , have scripted post-build step product. works nicely.

java - If the address of the node is stored in the hashmap(index), how can i get the address so that i can use it as a node again? -

hashmap newmap = new hashmap(); public void add(int v1,int v2) { node newnode = new node(); newnode.data = v2; newnode.next = head; head = newnode; newmap.put(v1,head); system.out.println("head1 " + head); }// storing address of node in index storing value of v2 in node.next i can address of node cant traverse nodes because says object cannot node. ex. system.out.println("head " + newmap.get(v[v2])); // can address node n; node n; int cnt = 0; for(n = newmap.get(v[v2]); n!=null; n=n.next) // error here { system.out.print("|" + n.data + "| |-> "); v2++; }

java - Hashset implementation output -

for block of code asked explain how output different input: does difference have string object being passed in , string literal being returned? import java.util.*; public class c { public static void main(string[] args) { set<string> s = new hashset<string>(); (string : args) if (!s.add(a)) system.out.println("here: " + a); system.out.println(s.size() + " there: " + s); } } the add(..) function returns false if string same contents present in hashset (and duplicate not added). hence, if (!s.add(a)) true, if duplicate strings present in args ; s.size() <= args.length .

html - Bootstrap 3.3.6 Nav Bar Item not taking full width when viewed in small resolution -

i facing strange issue. jsfiddle link https://jsfiddle.net/p2d2m72z/ <nav class="navbar navbar-default navbar-static-top navbar-inverse"> <div class="navbar-header"> <a class="navbar-brand " href="#"> website </a> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#home-menu" aria-expanded="false"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse" id="home-menu"> <ul class="nav navbar-nav"> <li class="active"><a class="navbar-brand">home</a>...

android - How to access the textview on which the selection of a spinner is displayed -

i want change text of spinner selection every time spinner item selected based on calculations. can't access spinner selection textview . or example have spinner has 3 int values 1,2,3. if value 1 selected want show selected item 6(1+5) instead of 1 actual selected item

Can a C++/CX library be used in .NET Core? -

as per title: can c++/cx library used in .net core? i wanted know: * can c++/cx library used .net core project? (or "portable" library) reference. * can .net core or .net portable projects reference c++/cx libraries such winrt? i have assumed first point "yes", appreciate reference. have assumed second point "no", however, again, love reference.

javascript - How to get ui-router state params? -

i trying create food planner allows user input meals. access through fixed monday-sunday buttons, , url looks like: #/planner/monday/add-meal i trying create new objects array takes: $scope.meal = { day: [the day in url], title: '', description:'' }; do need use $root service? i'm using ionic framework. appreciated. in router, use following url state: /planner/:dayofweek/add-meal then, in controller, inject $stateparams : .controller("thecontroller", ["$scope", "$stateparams", function ($scope, $stateparams) { $scope.meal = { day: $stateparams.dayofweek, title: '', description:'' }; }]); see https://github.com/angular-ui/ui-router/wiki/url-routing#url-parameters .

javascript - Plupload Fix Image Orienttion When Uploading -

images captured using devices iphone adds orientation tag exif meta in jpg. because of this, images stored in wrong orientation in server when uploaded via plupload. i'm wondering if possible fix orientation of image using plupload before upload server. ps. i'm using resize option of plupload. adding resize option preserve_headers: false, fixed it, this: resize: { quality: 90, preserve_headers: false },

c# - custom additional information in API documentation -

Image
i've read here additional information of web api page. data annotation provides additional information documentation. want know there anyway provide additional information without data annotations? if yes how? if not there anyway override additional information data annotations instance [required] shows required written in additional information if want show "this field required" or that? thanks edit see in picture want update additional information without data annotation if possible. if want give custom additional information(using data annotation) @pedro g. dias's answer solution if want give additional information without using data annotation afraid not possible or have use alternative procedure commented @dynamicvariable on question. ps. i've debugged documentation project check , found addition information provided data annotations.

ios - Why does my time UILabels skip 2 seconds when it resumes play from a pause state? -

i'm having weird issue using mpmovieplayercontroller . have currenttimelabel representing current playback time , endtimelabel representing remaining playback time. function update labels fired off every 1 second using nstimer . this coincides uislider increments every second video plays. however, problem is, video playing, , tap pause button, when tap play button again, currenttimelabel , endtimelabel jumps 2 seconds wherever last stopped. here's provided code: override func viewdidload() { super.viewdidload() print("viewdidload") nsnotificationcenter.defaultcenter().addobserver( self, selector: "movieplayerplaybackstatedidchangenotification:", name: mpmovieplayerplaybackstatedidchangenotification, object: nil) nsnotificationcenter.defaultcenter().addobserver( self, selector: "movieplayerloadstatedidchangenotification:", name: mpmovieplayerloadstatedidchangeno...

Renaming certain files with Windows batch -

using batch file there way can strip off .failed extension first 1000 files files in directory. for example 1.pdf.failed => 1.pdf 2.pdf.failed => 2.pdf this should work for %%f in (*.pdf.failed) rename "%%f" "%%~nf" if want xx first files, define variable count , increment on each loop itineration. when number reached, break loop. see how break loop here : how break inner loop in nested loop batch script

Customize the google signin button : Change button color to red g+ login IOS SDK -

Image
i want customize google signin button in ios application. by default in white color , there 1 method _signinbutton.colorscheme in there 2 color scheme white , blue. how can change color of button red ? also how can set language of button arabic without changing device language ? red color want achive provided google. please check google-sign-in-button-branding-guidelines and changing text of sign in google please check this. need change in .plist file. how-to-change-title-of-google-plus-sign-in-button

python - Getting startup time in Windows 10 doesn't give always the same time -

i'm using python (3.5) code check windows startup time gives me different time time using shell command "systeminfo" systeminfo: 9:15:23 python code: 9:14:42 not happy that, python code giving different times in itself! started giving me 9:14:42, , right gives me 9:15:19, it's been adding second boot time every 10 seconds or so. i give code: import datetime import win32api s = win32api.gettickcount() t = datetime.datetime.now() st = datetime.timedelta(milliseconds=s) bt = t-st boot = "boot time around {}:{}:{}".format(bt.hour, bt.minute, bt.second) print(boot) i'm starting think calling systeminfo command python , show time gives me. taken comments , question edit gettickcount not report startup time. should using wmi import datetime import wmi wmiob = wmi.wmi() sdata = wmiob.win32_perfformatteddata_perfos_system() uptime = sdata[-1].systemuptime tnow = datetime.datetime.now() utime = datetime.timedelta(seconds=int(uptim...

apache - 550 Error on Uploading Files using FTP over SSL Android -

i'm using apache commonsnet library ftp . i'm able create folders in ftp server. whenever storefile it's failing , returning me 550 error. ftpupload private boolean ftpupload(string remotefilepath) { ftpsclient ftpsclient = null; try { ftpsclient = new ftpsclient("ssl", true); } catch (nosuchalgorithmexception e) { e.printstacktrace(); } fileinputstream fis; boolean result = false; try { if (ftpsclient != null) { ftpsclient.setconnecttimeout(10000); keymanagerfactory kmf = keymanagerfactory.getinstance(keymanagerfactory.getdefaultalgorithm()); kmf.init(null, null); keymanager km = kmf.getkeymanagers()[0]; ftpsclient.setkeymanager(km); ftpsclient.connect(inetaddress.getbyname(getstring(r.string.ftp_hostname)), 990); boolean isloggedin = ftpsclient.login(getstring(r.string.ftp_username), getstring(r.string.ftp_password)...

Docker: execute a program that requires tty -

i have utility program depends on terminal characteristics. want execute inside docker container. (the program not interactive program such. old program written way). docker run -i -t or docker exec -i -t should open tty container. here happens.. user@1755e1f3f735:~/region/primer/cobol_v> kickstop [error] unable run without terminal device (tty) user@1755e1f3f735:~/region/primer/cobol_v> tty not tty when -t option docker command (run/exec) should give 'tty', tty commands returns 'not tty'. puzzling. i experienced on opensuse , fedora23 hosts , images, if matters. used 'guake', mate (gnome?) terminal emulators this, same results. is there solution this? or design , have replace/rewrite utility? i ran same issue, , found "docker exec -ti container script /dev/null" solved problem. after login container above command, can use screen normally. reference: https://github.com/docker/docker/issues/8755

python - Likely memory leak in generator loop with islice -

i working large files holding several million records each (approx 2gb unpacked, several hundred mbs gzip). i iterate on records islice , allows me either small portion (for debug , development) or whole thing when want test code. have noticed absurdly large memory usage code , trying find memory leak in code. below output memory_profiler on paired read (where open 2 files , zip records), 10**5 values (the default value overwritten). line # mem usage increment line contents ================================================ 137 27.488 mib 0.000 mib @profile 138 def paired_read(read1, read2, nbrofitems = 10**8): 139 """ procedure reading both sequences , stitching them """ 140 27.488 mib 0.000 mib seqfreqs = counter() 141 27.488 mib 0.000 mib linker_str = "~" 142 #for rec1, rec2 in izip(read1, read2): 14...

c - What is the complexity of the following simple program? -

i having trouble finding understanding complexity. me understand complexity of code below , why. for (int = 1; < n; i++) { // (n number chosen user) (int j = - 1; j >= 0; j--) { printf("i=%d, j=%d", i, j); } } an explanation great. assuming starts @ 0, complexity constant. complexity expressed relative variable defining number of executions, not case here. if 1 term should used describe behavior, "constant". there number of executions, number never change

amazon web services - Issues using Spyder python to connect to remote machine -

so have redhat system in aws running spark on top of hdfs. want access pyspark local machine i.e. interactive python. so, installed spyder-py2 connect remote aws machine can access spyder python. route: using cookbook: connecting remote kernel via ssh , started kernel on aws machine i.e. server , copied json file on local machine. changed ip in kernel1234.json point public ip. went consoles in spyder-py2 , select "connect existing kernel". passed kernel1234.json file, added username , host in hostname section. passed aws pem key in ssh key section , entered password but fails below error: unable connect ipython kernel-1234.json can please tell me missing here ? note: server on aws vm still running.

unity3d - AirConsole Unity plugin gives compiler error - 'DataContractAttribute' could not be found -

i'm trying compile airconsole project in monodevelop can debug it. it gives compiler error included 'newtonsoft.json' library: the type or namespace name `datamemberattribute' not found. missing assembly reference? (cs0246) (assembly-csharp) the project builds fine running unity; error happens when try hit "run" in monodevelop, enable debugger. is there easy way fix error? per comment above: monodevelop, find references folder in root folder of solution, right-click it, , choose edit . in window comes up, search system.runtime.serialization , add references. let build , debug unity project.

How to read large excel files containing more that 200,000 rows and load that data in datatable in C# -

i working on reading data excel , loading in datatable. problem is giving systemoutofmemoryexception while loading large excel files. colomns in excel not fixed can't load data in sql table. need manipulation on data loading in datatable. can suggest me how resolve issue? i doing oledbconnection conn = new oledbconnection(); oledbcommand cmd = new oledbcommand(); oledbdataadapter da = new oledbdataadapter(); conn = new oledbconnection(getoledbconnectionstring(strfiletype, strnewpath)); if (conn.state == connectionstate.closed) conn.open(); string query = null; datatable dt = new datatable(); query = "select * [" + spreadsheetname + "]"; cmd.connection = conn; cmd.commandtext = query; da.selectcommand = cmd; da.fill(dt); da.dispos...

python - how to filter story by it's belonging tag -

i have 2 models news , category, , in news have foreignkey of category. know how display news same category in single template. furthermore, in home page i'm trying display featured news of each category. i'm having problem. models.py class news(models.model): title = models.charfield(max_length=120) content = models.textfield() category = models.foreignkey("tag") active = models.booleanfield(default=true) featured = models.booleanfield(default=false) top = models.booleanfield(default=false) slug = models.charfield(max_length=255, unique=true) featuredincat = models.booleanfield(default=false) objects = storymanager() class newsqueryset(models.query.queryset): def active(self): return self.filter(active=true) def featuredincat(self): return self.filter(featuredincat=true) class newsmanager(models.manager): def get_queryset(self): return newsqueryset(self.model, using=self._db) def g...

objective c - How to avoid refresh cell label in tableview ios on scrolling? -

normally in ios, cells in tableview loading on scrolling. in time i'm setting label text. in case i'm setting text dynamically. when i'm scrolling down it's working expected. when it's scrolling up, it's not working expected. here tried. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"modulecell"; datetableviewcell *cell = (datetableviewcell*)[tableview dequeuereusablecellwithidentifier: cellidentifier]; if (cell == nil) { nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"datetableviewcell" owner:self options:nil]; cell = [nib objectatindex:0]; cell.backgroundcolor = [uicolor clearcolor]; cell.selectedbackgroundview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@""]]; cell.selectionstyle = uitableviewcellselectionstylenone; } if (self.newssegmentcontrol.selec...

Need Advice: Laravel single signon for different laravel applications -

i have requirement have central laravel application, , has users in there. there 2-3 sub laravel applications. users individually given access these sub applications. now requirement these sub applications shouldn't have users in there. should query central laravel application (through api). so if signs in central laravel application, should automatically sign-in other applications given access to. i aware providing code wont possible, overall overview of how might work , packages might helpful great. in advance. i have pretty done this. struggled find examples/advice started building it. i have several applications, internal use. i have 1 application/db storing users/roles/permissions. in other applications, user model points usermanager db. when user log in, grab permissions application , store them in session. seems working far. mick

database - Manually edit boltdb file -

i have app written on golang , want create builin database , i've selected boltdb . i have init data want seed database manually . have database.db file , want put data it. when open file - i see many 'nul' words . how can edit .db file manually? you can't edit manually, have write code code that'd you.

url - Multiple routing parameters in Scotty -

i'm trying use scotty in haskell, , following tutorial, route url so: get "/hello/:name" $ name <- param "name" text ("hello " <> name <> "!!") however, syntax capture multiple route parameters? neither of following worked: post "/newuser/:id/:name" $ id <- param "id" name <- param "name" json $ user {userid = id, username = name} "/users/{id}" $ id <- param "id" json $ filter (matchesid id) allusers http method part of route matching in scotty. match post route, have test post request, or scotty answer 404 http error.

How foreach of PHP works with MongoDB Cursor? -

there functions use mongodb driver iterate cursor can use "hasnext()" , "getnext()". can use simple php's foreach iterate cursor , don't have call above methods. my question if foreach simple php function, how work mongodb ? how fetches records cursor ? internally use "cursor.foreach()" of mongodb or internally runs "hasnext()" , "getnext()" ? any appreciated. the mongocursor class implements iterator interface. so, foreach ing cursor, same thing calling $cursor->next() , checking $cursor->valid() , getting value $cursor->current() (repeat until valid false ). $key => $value format gets value of $cursor->key() . it internal runs not running "hasnext()", "getnext()", etc. runs standard methods abstractly described in iterator interface. sorry captiousness, foreach not "simple php function"; it's language construct. i've found explanations the differ...

c# - EF Materialization is slow with complex Where Query -

i have following query: context.tblbeauftposmitarbs .where(bpm => bpm.tblbeauftragungposition.tblbeauftragung.tblprojekt.tbltasks.any(t => t.tblzeitens.any(z => z.datum >= start && z.datum <= end && employeeids.contains(z.mitarbeiterid))) || bpm.tblbeauftragungposition.tblbeauftragung.tblprojekt.tblzeitens.any(z => z.datum >= start && z.datum <= end && employeeids.contains(z.mitarbeiterid))) .tolist(); it returns 700 rows. this takes 24s in linqpad execute. i'm using ef 6.1 database first. the sql generation instant. i tested query in sql management studio , takes less 1 second execute. i'm using context.configuration.autodetectchangesenabled = false; context.configuration.proxycreationenabled = false; asnotracking() has no influence. take(1) has no influence. simplifying where (although no longer supposed then) cuts execution time in half (about ...

javascript - Dependent multiselect dropdown using chosen and select2 plugins -

this code have written in view : <div class="col-lg-12" style="margin-bottom: 20px;"> <div class="form-group"> <label class="col-sm-3 control-label" style=" margin-top: 14px; ">domains&nbsp;<font size="3" color="red">*</font></label> <br /> <div class="col-sm-4" style="width:50%;"> @html.listboxfor(m => m.selecteddomains, model.alldomains, new { @class = "chosen", multiple = "multiple", id = "drpdomains", style = "width: 350px;",onchange="filldomain();" }) </div> </div> </div> <div class="col-lg-12" style="margin-bottom: 20px;"> <div class="form-group"> <label class="col-sm-3 control-label" style=" margin-top: 14px; ">domai...

c# - SQL Server Application - Resetting database to original state -

background i need write integration tests in c# (about 120 of them) c#/sql server application. now, before test, database there, reason there because lot of scripts run set (about 20 minutes running time). when run test, few tables updated (crud operations). e.g. in 10-11 tables, few rows added , in 15-16 tables, few rows updated , in 4-5 tables few rows deleted. problem after every test run, the database needs reset it's original state. how can achieve that? bad solution after every run of test, re-run database creation scripts (20 minutes of running time). since there around 120 tests, comes 40 hours not option. secondly there process has several connections open against database database cannot dropped/re-created. good solution? i know if there other way of solving problem? problem have that, each of tests, don't know tables updated , have manually go , check see tables updated anyway if delete, revert database it's original state manually writing ...