Posts

Showing posts from January, 2011

node.js - Couchbase error : Authentication failed when querying a protected bucket Nodejs -

below sample code query pass protected bucket in couchbase in nodejs var couchbase = require("couchbase"); var cluster = new couchbase.cluster("couchbase://127.0.0.1"); var n1qlquery = couchbase.n1qlquery; var bucket = cluster.openbucket('bucketname', 'admin123'); var  q = n1qlquery.fromstring('select * `bucketname`'); var  req = bucket.query(q); req.on('row',  function (row) {     console.log('got row'); }); req.on('error',  function (err) {     console.error('got error %j',  err); process.exit(0); }); req.on('end',  function (meta) {     console.log('all rows received. metadata %j:',  meta); process.exit(0); }); getting:    couchbaseerror: authentication failed. may have provided invalid username/password combination admin123 looks root password. have provide password specific bucket. create password bucketname bucket in admin ui , pass password.

ios - Swift 3 unclear delay in filling up labels in a collection view -

i reading products data api , print down ids make sure data has been fetched successfully. then, put products titles collection view label. the strange thing here list of ids printed fast. app wait few seconds till collectionview populated. i couldn't understand why delay occurring have 10 products, should not take time loading , made loop on them , printed ids in no time! the following code shows have done yet. hope can me figure out bottle-nick: import uikit class testviewcontroller: uiviewcontroller, uicollectionviewdatasource, uicollectionviewdelegate { @iboutlet weak var collectionview: uicollectionview! var jsondata : [[string: any]] = [[:]] override func viewdidload() { super.viewdidload() var request = urlrequest(url: url(string: shopurl + "/admin/products.json")!) request.httpmethod = "get" urlsession.shared.datatask(with:request, completionhandler: {(data, response, error) in if e

Regex for grabbing payload from javascript NDEF tag -

i have string generated nfc ndef payload, below: string: enmac_98:d3:36:00:a2:90 from this: var macdevicex = string(finalndef.match(/mac_(.*)/)); i want grab text after mac_ part of string. getting string below instead. need text after comma text generated below match() above. dont want have match divide comma section, can in 1 match() getting wrong text: mac_98:d3:36:00:a2:90,98:d3:36:00:a2:90 you need captured value string, not whole match. with string#match , regex without global modifier g , array containing [0] whole match , [1] captured value 1 ... [n] captured value n . return value an array containing entire match result , parentheses-captured matched results; null if there no matches. the best way use check if there match @ first, , access 2nd element. var macdevicex = (m = "enmac_98:d3:36:00:a2:90".match(/mac_(.*)/)) ? m[1] : ""; console.log(macdevicex); here, assign match result m , , if t

c# - Can an SVM learn incrementally? -

i using multi-dimensional svm classifier (svm.net, wrapper libsvm) classify set of features. given svm model, possible incorporate new training data without having recalculate on previous data? guess way of putting be: svm mutable? actually, it's called incremental learning. question has come before , pretty answered here : a few implementation details support-vector machine (svm) . in brief, it's possible not easy, have change library using or implement training algorithm yourself. i found 2 possible solutions, svmheavy , lasvm , supports incremental training. haven't used either , don't know them.

How to variables to cut command in unix for -f option -

i need parse sql file , pull statements. for example sample.sql this alter table add column(c1 varchar(20)); alter table add column(c2 varchar2(10)); now want write script in below manner. #!/bin/ksh file in sample.sql echo $file no_of_statement=`grep ";" $file|wc -l` echo $no_of_statement iterator=1 statement="" while [ $iterator -le $no_of_statement] echo "inside while loop" statement=`cat $file` statement1=`echo $statement | cut -d";" -f "${iterator}"` echo $statement1 iterator=$iterator+1 done done if change [ $iterator -le $no_of_statement] [ $iterator -le $no_of_statement ] and iterator=$iterator+1 iterator=$(($iterator+1)) it prints queries: sample.sql 2 inside while loop alter table add column(c1 varchar(20)) inside while loop alter table add column(c2 varchar2(10))

magento2 - What is correct method to encrypt and decrypt data in magento 2? -

i creating magento 2 custom module, getting data using api call. need store data in custom table. before storage need encrypt data. think there default encrypt function that. have used mage::helper('mage_core_helper_data')->encrypt($value) . no success.

Security to iframe widget from clickjacking or csrf attacks -

i developing widget hosted on server www.exampleserver.com. our client embed iframe site www.validclient.com. on embedding widget sms sent client's customer. now thinking clickjacking double framing in attcker may embed our client url in iframe. widget server found request valid client , server shoots sms. valid client code: <html> // line of code <iframe src="www.exampleserver.com" /> // line of code </html> attcker code <html> // line of code <iframe src="www.validclient.com" /> // line of code </html> so want server url content rendered on clients iframe not on attacker iframe. security have used: content-security-policy: frame-ancestors http://www.validclient.com and x-frame-options: allow-from http://www.validclient.com this amazing blocks our url on attackers iframe. but not supported internet explorer , other browsers. please tell me other approach prevention of attack must un

ImageButton over action bar android -

Image
i want imagebutton on action bar in app this: my xml code is: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.recyclerview android:layout_width="match_parent" android:layout_height="match_parent" tools:context="in.yumigo.yumigovendor.ui.activity.invoiceactivity" android:id="@+id/invoice_recycler_view"> </android.support.v7.widget.recyclerview> <imagebutton android:elevation="2200dp" android:id="@+id/float_calendar" android:background="@android:color/transparent"

