Posts

Showing posts from September, 2014

http - Php $_SERVER["REQUEST_METHOD"] alway return get -

i'm writing code in localhost. index.php: $task = null; $method = $_server['request_method']; var_dump($method); //initialize data httpprotocol::init(); if (empty($method)) exitapp("unknown method"); if ($method == httpprotocol::get()) $task = new webhookverifytask(); else if ($method == httpprotocol::post()) $task = new processfacebookeventtask(); if (is_null($task)) exitapp("unknown method"); $task->start(); http_response_code(200); it doesn't matter if send or post request, $method get. when trying put or delete - changes perfectly.. what cause $method when post ? update apparently when i'm sending request localhost/path - above behaviour occur. if i'm sending localhost/path/ - post works perfectly. apparently when i'm sending request localhost/path - above behaviour occur. if i'm sending localhost/path/ - post works perf

c# - IF statement in xslt for matching two id in BlogCategories -

i want match blogcategory parentid parent id.. here code: <?xml version="1.0" encoding="utf-8"?> <blogcategories> <blogcategory id="1" parentid="0" name="travel" active="1" seo_keywords="travel blogs" seo_description="travel blogs" parentname=""/> <blogcategory id="13" parentid="1" name="destinations" active="1" seo_keywords="destinations" seo_description="destinations" parentname="travel"/> <parent id="1" parentname="travel"/> <parent id="2" parentname="healthcare"/> </blogcategories> this .xslt page: <xsl:for-each select="parent"> <div class="grid-row3"> <ul> <a href=""> <xsl:value-of select="@parentname"

Phonegap/Cordova App device detection isn't working on iOS -

i'm young developer who's school project went viral amongst school , turned app. i'm using phonegap i'm advanced in web languages. decided cater devices, built iphone layout. make on ipad, used cordova device detection implement changes (i know bad) this: //checks device being used var devicetype = (navigator.useragent.match(/ipad/i)) == "ipad" ? "ipad" : (navigator.useragent.match(/iphone/i)) == "iphone" ? "iphone" : (navigator.useragent.match(/android/i)) == "android" ? "android" : (navigator.useragent.match(/blackberry/i)) == "blackberry" ? "blackberry" : "null"; //width & height tannock image var width = 178.5; var height = 270; //if device ipad if(devicetype == "ipad"){ $('#teaimg').css('height', '540px'); $('#teaimg').css('width', '357px'); $('#text1').css('margin-left', '38%&#

function - Python issue gave up around 4am -

this question has answer here: how can read inputs integers? 14 answers program requests 4 number (integer or floating-point) user. program should compute average first 3 numbers , compare average fourth. if equal, program should print 'equal' on screen. import math x1 = input('enter first number: ') x2 = input('enter second number: ') x3 = input('enter third number: ') x4 = input('enter fourth number: ') if ( x4 == (x1 + x2 + x3) / 3): print('equal') error message: if ( x4 == (x1 + x2 + x3) / 3): typeerror: unsupported operand type(s) /: 'str' , 'int'" second error message after trying convert int: x1 = int(input('enter first number: ')) valueerror: invalid literal int() base 10: you using mathematical operands on strings. here fix: import math x1 = int(input('

java - How to set a default -vm option for maven build in eclipse? -

Image
the run > maven build... command in eclipse has vm arguments tab. how can force eclipse insert default vmarg there during compilation? eg -xmx1g ? possible @ all? sidenote: don't want give eclipse -xmx vmarg (like eclipse.ini). mvn compilation process! one way set in jre vm args option in ide run configuration. quick thing , can set @ plugin level , https://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-with-memory-enhancements.html used during run.

php - Add two variables values in one variable with if else condition when data pass through ajax -

