Posts

Showing posts from February, 2010

java - Get all trigger names from oracle -

why take empty result set row ? resultset row = dbmd.gettables("%", "dbuser1", "%", types); while (row.next()) { system.out.println(result.getstring(1)); } you can use code : try { //must upper case string username="dbuser1".touppercase(); resultset row = dbmd.gettables("%", username , "%", types); while (row.next()) { //you need table name trigger name result.getstring("table_name"); } //catch errors } catch (sqlexception e) { while (e != null) { system.out.println("\n message: " + e.getmessage()); system.out.println("\n sqlstate: " + e.getsqlstate()); system.out.println("\n errorcode: " + e.geterrorcode()); e = e.getnextexception(); } }

PHP convert Array with SimpleXMLElement Object to XML -

i have array simplexmlelement objects inside , need formed xml ajax interaction, how can do? this array: array ( [0] => simplexmlelement object ( [count] => 2 [id] => 20 [user_id] => 2 [title] => polo rl ) [1] => simplexmlelement object ( [count] => 3 [id] => 19 [user_id] => 4 [title] => tshirt fitch ) [2] => simplexmlelement object ( [count] => 2 [id] => 18 [user_id] => 2 [title] => polo la martina ) ) i xml result: <root> <record> <count>2</count> <id>20</id> <user_id>2</user_id> <title>polo rl</title> </record> <record> <count>3</count> <id>19</id> <user_id>4</user_id> <title>tshirt fitch</title

python - A fast way to find an all zero answer -

for every array of length n+h-1 values 0 , 1, check if there exists non-zero array of length n values -1,0,1 h inner products zero. naive way is import numpy np import itertools (n,h)= 4,3 longtuple in itertools.product([0,1], repeat = n+h-1): bad = 0 v in itertools.product([-1,0,1], repeat = n): if not any(v): continue if (not np.correlate(v, longtuple, 'valid').any()): bad = 1 break if (bad == 0): print "good" print longtuple this slow if set n = 19 , h = 10 test. my goal find single "good" array of length n+h-1 . there way speed n = 19 , h = 10 feasible? the current naive approach takes 2^(n+h-1)3^(n) iterations, each 1 of takes n time. 311,992,186,885,373,952 iterations n = 19 , h = 10 impossible. note 1 changed convolve correlate code considers v right way round. july 10 2015 the problem still open no solution fast enough n=19 , h=10 gi

c - Read .CSV file and store it in another file -

have made program reads .csv file , stores highest number in file. problem program can't read comma separated numbers 1,5,6,7,1,2. here loop need change int i; int max = 0; int min = 0; while (!feof(fp)) { fscanf( fp, "%d", &i); if (i < min) min = i; if (i > max) max = i; } and print out: fprintf(q,"%d",max); printf("maximum value %d \n", max); fclose(q); fclose(fp); #include <stdio.h> #include <limits.h> int main(void){ file *fp = fopen("input.csv", "r"); file *q = fopen("max.txt" , "w"); int i; int max = int_min; int min = int_max; while(1){ int state = fscanf(fp, "%d", &i); if(state == 1){ if (i < min) min = i; if (i > max) max = i; } else if(state == eof){ break; } else { ch

c# - wenzhixin bootstrap-table doesn't return any results with server size pageination -

i'm trying implement bootstrap table in code , i'm having worst time it. results until add line sidepagination: 'server'. nothing. code @using (html.beginform()) { <table id="itemstable"></table> } @section scripts { <script> $(document).ready(function () { $("#itemstable").bootstraptable({ url: '/tests/data', method: 'get', queryparamstype: 'else', pageination: 'true', pagesize: 10, sidepagination: 'server', pagelist: '[10, 25, 50, 100, 200]', columns: [ { field: 'campaignname', title: 'campaignname', sortable: true } ] }); }); </script> } server side code // get: tests public actionresult index() { retur

ruby - Keep Session open - Capybara/Cucumber -

i have feature requires in excess of 100 scenarios run, first step being log application. handled before hook , after hook log out. keeps tests independent of each other , me idea. in instance want log application, run scenarios , log out. i seem having issue sessions after scenario has finished redirected about:blank , session killed. i have tried class capybara::selenium::driver < capybara::driver::base def reset! # use instance variable directly avoid starting browser reset session if @browser begin #@browser.manage.delete_all_cookies <= cookie deletion commented out! rescue selenium::webdriver::error::unhandlederror => e # delete_all_cookies fails when we've gone # about:blank, rescue error , nothing # instead. end @browser.navigate.to('about:blank') end end end but error below in console expected not find xpath "/html/body/*", found ... so question how can finish scenario , click link in site , conduct next

ruby - Strings passed from controller to view in Rails arrive empty -

i trying pass string view controller this: controller: def index @str = 'foo' end view: string: <% @str %> the variable seems arrive because no error. however, arrives empty (only "string" in html, nothing else). , seems work great other built-in types, e.g. time. missing here? use ruby 2.2.1 , rails 4. as others have said, need use <%= @str %> i'll give explanation - use <% %> when need run ruby code don't want displayed screen. example, might have conditional logic <% if user_signed_in? %> <%= @welcome_string %> <% end %> use <%= %> when want output, drop '=' conditional logic or doesn't need display.

java - ORA-01858: a non-numeric character was found where a numeric was expected in Oracle ADF -

why above sql error oracle via java application query? select * testschema.testtable userid = :userid , transactiondate between to_date(:start_date, 'yyyy-mm-dd') , to_date(:end_date,'yyyy-mm-dd') i figured out. in example, there no need to_date functions on start_date , end_date. worked fine: select * testschema.testtable userid = :userid , transactiondate between :start_date , :end_date

android - Google Maps API - Ignore Streets in Path Planning -

is possible ignore specific streets in path planning process of google maps api? want build application specific streets can marked barriers , furthermore alternative route should offered. if not, can suggest alternative google maps api it's possible (for android development)? you want use directions api , set way points in way avoid streets.

c - What is the type of the value 1.0e+1 -

does 1.0e+1 return float value or int value? when print 1.0e+1 gives 10 when sizeof(1.0e+1) gives me 8 . does 1.0e+1 return float value or int value? ans: none. written, represents double . nitpick: let's use term represent instead of return i think you're confused. ihmo, need know proper usage of conversion specifiers. to print float, need use %f to print sizeof output, need use %zu that said, printing 1.0e+1 means printing value whereas, sizeof(1.0e+1) sizeof(double) , because, floating point literal default double . related, c11 standard, chapter §6.4.4.2 an unsuffixed floating constant has type double . if suffixed letter f or f , has type float . if suffixed letter ``l or l , has type long double .

Google+ Activity List How to Sorted Published Date Wise in Python? -

google plus activity list how sorting published date wise. json data form below code service = build('plus', 'v1') activity = service.activities().list(userid=wall.auth_user, collection='public') but data how sorting publish date. thank you,

ios - Two text field in alert view, with space between them -

Image
i have uialertview text fields. can me how should have space between them ? newboatalert.alertviewstyle = uialertviewstyleloginandpasswordinput; uitextfield * alerttextfield1 = [newboatalert textfieldatindex:0]; alerttextfield1.keyboardtype = uikeyboardtypedefault; alerttextfield1.placeholder = @"name"; uitextfield * alerttextfield2 = [newboatalert textfieldatindex:1]; alerttextfield2.frame=cgrectmake(alerttextfield1.frame.origin.x, alerttextfield1.frame.origin.y+alerttextfield1.frame.size.height+10, alerttextfield1.frame.size.width, alerttextfield1.frame.size.height+40); alerttextfield2.keyboardtype = uikeyboardtypedefault; alerttextfield2.placeholder = @"description"; alerttextfield2.securetextentry=no; now looks : you can't edit built-in uialertview styles apple provides (at least not without dirty hacks broken next ios release). if want customise how alert looks, example adding space between text fields, should create own uiview sub

javascript - Show succes message from ajax -

i have question, create sistem update in database row when onchange select box. goes well, want drop succes message if update succes. my view : <form action="" id="updatestatus" method="post"> <select id="statusselect" name="{{ gift.id_instant_gagnant }}" class="form-control" onchange="updatecadeaustatus({{ gift.id_instant_gagnant }})"> {% key,statut in form_logistique.statut.choices %} <option value="{{ key }}" {% if gift.etat == key %}selected="selected"{% endif %}> {{ statut }} </option> {% endfor %} </select> </form> <script> function updatecadeaustatus(id) { var id = id; var selectedname = $("#statusselect option:selected").val(); var url_deploy = 'http:localhost/

performance - php mcrypt encryption without IV -

Image
i need use encryption mechanism. chose mcrypt available , examples. see generation time much. when use iv in given examples, taken lot of time while when removed it generate encrypted value instantly. // code example using iv $ivsize = mcrypt_get_iv_size(mcrypt_rijndael_128, mcrypt_mode_ecb); $iv = mcrypt_create_iv($ivsize, mcrypt_dev_random); $encryptedstring = mcrypt_encrypt(mcrypt_rijndael_128, $encryptionkey, utf8_encode($origstring), mcrypt_mode_ecb, $iv); return base64_encode($encryptedstring); // code example without iv $encryptedstring = mcrypt_encrypt(mcrypt_rijndael_128, $encryptionkey, utf8_encode($origstring), mcrypt_mode_ecb); return base64_encode($encryptedstring); so if there big security issues encryption without using iv ? dev_random generates random integers /dev/random or equivalent, listens unpredictable data such mouse movement, keyboard strokes etc generate secure data. if there no keystrokes etc., waits until there enough data... , that&

ios - Popover Doesn't Work on iPhone -

i implemented popover in application , tested it. work fine on ipad when test on iphone, instead of showing popover show full storyboard. please me. here code: @ibaction func menuisclick(sender: anyobject) { var movetonextvc:menuviewcontroller movetonextvc = self.storyboard?.instantiateviewcontrollerwithidentifier("menuviewcontroller") as! menuviewcontroller movetonextvc.modalpresentationstyle = .popover movetonextvc.preferredcontentsize = cgsizemake(200, 200) if let popovercontroller = movetonextvc.popoverpresentationcontroller { popovercontroller.sourceview = sender as! uiview popovercontroller.sourcerect = cgrect(x: 0, y: 0, width: 85, height: 30) popovercontroller.permittedarrowdirections = .any popovercontroller.delegate = self } presentviewcontroller(movetonextvc, animated: true, completion: nil) } func adaptivepresentationstyleforpresentationcontroller(controller: uipresentationcontroller!, t

python - Getting started with unit testing for functions without return values -

i've got program that's built on functions taks user inputs inside functions , not parameters before function: example, function def my_function(): = input("a: ") b = input("b: ") print(a+b) and understand far unit testing function harder unit test function works example this: def another_function(a,b): return(a+b) so how go testing function looks my_function , example? feels if easy test manually entering incorrect inputs , checking errors, have write test suite tests functions automatically. given function input comes input , output goes print , have "mock" both of these functions test my_function . example, using simple manual mocking: def my_function(input=input, print=print): = input("a: ") b = input("b: ") print(a+b) if __name__ == '__main__': inputs = ['hello', 'world'] printed = [] def mock_input(prompt): return inputs.pop(

javascript - Function is undefined in JS object -

i create object var myobj = new functon () {...} . in object add functions : var myobj = new function () { this.func1 = function() { func2(); } this.func2 = function() { ... } } as can see in func1 try call func2 undefined. why? cause in 1 object. change scripts to var myobj = function () { var self = this; this.func1 = function () { self.func2(); }; this.func2 = function () { ... }; };

Add HTML code using CSS -

html <div id="mydiv"></div> i want add html code div (see following result want) using only css <div id="mydiv"><a href="#">lorem</a></div> i think :after , :before not helpful here! css not html. not possible achieve css not markup language. just add can add content not element using :before or :after pseudo-element. refer specs

html - Position absolute not scrolling on devices or Down Position of Links -

Image
my site has problem in menu. isn't visible or scroll on mobile. i'm attaching picture i have position:absolute on drop down menu. can make home menu scrollable rest of page or other css fluid positioning make admin , logout link down device , desktop @ bottom? thank you. @media (max-width: 767px) { .log-down,.admin-down { top: 0;} } do same thing vasanth did instead of doing position absolute do @media (max-width: 767px) { .log-down,.admin-down { position:fixed bottom: 0px; } } e.g. bottom:0px; = bottom of page top:0px; = top of page position:fixed = move screen i hope helped or misunderstood question

c# - get a column data from a gridview -

i have generated event of button field index of row couldn't content of column me please can use select query in pass index of row (i don't know how write condition in clause) protected void gridview1_rowcommand(object sender, gridviewcommandeventargs e) { if (e.commandname == "affichediplome") { int index = convert.toint32(e.commandargument); gridviewrow row = gridview1.rows[index]; int serverid = convert.toint32(gridview1.datakeys[index].value); messagebox.show(index.tostring()); } } try this.. add bound filed store information not want show user have use @ server side. <asp:datagrid gridlines="none" id="dg" autogeneratecolumns="false" runat="server" borderstyle="none"> <columns> <asp:boundcolumn datafield="id" visible="false"></asp:boundcolumn> <asp:templatecolumn h

jQuery Chosen change popup count items -

i'm using chosen jquery plugin in project. default count of viewed itemd after click on select 10. , i'm trying change 5, how that? var config = { '.chosen-select': {}, '.chosen-select-deselect': {allow_single_deselect: true}, '.chosen-select-no-single': {disable_search_threshold: 10}, '.chosen-select-no-results': {no_results_text: 'not found!'}, '.chosen-select-width': {width: "100%"} } (var selector in config) { $(selector).chosen(config[selector]); } thanks try below for example : <select name="reg_email" id="cars" size="3"> <option>toyota</option> <option>holden</option> <option>tata</option> <option>alfa romeo</option> <option>citroen</option> <option>honda</option>

git - Unable to connect nbd.name openwrt carambola2 -

i have same problem, when try build openwrt image carambola 2 board: checking out files git repository... cloning 'ubus-2015-01-22'... fatal: unable connect nbd.name: nbd.name[0: 46.4.11.11]: errno=connection refused a ping on ip adress work, git web up. seems there problem git protocol. is there somewhere mirror of repository? git://nbd.name/luci2/ubus.git

ios - Cannot debug Vine and Twitter api via charles debug proxy while facebook, flickr and any other API can be -

Image
i trying debug vine api using charles debug proxy. have ios version of vine app running in device , have set wifi proxy. i debug api calls other applications enabling ssl proxying. ssl proxying not working vine(api.vine.com) . tried twitter facebook , flickr apps. debug facebook , flickr apis , see json response twitter fails. as vine owned twitter, doubt if twitter has implemented security in apis or changed protocols ensure apis cannot debugged. if case why facebook has not implemented same ? apis can debugged. please find screenshots attached. vine api flickr api facebook api twitter api update:jul 22, 2015 it seems twitter using ssl pinning . at last found reason. twitter using ssl pinning in app secure apis man in middle attack. there hint in api documentation more information pinning can found here .

spring - java maven proguard plugin obfuscator -

i'm trying obfuscate java application i'm developing, , decided use proguard maven plugin it. i solve few problems following proguard configuration: # don't obfuscate or remove entry point -keep public class com.appspot.main { public static void main(java.lang.string[]); } # supress warnings javax.servlet -dontwarn javax.servlet.** -keepattributes *annotation*,signature,innerclasses now i'm having following error: [proguard] note: org.springframework.core.io.support.pathmatchingresourcepatternresolver accesses method 'resolve(java.net.url)' dynamically [proguard] note: there 18 unresolved dynamic references classes or interfaces. [proguard] should check if need specify additional program jars. [proguard] (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass) [proguard] note: there 1 class casts of dynamically created class instances. [proguard] might consider explicitly keeping mentioned classes an

Applying css on SVG,used as object in html file -

hi trying hand on svg , new it.though landed situation want change css value , fill of svg file.but not working. <html> <head> <meta charset='utf-8'> <title>practice</title> </head> <body> <style type="text/css"> .cp2{display: none;} .cloud:hover .cp2{ fill:#ffffff; stroke:#0fc5a5; stroke-dasharray:90; stroke-dashoffset:0; -webkit-animation:dash 1s linear forwards; -o-animation:dash 1s linear forwards; -moz-animation:dash 1s linear forwards; animation:dash 1s linear forwards; pointer-events:all; } .cloud:hover .cp1{display: none;} </style> <h2>svg</h2> <div class="cloud"> <object width="40" height="35" type="image/svg+xml" data="new.svg"></object> </div> </body> </html> <!-- , svg file name "new.svg"

How do I add camel-http4 to a Karaf features.xml file? -

if add <bundle>mvn:org.apache.camel/camel-http4/2.15.1</bundle> then following error below. what right way able use camel-http4 within blueprint camel routing within karaf? how should modify features.xml? org.osgi.service.resolver.resolutionexception: unable resolve root: missing requirement [root] osgi.identity; osgi.identity=social_importer.kar; type=karaf.feature; version="[1.0.0.snapshot,1.0.0.snapshot]"; filter:="(&(osgi.identity=social_importer.kar)(type=karaf.feature)(version>=1.0.0.snapshot)(version<=1.0.0.snapshot))" [caused by: unable resolve social_importer.kar/1.0.0.snapshot: missing requirement [social_importer.kar/1.0.0.snapshot] osgi.identity; osgi.identity=org.apache.camel.camel-http4; type=osgi.bundle; version="[2.15.1,2.15.1]"; resolution:=mandatory [caused by: unable resolve org.apache.camel.camel-http4/2.15.1: missing requirement [org.apache.camel.camel-http4/2.15.1] osgi.wiring.package; filter:="(

rx java - rxJava. Help to understand how publish and unsubscribe work -

i observe strange behavior when using publish() in conjunction observeon , subscribeon . please take @ folowing examples. code: connectableobservable<string> observable = observable.create( new observable.onsubscribe<string>() { @override public void call(subscriber<? super string> subscriber) { int i=0; log.d("testtag:", "start call"); while (!subscriber.isunsubscribed()) { subscriber.onnext("item "+i); i++; } log.d("testtag:", "completed"); subscriber.oncompleted(); } } ).publish(); observable .take(10) .subscribe( new action1<string>() { @override public void call(string s) { log.d("testtag:", "item received 1 : " + string.valueof(s)); } }); observable.connect(); outpu

r - return most common prefix in columns -

if columns in data frame share common prefix, how find out such common prefix? note: prefix here means longest substring before number appears. data set may like: date,vix1,vix2,vix3,dosg124,dosg220 in case, want vix instead of dosg because more columns (3) have vix prefix. you try table , which.max after removing 'suffix' part sub . here, assume suffix numeric part. tbl <- table(sub('\\d+$', '', v1)) names(which.max(tbl)) #[1] "vix" by using sub , match numeric part ( \\d+ ) end of string ( $ ) , replace '' data v1 <- c('date', 'vix1', 'vix2', 'vix3', 'dosg124', 'dosg220')

javascript - Regular express to match `command--o1--o2--o3` -

i have string command--o1--o2--o3 ( command,o1,o2,o3 arbitrary words) and want [o1, o2, o3] though regular expression(not array operation or other ways. use regular expression). is there idea accomplish !? if you're using javascript, , assuming want strings after -- , may do var things = str.split(/--/).slice(1) if want 2 characters words following -- , may use var things = str.match(/--\w\w/g).map(function(s){ return s.slice(2) })

Angularjs datatables rendering before data is fetched -

angular.module('someapp').controller('userlistsctrl',userlistsctrl); function userlistsctrl(dtoptionsbuilder,dtcolumnbuilder,$http,$q) { var vm = this; function serverdata() { var defer = $q.defer(); $.ajax({ 'datatype': 'json', 'type': 'post', 'contenttype': 'application/json', 'url': 'cgi/usernavlists.py', 'data': json.stringify({'request':"inprocess"}), 'success': function(data, textstatus, jqxhr, fncallback){ console.log("user table data coming up"); console.log(data); defer.resolve(data); }, }); return defer.promise; } serverdata().then(function(data){ console.log("promise data"); console.log(data); }); vm.dtoptions = dtoptionsbuilder.fromsour

angularjs - javascript validation of space and empty field -

i want validate form if user type white space aur leave field empty.. the problem code word perfect when put space in textbox , show validation..but when space empty redirect next page this controller $scope.valid= function (){ var fname = $("#fname").val(); var lname = $("#lname").val(); var email = $("#email").val(); var contact = $("#contact").val(); if( fname.indexof(" ") !== -1) { $scope.modalvalue = "spaces not allowed";registermodal.show(); } else if( lname.indexof(" ") !== -1){ $scope.modalvalue = "spaces not allowed";registermodal.show(); } else if( lname.indexof(" ") !== -1){ $scope.modalvalue = "spaces not allowed";registermodal.show(); } else if( contact.indexof(" ") !== -1){ $scope.modalvalue = "spaces no

bnf - "Non-exhaustive patterns in case" error while parsing the BNFC file -

i getting bnfc: src/lexbnf.x:(80,13)-(86,20): non-exhaustive patterns in case error. mean? it doesn't what's wrong bnf grammar, , have no idea how find error. tried looking for past few days, unsuccessfully. i checked if every symbol defined somewhere in file, fixed rules, nothing helped. i used have 2.6, , had same problem. however, on tool's webpage, says improvements error messages have been made since earlier versions, installed latest version (2.8), , gave me more informative error message. i'd recommend same.

c - How to search a string for a particular character or number or punctuation character -

i know use ctype.h various comparisons.i can make program have check weather given character upper case or lower case. suppose have entered string "singh21$" how check string contains uppercase,a dollar sign , @ least number. if string contains these 3 "its strong password". you can try this: for(int =0; < strlen(stringpassword); ++i) { if( islower(stringpassword[i]) ) haslower = true; if( isupper(stringpassword[i]) ) hasupper = true; if( isdigit(stringpassword[i]) ) hasdigit = true; if( isalnum(stringpassword[i]) ) hasspecial = true; } and if flags true consider strong password.

ruby on rails - rails4 authentication with devise on Mysql server doesn't work -

i'm following tutorial https://www.youtube.com/watch?v=aaym7uf6dr0 learn devise. i'm using rails 4.2.1. i've tryed devise using sqlite , works perfect, if want use devise mysql freezes when write: rails generate devise:install the console freeze , nothing happen. can't stop terminal whit ctrl+c , thing closing terminal. how can work whit devise on mysql? been lookng on google can't find solution... thank you!

Run a directive after the DOM has finished rendering AngularJS -

i have object api take considerable time, want directive wait till gets data. you can read on ngif . data stored in $scope.data . if have this <div ng-if="data"></div> this div injected in dom when $scope.data exists, means can make wait data before gets injected in dom.

angularjs - Website not running on Chrome and Firefox -

i use data localhost , rest api in website. website run on ie in chrome , firefox cros origin related problem occurs. use angular.js create website. please suggest how solve these problem. in chrome above problem solved adding "allow cross origin *" extension.

Neural Networks for integer values -

i have approximately 5000 integer vectors (=size) like: [1 0 4 2 0 1 3 ...] they have same length n=32 , values ranges 0 4 let's [0 max]. created nn takes vectors inputs , outputs binary array corresponding 1 of desired output(number of possible outputs = m): instance [0 1 0 0 ...0] => 2nd output. array_length = m used multi layer perceptron in neuroph integer values did not converge. guessing problem using integer values or using mlp 3 layers: input, hidden , output. can advise me on network structure? type of nn suitable? should remodel input , output simplify learning process? have been thinking gray encoding integers input.

Is it possible to load Bootstrap Glyphicons svg file into Inkscape? -

i want able display glyphicon halfling border of 13% around icon, , had thought of doing modifying svg file using inkscape. however, when open svg file in inkscape, although don't error page appears blank (for example, can't select anything). seems bit weird me - maybe going wrong way entirely? "glyphicons-halflings-regular.svg" not standard svg file. svg font. answer on superuser site may of help: https://superuser.com/questions/309743/edit-svg-font-using-inkscape

vertica - Create table with a variable name -

i need create tables on daily basis name date in form @ (yymmdd) , tried : dbadmin=> \set table_name 'select to_char(current_date, \'yymmdd \')' dbadmin=> :table_name; to_char --------- 150515 (1 row) and tried create table table name set parameter :table_name, got this dbadmin=> create table :table_name(col1 varchar(1)); error 4856: syntax error @ or near "select" @ character 14 line 1: create table select to_char(current_date, 'yymmdd ')(col1 va... is there way store value in variable , use variable table name or assign priority inner select statement has execute first give me name require. please suggest!!! try this for ever reason variable stored comes space , had remove , cannot start naming table starting numbers had add in form tbl_ in short need store value of exit need work , execute query. \set table_name `vsql -u dbadmin -w d -t -c "select concat('tbl_',replace(to_char(current_date, '

tomcat7 - Dorg.apache.el.parser.COERCE_TO_ZERO in Apache Tomcat 7 -

where can find parameter dorg.apache.el.parser.coerce_to_zero in apache tomcat 7 installation ? looked @ apache-tomcat-7.0.33\conf\catalina.properties suggested here on stackoverflow, didn't find it. it system property. if want apache configuration, drop -d prefix java command line. if not in configuration file, may add described here . org.apache.el.parser. coerce_to_zero - if true, when coercing expressions numbers "" , null coerced 0 required specification. if not specified, default value of true used.

ruby on rails - Serializing a custom attribute -

i using active model serializer gem application. have situation user can have avatar id of medium. i have avatar info saved redis. show avatar @ in serialized json, this: class userserializer < activemodel::serializer include avatar attributes :id, :name, :email, :role, :avatar def avatar medium.find(self.current_avatar)[0] end #has_one :avatar, serializer: avatarserializer has_many :media, :comments url :user end i query redis know medium in database, , use result in :avatar key. down in code there line commented out, way found on https://github.com/rails-api/active_model_serializers/ page using custom serializer inside of serializer. so problem. right :avatar comes in database want serialized before serve json. how can in case? you need serialize avatar class: class avatar def active_model_serializer avatarserializer end end then use way: class userserializer < activemodel::ser

.net - How to validate domain user credentials across domains using C#? -

i need validate domain user credentials across domains within same network. example domain user account created on "domain1", need verify user account computer c1 joined "domain2". able validate using dc ip address, need find out dc ip adress of domain2 computer c1 couldn't programmatically. is there other way validate domain user credentials? you can use dns.gethostentry acquiring ip address. https://msdn.microsoft.com/en-us/library/ms143998%28v=vs.110%29.aspx what api have been using auth - logonuser function ?

How to play video in my player from gallery in android? -

i developing video player in want set player @ launcher, user can play video in player gallery that: <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:mimetype="video/*" /> <data android:mimetype="application/sdp" /> <data android:pathpattern=".*3gp" /> <data android:pathpattern=".*3gp" /> <data android:pathpattern=".*mp4" /> <data android:pathpattern=".*mp4" /> </intent-filter> when set things in manifest show player @ video player launcher my problem is how video path in activity play video intent = getintent(); uri tmpselectedimageuri = i.getdata(); filename = getpath(tmpselectedimageuri, viewvideo.this); public

java - Android javax.crypto.BadPaddingException: pad block corrupted, Is there an alternative or Fix? -

i trying encrypt data in android app. having following exception. javax.crypto.badpaddingexception: pad block corrupted at line byte[] decrypted = cipher.dofinal(encrypted); my code follows private final static string hex = "0123456789abcdef"; public static string encryptstring(string str) throws exception { return encrypt("key123", str); } public static string decryptstring(string str) throws exception { return decrypt("key123", str); } public static string encrypt(string seed, string cleartext) throws exception { byte[] rawkey = getrawkey(seed.getbytes()); byte[] result = encrypt(rawkey, cleartext.getbytes()); return tohex(result); } public static string decrypt(string seed, string encrypted) throws exception { byte[] rawkey = getrawkey(seed.getbytes()); byte[] enc = tobyte(encrypted); byte[] result = decrypt(rawkey, enc); return new string(result); } private static byte[] getrawkey(byte[

php - Ordering versions in not lexicographical order -

this question has answer here: mysql sorting of version numbers 3 answers i need sort versions extract db query . right , sort order follows : 1.1.0 1.10.2 1.2.3 1.4 but wish were: 1.1.0 1.2.3 1.4 1.10.2 how can this? try this select * tab order cast(substring_index(ver, '.', 1) unsigned ), cast(substring_index(substring_index( ver , '.', 2 ),'.',-1) unsigned ) , cast(substring_index(ver, '.', -1) unsigned )

Error with pagination in Ajax (Jquery + PHP + MySQL) -

Image
i'm doing ajax search , many results, decided make pagination (i'm working in localhost right now). i write fields want/need/know find athlete (i fields jquery , send php page). after press search button , 10 results , pagination below results layout (all in div). the error comes when press page number button, because fields empty, , results div empty well. this jquery code: $('#btnbuscatriatleta').click(function () { $.get('wmatri/checkatleta.php', { nombreatleta: $('#nombreatleta').val(), apellidosatleta: $('#apellidosatleta').val(), clubatleta: $("select#clubatleta option:selected").val(), pagina: $("div#resultadobusquedatriatleta > nav.text-center > ul.pagination > li.active > a").attr('id') }, function (data) { $("#resultadobusquedatriatleta").html(data); }, '')

sql server - SQL : Retrieve ID stored in a string -

i bit lost how retrieve id. have stored inside string like hi interested in sharing apartment or rent rooms please text me {propertyid:43499} the part want 43499 how can achieve in sql-server. the solution worked me, edited answer got kavin chakaravarthi declare @string nvarchar(max) set @string = 'hi interested in sharing apartment or rent rooms please text me {propertyid:43499}' select substring(substring(@string, charindex(':',@string) +1, datalength(@string)), 0,6)` using sql query u can seperate id: declare @id varchar(max)='hi interested in sharing apartment or rent rooms please text me {propertyid:43499}' select @id=stuff(@id,len(@id),1,'') select @id=substring(@id,charindex(':',@id)+1,len(@id)) select @id output: id 43499

Nitrogen get content of table -

so, have nitrogen page, index.erl, contains codes this: body() -> [#table{ id = mytable, rows=[ #tablerow{ cells=[#tableheader{text="column a"}, #tableheader{text="column b"}, #tableheader{text="column c"}, #tableheader{text="column d"}] }, #custom_row{ %% wrapper around #tablerow column_a = "a", column_b = "b", column_c = "c", column_d = "d" } %% ... more #custom_rows omitted ] }, #button{text="submit", postback=store_table} ]. event(store_table) -> tabledata = something_like_queryselector(mytable), insert_into_database(tabledata). how content of mytable , nitrogen has queryselector ? there isn't nice , clean queryselector, possible retrieve co

How can I set a dynamic string as an Id of an Edittext Field in android -

i having multiple strings, coming dynamically, want set these strings id of edittext fields in form. how can that, can please me? for ex: if having id "title", want set title id of edittext field, when want access value of field, can access findviewbyid(title). please me here... thank in advance. no , can't set id char , string or else except int ...because, id maintained r.java file contains int . you can use settag() instead of setid() . use settag() below... edtext.settag("title"); you can later check using gettag() edtext.gettag(). you can use findviewwithtag in order find view specific tag.

Send data from Arduino to server -

is possible if arduino uno remains connected computer through usb port, me send data sensors server without other piece of equipment? if yes, there security concerns? because server won't know data coming arduino device supposed send him data or other source. a simple way achieve use breakoutjs download , install, , upload firmata sample arduino. you'll have right javascript code take care of sending requests distant server.

javascript - How to build CDATA values in xml2js for node server? -

i'm trying parse xml file , change cdata value of nodes using xml2js. , write new xml document file. i've tried everything, still not getting anywhere. tried using string "" , "cdata" option in builder class. doesn't work. writes text node undefined i.e. [![cdata[undefined]] fs.readfile(xmlfileurl, function(err, data) { parser.parsestring(data, function(err, result) { //change node value .... , build var xml = builder.buildobject(result); fs.writefile(xmlfileurl), xml, function(err) { if (err) { console.log(err); return; } }); }); });

mongodb - mongoexport - export in ISO data format -

i trying export data mongodb date stored in iso format. eg - { "_id" : "abcdef", "log" : [ { "ts" : isodate("2015-05-14t17:21:51z"), "visitorid" : numberlong(219301285) }, { "ts" : isodate("2015-05-15t19:20:52z") } ], "uts" : isodate("2015-05-14t17:21:50.589z") } when wrote export command mongoexport --host localhost:27018 --db mydb --collection mycoll --query '{"log.ts":{$gte :new date(1431619200000)}}' --out test_1.json it give me results in json format, date format numeric { "_id": "abcdef", "log": [ { "ts": { "$date": 1431624111000 }, "visitorid": 219301285 }, { "ts": { "$date&q

c# - Get windows operating system version in windows phone8 -

this question has answer here: getting windows phone version , device name in windows phone 8.1 xaml 3 answers i want operating system name , version of windows phone using c#. trying system.environment.osversion says osversion not found in system.environment system.environment.osversion not work in windows 8.1, because win 8.1 has many several versions. think fix bug when release newer versions.

c - printf macro for compiler with and without support for VARIADIC -

please me writing printf macro 1 compiler supports variadic , not. for instance: #ifdef have__va_args printf macro #else printf macro an solution variadic can lock this. #define my_printf(_format, ...) { \ printf(_format, __va_args__); \ } and if have compiler without variadic , have implement function variable argument list. #include <stdarg.h> #include <std.h> int my_printf(const char *format, ...) { va_list ap; va_start(ap, dst); return vprintf(format, ap); }

HTML Validation Issues -

sorry english not of good. try understand problem. , not able attach image because don't have of reputation. i have use html5 validation cross web site. facing issue that. let me explain is. i have 1 form , validation have use html5 validation concept. <asp:textbox runat="server" id="txtfirstname" tooltip="plz, enter valid first name" placeholder="contact first name" pattern="[a-z ]*" required="required"> </asp:textbox> <asp:button runat="server" id="btnsubmit" onclick="btnsubmit_click" /> on button click fire. problem have use 1 form popup on same page. , have html5 validation on popup well, when click button on popup, page validation getting fire. html5 have group validation? asp.net validation have. if no other way can avoid fire validation on page, on click of popup button? thanks in advance. please remove html5 validation , create new custo

C# to C++ multithreading, any issues to expect? -

after lot of testing have dozen algorithms don't give me satisfactory speed in c# , work fine in c++ (implemented same way, pretty copy pasted c# c++, heavily array based on large data sets). now know how call c++ code c# , don't want switch whole application over, i'm thinking of doing that. micro kernels must run heavily in parallel , since parallelism in .net nice, thinking of handling on side, , having each thread c# call whatever relevant. it sounds me shouldn't have issues thread safety way (i'm not calling c++ lib functionality, methods taking arrays input , returning arrays output, data not shared accross threads on either c++ or c# side). since i've never had question : stupid? missing huge elephant in room or should fine? have worry wether use mt runtime on c++ side or not considering don't call in of system calls? each microkernel slow enough (100+ms) .net boundary cross not big issue , substantially faster in c++ i'd rather avoid po

mysql - Select values compared with a calculated output (an average of another table) -

hopefully can explain properly, output shows ids , average bunch of results each id on table. grabs average of these results should be, , plate number.. now, is, set threshold.. show me ids of average less 50% of should be.... this code select k.ncr_identifier, avg(j.total_mass) masstotalavg, l.total_combination_mass , k.plate_number iapm_mass_data j inner join iapm_data_link k on j.record_id = k.mass_record_id inner join iacd_ncr_sdtcm_rec l on k.ncr_record_id = l.ncr_id k.ivu_date >= date '2015-03-01' , k.ivu_date <= date '2015-03-31' , l.vehicle_category_code = '12' group k.ncr_identifier i tried chuck in and l.total_combination_mass < 0.5(avg(j.total_mass)) but didnt seem it, ideas? for condition, need use having keyword. please try this: select k.ncr_identifier, avg(j.total_mass) masstotalavg, l.total_combination_mass , k.plate_number iapm_mass_data j inner join iapm_data_link k on j.record_id = k.mass_record_id inner

Capture Image through webcam on JSP Page and store image in folder in java -

how capture image through user's webcam , save file in default image folder database? i'm using jsp , java in web app. it easy opencv & javacv libraries , , here code snippet capture image webcam & save disc. iplimage img; // image format provided javacv apis opencvframegrabber grabber = new opencvframegrabber(0); // camera device id (0 built in , 1 external etc) grabber.start(); img = grabber.grab(); string imagename="images_name.jpg"; cvsaveimage(imagename, img);

c# - How to get passed seconds between actionfilters? -

let's have 2 actions , 2 action filters this [filter1] public actionresult index() [filter2] [httppost] public actionresult index(user user) here filter classes public class filter1:actionfilterattribute{ public override void onresultexecuted(resultexecutedcontext filtercontext)} public class filter2:actionfilterattribute{ public override void onactionexecuting(actionexecutingcontext filtercontext)} question is: how can passed seconds filter1 till filter2?

oop - Confusing about the output -

i'm new java programming. start reading head first java book. , found example on first chapter. public class beersong { public static void main(string[] args) { int beernum = 99; string word = "bottles"; while (beernum > 0) { if (beernum == 1) { word = "bottle"; } system.out.println(beernum + " " + word + " of beer on wall"); system.out.println(beernum + " " + word + " of beer"); system.out.println("take 1 down."); system.out.println("pass around."); beernum = beernum - 1; if (beernum > 0) { system.out.println(beernum + " " + word + " of beer on wall"); } else { system.out.println("no more bottles of beer on wall");