Posts

Showing posts from June, 2012

Java convert string to md5 and vise versa -

i have java 3 strings. let example. string test = "hi, "; string test1 = "this "; string test2 = "java programming!"; i wanna combine 3 string , change md5 format. how do? use messagedigest class 1 string have no idea how append 3 string before change md5. , wanna change md5 string. need external library. md5 not format, or encryption algorithm. md5 hash function . means, long text short digest - apart of short inputs transformation lossy. in general, there no going md5 plain text.

sql server - SQL Parameter sniffing is it possible that recompile does not help but local variables do -

i using sp_executesql pass complicated selection few parameters. slower doing way taking out of stored procedure , declaring variables. i have seen many questions sql parameter sniffing , scenario sounds case. after calling dbcc freeproccache or amending outer select option (recompile) still uses different , inefficent execution plan compared writing same query outside stored procedure. however still using stored procedure setting copies of parameters local variables use efficent execution plan. does scenario rule out sql parameter sniffing cause? becuase recompile query surely there no pre existing execution plan uses. if possible other reasons behaviour? just give idea of sql query can see below (messy generated via entity framework). fast query when put sp_executesql proc variable taken out , put in parameters generates inefficient execution plan declare @p__linq__0 int = 2032 ,@p__linq__1 uniqueidentifier = '8cc161fc-b8de-4746-ba4f-62fa55df26de' ,@p__l

GDCM library cannot read dicom file in C# -

i tried read dicom file using gdcm library using code : gdcm.imagereader imagereader = new gdcm.imagereader(); imagereader.setfilename(@"e:\sample_success.dcm"); if (!imagereader.read()) throw new exception("cannot read dicom file!"); for "sample_success.dcm" file, can read file fine ( sample_success.png ). using "sample_failed.dcm" file, gdcm throws exception because couldn't read it. tried open file using other dicom viewer such radiant , worked. there wrong gdcm build? why cannot read it? i use gdcm 2.6.5. please find both samples here. you're file contains garbage (bunch of binary 0) after offset 0x1480aa (somewhere in pixel data attribute). did expect toolkit if not report error ? by design gdcm still load whatever can until error. if remove new exception in code, can decide (for example) pass imagereader.getfile() gdcm::writer , rewrite file clean dicom. as side note not have access radiant software find

javascript - JS (CSS) dynamic background image moving -

i made little script makes photo background scroll up/button in same time page scrolling. problem background image scrolling after page scrolling (it have delay). question: how may make move background image page scrolling in example http://shapebootstrap.net/item/1524936-unika-responsive-one-page-html5-template/live-demo ? i made plnkr code: https://plnkr.co/edit/e6ocuf4sxsa80pi6xanj?p=preview var bgscroll = function(lastscrolltop, elem) { lastscrolltop = $(window).scrolltop(); $(elem).css('transition', 'all .5s'); $(elem).css('background-position', '0% ' + parseint(-lastscrolltop / 2) + 'px'); console.log('lastscrolltop = ' + lastscrolltop); }; $(window).load(function() { var lastst = 0; var homeelem = '#add-outer-container'; $(window).on("scroll", function() { bgscroll(lastst, homeelem); }); }); html, body { height: 100%; margin: 0; padding: 0; background-c

javascript - Form submit with hidden fields -

i've got form 2 hidden fields , want , when hit submit button fill fields script before sending . form looks : <form method = "post" action = "submit.php"> <input type="text" value="" > ... <input type"hidden" value="" > <input type"hidden" value="" > <input type="submit" value="sendme"> <script > //do before send form </script> the problem ive got field @ end of form , need value of fill hidden fields calculation based on value before form submitted. as per question, assumed want set values hidden fields based on calculation done on entered value first text-box. you can use change method of text-box set values of hidden fields, once submit give values of fields. <input type="text" value="" id="inputbox"> <input type="hidden" value="" id="hidden1"&

Linking Excel In C# -