sql server - Count how many rows are for a value in SQL? -

i have table looks this: [contractid] [contractdate] [snapshottimeid] [dayspastdue] [exposure] int(not unique) datetime int(format20160431) int int the table sorted contractid, contractdate. now, add 6th column, let's call unique, has value 1 first contractid value adds 1 until bumps across next contractid. basically, want know how many rows have each contractid , put values, incrementally, in column. edit: want output this >documentid contractdate snapshottimeid dpd exposure unique >1 31-aug-15 31-aug-15 0 500 1 >1 31-aug-15 30-sep-15 5 450 2 >1 31-aug-15 31-oct-15 35 450 3 >1 31-aug-15 30-nov-15 7 350 4 >1 31-aug-15 31-dec-15 37 350 5 >1 31-aug-15 31-jan-16 67 340 6 >2 31-aug-15 30-jun-14 3 800 1 >2 31-aug-15

sql server - SSIS Package Execution taking long time (Not frequently) -

i have etl job running, scheduled every 5 minutes 1 9 pm everyday. takes 10 minutes execute package, unfortunately first cycle i.e. @ 1am taking 2 hour or 3 hours or 4 hours last few days . when see reports integration service catalogue see following message: data flow task:information: buffer manager failed memory allocation call 65520 bytes, unable swap out buffers relieve memory pressure. 74 buffers considered , 72 locked. either not enough memory available pipeline because not enough installed, other processes using it, or many buffers locked and then: data flow task: buffer manager has allocated 65520 bytes,even though memory pressure has been detected , repeated attempts swap buffers have failed can stop ssis package or sql job time , pro cache flush on db server; once completed can please try rerun package ? otherwise try touch dba team , perform cleanup in tempdb , try find out enough space available in tempdb;if not try doing shrink space withi

android - how to send some data from fragment of one activity to another fragment of another activity -

i have read many links passing data 1 fragment activity or 1 activity other activity's fragment want send fragment of 1 activity other fragment of activity if have pass datas on application or maybe between far activities/fragment in example, consider using static classes (even if in java there no static classes. it's more static field wrapper). public class myruntimedatas{ private static string mystringdata; private static int myintdata; //getters , setters } now, in fragment 1 use myruntimedatas.setmystringdata("my value"); myruntimedatas.setmyintdata(69); finally in fragment 2 can call string mybeautifulstring = myruntimedatas.getmystringdata(); int myfantasticint = myruntimedatas.getmyintdata(); and done

dynamics crm - MS CRM Online data abnormalities -

i have client migrated ms crm online in april, they've reported number of cases data has updated itself, example: custom entity data records disappear , related record entities show record value. ownership of accounts/contacts changed. 2500+ accounts changed ownership in 10 minute window. (surely can't human error). audit log show 1 specific user having updated 2500+ records. there no scheduled tasks running other configured , managed microsoft. there 1 plugin automatically creates sharepoint doc folder activities entity , moves attachments sharepoint folder. any ideas/suggestions appreciated. could couple of causes, jump mind; user manually bulk editing records or cascading relationship behaviour ,

linux - Want to append records in two file using shell script -

my first input file contains records name abc.txt: abc@gmail.com bscd@yahoo.co.in abcd.21@gmail.com 1234@hotmail.com my second file contains record name details.txt: 123456^atulsample^1203320 i want final file having output final.txt: abc@gmail.com^123456^atulsample^1203320 bscd@yahoo.co.in^123456^atulsample^1203320 abcd.21@gmail.com^123456^atulsample^1203320 i have uses sed command not getting required output. kindly don't have knowledge in shell scripting. try this; #!/bin/bash while read -r line detail="$line" sed '/^[ \t]*$/d' abc.txt | sed "s/$/^${detail}/" >> final.txt done < "details.txt" this delete blank lines; sed '/^[ \t]*$/d' abc.txt this append details.txt sed "s/$/^${detail}/"

sql - Select multiple COUNTs for every day -

i got table of visitors. visitor has following columns: id starttime (date) purchased (bool) shipped (bool) for each day within last 7 days, want select 3 counts of visitors have day starttime : the count of total visitors the count of total visitors purchased = true the count of total visitors shipped = true ideally returned result be: day total totalpurchased totalshipped 1 100 67 42 2 82 61 27 etc... i used .net linq has proved quite challenge me. all have come far following: select count(*) total [dbo].[visitors] day([starttime]) = day(getdate()) it selects total of current day fine, feel pretty stuck right it'd nice if point me in right direction. for last 7 days use query proposed stanislav where clause select day([starttime]) theday, count(*) tot, sum(case when purchased=true 1 else 0 end) totpurch, sum(case when shipped=true 1

authentication - Issuing SMTP 'AUTH LOGIN'? -

where , how issue smtp command 'auth login' credentials done mailing? i trying use auth mailing esp, hotmail, through smtp commands. concern username , password entered in smtp session response of auth command , can issue them.

Compile OpenSSL 1.1.0 for Android -

