Posts

Showing posts from April, 2011

android - How to log event parameters to Firebase console -

this question has answer here: firebase analytics custom events params 6 answers i have started using firebase app's analytics , i'm having issues trying view custom parameters associated events. the problem when creating audience, can see events cannot drill down parameters (no parameters shown associated events) as example, i'd register event "add retail favourite" , pass, parameter, id of retail. final goal assess how many users had added retail favourite list. for ios i'm using piece of code: [firanalytics logeventwithname:@"add_retail_to_favorite" parameters:@{@"id_retail":idretail}]; and android: bundle bundle = new bundle(); bundle.putstring(firebaseanalytics.param.item_id, string.valueof(mid)); mfirebaseanalytics.logevent("pv_detail", bundle); am doing wrong? thanks support curre

powershell - Pulling a list of entries from Registry key and checking them for anything that is contained in an array -

i using following code try , pull list of installed software on system , check entries within list, far have managed software list run desired using following code: $path = 'hklm:\software\microsoft\windows\currentversion\uninstall\*' get-childitem $path | get-itemproperty | select-object displayname if (itemproperty -name -eq ('wacom tablet')) { start notepad.exe } i array references displayname list, following error: itemproperty : cannot find path 'c:\windows\system32\wacom tablet' because not exist. @ c:\users\username\documents\scripts\win10test.ps1:39 char:5 + if (itemproperty -name -eq ('wacom tablet')) { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : objectnotfound: (c:\windows\system32\wacom tablet:string) [get-itemproperty], itemnotfoundexception + fullyqualifiederrorid : pathnotfound,microsoft.powershell.commands.getitempropertycommand how achieve this? itemproperty expanded get-itemp

spring - RxNetty download large file -

i'm trying create controller download large file using rxnetty i write stupid like @requestmapping(method = requestmethod.get, path = "largefile") public deferredresult<responseentity<byte[]>> largefile() throws ioexception { observable<responseentity<byte[]>> observable = rxnetty.createhttpget(url) .flatmap(abstracthttpcontentholder::getcontent) .map(data -> { byte[] bytes = new byte[data.readablebytes()]; data.readbytes(bytes); return new responseentity<>(bytes, httpstatus.ok); }); deferredresult<responseentity<byte[]>> deferredresult = new deferredresult<>(); observable.subscribe(deferredresult::setresult, deferredresult::seterr

bash - Execution time of a ksh script -

i want know execution time of ksh script, without editing or running script. any command time taken script execute? you can try time command below ; root@host:/tmp:>cat test.ksh #!/bin/ksh echo started sleep 3 echo finished root@host:/tmp:>date; time ksh test.ksh ; date tue jul 19 14:36:43 eest 2016 started finished real 0m3.006s user 0m0.001s sys 0m0.002s tue jul 19 14:36:46 eest 2016

Using batch code in php -

is possible make php code on webpage send out code visitor run? like: <?php batch("echo text"); ?> then open cmd window says text. if not work in php work in launge? php runs on server , has no magical control on happens on else's computer. once page has loaded send requester's browser. from there have access local storage/cookies/etc., browser provides you. if browser give website access cmd, mean website read pretty on anyone's computer, or harm in many other ways. can imagine not secure. the way can execute batch commands on someone's computer if or program have access computer. in other words, user must download batch/.exe file , run manually.

c# - Access namespace not defined exactly in XAML -

lets assume xaml defined below imported namespace in mycontrols. <grid x:class="layoutgrid" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:system;assembly=mscorlib" xmlns:mycontrols="clr-namespace:predefined.controls;assembly=uicontrols" > if use defined in namespace predefined.controls reference alias mycontrols example: <mycontrols:mycustombutton name="submitbutton" /> now if namespace predefined.controls.customtextboxes existed, there way use control inside namespace without having add xaml definition @ top? something this?? <mycontrols.customtextboxes:mycustomtextbox name="textbox1" /> no. in xml, namespace prefix defines namespace, can't tack things onto it. you'll need add full clr namespace xml namespace declaration in parent e

linux kernel - Conntrack on single interface - is it possible? -

i want use conntrack track per-connection bytes, packets etc. on end-host single network interface, rather connections through router multiple interfaces. means track connections terminate on host. i have set conntrack on multiple linux distributions, , answer conntrack -l same: "0 flow entries have been shown". is there way of tracking per-connection stats in way using conntrack or else on linux end-host? conntrack best way stores tuple each connection. load necessary conntrack module in /lib/modules/xxx/kernel/net/netfilter/yyy.ko , /lib/modules/kernel/xxx/net/ipv4/netfilter/yyyy.ko though want connection pc end point conntrack tool work if necessary conntrack module installed. another approach write kernel module , hook @ pre-routing want catch end-point , parse skbs fullfill requirements.

can't delete conditionally from xml using Java -

i've xml file need delete elements depending on attribute value. unconditional deletion works fine won't: nodelist nodes = doc.getelementsbytagname("host"); element d; ( int = 0; < nodes.getlength(); i++ ) { string state = nodes.item(i).getchildnodes().item(0).getattributes().item(0).gettextcontent(); if("down".equals(state)){ d= (element) nodes.item(0); d.getparentnode().removechild(d); system.out.println(state); } } there couple of problems code. first line string state = nodes.item(i).getchildnodes().item(0).getattributes().item(0).gettextcontent(); which assumes 1) there no text nodes between child elements, , 2) attribute looked first attribute in list. makes code brittle , subject failure if format of input document change. the second problem while iterating on node list, of members of list removed parent. behavior of list