so i'm working in microsoft visual studio 2015 , want able link project excel spreadsheet. what want achieve this; able create program can use number in specific cell , calculations it. example, take cell d4 , create poisson distribution using value mean. you need add reference microsoft.office.core , microsoft.office.interop.excel in projects references. add references class. using microsoft.office.interop.excel; using excel = microsoft.office.interop.excel; then can open/create/manipulate excel sheets in code. lots of info on web. update comment-- this example opening new worksheet save when done. excel.application xlapp; excel.workbook myworkbook; excel.worksheet myworksheet; object misvalue = system.reflection.missing.value; xlapp = new excel.applicationclass(); myworkbook = xlapp.workbooks.add(misvalue); myworksheet = (excel.worksheet)myworkbook.worksheets.get_item(1); done work on sheet myworksheet.cells[curxlrow, 5] = "pf"; myworksheet

c# - how to press Ctrl + ] in Selenium web driver -

i have ff.code opens chrome browser , press "f12" open chrome dev tools, i've been searching in google on how press ctrl+] unfortunately did not find article/info it. has here made stuff? thanks! iwebdriver wdriver = new chromedriver(); wdriver.navigate().gotourl("www.samplewebapp.com"); wdriver.manage().window.maximize(); actions action = new actions(wdriver); action.sendkeys(openqa.selenium.keys.f12).perform(); use either actions action=new actions(driver); action.sendkeys(openqa.selenium.keys.control + "]").build().perform(); or yourwebelement.sendkeys(keys.control + "]");

Javascript to format number as currency -