i'm trying compile openssl-1.1.0 on android cygwin follow guidance: compiling latest openssl android but it's failed, error : crypto/aes/aes_ecb.c:10:20: fatal error: assert.h: no such file or directory #include <assert.h> i'm using android-ndk-r12b, win10, cygwin 64 bit. this pre-config before compiling: export ndk=~/android-ndk-r12b $ndk/build/tools/make-standalone-toolchain.sh --platform=android-21 --toolchain=arm-linux-androideabi-4.9 --install-dir=`pwd`/android-toolchain-arm export toolchain_path=`pwd`/android-toolchain-arm/bin export tool=arm-linux-androideabi export ndk_toolchain_basename=${toolchain_path}/${tool} export cc=$ndk_toolchain_basename-gcc export cxx=$ndk_toolchain_basename-g++ export link=${cxx} export ld=$ndk_toolchain_basename-ld export ar=$ndk_toolchain_basename-ar export ranlib=$ndk_toolchain_basename-ranlib export strip=$ndk_toolchain_basename-strip export arch_flags="-mthumb" export arch_link= export cppflags="

javascript - How to open and close square box animation using css -

i trying animate square div open top. try close box. working. how opposite of that.now want open top bottom.i used showbox function opening div top bottom.i thing going wrong somewhre. i new in this.i want animation.you check box in link.i facing while opening it. https://dribbble.com/shots/1375652-gif-animation-abracadabra-app . can guide me please. here code function showbox() { settimeout(function() { $("#slide1").show(); //$("#slide1").addclass("transitionin"); settimeout(function() { // $("#slide1").removeclass("transitionin"); $("#slide1").addclass("transitionin"); }, 300) `enter code here` }, 500); } showbox(); .transitionin { -webkit-transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, 90deg); -moz-transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, 90deg); -o-transform: translate3d(0, 0, 0) rotate3d(1, 0, 0, 90deg); -ms-transform: tran

eval - How to create own php templating system? -