javascript - background-image not fading in properly -

i've been working on loading screen one-page website, loading screen nothing more svg logo drawing out works fine, once 'loading' done fade out loading screen , fade in content of website. it works fine except fact when content fades in shocks bad because of background-image, know not background-image loading because whole reason there loading screen @ give website time load of images, reason fadein not working properly.. perhaps it's way set animations, have look: (i use jquery , animate.css fades) jquery: settimeout(function() { $("#builds").children().addclass("animatedlogo"); settimeout(function() { $(".loadinglogo").addclass("fadeout"); settimeout(function() { $(".loadingscreen").addclass("fadeout"); settimeout(function() { $(".loadingscreen").css('display', 'none'); settimeout(function() { $("body&quo

sql - Syntax error creating table in MySQL database -

i'm getting syntax error when i'm trying create table in mysql database, around mediumblob, can me? create table `elo`.`images` ( `image_id` varchar( 50 ) not null , `user_id` varchar( 50 ) not null , `image` mediumblob(16777215) not null , `longitude` varchar( 15 ) not null , `latitude` varchar( 15 ) not null , `city` varchar( 50 ) not null , `delete_at` datetime not null , `description` varchar( 250 ) not null , `score` int( 8 ) not null default '0', `categories` set( 'nightlife', 'food', 'beach' ) not null default 'nightlife', primary key ( `image_id` ) , unique ( `image` ) ) engine = myisam you can't set length mediumblob column should defined image mediumblob not null, means can't set unique don't have length sql should this create table `images` ( `image_id` varchar( 50 ) not null , `user_id` varchar( 50 ) not null , `image` mediumblob not null, `longitude` varchar( 15 ) not

javascript - input keyboard type prevent html5 cordova -

i create html input box 4 digit number , following restrictions even user tries press other numbers, should not appear on screen if more 4 numbers pressed, 5th number should not appear on screen how achieve in html5 hybrid cordova app while running in mobile device i tried <input type="number" maxlength="4" size="4" max="999"/> but in google chrome mobile device preview, allows number of characters pressed is default behaviour of webkit? should post submit validation , throw message?

assembly - Single Instruction Alternates of code snippets -

what'll single instruction alternates of following code snippets. have been trying hours , can't figure them out cmp ebx,eax jne x1 mov ebx,ecx jmp x2 x1: mov eax,ebx x2 pushf mov bh,ffh cmp bl,0 jl x1 not bh x1: popf bt ax,15 jc x1 , eax,0000ffffh jmp x2 x1: or eax, ffff0000h x2: please provide explanation too. thanks looks cmpxchg ebx, ecx . if (eax == ebx) ebx = ecx else eax = ebx that gives 0ffh in bh if bl negative, or 00h otherwise. such that's sign extending, ie. movsx bx, bl that's same, it's sign extending ax testing sign bit directly, ie. movsx eax, ax . note doesn't affect flags opposed code snippet.

Anaconda Spyder keeps crashing after a while -

Image
i new , learning python , development tools, please me resolve following issue. i have googled error on , on fail find solution exact error. have tried uninstalling , re-installing twice no success. i using anaconda's spyder ide , whenever leave pc unattended bit , return, presented following crash error: the result python becomes unresponsive , forced restart. please note else working fine; merely annoying crash.

mysql - nginx connect() failed (110: Connection timed out) -

i know that, question has been asked multiple times on different forums, still can not manage find solution, solves problem... situation: have nginx, php-fpm , mysql stack on server. server sits behind nginx reverse proxy. problem on upstream server there clean error logs , on reverse proxy getting multiple messages connect() failed (110: connection timed out) while connecting >upstream, client: ++++++++++, server: domain.com, request: "get >/files/imagecache/frontbullet/blog1/dknasda.jpg http/1.1", upstream: >" http://192.168.158.142:80/files/imagecache/frontbullet/blog1/dknasda.jpg >", host: "somedomain.com" for reason error occurs every 1-5 minutes different resources or files. my nginx config on reverse proxy following 1 : user ++++; worker_processes 3; error_log /var/log/nginx/error.log; pid /run/nginx.pid; events { worker_connections 1024; use epoll; } http { log_format main '$remote_addr - $remote_

java - Parse a simple xml string -

i have simple xml , want retrieve value held in 'string' either true or false. there lots of suggested methods complex! best way this? <?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">"true"</string> i able read xml xmlreader below. xmlreader xmlreader = saxparserfactory.newinstance() .newsaxparser().getxmlreader(); inputsource source = new inputsource(new stringreader(response.tostring())); xmlreader.parse(source); how value out of reader? here 1 not need xml. two-liner: string xmlcontent = response.tostring(); string value = xmlcontent.replacefirst("(?sm)^.*<string[^>]*>([^<]*)<.*$", "$1"); if (value == xmlcontent) { // no replace throw new illegalstateexception("not found"); } boolean result = boolean.valueof(value.trim().tolowercase()); with xml 1 do: documentbuilderfactory factory

java - Is mapping of an @Embeddable through a wrapper @Entity possible? -

i building persistence layer number of data classes can not change. these classes have no id property/field makes them ill suited being used in orm. best case scenario me have been sort of auto-generated ids present inside database set objects in relation each other. sadly not seem possible using jpa apis. since above approach did not work out, decided on trying use simple wrapper @entity objects so: @entity public class thirdpartyobjectwrapper { @id private long id; @embedded private thirdpartyobject mythirdpartyobject; } this approach works out nicely in database, having problems getting object out of wrapper , place inside third party object. public class anotherthirdpartyobject { private thirdpartyobject object; //actually in many-to-one-relationship } because third party objects i'm mapping them through orm.xml file defining relationships there. @ point in time relationship mapping looks so: <many-to-one name="object" target-entity=&quo

java - Instantiate an extended class or its parent (depending on circumstances) -

let's have class named human in projecta . instantiated in creaturebuilder class of same project. now want create new class called cyborg in different project, i.e. in projectb . projectb has projecta in imports, projecta knows nothing projectb . cyborg extends human , , must instantiated creaturebuilder of projecta (so, cyborg located in projectb , call creaturebuilder projectb instantiate cyborg , creaturebuilder located in projecta , human class). i need logic create human when creaturebuilder instantiated projecta , , create cyborg when creaturebuilder instantiated projectb . i think achievable creating interface getcreature() method in projecta . method overridden in projectb return new cyborg , passed creaturebuilder of projecta . other suggestions? think best workaround? can use reflection api instead? cheers! java 8 creaturebuilder can delegate creature's creation caller asking supplier . public class creaturebuilder {

gridview - Yii2 DataPorivider $totalSum for a column -

i have order , ordersearch models. in order list (actionindex) gridview there filtering , sorting. on of columns in order order_total (sum of products in order). i need implement sum of order_total in gridview. if manually counting activedataprovider->getmodels() array_map spend 3 seconds 3000 orders (localhost). don't want miss time. i see 2 ways make faster: create cache every filter , update lifetime (horrible) the interesting can right in ordersearch->search() method $query method. don't understand how can pass in controller. example of code 2nd way: class ordersearch extends order { public $totalsum; public function search($params) { $query = order::find(); $dataprovider = new activedataprovider([ 'query' => $query, ]); $this->load($params); $this->totalsum = $query->sum('order_total'); // works fast return $dataprovider; } } after i

Unable to visualize Inception v3 model in TensorBoard with TensorFlow 0.7.1 -

Image
i'm attempting visualize google's inception v3 model using tensorboard in tensorflow 0.7.1 , unable so. tensorboard graph tab stalls statement data : reading graph.pbtxt i downloaded un-tarred inception v3 model . graph protobuffer in /tmp/imagenet/classify_image_graph_def.pb . here's code dump model: import os import os.path import tensorflow tf tensorflow.python.platform import gfile inception_log_dir = '/tmp/inception_v3_log' if not os.path.exists(inception_log_dir): os.makedirs(inception_log_dir) tf.session() sess: model_filename = '/tmp/imagenet/classify_image_graph_def.pb' gfile.fastgfile(model_filename, 'rb') f: graph_def = tf.graphdef() graph_def.parsefromstring(f.read()) _ = tf.import_graph_def(graph_def, name='') writer = tf.train.summarywriter(inception_log_dir, graph_def) writer.close() this dumps 91 mb file called events.out.tfevents.1456423256.[hostname] (same si

sql - MSSQL - Grouping Results using MAX() -

i have dataset; did num 11 3 11 4 11 5 13 9 13 11 45 3 45 8 99 44 99 78 99 53 i want this. did num 11 5 13 11 45 8 99 78 list id's , show id's 'num' largest number group of id's my attempt here doesnt quite work out. http://sqlfiddle.com/#!9/1a47f/1 you right, grouped wrong column: select did, max(num) data group did see here: http://sqlfiddle.com/#!9/1a47f/3

Selection of text as starting point of an algorithm in Python -

i 've troubles figure out how make act of selecting or clicking word in text call action other functions i explain myself following pseudo-code of do: word_selected= recognition_of_selected_word_function() if(word_selected) function1(word_selected) function2(word_selected) function3(word_selected) is there function fit "recognition_of_selected_word_function()"? as example, i've seen google translator extension has similar. select text, , start own script. selection of text starting point of algorithm i've been searching similar goggle week...but nothing... thanks time! just in case have same problem, 've found solution in stackoverflow question mouse events on text in python using wxpython

select only specific number of columns from Table - Hive -

how select specific number of columns table in hive. example, if have table 50 columns, how can select first 25 columns ? there easy way rather hard coading column names. i guess you're asking using order in defined columns in create table statement. no, that's not possible in hive moment. you trick adding new column column_number , use in where statements, in case think twice of trade off between spending more time typing queries , messing whole table design adding unnecessary columns. apart fact if need change table schema in future (for instance, adding new column), adapting previous code different column numbers painful.

c++ - Modifying class behavior depending on property using if() is code smell or not? -

i have class representing parameter. parameter can number, array, enum or bitfield - param type. behavior different between these types, subclasses of parambase class. parameter can stored in ram or static (i.e. hardcoded in way, saved in file). void read() implemented in parambase , uses template method pattern implement reading param type, works ram storage. if parameter static read() must completely different (i.e. read file). a straightforward solution can further subclassing paramarraystatic , paramnumberstatic , etc. (it 8 subclasses). difference between paramarray , paramarraystatic in read() method, straightforward solution lead code duplication. also can add if( m_storage==static ) read() method , modify behavior, code smell(afik). class parambase { public: virtual paramtype_t type() = 0; paramstorage_t storage(); virtual somedefaultimplementedmethod() { //default implementation } voi

angularjs - Why I can't get scope property value defined in link? -

i have directive: (function () { "use strict"; angular.module("siteobjects").directive("siteobjectslist", [newobjectslits]); function newobjectslits() { var directive = { restrict: "e", scope: { objects: "=", region: "=", contractid: "=", //isannual:"=" }, link: function (scope) { scope.name = 'jeff'; }, templateurl: "app/siteobjects/templates/siteobjectslistdirective.tmpl.html", controller: "siteobjectslistcontroller", controlleras: "list" } return directive; } })(); controller: (function () { "use strict"; angular.module("siteobjects").controller("siteobjectslistcontroller", ["$scope","config&quo

android - What is mean by setRequestedFps in CameraSource Google Mobile vision API -

what meaning of setrequestedfps in mobile vision api. camera code : mcamerasource = new camerasource.builder(getapplicationcontext(), textrecognizer) .setfacing(camerasource.camera_facing_back) .setrequestedpreviewsize(1280, 1024) .setrequestedfps(40.0f) .setflashmode(useflash ? camera.parameters.flash_mode_torch : null) .setfocusmode(autofocus ? camera.parameters.focus_mode_continuous_picture : null) .build(); initializing processing object. ocrdetectorprocessor =new ocrdetectorprocessor(this,mgraphicoverlay,documenttype); textrecognizer textrecognizer = new textrecognizer.builder(context).build(); textrecognizer.setprocessor(ocrdetectorprocessor); processor class class ocrdetectorprocessor{ public ocrdetectorprocessor(ocrcaptureactivity ocrcaptureactivity,graphicoverlay<ocrgraphic> mgraphicoverlay,string documenttype) { }

javascript - Leaflet map background tiles appear as broken links -

Image
good day! have little project going , need have map in website. fine , except 1 detail: background tiles appear broken links no apparent (to me) reason. , appreciated :) here's picture: html code: <html> <head> <link rel="stylesheet" type="text/css" href="bootstr/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="dizainas.css"> <link rel="stylesheet" href="https://npmcdn.com/leaflet@1.0.0-rc.2/dist/leaflet.css"> <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-bbhdlvqf/xty9gja0dq3hiwqf8lacrtxxzkrutelt44=" crossorigin="anonymous"></script> </head> <body> <!-- <div id="mapas"></div> --> <div class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="cont

jquery - Export table to CSV in JavaScript not working for table input elements -

i have script exporting output table csv in javascript. various reasons relating (someone else's) ajax code, trigger link instead of submit button. html: <a href="#" class="export"><img alt="exporttoexcel" src="../export1.png"></a> javascript: (".export").on('click', function (event) { var d = new date(); exporttabletocsv.apply(this, [$('#table1'), 'export' + d.gettime() + '.csv']); }); function exporttabletocsv($table, filename) { csv=createcsv($table,"yes"); csvdata = 'data:application/csv;charset=utf-8,' + encodeuricomponent(csv); if (navigator.mssaveoropenblob) { // separate deal ms browsers var blob = new blob([csv],{type: "text/csv;charset=utf-8;"}); navigator.mssaveoropenblob(blob, filename + ".csv") } else{ $(this) .attr({ 'download': filename, 'href': csvdata, 'target': '

shell - How to send input to a website from a LINUX script -

i have shell script takes input user, need feed input website. example #!/bin/sh echo -n "enter name > " read name echo -n "enter age > " read age echo -n "enter marks > " read marks # these 3 inputs have feed automatically website (e.g.abc.mydomain.com) has data field take input. you can convert data json format , use curl send post request website url data. #!/bin/sh echo -n "enter name > " read name echo -n "enter age > " read age echo -n "enter marks > " read marks curl -h "content-type: application/json" -d "{\"name\" : \"$name\", \"age\" : \"$age\", \"marks\" : \"$marks\"}" http://abc.mydomain.com

jquery - Show message after contact form validated - Bootstrap Validation -

i working bootstrap plugin , want make confirmation submit message appear ( jsfiddle ) form validated. the developer of plugin notes following: when form invalid, .preventdefault() called on submit event. result, if want hook submit event , conditionally based on whether or not form valid, can check if event .isdefaultprevented(). sure submit handler bound after plugin has been initialized on form. so after few tries came out code (which not work): $('#form').validator().on('submit', function (e) { if (e.isdefaultprevented()) { $('button').click(function(){ $('.alert').hide() }) } else { $('button').click(function(){ $('.alert').show() }) } }) what missing? update as @nikhil nanjappa provided solution came out problem, since contact form reloads content, message shown 1 milisecond ( jsfiddle updated ). there way prevent behavior? update2 for make work, added ha

ruby on rails - Rspec test got: nil -

i'm trying basic rspec test, looks this; require 'rails_helper' describe reviewscontroller describe "get #index" "assigns new review @reviews" review = review.create( rating: 4 ) :index expect(assigns(:review)).to eq([review]) assert_response :success end end end but i'm getting failure: expected: review id: 8, rating: 4, created_at: "2016-07-19 11:58:28", updated_at: "2016-07-19 11:58:28", user_id: nil, game_id: nil got: nil my reviewscontroller looks this: class reviewscontroller < applicationcontroller def index @reviews = review.all end def show @review = review.find(params[:rating]) end def create review = review.new(review_params) respond_to |format| if @review.save format.html { redirect_to root_url, notice: 'review updated.' } format.json { render :show, status: :ok, location: @review } else format.html { render :new }

Sharing information between a python code and c++ code (IPC) -

i have 2 code bases, 1 in python, 1 in c++. want share real time data between them. trying evaluate option work best specific use case: many small data updates c++ program python program they both run on same machine reliability important low latency nice have i can see few options: one process writes flat file, other process reads it. non scalable, slow , i/o error prone. one process writes database, other process reads it. makes more scalable, less error prone, still slow. embed python program c++ 1 or other way round. rejected solution because both code bases reasonably complex, , prefered keep them separated maintainability reasons. i use sockets in both programs, , send messages directly. seems reasonable approach, not leverage fact on same machine (it optimized using local host destination, still feels cumbersome). use shared memory. far think satisfying solution have found, has drawback of being more complex implement. are there other solutions should cons

angularjs - ng-option showing two empty options while group by empty value -

i have made dropdown ng-option , added grouping. data contains empty string opting on have added grup by. show 2 empty nodes in dropdown. need remove 2 empty nodes dropdown angular.module('selectexample', []) .controller('examplecontroller', ['$scope', function($scope) { $scope.colors = [{ name: 'black', shade: '' }, { name: 'white', shade: 'light', notanoption: true }, { name: 'red', shade: 'dark' }, { name: 'blue', shade: 'dark', notanoption: true }, { name: 'yellow', shade: 'light', notanoption: false }]; $scope.mycolor = $scope.colors[2]; // red }]); html: <select ng-model="mycolor" ng-options="color.name group color.shade color in colors"> </select> plunker link you can remove empties shades of colors. just includ

Template10 - return user to the main page after resuming -

let's assume uwp app gets suspended , not used long time. when user opens app again (previous applicationexecutionstate suspended or terminated ), don't want user navigated page he/she viewing last (it became irrelevant since then), instead fresh navigation main page. how can using template10? it seems when user returns app, template10 returns user page being viewed last. tried overriding onresuming method in app.xaml.cs , had no effect. i had problem. solved saving bool property itwassuspended in localsettings of app. when onresumming activated set true property or when launched event raised set property false. finally in pages in onnavigatedto value of property if property true navigate main page , clear stack. here how use local settings https://msdn.microsoft.com/library/windows/apps/windows.storage.applicationdata.localsettings.aspx you can clear stack doing this this.frame.backstack.clear(); please mark answer if it's useful you! best r

javascript - Drag and drop image, store image ID via ajax form -

i trying make drag , drop function, image should draggable onto section , stored "folder". each folder have it's own id. model working need front-end wizardry make good, similar how gmail works drag email folder. this have far, managed working dragging image onto textbox, hiding textbox doesn't have same effect, though. html image: <img id="{{$preview->id}}" draggable="true" src="{{$preview->img_thumb}}" data-zoom-image="{{$preview->img_url}}" data-imgid="{{$preview->id}}" data-imgexp="exposure" class="img-rounded draggie" height="80" width="120"></img> js: <script> $(document).ready(function() { $(".draggie").draggable({ containment: "parent", cursor: "move", revert: true, revertduration: 100 }); var targetname; $(".draggie").mousedown(function(){ exposure = $(this).

Code Signing Certificate Flag -

is microsoft_root_cert_chain_policy_check_application_root_flag flag used code signing supported on windows xp , windows vista , windows 7 ? when using flag in certverifycertificatechainpolicy function on above operating systems, getting cert_e_untrustedroot error. it working fine me on windows 8 , above though. according microsoft the dwflags member of cert_chain_policy_para structure pointed ppolicystatus parameter can contain microsoft_root_cert_chain_policy_check_application_root_flag flag , which causes function check microsoft application root " microsoft root certificate authority 2011 ". so make sure older systems have "microsoft root certificate authority 2011" package installed. more info, see http://support.microsoft.com/kb/931125 to manually install certificates download http://download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/rootsupd.exe extract files using command rootsupd.exe /c /t:c:\t

R: censored cumsum (censored random walk) -

Image
i able censor generation of random walk data walk never drops below target value (generally 0). following code accomplishes want except rather have function works similar cumsum can use crunch through millions of rows of such values such cumsum(x,min=0) : x <- rnorm(1000) y <- rep(0,length(x)) for(i in 2:length(x)) y[i] <- max(x[i]+y[i-1], 0) plot(y, type='l') why not make own function (copied code, added initialization of y[1] make similar cumsum behavior): cumsum0<-function(x,min=0){ y<-rep(0,length(x)) y[1]<-max(x[1],0) (i in 2:length(x)) y[i] <- max(x[i]+y[i-1], min) return(y) } x<-rnorm(1000) plot(cumsum0(x),type="l")

html - Three columns div layout design with adjustable -

Image
i want know how to design 3 column div layout adjustable in deference sizes showing in image. when desktop size (770px) first column have 2 div , others have 1 divs. when tablet size (600px) first column have 3 divs , other have 1 div. has 2 columns. when mobile size (less 600px) divs have 1 columns. please find order colors in image. sample code without proper styles. html: <div class="body"> <div class="c1">blue</div> <div class="c2">pink</div> <div class="c3">green</div> <div class="c4">yellow</div> </div> css: @media screen , (min-width: 0px) { .c1 { width:100%; } .c2 { width:100%; } .c3 { width:100%; } .c4 { width:100%; } } @media screen , (min-width: 600px) { .c1 { width:25%; } .c2 { width:25%; } .c3 { width:75%; } .c4 { width:25%; } } @media screen , (min-width: 768px) { .c1 { width:25%; } .c2 { width:25%; } .c3 { widt

node.js - Why do this port-scanner not give accurate results everytime? -

below code port-scanner have written in node. problem gives correct result 1 time skip few open ports on other instances of running. open ports should list include 22, 80 , 443. can me running few times please? const async = require('async') const net = require('net') const timeout = 3000 const host = '192.30.253.113' const openports = [] const concurrency = 100 const portstoscan = 2000 const q = async.queue(function(port, callback) { const client = net.createconnection({ port: port, host: host }, () => { openports.push(port) client.destroy() }) client.on('error', () => { client.destroy() }) client.settimeout(timeout, () => { client.destroy() }) client.on('close', () => { callback() }) }, concurrency) (let port = 0; port <= portstoscan; port++) { q.push(port) } q.drain = () => { console.log(openports) } it depends

Matlab create matrix by iterating the same command several times without for loop -

i have code this: a = [sparse(round(rand(4,4)))]; b = [sparse(round(rand(1,4)))]; c = [bsxfun(@minus,a(1,:),b); bsxfun(@minus,a(2,:),b); bsxfun(@minus,a(3,:),b); bsxfun(@minus,a(4,:),b);] is possible somehow define c way large amount rows (so cannot physically print command way) without loop (because loop take excessively long time)? one options: if prefer keep sparse matrix: c = - repmat(b,size(a,1),1); %but slower bsxfun version.

How to specify the specific elements in order - using util ordering in Alloy? -

my intention here specify date in order. start d, followed d1, d2, d3, , end d". have initialised 'd = request.begin' first element while 'd"' last element in ordering. in following codes, define 'd1 = d.next', 'd2 = d1.next', and, 'd3 = d2.next'. in addition, invoked util ordering in library; 'open util/ordering [date] dateorder'. however, no instance found when executing codes. please let me know what's problem codes? open util/ordering [date] dateorder abstract sig resource {} 1 sig tour extends resource {date : 1 date, destination : tour_destination} 1 sig tour_destination {} pred holiday [disjoint d,d1,d2,d3,d": date , r:request, t:tour] { r.begin = d , r.end = d" t.date = d or t.date = d1 or t.date = d2 or t.date = d3 or t.date = d" d != d"} sig date{} pred init [d:date]{d= request.begin} fact traces { init [first] let d" = l

asp.net - How does Identity.GetUserId() finds the user Id? -

question how user.identity.getuserid() finds current user's id? does find user id cookies, or query database? or other methods? problem for reason, user.identity.getuserid() returns null when add valid bearer token http request header , send request controller's endpoint: // mvc controller action method [authorize] public httpresponsemessage(userinfoviewmodel model) { // request passes authorization filter since valid oauth token // attached request header. string userid = user.identity.getuserid(); // however, userid null! // other stuff... } when user logged app, server, using asp.net identity, validates user using db , creates valid token returns ui. token valid expiration , has inside information needed authenticate , authorize user, including user's id. next calls client side server side must done using token in http request header, server not call db again, because asp.net identity knows how decrypt token , informati

c# - How to synchronize writing and async reading from interactive process's std's -

i trying build wpf application makes use of pythons dynamic interpreter , eval function. edit : gave more detailed description here in simple words, want able following: string expression = console.readline("please enter expression"); if (evaluatewithpythonprocess(expression) > 4) { // } else { // else } as program uses functionality during it's entire lifetime, not able exit python process each time want start evaluation. consequence, stdin, stdout , stderr streams remain open time. i able start interactive python.exe using process class , 2 corresponding onoutputdatareceived , onerrordatareceived methods transfer data stdout , stderr stringbuilders: // create python process startupinfo object processstartinfo _processstartinfo = new processstartinfo(pythonhelper.pathtopython + "python.exe"); // python uses "-i" run in interactive mode _processstartinfo.arguments = "-i";

android - The best way to build cache -

i have app suits on facebook, vk apps. need make cache system have offline access pages , improve time of data loading. never make cache system earlier... want listen advices people built systems. example, how save data better in database or in files. if it's database best way storage in android app cache folder or use simple built-in sqlite database... glad answers theme. you can cache items using lrucache available in android. lrucache as trying save json objects, effective way retrieve json objects using network library such volley , save json string in sharedpreferences file. , can parse load view whenever want! , can cache images using networkimageview of volley lrucache! helps cache , populate images , texts trouble free ! perfect tutorial available here also, here code implementation well!

oracle - External table ORA-29913: error in executing ODCIEXTTABLEOPEN callout.Error in opening file -

i have setup simple oracle external table test. the database we're using 11g. have followed following steps : first created directory : create or replace directory intf_dir '/orabin/hrtst/test/' ; this external table definition: create table xxhcm_lu_ext ( lookup_type varchar2(200 byte) , lookup_code varchar2(200 byte) , meaning varchar2(200 byte) , enabled_flag varchar2(10 byte) ) organization external ( type oracle_loader default directory intf_dir access parameters ( records delimited newline skip 1 badfile intf_dir:'lookup_code.bad' logfile intf_dir:'lookup_code.log' nodiscardfile fields terminated '|' optionally enclosed '"' missing field values null reject rows null fields ) location ( intf_dir: 'lookup_code.csv' ) ) reject limit unlimited but when executing **select * frm xxhcm_lu_ext;** i getting following error : ora-29913: error

Excel 2010, sum individual cells rather than a range in a row using a sumif function -

with excel 2010, trying sum individual cells rather range in row using sumif function. example: formula = sumif(c2,"<>",(k2+n2+q2+t2)) not work. must range , not individual cells? without seeing data you're working bit difficult answer question. sumif requires single cell reference or range of cells. can try breaking formula down multiple sumif formulas: =sum(sumif(c2,"<>",k2),sumif(c2,"<>",n2),sumif(c2,"<>",q2),sumif(c2,"<>",t2))

php - Cannot get queued cookie from request -

so have php controller sends cookie in queue, , need cookie next time when refresh page (and call controller). when controller called, checks if cookie exists in request, if not, sets in queue expiration time 15 minutes. but when controller called again, nothing got in request. i've looked in dev-tools->network->cookies , haven't found cookie neither in request nor in response section. @ same time, getqueuedqookies() shows cookie has been added queue. code looks follows: $cookie = $this->request->cookie('id'); if($cookie=='id') { die('id detected.'); } else { $this->cookiejar->queue('id', 'id', 15); } then other actions taken, , controller returns string in end. what doing wrong , how can problem solved? highly appreciate possible help! update change test function name , cookiejar auto injected. public function test(cookiejar $cookiejar, request $request){ $cookie= $request->cook

Best way to load customer parameters in a multi-tenant angularJS application -

we have multi-tenant angular js single page application. routing application uses customer identifier part of url - #/home/<key> or #/search/<key>/<search term> instance. in theory first page served of type. each page calls api using customer key , other values picked url data page. far good. we have parameters - logo, copyright statement, default language (for internationalization) - can loaded using separate api call uses customer key. these parameters need available strings in partials, drive internationalization , perhaps in controllers. the question call api these parameters , how set them / make them available rest of app. have looked @ bunch of questions in general area can't find concrete suggestion. should use config in app.js? call script index.html? appreciate people's advice. the right place make api call after authentication various customer specific configuration data customer settings logo, language , put them in session st

node.js - Total count without limit -

i doing paging using limit , offset: test.query(function(q){ q.where('testname', 'like', '%test%') .orwhere('testno', '1234') .limit(limit) .offset(offset); }) .fetchall() how can total count without limit? you need use model.count think following should work var q = test .where('testname', 'like', '%test%') .orwhere('testno', '1234'); q.limit(limit) .offset(offset) .then(function(results){ q.count('id').then(...) })

javascript - How to show files already stored on server with Dropzone in Angularjs -

i use directive render dropzone.js in page: angular.module('dropzone', []).directive('dropzone', function () { return function (scope, element, attrs) { var config, dropzone; config = scope[attrs.dropzone]; // create dropzone element given options dropzone = new dropzone(element[0], config.options); // bind given event handlers angular.foreach(config.eventhandlers, function (handler, event) { dropzone.on(event, handler); }); }; }); and in controller use code: angular.module('app', ['dropzone']); angular.module('app').controller('somectrl', function ($scope) { $scope.dropzoneconfig = { 'options': { // passed dropzone constructor 'url': 'upload.php' }, 'eventhandlers': { 'sending': function (file, xhr, formdata) { }, 'success': function (file, response) { } } }; }); in dropzone show files s