i have following code. <select id="cage_options"> <option>please select</option> <option value="2,63330">option1</option> <option value="3,13300">option2</option> <option value="4,2000.00">option3</option> </select> <input id="cage_labor_estimate" disabled> <script> function format(n) { return n.tofixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,"); } document.getelementbyid("cage_options").addeventlistener("change", cageoptionfunction); function cageoptionfunction() { select=document.getelementbyid('cage_options').value.split(','); cage_option = select[1]; document.getelementbyid("cage_labor_estimate").value = format(cage_option); } </script> i trying format output in disabled input box in current format following error: typeerror: n.t

git - Is there a better way to accomplish the combination reset, checkout, cherry-pick, checkout, rebase? -

suppose have following history: a ─▶ b -- master ╲ ◀ c ─▶ d ─▶ e -- feature at point e , stuble upon small bug in code has strictly speaking nothing feature , happens important @ point, though went unnoticed. i'll first of fix right in place: a ─▶ b -- master ╲ ◀ c ─▶ d ─▶ e ─▶ f -- feature ⋮ fix bug but, since after bug has not feature such, isn't history want – fix should right in master (if not in dedicated bugfix branch). git checkout master git cherry-pick f ─▶ b ─▶ f' -- master ╲ ◀ c ─▶ d ─▶ e ─▶ f -- feature ok, fine, can't leave @ (or can i?) – f occurs 2 times in active branches yet want merge. could git checkout feature git reset --hard head^ ─▶ b ─▶ f' -- master ╲ ◀ c ─▶ d ─▶ e -- feature and wait f' when merging feature master , won't because don't have bugfix available right need

kubernetes - kube-up.sh fails on ubuntu 14.04 with some dzdo(sudo ) issue -

flanneld 100% 2131 2.1kb/s 00:00 + need_reconfig_docker=true + cni_plugin_conf= + extra_sans=(ip:${master_ip} ip:${service_cluster_ip_range%.*}.1 dns:kubernetes dns:kubernetes.default dns:kubernetes.default.svc dns:kubernetes.default.svc.cluster.local) ++ tr ' ' , ++ echo ip:10.204.22.202 ip:192.168.3.1 dns:kubernetes dns:kubernetes.default dns:kubernetes.default.svc dns:kubernetes.default.svc.cluster.local + extra_sans=ip:10.204.22.202,ip:192.168.3.1,dns:kubernetes,dns:kubernetes.default,dns:kubernetes.default.svc,dns:kubernetes.default.svc.cluster.local + bash_debug_flags=true + [[ false == \t\r\u\e ]] + ssh -ostricthostkeychecking=no -ouserknownhostsfile=/dev/null -ologlevel=error -t karan.singhal@10.204.22.202 ' set +e true source ~/kube/util.sh setclusterinfo create-etcd-opts '\'

javascript - Why is my mocha/should Array throwing test failing? -

the following code snippet simple (from https://mochajs.org/#synchronous-code ). feels stupidbut, why [1,2,3] evaluates undefined when used literal notation, , not when used in myarray variable? var assert = require('assert') // "mocha": "^3.0.2" var should = require('should') // "should": "^11.1.0" describe('array', function () { describe('#indexof()', function () { var myarray = [1, 2, 3] it('should return -1 when value not present', function () { myarray.indexof(0).should.equal(-1) // - success [1, 2, 3].indexof(0).should.equal(-1) // b - fails test }) }) }) when run test, line 'b' fails follows: array #indexof() 1) should return -1 when value not present 1) array #indexof() should return -1 when value not present: typeerror: cannot read property 'indexof' of undefined ... error trace points line fails, nothing else ...

php - zend expressive + doctrine custom types -

i'm trying map custom type string. here's entity definition: /** * @var string * * @orm\column(name="type", type="string", columndefinition="my_type_enum", nullable=false) */ but when try create migration (migration:diff) output [doctrine\dbal\dbalexception] unknown database type my_type_enum requested, doctrine\dbal\platforms\postgresql92platform may not suppo rt it. seems need map custom type my_type_enum string using mapping_types , in zend expressive? it's seems configuration ignored ... 'doctrine' => [ 'dbal' => [ 'mapping_types' => [ 'my_type_enum' => 'string' ] ] ] ... zend-expressive doesn't have doctrine support build in. depends on doctrine module , factory using. factory starts doctrine service config. inside doctrine factory figure out how , if supports custom mapping types. in cas

javascript - AngularJS duplicated element for 1 second -

i have login form contains box display error message <div class="ui negative message" ng-if="vm.message != ''"> <span ng-bind="vm.message"></span> </div> the message set inside controller loginservice.checkuser(vm.credentials).then(function(res) { $rootscope.token = res.data.token; $state.go('home'); }, function(err) { vm.error = true; if(err.status == 401){ vm.message = "error !"; } }); my problem div containing message shown 2 times during 1sec after clicking on login button. during 0.5/1 second have 2 times same div same message. user cannot see says can see blinking. how can avoid getting blink ? your ng-if doesn't work in html, change this: <div class="ui negative message" ng-if="vm.message"> <span ng-bind="message"></span> </div> the statement ng-if="vm.message != ''

posix - Regex for detecting a query string -

i'm trying use regex testing url. accepted cases: www.mystite.com/whatever/?bla=dfgsd&page=test www.mystite.com/whatever/?bla=dfgsd&page=test& www.mystite.com/whatever/?bla=dfgsd&page=test&hello=bla www.mystite.com/whatever/?page=test&hello=bla rejected: www.mystite.com/whatever/?hello=bla&page=testfff www.mystite.com/whatever/?page=testfff&hello=bla - not because misses &page=test& , page=test& or &page=test that's tried, , doesn't work: ([^&amp;]+)([page=test])([^&amp;]+) you can ignore domain , sub folder, i'm trying check after question mark after reading question 3rd time think asking for: &?page=test($|&) this matches occurences of "page=test" optional "&" @ start. @ end there needs either "&" (optionally followed other characters) or nothing (end of string). does solve problem?

linux - Access server using Browser and IP instead of DNS -

i want access test site home using firefox , entering ip instead of dns. my server aws ubuntu , has mysql, apache2 installed. i want access test site in firefox: x.x.x.x/test but showed me 404. when type in firefox works fine: x.x.x.x i have no idea how make work. here's did in server. cd /var/www sudo mkdir test sudo cp wordpress test/ cd test sudo mv -r test public sudo chown -r www-data:www-data public sudo chmod -r 775 public cd /etc/apache2/sites-available sudo cp 000-default.conf test.conf sudo vim test.conf here test.conf <virtualhost *:80> servername test serveradmin webmaster@localhost documentroot /var/www/test/public <directory /var/www/test/public/> allowoverride </directory> </virtualhost> here goes command again sudo a2ensite test.conf sudo service apache2 restart now goto firefox , enter aws elastic ip in address bar this: x.x.x.x/test which gives me 404 you doing mistake in

ruby - Rails, current_page?(user_path) giving an error -

i have element witch want hide on specific pages, example on pages located @ app/views/users/ (there have new.html.erb ; edit.html.erb ; show.html.erb . , have div in layouts/application.html.erb shown on pages, want hide it. i thought can this: <% unless current_page?(new_user_path) || current_page?(user_path) %> <div>some content</div> <% end %> but give me error, pretty obvious: user_show method need id of user, not visiting pages variable @user present. can land me help: any possibility around error? (and don't want assign @user variable every , don't want make list of page allowed) is there other way hide element on specific pages? not entirely sure trying achieve, how can guard user not being present: unless current_page?(new_user_path) || @user && current_page?(user_path(@user))

Extracting data values from MATLAB meshgrid output -

i need extract data values particular coordinate meshgrid in matlab, code following: paarx=paar(:,1); paarx1=paarx(1:20:length(paarx)); paary=paar(:,2); paary1=paary(1:20:length(paary)); x=paarx; y=paary; v=paar(:,3); [xi, yi]=meshgrid(paarx1, paary1); vq=griddata(x, y, v, xi, yi, 'cubic'); the paarx , paary , v x, y , z values of surface, z values values interpolated. paarx1 , paary1 values used in meshgrid every 20th value taken (the array large before this). need extract interpolated z values in vq particular x , y coordinates. as understood question, need this: nx = 3; % <= length(paarx1) ny = 4; % <= length(paary1) fprintf('the interpolated value @ x=%g , y=%g %g',paarx1(nx),paary1(ny),vq(ny,nx)) or can transpose matrix vq vq = vq.'; fprintf('the interpolated value @ x=%g , y=%g %g',paarx1(nx),paary1(ny),vq(nx,ny)) vq(ny,nx) ( y first) because use meshgrid function. can use access matrix element in form vq(nx,ny)

swift - Protocol oriented programming and introduction of additional properties -

i started using pop couple months ago , premise. despite allows feel inability introduce new properties cripples it. find in real world situations need introduce 1 or more property extension needs intended do. recent example this: i have extension uiview renders special kind of border. creating new calayer , adding sublayer view. worked fine until noticed when view's bounds change, stuck old border. remedy this, wanted store border layer property , when layout changed remove old border layer , create new one. since protocols can't add properties directly, had use subclass. i not interested how handle situation above omitted details might render improvements unusable. know if have live , revert subclasses or missing , can somehow overcome it. i know protocols can define properties classes implementing need define well, limiting too. in example above, wanted extend functionality of uiview, not subclass of uiview, can used in view my cheeky answer: protocol or

php - Type error: Argument 1 passed to Doctrine\Common\Collections\ArrayCollection::__construct() must be of the type array, object given -

actually... more or less know problem. i'm receiving error in particular controller try persist($object) ... actually i'm developing webapp me have register books i'm reading.. , use google books api that. so, have next entities: admin users books categories i thinking db , wanted table user_id, book_id decided manytomany but, don't know if way.. or not. (because familiars going use it) it has many users can have same book , user can have many books obviusly. so, error i'm getting guess it's because i'm not implementing done manytomany... write below controller , entities where users like: /** * @orm\entity * @orm\table(name="users") * @orm\entity(repositoryclass="usersrepository") * @uniqueentity("username") * @uniqueentity("email") */ class users implements userinterface, \serializable { /** * @orm\column(type="integer") * @orm\id * @orm\generatedvalue(st

java - How to extract nested JSON Elements in Liferay -

i'm using liferay 6.2 , have jsonobject containing following: { "foo":{ "bar":{ "baz":["42","23"] } } } i have string containing path/selector/whatsitcalled pointing somewhere in jsonobject: foo.bar.baz[0] how go getting corresponding value jsonobject, i.e. "42"? all methods find deal next level down, nothing seems cover nesting. parse path manually, isn't there easier way? use java library perform xpath similar query json. i've used success in liferay. https://github.com/jayway/jsonpath

creating a trigger for snmp item in zabbix -

i have problem in defining trigger snmp item in zabbix. snmp oid 'if-mib::ifhcinoctets.10001' & key 'inbound_traffic10001' item. the item stores delta (simple change) & update interval set 20 120 seconds. i have defined trigger following expression: {template snmp-v2 switch c3750:inbound_traffic10001.last()}>2000000 i want trigger fires if inbound traffic of port 1 of switch goes on 2mbs. but problem traffic goes on 2mb trigger not fire!!! any appreciated. as discovered through discussion, "store value" setting in item should set delta (speed per second) .

sql - Stored procedure with a parameter in FROM clause -

is possible create stored procedure uses parameter in from clause? for example: create procedure [dbo].[getmaxid] @id varchar(50) @table varchar(50) begin select max(@id) @table end you cannot pass identifiers parameters query (neither table names nor column names). solution use dynamic sql. syntax suggests sql server, like: create procedure [dbo].[getmaxid] ( @id varchar(50) @table varchar(50) ) begin declare @sql nvarchar(max); set @sql = n'select max(@id) @table'; set @sql = replace(replace(@sql, '@id', quotename(@id)), '@table', quotename(@table)); exec sp_executesql @sql; end; -- getmaxid

javascript - Fetch and append element at last using jQuery -

i have div parent element class .carousel-inner. within parent div, there children elements. want take 2nd (child) element , append element @ last. getting , appending second element this. var = $(".carousel-inner").children()[1]; $(".carousel-inner").append(a); now append element, removes element second position , append @ last. want keep element second position well. how can it? using clone() after find element. , make variable var = $(".carousel-inner").children()[1], b = $(a).clone(); $(".carousel-inner").append(b); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="carousel-inner"> <div class="child"> </div> <div class="child"> clones </div> <div class="child"> c </div> </div> or clone element b

c# - How to pass and retrieve table row data using QueryString in asp.net -

i have datatable i have created var a=[]; $("#datatable tbody").on( 'click', 'tr', function () { a=table.row( ).data(); }); now want pass array a[] web form using query string on button click <asp:button id="button" onclick="click_function"/> and then [webmethod] click_function() { var darr = []; darr = table.row('.selected').data(); var url = "questiondetail.htm?questionid=" + darr; window.location.href = url; } how should i? and have retrieve array in new webform. so, data of row i'm guessing // javascript var table = $("#datatable").datatable(); if that's case add hidden field on form <!-- html --> <input type="hidden" runat="server" id="hfselectedrow" /> and set data field // javascript $("#datatable tbody").on( 'click', &

javascript - Redux not re-rendering React component after store update -

i've trawled net , stackoverflow answers no luck, so... my reducer: import { combinereducers } 'redux' import { update_calories } './actions' const calories = (state = 0, action) => { switch (action.type) { case update_calories: //return object.assign({}, state, {calories: action.calories}); /*return { ...state, calories: action.calories }*/ return action.calories default: return state } } const fitnessapp = combinereducers({ calories }) export default fitnessapp my actions: export const update_calories = 'update_calories'; export const updatecalories = (calories) => { return { type: 'update_calories', calories } } i calling store.dispatch(updatecalories(totalcalories)); 1 component seems update store - see below console.log getstate object {calories: 1357} and component should updating: class dial extends

iphone - InApp purchases in iOS using ti.storekit in Appcelerator -

i'm trying use ios in-app purchases in application through ti.storekit module. i'm posting successful purchases on custom server. works fine , misses call custom function posting purchase on server. i'm confuse either module not compatible titanium sdk or what. and i'm following tutorial @rodolfo perottoni. https://medium.com/all-titanium/monetising-your-ios-titanium-app-in-app-purchases-de35d55feb81#.yqgnj0sf2 titanium sdk 5.3.0 ti.storekit version 3.1.2 i'd thankful help.

javascript - Bootstrap: Closing others nav menus on collapse via JS -

i've been new @ bootstrap , js. currently, i've 2 navbar-collapse submenus. close others, when 1 opened. found codesnippet: $(function () { $('.navbar-collapse').on('show.bs.collapse', function (e) { $('.navbar-collapse').not(this).collapse('hide'); }); }); i placed in $(document).ready(function(){...}); . event fired on collapse event, seems close navbar-collapse elements. why? , how can archiv goals? here demo method 1 to collapse can use like, can collapse navs has class " in " , because opened collapsible have class " in " added. catch them using below script close those. $('#accordion .collapse').on('show.bs.collapse', function (e) { $('#accordion .in').collapse('hide'); }); method 2 <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src=

string - C++ Throwing same error message from different places in code -

i want throw same error different places. here's example: int devide(int a,int b) { if(b==0) { throw "b must different 0"; } return 0; } int mod(int a,int b) { if(b==0) { throw "b must different 0"; } return 0; } and in main function: int main() { try { devide(1,0); } catch(char const* e) { cout << e << endl; } try { mod(1,0); } catch(char const* e) { cout << e << endl; } return 0; } now output of program is: b must different 0 b must different 0 as can see, error nature same, error message different. what's best practice can follow in case, scalable? let's have 100 different types of exceptions, when throw exception devisor different 0 want same messege everywhere exception thrown. edit: thinking 2 options: for every exception may throw define own class inherit std::exception . every exception can put in exceptions.cpp . i can define 1 one class myexce

javascript - TinyMCE stacks classes -

i'm using tinymce 4 default editor. in config specified style formats. works excuistly except 1 thing: stacks classes. my style format: style_formats: [ { title: 'heading 2', block: 'h2', classes: 'heading-02' }, { title: 'heading 3', block: 'h3', classes: 'heading-03' }, { title: 'heading 4', block: 'h4', classes: 'heading-04' }, { title: 'heading 5', block: 'h5', classes: 'heading-05' }, { title: 'text', block: 'p', classes: 'copy-02' }, ], after selecting text , switching between format, end result looks this: <h4 class="heading-02 heading-03 heading-04">example</h4> obviously there should no other classes heading-04 alone. non less adds them anyways. my question therefore is, how can make sure there 1 class after format switch. add style_formats_merge: true style_forma

php - Results of a simple execution time check contradict Xdebug profiling results -

i have expensive method removecolumns(...) , in addition gets called multiple times. want increase performance. analyze optimization results use 2 tools: (1) xdebug profiler webgrind , (2) simple execution time measuring script (that executed on command line within phpunit test method): $timestart = microtime(true); ($i=0 ; $i < 1000000; $i++) { // code measure $this->...->removecolumns($testarray, $columnnames, $iswhitelist); } $timestop = microtime(true); $resulttime = $timestop - $timestart; $cycletime = $resulttime / $i; echo number_format($cycletime, 10, ',', '') . ' sec/run'; die(php_eol . '###' . php_eol); but i'm looking @ results -- , see, results ot both tooas absolutely contrarian each other. the execution time measuring script's results are: variant sec/run (x69) sec/run (x1000) sec/run (x10000) sec/run (x100000) 1 0,0000121144 0,0000102139 0,0000092316 0,0

Algolia Secured API Keys: attributesToRetrieve parameter -

with algolia possible restrict attributes retrieve when building secured api key? by defualt, when searching, attributestoretrieve parameter may used, not sure if it's possible used during generation of secured api key . the reason of because want restrict attributes of document specific users. unfortunately, it's not possible restrict attributes retrieve using attributestoretrieve query parameter while generating secured api key -> user still able override @ query time. the thing can configure unretrievableattributes setting in index settings. setting forces attributes non-retrievable whatever attributeto{retrieve,highlight,snippet} query parameter set.

dynamics crm - Issue with lookup filter criteria and subgrid issue in a specific scenario -

following exact scenario in dynamics crm application: there 2 entities "departments" , "employees", there 1:n relationship departments employees. i have created lookup view on employees expected display employees has no departments associated. there subgrid in department form allows users select employees department. this works fine, until user tries create new employee within department page. creates employee , associate department employee's lookup view set list employess having no department, displays message saying "no records found. create new record". because newly created employee has department associated it. message issue, whereas data seems ok. message annoying end-users obvious reasons. when user clicks anywhere on form, error disappears. any suggestions on how deal issue? i'd hide grid it's empty, , show webresource displays message employees have department. create button allow them create new employee well,

docker - "Error reading data" while executing a RabbitMQ consumer in Symfony -

i have rabbitmq container , php 7 container symfony 3.1.x project executes rabbitmq consumer using oldsoundrabbitmqbundle . when running command executes test consumer: bin/console rabbitmq:consumer -w test i following error: [phpamqplib\exception\amqpioexception] error reading data. received 0 instead of expected 7 bytes my setup simple , checked following things: rabbitmq @ latest version (3.6.5) the configured host , vhost , user , password parameters correct mbstring extension enabled it's easy set project reproduce issue. the sample project available on github , instructions provided in readme file reproduce issue few steps. here highlights: docker-compose.yml version: '2' services: php: build: ./docker/php/ links: - rabbitmq volumes: - ./src:/var/www/rabbitmq-test working_dir: /var/www/rabbitmq-test rabbitmq: image: rabbitmq:3.6-management config.yml old_sound_rabbit_mq: connectio

Kivy UrlRequest called as a class - Methods not executed? -

trying experiment , build class resolving around use of urlrequest check if given url valid. turns out being bit more difficult anticipated! the issue on_success , on_failure/error methods defined part of class never called. script throws following output (based on print commands): http://www.google.com request sent url doesn't work now suspicion i´m getting return code ("none") test_connection method, , not connectionsuccess or connectionfailure. how can make call wait 1 of latter give return? suggestion welcome. thanks. from kivy.app import app kivy.uix.floatlayout import floatlayout kivy.network.urlrequest import urlrequest class webexplorer(): def test_connection(self, path): self.path = path print (self.path) req = urlrequest(self.path,on_failure=self.connectionfailure,on_error=self.connectionfailure,on_success=self.connectionsuccess) print ("request sent") def connectionsuccess(self,*args):

database - Auto Import many .txt files into sql server table -

i have many .txt files , want import them sql server table. the file names like: hazem.20160922.txt hazem2.20160921.txt the table exists no need create again. daily activity, need automate that. read many articles online , unable it. since said automatic process should happen every day, can create ssis (etl) job , can schedule job in such away run everyday. here link explain how create etl package flat file source , database destination. this link step step procedure scheduling job in sql server agent. you can select folder path instead of file name in source etl job move files in folder destination table once per day.

json - Must hide one line / password in my Google Sheets script -

i've created google sheet accepts input user, based on information, goes external website , automatically populates spreadsheet. my problem want hand on google sheet , allow others use it, contains own personal api key external website. unlikely users own api or know how/where put if do. i want allow them use sheet, not able access or see script, or @ least api key within script. because sheet requires input, permissions must allow them edit...and therefore, see/edit script well. part of tos of external website requires registered api key in order pull information. can let use information when use application contains key, not allowed let else know actual key is. suggestions? you should create google script doget method , publish web app. here can put api key , pass user input parameter. the google sheet can call script , api key not exposed end user. web app can connect external api , return results sheet.

firebase - When will Google stop supporting GCM? -

since firebase replacing gcm, asking myself how longer google support gcm? in short: when end of life/support of gcm? as of right now, there still no official date when gcm officially deprecated. seen in gcm faq : is gcm going deprecated? we continue support current version of gcm android , ios sdks because know lot of developers using gcm sdks today handle notifications, , client app upgrade takes time. but new client-side features added fcm sdks moving forward. encouraged upgrade fcm sdks. seeing there still lot of developers still using gcm, i'm pretty sure support still continue quite time. however, if intend make use of push notification, highly suggest proceeding fcm. saving hassle of migration in future (not it's hard tho) , make use of new features available.

linux - Why mmap-ing a file into the OS cache introduced performance bottlenecks for reads? -

when reading document of rocksdb, saw that: we found mmap-ing file os cache introduced performance bottlenecks reads. i have 2 questions: what's root cause of performance? how test case? going produce test results of this.

office365 - Excel 2013 js API: How to get Worksheet names? -

how can name of different sheets within excel workbook using js api of microsoft. for excel 2016 use ctx.workbook.worksheets.items there when developing add ins excel 2013? unfortunately not. host-specific functionality (as opposed cross-host apis of 2013, didn't got depth given host), need office 2016.

sql server - Azure Easy API JavaScript: How to return multiple result set from MSSQL query -

i have created azure easy api (on app service migrated mobile service). want return 3 result sets sql stored procedure. returns first result set. have read setting multiple attribute of query true allow returning multiple result sets, not sure how it. that's azure api looks like: exports.get = function(request, response) { var mssql = request.service.mssql; var param1 = request.query.pollid; var param2 = request.query.userid; var sql = "exec poll.getpollsdata @pollid = ?, @userid = ?"; mssql.query(sql, [param1, param2], { success: function(results) { response.send(200, results); }, error: function(err) { response.send(400, { error: err }); } }); }; getpollsdata stored procedure returns 3 result sets (for polls, questions , options). api shows first table on client side (in polldata below). this client side javascript: client = new windowsazure.mobileservicecli

R Shiny Reactive: Object not found when table is imported from a txt file -

the following script runs fine if define data table within script "data.table(...)". larger data sets more comfortable import data text file using "read.table(...)". unfortunately script not run when data imported text file. error message is: "warning: error in grepl: object 'material' not found" the column "material" cannot identified in case. have idea how solve problem? #this content of example_data.txt (sep. tabulator): #id londd latdd material application name color #1 20 60 stone 1 red #2 38 56 water,sand b 2 green #3 96 30 sand c 3 blue #4 32 31 wood d 4 yellow # filtermap library(data.table) library(shiny) library(dplyr) library(leaflet) #mydat <- data.table( id=c(1,2,3,4), # londd=c(20, 38, 96, 32), # latdd=c(60, 56, 30, 31), # material=c("stone", "water,sand", "sand", "wood"), #

qt - Allignment of a QLabel and a QCheckBox in a BoxLayout gives unexpected result -

Image
when add qlabel , qcheckbox s either qvboxlayout or qhboxlayout expect them evenly distributed checkboxes allign tight @ bottom (in above example) , label centered on resulting free space in widget. how can change behaviour distribute 3 widgets evenly? many thanks. this example code: widget::widget(qwidget *parent) : qwidget(parent), ui(new ui::widget) { qlabel* l = new qlabel("hi"); qcheckbox* c = new qcheckbox("label"); qcheckbox* c2 = new qcheckbox("label"); l->settext("hi"); qvboxlayout* v = new qvboxlayout; v->addwidget(l); v->addwidget(c); v->addwidget(c2); setlayout(v); ui->setupui(this); } and result: take @ qsizepolicy . need setsizepolicy qlabel , qcheckbox es qsizepolicy::preferred , docs : the default policy preferred / preferred , means widget can freely resized, prefers size sizehint() returns. button-like widgets set size policy s

jquery - dataTables removes row after click -

i want call function after clicking on datatables row. row disappears after clicking error "datatables warning: table id=datatables-example-requested unknown parameter '0' row 0, column0. more information error, please see http://datatables.net/tn/4 " i found code in 1 of posts: $(document).ready(function() { var table = $('#datatables-example').datatable(); $('#datatables-example tbody').on( 'click', 'tr', function () { var id = table.row().data(1); myfunction(id); return false; }); }); if put in id hardcoded works fine, somehow table.row().data(1) generates error. data() returns either array or object, , takes params if update values. why error, data() expects array or object when used setter-method. need specify want data() clicked row, row() return first visible row on page. use var id = table.row(this).data()[1]; instead.

windows - Invoking remote command/script with specific credentials -

i attempting invoke remote batch script using powershell. here sample code: invoke-command -computername 127.0.0.1 {c:\myfile.bat} myfile.bat contains this: echo %username% copy \\10.10.10.10\sample c:\tome when invoke myfile.bat locally in cmd window, fine. username expected. however, when run invoke-command using powershell, gives me error, while username still correct: access denied. here have tried far. $password = convertto-securestring "mypassword" -asplaintext -force $username = "domain\username" $cred = new-object -typename system.management.automation.pscredential -argumentlist $username, $password invoke-command -computername 127.0.0.1 {myfile.bat} -credential $cred however, while equates same username, still gives me same error. i tried create psdrive, , execute command well: new-psdrive -name x -psprovider filesystem -root \\10.10.10.10\sample invoke-command -computername 127.0.0.1 {myfile.bat} remove-psdrive x but same er