i have 2 files name test.txt contains template code.i need evalute template evaluated php. eval() function giving errors on ifelse , other similar conditions. test.txt @$firmware_path=true; @$dialplan=1312321; @$max_lines=3; @$data=array(); @$operator_ip=''; @$enabled=true; @ if ($firmware_path) @{ firmware server: http://{$operator_ip}{$firmware_path} @ } @ ($i = 1; $i <= $max_lines; $i++) @ { @ $enabled = isset($lines[$i - 1]); @ if ($enabled) @{ @ $data = $lines[$i -1]; @ if ($data['user_fullname']) @{ @ if ($phone_label) @{ @ $screenname = $data['user_fullname'] . ' ' . $data['telnum']; @ $screenname2 = $phone_label; @ } @else @{ @ $screenname = $data['user_fullname']; @ $screenname2 = $data['telnum']; @ } @ } @els

how can i just show the lines which contains the searched string in textarea Java? -

this code snippet. instead of printing in console how can refine in text area itself. tried textarea.write(line) throws error. public void search() { hilit.removeallhighlights(); string s = entry.gettext(); if (s.length() <= 0) { message("nothing search"); return; } scanner in = null; in = new scanner(textarea.gettext()); while(in.hasnext()) { string line=in.nextline(); if(line.contains(s)){ system.out.println(line); } }

mathml - How to convert EPS to mathtype (.mml) using command line -

i having .eps equation file created using mathtype now want convert .eps .mml or markup language format using command line tool thank i don't know of way directly save eps mathml, whether using command line or other method. requires parsing contents of eps, looking things mathtype includes in epss. at top of eps created mathtype group of comments. @ end of comments mathml. beginning of string of mathml this: <?xmlversion="1.0"?><!--mathtype@translator@5@5@mathml2(clipboard).tdl@mathml2.0(clipboard)@--> at end this: <!--mathtype@end@5@5@-->! . between these mathml.

javascript - How to get nested directives work in AngularJS -

i learning angular js bit , came across http://www.jvandemo.com/the-nitty-gritty-of-compile-and-link-functions-inside-angularjs-directives/ . trying implement similar , have directives defined follows (message1, message2 , message3 have same code): <pre> var app = angular.module('app', []); app.controller('msg', ['$scope', function($scope){ $scope.a = 5; }]); app.directive('message1', function($interpolate){ return{ template: '<div> = {{a}} </div>', compile: function(telement, tattributes){ console.log(tattributes.text + " -in compile.."); return { pre: function(scope, ielement, iattributes, controller){ console.log(iattributes.text + " -in pre.."); }, post: function(scope, ielement, iattributes, controller){

bash - Filter out directories using Makefile list -

i'm trying make release rule makefile it's job copy directories in folder, except few (like destination etc) have looked @ makefile filter function seems it's not working inside of bash loop? there easy way filter out items in list in bash? source_dir=builds/$(name)_$(version) #list of items ignore ignore=builds cfg compiled release: if [ -d "cfg" ]; \ cp -r cfg $(source_dir)/cfg; \ fi; folder in *; \ if [ -d "$$folder" ]; \ if [[ $(ignore) != $$folder ]]; \ cp -r $$folder $(source_dir)/addons/; \ fi; \ fi; \ done; the filter-out function make function, if want use it, must use before pass command shell. you can use outside rule: things := $(wildcard *) ignore = builds cfg compiled things := $(filter-out $(ignore), $(things)) release: @for folder in $(things); \ if [ -d $$folder ]; \ echo $$folder; \ fi; \ done or inside rule: things := $(wildcard

mysql - Hive : finding items that customers bought together from transactions -

Image
i working on mysql need replicate queries on hive. i have table in form i retrieve following info: on mysql, below query works: select c.original_item_id, c.bought_with_item_id, count(*) times_bought_together ( select a.item_id original_item_id, b.item_id bought_with_item_id items inner join items b on a.transaction_id = b.transaction_id , a.item_id != b.item_id original_item_id in ('b','c')) c group c.original_item_id, c.bought_with_item_id; but not able translate hive query, have tried lot of shuffling joins , replacing on conditions have not got necessary results. great if can find on this hive not support not equality joins. can move condition a.item_id != b.item_id where clause: create table items(transaction_id smallint, item_id string); insert overwrite table items select 1 , 'a' default.dual union select 1 , 'b' default.dual union select 1 , 'c' default.dual union select 2 , 'b' defaul

java - What is the difference between doGet and doPost? -

this question has answer here: doget , dopost in servlets 5 answers public void doget(httpservletrequest request,httpservletresponse response){ } and public void dopost(httpservletrequest request,httpservletresponse response){ } in http protocal , post type of request headers. whenever type of request recieved server, doget() method invoked @ backend. same goes post, dopost() invoked. example: invoke doget when html form submitted. <form method="get" action="servletname"> this invoke dopost() <form method="post" action="servletname"> there more request type headers put, delete used implementing rest api.

omnet++/veins : connecting inet and veins : TraCIMobility error in TraCIScenarioManagerLaunchd -

i'm trying connect inet 3.4.0 , veins 4.4 tcp/ip support. i've followed instructions ( veins - inet compatibility ) , more, have error while trying run simulation : i'm not sure understand tracimobility function. <!> error in module (veins::traciscenariomanagerlaunchd) simple_junction_notls_ipv4.manager (id=6) @ event #23, t=0.2: assert: condition lastupdate != simtime() false in function changeposition, veins/modules/mobility/traci/tracimobility.cc line 192. here car module : import inet.node.inet.adhochost; import org.car2x.veins.base.modules.*; import org.car2x.veins.modules.nic.nic80211p; import org.car2x.veins.base.modules.imobility; module car extends adhochost { parameters: //string appltype; //type of application layer int numwaveradios = default(1); string nictype = default("nic80211p"); // type of network interface card string veinsmobilitytype; //type of mobility module string imobilitytype; //type of

python - Facebook Messenger bot Publish error -

my facebook messenger bot working perfectly, started publish process (making bot available everyone) bot stopped responding. there no error in code or on server, , webhook connected. tested webhook connection , got {"success":true} response in terminal . once started publish process started receiving these error messages facebook: your webhooks subscription callback url .... has not been accepting updates @ least 16 minutes somehow, facebook managed mess application, working fine, , cannot in contact facebook, because there no way contact them. by way, code written in python , have used django

c# - Using WebClient or WebRequest perform button click on page -

i need perform button click on page of webclient or webrequest. button pure user side action load html form of javascript. <a id="testmelink_index" class="testmelink" href="#" onclick="form.start(33);return false;">testme</a> after link clicked popup window form loaded. main task test form loaded page. second task submit form after. page trying work static html page on iis

angularjs - How to access a ngform name from controller? -

i need check if elements on current html page (being rendered using ui-view) dirty or pristine before navigate next tab. parent page: <div class="inner-menu"> <nav> <div> <ul class="nav nav-tabs edit-menu" role="tablist"> <!-- location 1 --> <li ng-repeat="innertab in innertablistarr" ng-click="switchtab($index, $event)"> <a role="tab" data-toggle="tab" href="">{{innertab.text}}</a> </li> </ul> </div> </nav> <div ui-view="innertabholder" name="currform"></div> </div> and html template rendered innertabholder view : <div class="edit-general" id="general"> <div class="modal-dialog modal-lg"> <form class="form-horizontal" name="generalfo

javascript - remove CSP header from webview in chromeApp -

i'm trying remove csp header specific website. the problem cant first request of webview. the (webrequest api) available after webview started load, , cant first request. and code below dose not work since starts listen late ** wierd part works if devtools of webview open :0 previewwebview.addeventlistener('loadstart', function () { var headers_to_strip_lowercase = [ 'content-security-policy', 'content-security-policy-report-only' ]; previewwebview.request.onheadersreceived.addlistener( function (details) { return { responseheaders: details.responseheaders.filter(function (header) { return headers_to_strip_lowercase.indexof(header.name.tolowercase()) === -1; }) }; }, { urls: ["<all_urls>"] }, ["blocking", "responseheaders"]); }); to work right beginning (i.e. fir

android - Xam.Media.Plugin Bitmap too large to be uploaded into a texture -

i'm using excellent xam.plugin.media nuget package in xamarin forms app allow users take photos. have followed example code xam.plugin.media github page: takephoto.clicked += async (sender, args) => { await crossmedia.current.initialize(); if (!crossmedia.current.iscameraavailable || !crossmedia.current.istakephotosupported) { displayalert("no camera", ":( no camera available.", "ok"); return; } var file = await crossmedia.current.takephotoasync(new plugin.media.abstractions.storecameramediaoptions { directory = "sample", name = "test.jpg" }); if (file == null) return; await displayalert("file location", file.path, "ok"); image.source = imagesource.fromstream(() => { var stream = file.getstream(); file.dispose(); return stream; }); }; however, fails on android error message: bitmap large uploaded texture (5312x2988, max=4096x4096) is there way around thi

angularjs - angular ui bootstrap ng-repeat tabs -

how can use ng-repeat in angular bootstrap ? // styling not work <uib-tabset active="activepill" vertical="true" type="pills"> <span ng-repeat="tab in tabs track $index"> <uib-tab index="$index" heading="{{ tab.title }}">{{ tab.content }}</uib-tab> </span> </uib-tabset> what missing? should ng-repeat go preserve styling? plunkr use index="{{$index}}" instead of index="$index". see this <uib-tabset active="activepill" vertical="true" type="pills"> <span ng-repeat="tab in tabs track $index"> <uib-tab index="{{$index}}" heading="{{ tab.title }}">{{ tab.content }}</uib-tab> </span> </uib-tabset>

excel - VBA Declare date/time data -

Image
i ve got hourly data , when try execute following code runtime error 91.the format of data in cyc sheet example #07/07/2009 23:00:00# (at row 194), when enter dt automatically converts #7/7/2009 11:00:00 pm#. (please note shtcyc , shtco have been declared , set). dim dt date dt = #7/7/2009 11:00:00 pm# shtcyc.activate 'finds day set rng = shtcyc.range("a3:a1514").find(dt, , xlvalues) 'copies dates shtcyc.range("a" & rng.row - 191 & ":a" & rng.row + 24).copy (this debug highlights) shtco.range("b10").pastespecial paste:=xlpastevalues anyone got ideas..? many many thanks! well not problem see. see code below. to find dates have use datevalue because of various formatting reasons. you need check if value found you need check if rng.row falls in specific range i have explained in comments. let me know if still have questions. sub sample() dim dt date dim shtcyc works

go - Why am I losing precision while converting float32 to float64? -

while converting float32 number float64 precision being lost in go. example converting 359.9 float64 produces 359.8999938964844. if float32 can stored precisely why float64 losing precision? sample code: package main import ( "fmt" ) func main() { var float32 = 359.9 fmt.println(a) fmt.println(float64(a)) } try on playground you never lose precision when converting float (i.e. float32) double (float64). former must subset of latter. it's more defaulting precision of output formatter. the nearest ieee754 float 359.9 359.899993896484375 the nearest ieee754 double 359.9 359.8999999999999772626324556767940521240234375 the nearest ieee754 double 359.899993896484375 is 359.899993896484375 (i.e. same; due subsetting rule i've mentioned). so can see float64(a) same float64(359.899993896484375) 359.899993896484375 . explains output, although formatter rounding off final 2 digits.

jax rs - Add JSON provider for CXF JAX-RS in Spring Boot properties or YAML file -

how move endpoint.setprovider(new jacksonjsonprovider()); application properties file? @bean public server rsserver() { jaxrsserverfactorybean endpoint = new jaxrsserverfactorybean(); endpoint.setbus(bus); endpoint.setprovider(new jacksonjsonprovider()); endpoint.setservicebeans(aslist(new customerservicedefault())); endpoint.setaddress("/"); endpoint.setfeatures(aslist(new swagger2feature())); return endpoint.create(); } first if haven't done already, have add dependency provider: <dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-jaxrs</artifactid> <version>1.9.0</version> </dependency> then need add package jackson entity providers jax-rs scanning ( org.codehaus.jackson.jaxrs in case), other packages created. i'm using yaml configuration , class scanning opposed component scanning

tensorflow - Best way to split computation too large to fit into memory? -

i have operation that's running out of memory when using batch size greater 4 (i run 32). thought clever splitting 1 operation along batch dimension, using tf.split , running on subset of batch, , recombining using tf.concat . reason doesn't work , results in oom error. clear, if run on batch size of 4 works without splitting. if instead run on batch size of 32, , if perform 32-way split each individual element run independently, still run out of memory. doesn't tf schedule separate operations not overwhelm memory? if not need explicitly set sort of conditional dependence? i discovered functional ops, map_fn in case, address needs. setting parallel_iterations option 1 (or small number make computation fit in memory), i'm able control degree of parallelism , avoid running out of memory.

node.js - My mongodb code does not insert all data -

i receive stream of /r/n terminated data want inserted mongodb database. tag~4~keyword~sim tag~5~keyword~mib tag~4~keyword~gom tag~3~keyword~qbo tag~6~keyword~qqq tag~3~keyword~k94 tag~4~keyword~g93 i've separated them using arr.split(~) i'll array representation first line represented follows: arr[0] refers tag arr[1] refers 4 arr[2] refers keyword arr[3] refers sim i insert them mongodb representation: { tag: 4, keywords: [{ keyword: "sim" }, { keyword: "gom" }, { keyword: "g93"} ] } the gist of nodejs/mongo client (native) code using async follows: i. check collection('dat') presence of tag. ii. if tag not exist, create document , insert tag number iii. next insert keywordobj. var newtagnumber = parseint(arr[1]) var keywordobj = { keyword: arr[3] } async.waterfall([ function(callback) { db.collection('dat') .find({ tag: newtagnumber }, { forceserverobjectid: true}).t

runtime - How can I make a python script change itself? -

how can make python script change itself? to boil down, have python script ( run.py )like this a = 0 b = 1 print + b # here such first line of script reads = 1 such next time script run like a = 1 b = 1 print + b # here such first line of script reads = 2 is in way possible? script might use external resources; however, should work running 1 run.py -file. edit: may not have been clear enough, script should update itself, not other file. sure, once allow simple configuration file next script, task trivial. answer: it easier thought. @khelwood 's suggestion works fine, opening script , writing it's own content unproblematic. @gerrat's solution works nicely. how i'm having it: # -*- coding: utf-8 -*- = 0 b = 1 print + b content = [] open(__file__,"r") f: line in f: content.append(line) open(__file__,"w") f: content[1] = "a = {n}\n".format(n=b) content[2] = "b = {n}\n".format(n=a+b) in r

Windows message WM_QUIT and WPF -

i have catch wm_quit message in wpf there problem. intptr windowhandle = (new windowinterophelper(this)).handle; hwndsource src = hwndsource.fromhwnd(windowhandle); src.addhook(new hwndsourcehook(wndproc)); wndproc works fine , catch messages except wm_quit . msdn says: the wm_quit message not associated window , therefore never received through window's window procedure. retrieved getmessage or peekmessage functions. is there way catch message in wpf? maybe componentdispatcher ? there also: http://www.pinvoke.net/default.aspx/user32.getmessage which can used in c# environment. any welcome.

ionic framework - cordova: How to debug app remotely? -

my client located on remote distance , having issue app. want debug app remotely in phone. is possible? if how can that? two ways, each varying degrees of success: to see actual problem app having, client can download "airserver", it's way mirror iphone computer screen. can use screensharing software (like google hangouts or skype) see what's going on. release update includes "logging service" logs localstorage when have error; , enable access through special sequence on phone (if aren't worried people seeing it, can make menu option. if are, hide via speciifc touch presses). can dump , errors screen , load way. used approach when creating the bluetooth low energy demo app .

Android emulator not showing in Visual Studio -

i made android virtual device. runs on sdk emulator using intel haxm. able see in visual studio (debug devices drop down list) , debug applications on it. great when don't have physical device hand. something happened!?! refuses show now? over last week have tried (in no particular order): recreating virtual device. reinstalling visual studio. reinstalling android sdk. installing both of above administrator. checking sdk path in windows registry. tried adb kill-server / start-server. checked adb can see device - can. tried uninstalling/reinstalling haxm manually. made sure project targets api of emulator. made sure build active configuration matches emulator. ended other adb processes using task manager (leaving 1 visual studio). checked windows event log warnings/errors. nothing. i have read these. no joy... https://forums.xamarin.com/discussion/10937/devices-not-showing-up-in-android-target-device-dropdown visual studio 2015 android emulator issue

c# - What is the difference between MD5CryptoServiceProvider and HMACMD5 -

in c#,what difference between hmacmd5() , md5cryptoserviceprovider()? thanks in advance md5 cryptographic hash function. hmacmd5 message authentication code, keyed hash function uses md5.

python - How can i remove all extra characters from list of strings to convert to ints -

hi i'm pretty new programming , python, , first post, apologize poor form. i scraping website's download counts , receiving following error when attempting convert list of string numbers integers sum. valueerror: invalid literal int() base 10: '1,015' i have tried .replace() not seem doing anything. and tried build if statement take commas out of string contains them: does python have string contains substring method? here's code: downloadcount = pagehtml.xpath('//li[@class="download"]/text()') downloadcount_clean = [] download in downloadcount: downloadcount_clean.append(str.strip(download)) item in downloadcount_clean: if "," in item: item.replace(",", "") print(downloadcount_clean) downloadcount_clean = map(int, downloadcount_clean) total = sum(downloadcount_clean) strings not mutable in python. when call item.replace(",", &q

Upload file with tags through OwnCloud or NextCloud API -

i have database of files tagged. now, upload these files owncloud or nextcloud server , pass on existing tags show tags in respective system. wasnt able yet find way how in documentation, have idea how it? thanks! i made available source code of (remote) file tagging micro-service nextcloud on github ( https://github.com/julianthome/taggy ). implementation consists of 2 parts: 1) taggy client uploading files nextcloud server, , invoking taggy server; 2) taggy server adding specified tags uploaded files. i polish code further within next days. planning add ssl support important because username , password transmitted unencrypted taggy server. server uses these credentials in order check whether user can authenticated before tagging files. please let me know if have other ideas, suggestions or feedback ;) kind regards

html - make image height fit inside the screen -

i have image inside bootstrap code <header> header </header> <div class="container"> <div class="col-md-8"> <div class="col-image"> <img src="my-image.jpg" > <div> </div><!--col-md-8--> <div> comments </div> <div class="col-md-4"> sidebar </div><!--col-md-4--> </div><!--container--> <footer> footer </footer> i want image height inside screen of size. responsive height i try adding height:auto; max-height:100vh; didnt work @ all. appropriated. the image parents should height defined. so, can set max-height, or height. search heitgh in percent ;) ps.: see in full page .col-image{ height: 100vh; border: 1px solid red; } img{ float:left; max-height: 100%; height: 100% } <header> header </header> <div class="container"> <div class="col-m

dynamic oracle sql parent-child cursor insert -

i'd insert values parent table_1 , child table_2 tables in cursor. how can that? if statement , variables trying. all columns constraint: table_1 constraints: pprt_mandant_nr, pprt_pro_prod_nr, pprt_prp_position table_2 constraints: patt_mandant_nr, patt_pro_prod_nr, patt_prp_position, patt_are_realartnr this code working without error message wrong results. few rows table_2. think if statement wrong. or dunno... me pls. open l_cursor l_query; fetch l_cursor bulk collect l_sucherg; close l_cursor; := l_sucherg.first; while not null loop if ( l_pro_mandant_nr <> l_sucherg (i).pro_mandant_nr or l_pro_prod_nr <> l_sucherg (i).pro_prod_nr or l_prp_position <> l_sucherg (i).prp_position) , l_prp_are_realartnr <> l_sucherg (i).prp_are_realartnr begin insert table_1 (pprt_pkot_seq, pprt_mandant_nr, pprt_pro_prod_nr, pprt_prp_position ) val

asp.net - link button click depends on text property -

i need click on link button "view old" display list of old items , change text of link "view active". works, changes text , displays old list items . if click on same link button new text "view active", doesn't work , stays same. second "if" statement doesn't executed. how can make work , force using same link button? new it. thank if can enter image description here protected void lknbtnoldwwus_click(object sender, eventargs e) { if (lknbtnoldwwus.text == "| •view old wwu&#39;s |") { lstbxwwulist.items.clear(); lists list = new lists(request.islocal); lknbtnoldwwus.text = "| •view active wwu&#39;s |"; foreach (listitem item in list.wwu((int)session["usertable.companyid"], true)) { lstbxwwulist.items.add(item); } } if (lknbtnoldwwus.text == "| •view active wwu&#39;s |") { lstbxwwulist.items.clea

python - Rounding up a value to next int -

i need make paint program rounds next gallon, having problem. when said in done, lets height 96, width 240, , length 200, equals out 919 feet. subtract few walls , windows , have 832 square feet. divide 200 , gives me 4.3 can't have 4.3 gallons of paint, need rounded 5. code below though, round out 4. simple, , easy fix help? primer_area = (2*(length * height) + 2*(width*height)) / 144 primer_needed = (primer_area + result - door_area - window_area) / 200 # primer rounded next gallon primer = primer_needed primer = math.ceil(primer) i think if change these lines work primer_needed = float(primer_area + result - door_area - window_area) / 200 primer_needed = float(primer_area + result - door_area - window_area) / 200 or can determine result float like x = float

c# - Using a Model Class of Type T or Interface for Strongly Typed View -

i'm trying refactor view , model. previously, typed view had model directive in cshtml file: @model myviewmodel<mysubviewmodel> i've since identified type mysubviewmodel needs either generic or inheritable because i've identified multiple types should interchangeable here. first tried this: @model myviewmodel<t> ... couldn't make work, so, wishfully thinking, tried this: @model myviewmodel<t> t : imysubviewmodel ... that's no either, tried this: @model myviewmodel<imysubviewmodel> ... @ first thought working visual studio didn't underline it. however, saw every place have razor insertion, it's showing error message "the name 'whatever' not exist in current context." goes viewbag, html helpers , usages of view model. so how should done? or can not done? realize use: @model myviewmodel<dynamic> ... i'd rather not lose intellisense given know "dynamic" type implements

Compilation of llvm and clang from their git repos hangs at 96% -

i have problems compilation of llvm , clang bpf , x86 targets on debian machine. gcc version 6.2,python exists on system.compilation lasts more 24 hours already.now hangs @ 96% linking cxx executable ../../bin/opt what wait more or this? most linker running out of ram. few suggestions: release builds tend require less ram linking compared debug one use gold, not bfd ld add more ram :)

selenium c# instance of an object error -

there selenium web drive c # create code in "object reference not set instance of object" error how supposed regular code? can please? private void modul4_siteimage() { try { iwebdriver driver = webdriverselect(combobox_browser.text); //browser seçilir (int = 0; < lst_result.items.count; i++) { driver.navigate().gotourl(lst_result.items[i+1].tostring()); //link seçilir foreach (var item in driver.findelements(by.classname("lazyowl"))) { if (doesimageexistremotely(item.getattribute("src").tostring(), "image/jpeg")) { lst_result.items.add("doğru " + lst_result.items[i].tostring()); } else { lst_result.items.add("hata

join - Mysql: select value that matches several criteria on multiple rows -

Image
good evening, i have 2 tables t1 , t2 in t1, have 2 variables, id (which uniquely identify each row) , doc (which can common several ids) in t2, have 3 variables, id (which not uniquely identify rows here), auth , , type. each id has maximum of 1 distinct auth. sample data: what select docs have id auth='ep', , have id auth='us'. have additional ids other auth, have have @ least these two. thus, have final table doc, id,and auth (there should @ least 2 ids per doc, can more if there exists additional auth , ep doc) the desired results: this should work: select distinct (t1.id), t1.doc, t2.auth t1 left join t2 on t2.id = t1.id t1.doc in( select t1.doc t2 left join t1 on t1.id = t2.id t2.auth in('ep','us') group t1.doc having count(distinct t2.auth) = 2) ;

angularjs - Node js, TCP request from front-end causing crash -

i creating website involves user pressing button performs http request node server. there, node server opens tcp socket using "net.socket()". afterwards, send response after message delivered using res.send("ok"). when user presses multiple times error below. also, when server communication tcp not available, same issue occurs well. there way can prevent multiple requests user or when tcp server not available crashing node server? can't set headers after sent. @ serverresponse.outgoingmessage.setheader (_http_outgoing.js:344:11) @ serverresponse.header (/users/kevin/documents/mic/node_modules/express/lib/response.js:719:10) @ serverresponse.send (/users/kevin/documents/mic/node_modules/express/lib/response.js:164:12) @ serverresponse.json (/users/kevin/documents/mic/node_modules/express/lib/response.js:250:15) @ serverresponse.send (/users/kevin/documents/mic/node_modules/express/lib/response.js:152:21) @ /us

How to use Rabbitmq binder in spring cloud dataflow stream -

i have stream launches task based on given time interval. want use rabbit binder missing syntax of providing rabbitmq broker properties. please me. here steps , configuration have. 1. imported apps using: app import --uri http//bitly/stream-applications-rabbit-maven 2. registered task: app register --name task-sink --type sink --uri file://tasksink.jar 3. created stream: stream create foo --definition "triggertask --triggertask.uri=file://task-file.jar --trigger.cron-expression=10 | task-sink" 4. stream deploy foo --properties "spring.rabbitmq.host=myhost, spring.rabbitmq.username=user,spring.rabbitmq.password=pass, spring.rabbitmq.port=5672,spring.rabbitmq.virtual-host=xxx" when both stream , runtime apps deployed see error on logs saying connection not established. changed properties syntax "spring.cloud.stream.bindings.rabbitmq.host" same error. not sure not using correct syntax here below different behaviour when run on vpn

android - ListActivity: Add reaction when pressing on List Item -

i'm starting out java/android studio , wrote following listactivity: public class transmitchaptersel extends listactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); string[] chapters = {"chapter 1", "chapter 2", "chapter 3"}; arrayadapter<string> adapter = new arrayadapter<string>(getlistview().getcontext(), android.r.layout.simple_list_item_1, chapters); getlistview().setadapter(adapter); } } but don't know how can produce reaction when click/touch/hold 1 of list items. what want produce this: pseudocode: if(actionevent e == chapter1pressed){ //do stuff } or: pseudocode: while(actionevent e == chapter1helddown){ //do stuff } if need know when item clicked can use onitemclicklistener list view. getlistview().setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview&l

angularjs - How to progress bar with ng-style -

i trying make progress bar ng-style. problem that, when make it, progress slider goes middle, , not cover whole bar. progress bar should in hours, like: 4h, 5h etc. when make %, works. 1 help? this code: <div class="progress-bar progress-bar-slider"> <input class="progress-slider" type="range" min="4" max="12" ng-model="workinghoursselectedrange"> <div class="inner" ng-style="{width: workinghoursselectedrange + '%' }"></div> </div> jsfiddle: https://jsfiddle.net/f6h32sfx/ try <style> .progress-box { width: 100%; } .progress-box .percentage-cur .num { margin-right: 5px; } .progress-box .progress-bar { width: 100%; height: 12px; background: #f2f1f1; margin-bottom: 3px; border: 1px solid #dfdfdf; box-shadow: 0 0 2px #d5d4d

php - How to setup HTTP server with nodejs for logging? -

i need setup logging service startup. , team not have time , resources (monetary) deploy dedicated tool logs. need run analytics on user behavior. while going learn analytics bit , implement down line, need log user activity can pull out data later , math. i using sql based (rdbms) setup main application (which web service) , plan log user activity in dynamodb (aws). also, plan setup local (on same server) node.js server can handle log requests coming php based app to make sure logging activity runs in process , handled gracefully without crashing or slowing down main server code. idea here - when request comes in user, php application make call nodejs server. nodejs server take request , return immediately while queuing request (like 200 other requests) , php app continue serve request. nodejs server go on logging in queue 1 after other. the reason why plan - nodejs runs on single thread , event-loop based - hence, in case there sudden traffic spike, log requests queued ,

Limit the number of rows of autocomplete result , and match strings with starting letters only -

i'm using jquery autocomplete in project, <div class="ui-widget"> <label for="tags">tags: </label> <input id="tags"> </div> json file [ { "value": "saree", "url": "/collection/saree" }, { "value": "lehangas", "url": "/collection/lehangas" }, { "value": "dresses", "url": "/collection/dresses" }, { "value": "tunics", "url": "/collection/tunics" }, { "value": "kurtis", "url": "/collection/kurtis" }, { "value": "blouses", "url": "/collection/blouses" }, { "value": "duppattas", "url": "/collection/duppattas" }

swift - How do I reset all global variables? -

i want reset global variables when user logs out otherwise of information stay (the info in global variables). is there way without manually resetting them initial value when log out button pressed? if understand correctly, saving user-data global variable? doesn't seem make sense me. if intending equal nsuserdefaults global variables , can use following approach delete data standard userdefaults: private func cleanuserdefaultsonlogout() { let standarddefaults = userdefaults.standard key in standarddefaults.dictionaryrepresentation().keys { standarddefaults.removeobject(forkey: key) } standarddefaults.synchronize() } please correct me if i've misinterpreted question.

python - Asserting a function that prints an array -

this question has answer here: python function returns none without return statement 6 answers i trying test function def print_board(m): in range (m.shape[0]): line='' j in range (m.shape[1]): line+=str(int(m[i,j])) print(line) i created new file test , imported file , function array not sure on how can test since don't return it, tried : assert(print_board(array([[1,1,1],[0,0,0],[1,1,1]],dtype='bool')) == '''111 000 111''') but got assertionerror what redirect python standard output (where print sends it) string, , compare string. see this question explanation of how that.