Posts

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.