i want add 2 variables(class textbox , hiddentxtbox) values in 1 variable(check) using if else condition , want pass 1 variable(check)in ajax.i want if select database headers options firstname,lastname dropdown value pass through checkbox else textbox value pass through checkbox.in script have pass check variable this:- data: { check: textbox, oldval: textbox1,hiddentxtbox:hiddentxtbox,olddropval:textbox2} in above code check variable has 1 value textbox.i want if select database headers options firstname,lastname dropdown value pass through checkbox check:hiddentxtbox else check:textbox <script> $(document).ready(function(){ $('#submit').click(function(){ var hiddentxtbox=[]; var textbox = []; var textbox1 = []; var textbox2= []; var check = []; $('.check').each(function() { if ($(this).is(':checked')) { var current = $(this).val(); //alert(current); textbox.push($(this).parents

android - How to link cordova app to app store? -

how can create link button in cordova app, redirecting app on ios/android/amazon app store depending on device. i have tried following code, gets in ios if clause, doesn't redirect me, neither gives error: if(window.cordova && window.device) { if (device.platform.touppercase() === 'ios') { window.open("https://itunes.apple.com/gb/[obfuscated]"); } else if (device.platform.touppercase() === 'android') { window.open("https://play.google.com/store/apps/details?id=[obfuscated]"); } else { window.open("https://www.amazon.co.uk/[obfuscated]"); } } i figured out: ios: itms-apps://itunes.apple.com/app/[appid] android: market://details?id=[apppackageid] amazon: am

php - How to find the end of a word using strpos() -

i'm getting address input 1 long string opposed name, address, city, state , zip. split of up, besides between address , city. want search street type name (court, road, street, avenue, etc) , split string @ end of word. left address , city separate. strpos() gives me position of beginning of keyword, want split @ end of keyword. example i'm to: john doe 1 main street anytown ny 00000 i want split between street , anytown . , address won't static, there may more words etc. another idea function automatically splits string different fields. told me in countries postal service has api it. usps have such thing? site doesn't indicate it. actually should searching multiple needle in haystack, summing position , length of needle. function strpos_street($string){ $types = [ 'court', 'road', 'street', 'avenue' ]; foreach($types $t){ $pos = strpos(strtolower($string), strtolower($t));

How to get image meta without downloading whole image in python -

how fetch image properties height, width, size, mime in python downloading required bytes, doesn't take long fetch image. any appreciated. i solved creating imageinfo php library using threads. here's github link repository: https://github.com/rohitkhatri/python-image

How can i use java variable value in JavaScript -

i don't know if realizable, because don't have strong knowledge in javascript. i want use java variable in javascript , xhtml code, have file path in java variable: applicationdadesversiobb.rutafitxerlog display follows in xhtml page in table follows: <tr> <th scope="row">#{literalscore['entorn.fitxerlog']}</th> <td> <a href="#{applicationdadesversiobb.rutafitxerlog}" onclick="descarga([[${applicationdadesversiobb.rutafitxerlog}]])">#{applicationdadesversiobb.rutafitxerlog}</a> </td> </tr> until fine, want once path clicked, file should downloaded, not able with: onclick="descarga([[${applicationdadesversiobb.rutafitxerlog}]]) the javascript descarga function: <script type="text/javascript"> function descarga(file) { window.location=file; } </script> i think problem have conversion of java variable values java

mysql - HTML5 & PHP : Get & Convert MONTH Input Type Value into STRING and Minus One Month From Input Value -

stackoverflow community. have unique experience. been google, trial , error hours still not find solution this. input , desired output pretty simple tricky, dont know how code properly. well, define requirement. explanation , requirement : i have input field. input field type month (not date). input field should produce year , month, different date input type produce complete date. i want echo value in month input field after converted string before (example : "2016-7" in string format) , produce "jul 2016". this month format similar date format, script work date format, not working month format. thats make me wondering, im curious why. experiment : for basic input type month use script. <input type="month" name="monthtransaction" value="<?php echo date("y-m") ?>"/> then tried echo it. $month = mysql_real_escape_string($_post['monthtransaction']); $newmonth = date('y-m', st

sparql - Get only english values and integers from dbpedia -

i trying retrieve english values , integers dbpedia. example, following sparql query prefix owl: <http://www.w3.org/2002/07/owl#> prefix xsd: <http://www.w3.org/2001/xmlschema#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix foaf: <http://xmlns.com/foaf/0.1/> prefix dc: <http://purl.org/dc/elements/1.1/> prefix dbr: <http://dbpedia.org/resource/> prefix dbpedia2: <http://dbpedia.org/property/> prefix dbpedia: <http://dbpedia.org/> prefix skos: <http://www.w3.org/2004/02/skos/core#> prefix dbo: <http://dbpedia.org/ontology/> select distinct ?p ?o { dbr:cristiano_ronaldo ?p ?o filter(langmatches(lang(?o),'en'))} } it returns english values. missed important details such date of birth, height, number of caps etc. being missed because integer. how can make rdf resultset consisting of proper set of information cristiano ronaldo? pr

How to shift all UIView From Left to Right in iOS? (Objective-C) -

Image
i working on app support english , arabic languages. my requirement when choose english, uiview s should displayed left right. (ie. on left side there uiimageview , uilabel on right of uiimageview , see in pic below) but when user choose arabic language uiimageview should come right side of screen , uilabel should come left of uiimageview . is possible in ios or should create separte viewcontroller layout arabic language ???? here need change layout there 2 ways of localisation, localisation - can using single storyboard, have set leading space , trailing space constraint , change language os take care of making mirror image of english version of views (especially rtl languages). how works is, when change language device setting , when launch app, ios checks selected language , loads storyboard specific language, in case have provide language change feature in app have write code change language on fly. creating separate storyboard - second

java - Weblogic Auto deploy changes xhtml using intellij idea -

i have development project on ear project using jsf , primafaces . i'm using intellij 15.6 , web logic 12.1.1.0. after completed configuration on server , idea, start server idea, makes , deploys application deploy fails. after maven wls plugin undeploy, redeploy successfull. when change xhtml files, cannot see changes in browser. configuration server, update resources both them. want see changes in xhtml after refresh browser or window.

java - Views are invisible after they was added into ViewGroup -

i'm adding views programatically framelayout : public class pixelgridview extends framelayout { ... public void addviewwithoutcoords(tableview view, int column, int row) { float x = column * mcellsidesize; float y = row * mcellsidesize; framelayout.layoutparams lp = new framelayout.layoutparams(viewgroup.layoutparams.wrap_content, viewgroup.layoutparams.wrap_content); view.setlayoutparams(lp); view.setleft(0); view.settop(0); view.setx(x); view.sety(y); view.setvisibility(visible); addview(view); } ... } however, somehow invisible. getchildcount() returns count of them. getvisibility() each added view returns visible . i can drag'n'drop such views viewgroup framelayout , when this, earlier added views become visible. view layout file: <relativelayout xmlns:android="http://schemas.a

ios - Swift 2 upgrade Swift 3 compile error in many method such as willTransitionToTraitCollection:newCollection:withTransitionCoordinator -

when used swift 3 run old code, , convert them newest swift 3. found method compile error override func willtransitiontotraitcollection( newcollection: uitraitcollection, withtransitioncoordinator coordinator: uiviewcontrollertransitioncoordinator) { } and compiler told me "method not override method superclass" should import modules? in swift editor of xcode 8 beta 3: class myviewcontroller: uiviewcontroller { //wait hear ↓ willtransition } i have got suggestion: class viewcontroller: uiviewcontroller { //wait hear ↓ override func willtransition(to newcollection: uitraitcollection, coordinator: uiviewcontrollertransitioncoordinator) { <#code#> } } (you need remove other syntax errors better suggestions.) anyway, should not yourself. make swift it. new documentation willtransitiontotraitcollection:withtransitioncoordinator: here: willtransitiontotraitcollection:withtransitioncoordinator:

java - How much UI skills are needed for a springmvc developer -

im android developer want switch career java web developer, have learned jsf , spring mvc, question how ui skills required work in spring mvc to learn springmvc recommend learning basics in these. servlets jsp tomcat (or web application container) for ui part should know basic of html, jsp, css , javascript. depends on type expertise want achieve , level.

ios - Run android emulator without android sdk -

we want automate android/ios app testing , company doesn't allow me install android sdk or xcode. there way can still write automated test cases in appium or other tool have it's own emulator , doesn't force me install android sdk or xcode?

android - What is difference between File Based Encryption(FBE) and Full Disk Encryption(FDE) -

from android n, new feature fbe (file based encryption) introduced. how different fde (full disk encryption). how can verify whether android device has fbe? different encrypting full disk, file based encryption can encrypt each file via different keys. noticeable usage different user profile using different keys. previously, different users share same disk encryption key. ok, user/developer visible change have so-called direct boot feature. after rebooting, user has unlock entire disk (same password primary user), on black screen password input, , unlock own profile (mostly primary user). now, can reboot directly user profile unlock. no black screen unlocking more. developer, can run app in user0 space doesn't require user's profile unlocked. means app can run before user input password , swipe unlock. more info can found android official doc

csv - R: Histogram of missing data -

i have csv of sec-by-sec values, looks this: "x","timestamp","value" "1",2016-01-01 00:00:00,124 "2",2016-01-01 00:00:01,121 "3",2016-01-01 00:00:02,na "4",2016-01-01 00:00:03,na "5",2016-01-01 00:00:04,na "6",2016-01-01 00:00:05,123 "7",2016-01-01 00:00:06,122 "8",2016-01-01 00:00:07,124 "9",2016-01-01 00:00:08,na "10",2016-01-01 00:00:09,124 so there data missing , marked na . want make histogram of length of missing data blocks. in given example mean count how many missing data blocks have length of 1 sec (1) , of 2 sec (0) , of 3 sec (1) , on. in real life data set bins/intervals bit different, think of these 8 categories: = 1 sec 2 5 sec 6 10 sec 11 30 sec 31 300 sec 301 3600 sec 3600 86400 sec > 86400 sec so idea let r code run through lines of csv , whenever detects na value, count lines until finds real value again. 8 categories

java - Is it OK ByteArrayOutputStream is not closed -

i reading following java file: https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/util/printtextlocations.java?revision=1709154&view=co in linked code, bytearrayoutputstream initialized not closed, ok? in opinion, bytearrayoutputstream closeable , should closed eventually read javadoc : closing bytearrayoutputstream has no effect.

github - git cherry-pick without fetching remote branch -

i having bit of problem here, want cherry-pick commit git repo isn't locally present in system. for example : https://github.com/despairfactor/n6/commit/ecea4ab6d3d8bb4122522398200f1cd2a06af6d5 a usual cherry-picking procedure includes doing 1) git remote add <reponame> <repourl> 2) git fetch <reponame> , downloads copy isn't merged own local repo. 3) git cherry-pick <commit sha> , cherry-pick done. i have slow download speed (1 mbps), , don't have enough time download whole repo 1 commit. sorry if question asked , answered. you might consider download patch, apply locally. to patch specific commit on github, append .patch suffix commit url: https://github.com/despairfactor/n6/commit/ecea4ab6d3d8bb4122522398200f1cd2a06af6d5.patch see: https://github.com/blog/967-github-secrets#diff-patch

wso2carbon - WSO2 EMM: Everytime creates a new VPN -

wso2 emm version: 2.0.1 database: mysql i setting vpn on ios device using https://docs.wso2.com/display/emm201/setting+up+a+vpn+on+ios+devices+via+the+rest+api api. but every time call api, wso2emm creating new vpn. want update existing vpn connection or remove vpn connection if update not possible. please let me know how can achieve that.

javascript - $watch is not defined in side a $compile(cutsom directive) but scope is available in the controller but not in the template -

Image
i trying compile directive $compile method following error occurring. want long listing lazy load 1 time binding functionality out iterating entire array the code below: app.directive('lazydata', function() { return { controller: ['$scope', function($scope) { $scope.sample = 'sample'; }], replace: true, template: '<span ng-bind="favoritefruit">sample {{favoritefruit}} </span>' }}); app.directive('lazyload', function($compile) { return { scope: { pdata: "@pagenationdata", options: "@options" }, transclude: true, controller: ['$scope', '$element', function(scope, ele) { var pdata = json.parse(scope.pdata); options = angular.extend({ itemsperpage: 10, buttons: false }, scope.options), compile = $compile; var loadmore = function() {

python - Django URL error when using forms -

i new django , totally stuck on causing error. have done lots of searching no avail! super appreciated. the actual form works fine when try , submit input data error: using urlconf defined in mysite.urls, django tried these url patterns, in order: ^admin/ ^$ [name='home'] ^patientlist [name='patient_list'] ^patientdetail/(?p<pk>\d+)/$ [name='patient_detail'] ^add_patient/$ [name='add_patient'] current url, spirit3/add_patient/, didn't match of these. my urls.py in mysite directory looks like: from django.conf.urls import url django.contrib import admin django.conf.urls import include urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'', include('spirit3.urls')), ] my urls.py in app looks like: from django.conf.urls import url . import views urlpatterns = [ url(r'^$', views.home, name='home'), url(r'^patientlist', views.patient_list, name='patient_list'), url(r

javascript - highcharts - Remove only legend for colorAxis (keep legend for series) -

i have heatmap , scatter in 1 plot. tried remove legend of coloraxis (for heatmap). solution found on web remove whole legend not want since want keep legend scatter. so flowing example not solve problem. still want have legend. want remove part coloraxis. legend: { enabled: false } i want have seriest 2 in legend. http://jsfiddle.net/9ml8x9bc/4/

Combine multiple backgrounds on android XML? -

can combine own android drawable , ?android:selectableitembackground...? searched lot can't find right answer... example lets have simple button , want this: <button android:id="@+id/btest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="?android:selectableitembackground" | @drawable/mydrawable/> any ideas? how using framelayout <framelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/mydrawable"> <button android:id="@+id/btest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="?android:selectableitembackground"/> </framelayout> or using imagebutton <imagebutton android:id="@+id/btest" android:src=&q

Populate JRadioButtons with a SPARQL query -

how can populate jradiobuttons ontology using query? have 1 jlabel contain question: einstein? 4 radiobuttons choices. scientist lawyer engineer politician then next button. all data extracted using query like: string query=select ?x {some query} mylabel.text=query; how can populate 4 radio buttons this?

java - libGdx: Draw Line on Stage and keep it there -

i working on app, need draw trace of sprites. tried shaperenderer, , draws lines correctly, after line drawn, gets erased again. tried polyline, , add points each update, after time polyline large draw. i have code in overriden actor class, on every draw call checks if sprite has moved, , if so, line gets drawn shaperenderer. there way, keep line ? code: shaperenderer renderer = stageactivity.stagelistener.shaperenderer; renderer.setcolor(color); gdx.gl.gllinewidth(strokewidth); line.add(sprite.look.getx()); line.add(sprite.look.gety()); renderer.polyline(getlinevertices()); the getlinevertices() method converting arraylist float[] array. edit: since code above has poor performance lot of lines, tried out framebuffer need (i think), not draw, doing wrong ? buffer.begin(); renderer.begin(shaperenderer.shapetype.line); renderer.line(previouspoint.x, previouspoint.y, sprite.look.getx(), sprite.look.gety()); renderer.end(); buffer.end(); batch.draw(buffer.getcolorbufferte

Ios Swift Looping through Fonts provided by application in info.plist -

using xcode 7 , swift 2 i have assigned string each font in info.plist -> fonts provided application -> array how loop through these fonts , assign in loop i tried : output nil var familylist = nsbundle.mainbundle().objectforinfodictionarykey("fonts provided application") [string] i came across below code gives me list of family names, dont need. i need same loop fonts have added. for family: anyobject in uifont.familynames() { println("font family: \(family)") font: anyobject in uifont.fontnamesforfamilyname(family nsstring) { println("font name: \(font)") } } to retrieve info in info.plist, can use objectforinfodictionarykey() uiappfonts key. i don't speak swift, , don't know if code compile, should able idea. let fonts = nsbundle.mainbundle.objectforinfodictionarykey(uiappfonts) nsarray that should give array of fonts. it's construct uifont objects.

C# Moving bar/image on Picturebox -

i'm creating windows form application, in picturebox have static background (from image). i'm willing add moving bar/image @ bottom of background (like in news tv). bar/image created dynamically (depending on received data) , it's size (width) far greater of picturebox (only part of bar/image visible @ time). how can achieve in manner won't kill neither cpu nor ram? time ago did creating image of background + visible part of bar , refreshing operation , box lot, wasn't smartest idea due high usage of cpu , memory. thanks in advance ! :)

javascript - TypeScript compiled module declares var before auto invoking function -

i porting existing angularjs (1.x) project typescript, far code working, i'm wondering why happening. in javascript declaring module so: (function() { 'use strict'; angular.module('mymodule', []); })(); in typescript so: module mymodule { 'use strict'; angular.module('mymodule', []); } which compiled this: var mymodule; (function (mymodule) { "use strict"; angular.module("mymodule", []); })(mymodule || (mymodule = {})); i have few doubts: isn't wrong add global scope var mymodule ? why mymodule being passed anonymous function? since var mymodule added, wonder if should avoid overwriting. separate module declaration from, say, controller. wonder, when declare controller, should use different module name? in other words, can reuse same name second module, so module mymodule { angular .module('mymodule') .controller('mycontroller'); } // "

c# - Create Json Object (trying) -

so have object want send in json format (model) function serachclient() { var tempfirstname = $("#firstname").val(); var templastname = $("#lastname").val(); var tempmobile = $("#mobile").val(); var tempaccountid = $("#accountid").val(); var temppin = "1234"; var model = { lastname: templastname, firstname: tempfirstname, mobile: tempmobile, accountid: tempaccountid, pin: temppin } $.ajax({ url: "/home/searchclient/", type: 'get', data: { model: json.stringify(model) }, cache: false, crossdomain: true, async: true, datatype: 'json', success: function (data) { }, error: function (event) { }, headers: { 'access-control-allow-origin': '*' }, }).done(functio

Cakephp 3 query OR Condition -

guys how can apply or condition in following statement ? $this->ibcommisions->find()->matching( 'users.accounts',function ($q) { return $q->where(['ibcommisions.ib_id' => $this->userid, 'users.country_id' => $this->request->data['country']]); } to become (['ibcommisions.ib_id' => $this->userid or 'users.country_id' => $this->request->data['country']]) return $q->where(['or' => [ 'ibcommisions.ib_id' => $this->userid, 'users.country_id' => $this->request->data['country'] ]]); or alternatively return $q->where(['ibcommisions.ib_id' => $this->userid]) ->orwhere(['users.country_id' => $this->request->data['country']]); http://book.cakephp.org/3.0/en/orm/query-builder.html#advanced-conditions

infragistics - How to dynamically update Ignite UI igDataChart with AngularJS -

i need show ignite ui igdatachart , need open in new window. when new data comes service need update chart in open instances. can suggest method. here code. i'm using ngstorage save data in angular, need update object. my index.html <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/ngstorage/0.3.6/ngstorage.min.js"></script> <link href="http://cdn-na.infragistics.com/igniteui/2016.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="http://cdn-na.infragistics.com/igniteui/2016.1/latest/css/structure/infragistics.css" rel="stylesheet" /> <!--css file specific chart styling --> <link href="http://cdn-na.infragistics.com/igniteui/2016.1/latest/css/structure/modules/infragistics.ui.chart.css" rel="stylesheet" />

javascript - How to change the context of function using 'bind'? -

this question has answer here: bind more arguments of bound function in javascript 2 answers function greet(){ return 'hi ' + this.name; } greet = greet.bind({name: 'tom'}); greet(); // hi tom greet = greet.bind({name: 'harry'}); greet(); // hi tom (why??) 'bind' should return new function new values 'this'. why not working? once function binded custom object, cannot changed. can original function unchanged: function greet(){ return 'hi ' + this.name; } greet1 = greet.bind({name: 'tom'}); greet1(); // hi tom greet1 = greet.bind({name: 'harry'}); greet1(); // hi harry

Sql Query Data Reader Returning True even it's False in C# -

good day! it's taking me hours why query returns true it's false. here's code. public sqldatareader check(bel bel) { sqlcommand cmd = new sqlcommand(); cmd.connection = dbcon.getcon(); cmd.commandtype = commandtype.text; cmd.commandtext = "select sum(total) overalltotal table id=@id , datefrom=@from , dateto=@to , status='without'"; cmd.parameters.addwithvalue("@id",bel.clempid); cmd.parameters.addwithvalue("@from", bel.clpayrollfrom); cmd.parameters.addwithvalue("@to", bel.clpayrollto); sqldatareader dr = cmd.executereader(); return dr; } suppose parameterized values are: @id = 0001 @from = 1/28/2016 @to = 1/29/2016 here's method calling datareader sqldatareader drcheck; drcheck = bal.check(bel); if (drcheck.hasrows == true) { drcheck.read(); // i'm inside computation of overalltotal }else{ drcheck.close(); /

java - Search nodes in network using akka. -

is there way search nodes in network if node down can reconnect again when becomes up. using mdns want achieve akka. using akka java. you may use 2 approaches here: 1) external - run instance of consul.io along cluster. reading status of consul cluster know machines connected cluster - give idea total set of nodes , ip addresses. use jmx anywhere retrieve status of akka cluster - you're looking akka:type=cluster bean here , it's property members or clusterstatus . return cluster status - hence know set of nodes available in akka cluster. if subtract set of nodes in akka cluster nodes in consul cluster - removed/quarantined akka cluster quorum, , has restarted. 2) internal - once have added thisactorsystemquarantinedevent akka remoting. event fired when node removed cluster, , put in quarantine - can't reconnect cluster automatically. can create this: object clusterwatcher { private class defaultclusterwatcher extends actor clusterwat

java - Log4J - JsonLayout and RollingFileAppender generating invalid JSON -

i'm trying store logs in json files using log4j (2.6.2). i'm using jsonlayout in rollingfileappender , , it's working long i'm not trying append file has been written previously. here's code setting layout , appender: layout<?> layout = jsonlayout.createlayout(config, false, false, false, true, false, true, "[", "]", charset.defaultcharset()); string appenderfilename = "mylogfile-latest.log.json"; string appenderfilepattern = "mylogfile-%i.log.json"; string appendername = "myappender"; appender appender = rollingfileappender.createappender(appenderfilename, appenderfilepattern, "true", appendername, "true", "256", "true", sizebasedtriggeringpolicy.createpolicy(this.configuration.getlogmaxsize().tostring()), null, layout, null, "false", "false", null, config); as said, it's working fine first time i'm writing in log f

Shell Script to new file referring other files -

can please in writing shell script below requirement. i have csv file shown below in comma separated format a,b,c d,e,f there file in values written mentioned below:- ramesh suresh with of above 2 files need construct new file. <root> <env name="a" domain="b"> <component name="ramesh"> <machine name="c">ramesh</machine> </component> <component name="suresh"> <machine name="c">suresh</machine> </component> </env> <env name="d" domain="e"> <component name="ramesh"> <machine name="f">ramesh</machine> </component> <component name="suresh"> <machine name="f">suresh</machine> </component> </env> </root> try this; #!/bin/bash echo "<root>"

html - Using transition to open a simple drop down I have basics but can't fit it with my design -

i need save real estate on page i'm working on wanted able hover on topics , have sub-topics accessible "drop-down" (actually div eases out) div. here fiddle effect want: https://jsfiddle.net/170z6pj1/ however can't seem brain around how make work this, whereby want text "how to..." trigger cause ease-out: https://jsfiddle.net/170z6pj1/3/ i've tried various ways try , id="menu" onto "how to..." or "titleb" divs never work if way. realise base css isn't correct work, can't wrap head around need change - first time trying transitions. thanks , responses. p.s. far know have use "max-height workaround" dynamically adjust correct length of list items. html: <div id="titlea"> <div id="titleb"></div>how to...</div> <div id="menu"> <a>hover expand</a> <ul id="list"> <li>how book meeting room

Jquery, ajax, PHP - Live search not returning values in some situations -

i have live search going health card numbers. linked mysql database , part works... kinda. im running problem strings of numbers seem give trouble strings such 12345689999 (my 7 key broken). seems appear when there same characters used repeatedly after 1 another. data type in database hcn's text. code follows: html <div class="container-fluid"> <div class="jumbotron"> <h1 class="display-3">search patient using health card number</h1> <hr class="m-y-2"> <p class="lead"> <input type="text" class="form-control" id="hcnsearch" aria-describedby="hcn" placeholder="search health card number"> </p> </div> <div id="result"> </div> </div> jquery / ajax $(document).ready(function(){

c# - wpf checkbox label as button -

in wpf label in checkbox behave button, when toggle checkbox on, label change button, , when toggle checkbox off, button go change label. here have far <checkbox margin="2,0,2,0" ischecked="{binding issteps}" horizontalalignment="stretch" verticalalignment="bottom" height="32" focusvisualstyle="{x:null}" style="{staticresource slidercheckboxstyle}"> <checkbox.content> <textblock text="steps" foreground="#ffffffff" fontfamily="lucida sans" fontsize="8" fontweight="bold"/> </checkbox.content> </checkbox> in checkbox.content, create stackpanel both textblock , button. then, can bind textblock.visibilty , button.visibilty "issteps" tri

sql server - LocalDB .mdf file not attached automatically with AttachDbFileName in connection string -

i'm expecting behavior because of this msdn article attachdbfilename property the first time connect database using option in connection string, sql server express or localdb instance attaches database, , stays attached. when want connect same database in future use initial catalog without attachdbfilename if prefer. i have connection string used entity framework: <add name="databasecontext" providername="system.data.sqlclient" connectionstring="server=(localdb)\mssqllocaldb;database=databasename;integrated security=true;attachdbfilename=|databasename|\databasename.mdf" /> this works fine after open database in sql management studio feeding attachdbfilename value absolute path additional prameter. but if don't attached sql management studio first i'm getting following error when trying run ef migrations on database: system.data.sqlclient.sqlexception (0x80131904): cannot create file 'c:\users\user\desktop\

Textbox values retrieving null in code behind asp.net c#? -

i have griview contains itemtemplates i'm not able retrieve values in code behind. i'm getting null value in textbox . here aspx code: <asp:gridview runat="server" id="gridview" autogeneratecolumns="false" width="1100px" cellpadding="4" forecolor="#333333" gridlines="none" height="600px" > <alternatingrowstyle backcolor="white" /> <columns> <asp:templatefield headertext="refine requirement " headerstyle-width="200px"> <itemtemplate> <asp:textbox id="textbox1" runat="server" forecolor="black" height="27px" width="200px" font-size="medium"></asp:textbox> </itemtemplate> <headerstyle width="200px" /> </asp:templatefield> <asp:templatefield headertext=

Hash sorting alphabetiacly in ruby -

i have following hash. h = { "31d2fcd5-aec0-438d-895c-806fd0358c23"=>{"name"=>"q", 'database'=>'mysql'}, "69a05dea-d767-44b7-b40c-f76d0d12f8c1"=>{"name"=>"qwerty", 'database'=>'h2'}, "69a05dea-d767-44b7-b40c-f76d0d121993"=>{"name"=>"b", 'database'=>'postgresql'}, "69a05dea-d767-44b7-b40c-f76d0d121994"=>{"name"=>"b", 'database'=>'oracle'}, "69a05dea-d767-44b7-b40c-f76d0d121995"=>{"name"=>"apple", 'database'=>'sqlite3'}, "69a05dea-d767-44b7-b40c-f76d0d521996"=>{"name"=>"a", 'database'=>'mariadb'}, "69a05dea-d767-44b7-b40c-f76d0d1k1996"=>{"name"=>"a", 'database'=>'mongodb'} }

elixir - How can I generate gettext translations for ecto model field names? -

i have usual ecto.model , need register fields translations move them .pot file. how can that? update i'm using these field names prepare list of translated errors: errors = changeset |> ecto.changeset.traverse_errors(fn {msg, opts} -> enum.reduce(opts, msg, fn {key, value}, _ -> string.replace(msg, "%{#{key}}", to_string(value)) end) end) formatted = {field, messages} <- errors, message <- messages, do: "#{field} #{translate_error(message)}" # functionality here defp translate_error(msgid) gettext.dgettext(myapp.gettext, "errors", msgid) end i want translate not message, field too!

Solving linear programming with Prolog -

i trying solve first linear programming problem example on http://www.zweigmedia.com/realworld/tutorialsf4/frameslinprogr.html . x , y 0 or positives, sum can upto 50, 2x+y can upto 60. function x+3y has maximized. i using following code: mysol2(x,y,z):- x in 0..sup, % error: syntax error: operator expected y in 0..sup, x + y =< 50, 2 * x + y =< 60, z max(x + 3*y). however, not load (error indicated above). with following code: mysol2(x,y,z):- x >= 0, y >= 0, x + y =< 50, 2 * x + y =< 60, z max(x + 3*y). the program loads, on running: error: >=/2: arguments not sufficiently instantiated how can correct these errors? (>=)/2 , (is)/2 very low-level predicates. can use them in special circumstances. in cases, these predicates lead instantiation errors because 1 or both arguments not sufficiently instantiated. constraints declarative solution in such cases, working correctly in cases. for

Rules to avoid repeated data on Firebase -

i need create validation rule in firebase don't have repeated data primary key in relational db. here code trying: "roles": { ".read": "auth.uid != null", "$rol_id": { ".write": "auth.uid != null", ".validate": "newdata.haschildren(['description', 'state'])", "description": { ".validate": "newdata.isstring() && newdata.val().matches(/[a-za-z]$/i) && root.child('roles').child('$rol_id').child('description').val() != root.child('roles').child('$rol_id').child('description').exists()" }, "state": { ".validate":"newdata.isboolean()" } } }, the problem can't enter in $rol_id unless give constant value need ev

sql - How to generate random numbers using C# that hasn't been listed in a database? -

i'm working on application allows me generate random id numbers (6 integers) employees know how generate these random numbers using c# , not duplicate numbers has been used employee in sql database. below code done in sql: declare @unique_uid varchar(6) select @unique_uid = right(abs(cast(cast(newid() varbinary) int)), 6) while exists (select 1 dbo.tbluserid @unique_uid = userid_uid , len(@unique_uid) = 6 , @unique_uid <> @parm_user_pin)( select @unique_uid = right(abs(cast(cast(newid() varbinary) int)), 6) ` 6 integeres make 999999 numbers. write them available ones in table. pick 1 randomly , delete it: cte ( select top (1) number available order newid() ) delete cte output deleted.number; this more reliable trying generate random , check availability. if org has 999998 employees already, trying randomly generate 1 still available going take ages...

cordova - $anchorScroll in Ionic 2? Scroll to element with ID -

any way $anchorscroll in ionic 2/angular2 of angular 1.x? trying scroll element on page. tried ng2-page-scroll https://github.com/nolanus/ng2-page-scroll not sure if m doing right, followed through tutorial , got error: parseerror: 'import' , 'export' may appear 'sourcetype: module' i think doesnt work latest ionic 2 release anymore. wish there's easier way of doing it, work around? i in same situation, wanted scroll next page/element each click of button. i looked @ same options mentioned, , found in ion-slides ( http://ionicframework.com/docs/v2/api/components/slides/slides/ ), can set direction 'vertical', did trick me. don't know if can use case. otherwise, can content, , scrollto function. http://ionicframework.com/docs/v2/api/components/content/content/