Posts

Showing posts from March, 2010

jdbc - Use of jTDS to connect to SQL Server 2012 throws IOException; MS SQL Driver works -

the following code using jtds driver (1.3.1): drivermanager.getconnection("jdbc:jtds:sqlserver://anipaddress;databasename=adatabase", "user", "pass") results in: java.sql.sqlexception: i/o error: db server closed connection. @ net.sourceforge.jtds.jdbc.tdscore.nexttoken(tdscore.java:2481) @ net.sourceforge.jtds.jdbc.tdscore.login(tdscore.java:632) @ net.sourceforge.jtds.jdbc.jtdsconnection.<init>(jtdsconnection.java:371) @ net.sourceforge.jtds.jdbc.driver.connect(driver.java:184) @ java.sql.drivermanager.getconnection(unknown source) @ java.sql.drivermanager.getconnection(unknown source) @ com.seasset.crd.test.testdb.main(testdb.java:20) caused by: java.io.ioexception: db server closed connection. @ net.sourceforge.jtds.jdbc.sharedsocket.readpacket(sharedsocket.java:852) @ net.sourceforge.jtds.jdbc.sharedsocket.getnetpacket(sharedsocket.java:731) @ net.sourceforge.jtds.jdbc.responsestream.getpacket(re...

c - How to find compiled variable/function address from debug symbols -

i found following post ( how generate gcc debug symbol outside build target? ) on how split compiled file , debugging symbols. however, cannot find useful information in debugging file. for example, my helloworld code is: #include<stdio.h> int main(void) { int a; = 5; printf("the memory address of is: %p\n", (void*) &a); return 0; } i ran gcc -g -o hello hello.c objcopy --only-keep-debug hello hello.debug gdb -s main.debug -e main in gdb, tried won't give me information on a, cannot find address, cannot find main function address for example : (gdb) info variables defined variables: non-debugging symbols: 0x0000000000400618 _io_stdin_used 0x0000000000400710 __frame_end__ 0x0000000000600e3c __init_array_end 0x0000000000600e3c __init_array_start 0x0000000000600e40 __ctor_list__ 0x0000000000600e48 __ctor_end__ 0x0000000000600e50 __dtor_list__ 0x0000000000600e58 __dtor_end__ 0x0000000000600e60 __jcr_end__ 0x00000000...

javascript - How to Reset Newly Added Form Inputs -

edits: 1. removed code unnecessary... 2. clarified desired solution , added reset button html. i've seen various methods used reset form add content blank div (id = "unitpulled") via ajax so, methods similar following not work: document.forms[0].reset(); my goal reset entire form when user hits reset button. how go tackling issue? dom have reloaded? html button: <button id="reset" name="reset" class="btn btn-default" type="reset">clear</button> javascript: /* below auto-updating of initial , number */ var oxmlhttp function showunits(str) // change function name { var url = "ajax.cfm?&lic_plate=" + str // change url oxmlhttp = gethttpobject(statechanged) oxmlhttp.open("get", url, true) oxmlhttp.send(null) } // below new elements added: function statechanged() { if (oxmlhttp.readystate == 4 || oxmlhttp.readystate == "complete") { document.ge...

c# - How to reduce memory consumption when app is minimized for x amount of time -

this common problem windows. on years, it's i've noticed , it's aggrevating me point don't want make apps anymore. i've decided try , fix within own apps. when minimize app (for example, visual studio, windows explorer, internet explorer, chrome, or any other app ever made) , leave there while, there huge delay (of anywhere between 3 20 seconds) between time click icon in taskbar until time has reached windowstate.normal again. why this? why doesn't windows suspend processes when minimized on desktop? , how can solve problem within own apps? i have thought using timer. start timer when minimize app, let run while , say, after 10-15 minutes of being minimized, if hasn't been restored yet, start releasing resources in hopes of freeing memory - assume make response time quicker doesn't feel i'm waiting in er when try un-minimize app. not sure if timer right way deal problem, , i'm not sure if right solution. know i'm getting sick of ,...

javascript - In IE & Mozilla, mouse can't move the cursor or select text in input fields -

i have scratching head week find root cause of problem: i have input fields (<input type="text">) ; in ie have click 2 times in write , in mozilla works fine. if there text in it, takes 3 clicks write text in , same problem in mozilla. after this, can't move cursor or select text mouse. tab key works fine , cursor can moved arrow keys. same problem exists textarea . in chrome, works fine. more information: the whole html in iframe the problem not in focusing. on single click, gets focused on double click only, cursor shown in input fields i can't modify or access element outside iframe. can modify code inside iframe the code big can't paste here problem exists <input type="text"> fields. using oi-select library. fields working fine. before declare duplicate, here things have tried: i removed css element , reset inherited css not issue of css i not overriding mousedown function i tried focus on element inside iframe t...

Creating HTML table from Java, check if TD already has a TD to the right of it -

Image
i using gagawa ( https://code.google.com/archive/p/gagawa/ ) library dynamically create html table display school courses on weekly schedule. problem that, because i'm using rowspan increase size of cell based on course's duration, when try to, example add course meets on mwf, typical layout row <td>...content...</td> <td></td> <td>...content...</td> <td></td> <td>...content...</td> but, if 2 courses overlap in time on different days, inserting blank <td> element forced right, because <td> other course exists in next column. see attached screenshot more clarification (i've drawn arrows on in red show correct layout should be; ant210.101 should on mwf, i'm trying insert blank <td> bottom half of first ant220.102 block it, gets put right of it). i either need way dynamically detect whether or not put in blank <td> or way make instead of getting shifted right, gets shifted d...

Directing user to a page or another (PHP and MysQL) -

i creating site invited users directed register once email validated against master list of users , (2) returning users directed different page once validated against master list of users. master list of users have email addresses invited users. upon registration, users enter rest of information, including first name (fname). what need piece of code check if first name null, if direct user "registration.html"; whereas if first name present user user should directed "overview.html". my code not working properly, regardless of fname being null or xyz users directed "overview.html". $query = "select email, fname registration email='$email'"; if (fname = "null") { header('location: registration.html'); } else { header('location: overview.html'); } thanks help! i'm assuming didn't paste whole code here. how did fetch row? one thing can point out though, in php...

Learning Prolog (cuts, lists, negation) push me in the right direction -

i have following base knowledge: “ nba players on 30 years old have won @ least 3 nba championships superstars. nba players below 30 superstars if appear on front cover of videogame or if have @ least 5 million followers in twitter. ” define unary predicate superstar gives 1 answer (true/false) each query, when applied concrete person, e.g. superstar(paugasol). rules should check fact once (for instance, should not check age of queried person twice). can’t use “;” operator. you can use these data in tests (4 of these 8 players superstars, according previous definition): age(kobebryant,37). championships(kobebryant,5). millionsfollowers(kobebryant,9). age(paugasol,35). championships(paugasol,2). videogamecover(paugasol). millionsfollowers(paugasol,3). age(marcgasol,31). videogamecover(marcgasol). millionsfollowers(marcgasol,1). age(stephencurry,28). championships(stephencurry,1). videogamecover(stephencurry). millionsfollowers(stephencurry,5). age(klaythompson,26). championshi...

r - Fill bar chart with choosed Color and Error: Aesthetics must be either length 1 or the same as the data -

is there know how set color of bars? example, set so2 in red , nox in blue.i used code below : emission.l <- melt(emission.aerosol, id.vars = 'year', measure.vars = c('so2.tons', 'nox.tons')) gp <- ggplot(emission.l, aes(x = year, y = value, fill = variable)) gp <- gp + theme(axis.text.x = element_text(angle = 90, hjust = 1)) gp <- gp + geom_bar(stat = 'identity', position = 'dodge', fill=c("red","blue")) gp <- gp + ggtitle(emission.aerosol$facility.name) gp <- gp + ylab("emission(tons)") gp <- gp + scale_fill_discrete( name = '', labels = c('so2 (tons)', 'nox (tons)')) gp <- gp + scale_x_continuous(breaks = 2003:2015) ggsave(filename= paste0(emission.aerosol$facility.name,".png"),device = "png", width = 15, height = 10,units = "cm", dpi = 100) but error message : erro...

javascript - JS HTML CSS Accordion -

i'm looking use code have modified larger chunks of information. appears text cut off without padding. advice on how fix it? here code. can see images on accordions end , text collides them. .container { max-width: 960px; margin: 0 auto; padding: 2em 0 2em 0; } //uses classlist, setattribute, , queryselectorall //if want work in ie8/9 youll need polyfill these (function() { var d = document, accordiontoggles = d.queryselectorall('.js-accordiontrigger'), setaria, setaccordionaria, switchaccordion, touchsupported = ('ontouchstart' in window), pointersupported = ('pointerdown' in window); skipclickdelay = function(e) { e.preventdefault(); e.target.click(); } setariaattr = function(el, ariatype, newproperty) { el.setattribute(ariatype, newproperty); }; setaccordionaria = function(el1, el2, expanded) { switch (expanded) { case "true": se...

javascript - How to determine if browser supports properties on event object? -

some touch-enabled browsers (such mobile safari) have scale , rotation property available on event object events such touchmove . i can detect support scale property so... document.body.addeventlistener("touchmove", function(event) { var supportsscaleproperty = !!event.scale; }); however, there way detect without having bind listener , property in callback? for example, if worked? var supportsscaleproperty = !!(new customevent("touchevents")).scale; i tried looking @ createevent() , it's deprecated. looked @ new customevent() , wasn't sure string use touch events. you may able use event constructor : if ('scale' in new event("touchmove")) { // has }

R: Put Variables from .GlobalEnv, that meet certain criteria in list -

for weeks measured data once week. since measuring instrument used elsewhere in between got quite few .csv -files read r , got them in workspace now. named them alike of data.frames contain pattern "11." in variable name. know can list of (only) variable names using ls(pattern = "11.") but want have list containing data.frames . of course go in script , change read.table command e.g. a.11.01 <- read.table(...) to data.list[1] <- read.table(...) and later change name of list element data.list[1] "a.11.01" (and have saved nice amount of time if had done immediately) , i'm quite sure find out how defining , naming of list element in 1 command, feels if there quite simple option let r create list @ all. (another approach tried data.list[1] <- .globalenv[1] , ended finding no way subset environment . (my other approaches seem silly mentioned @ all.)) you use mylist <- mget(ls(pattern = "11.")) or, if...

postgresql - Error:must be owner of database -

i want delete particular database have named 'mysitedb' did opened terminal , entered command 'dropdb mysitedb' error 'error: must owner of database mysitedb' pops up. know username , pass particular database don't have clue on deleting it. new postgresql. gentle :p q: want delete particular database have named 'mysitedb' did opened terminal , entered command 'dropdb mysitedb' error 'error: must owner of database mysitedb' pops up... ok - means don't have right credentials. need username/password of postgresql user permissions delete database. note: know user owns it. know password. what ??? logged in when got permissions error???? anyway: want dropdb command: dropdb -u db_owner_username -i [-h host] mysitedb here postgresql documentation page: http://www.postgresql.org/docs/manuals/

javascript - change css using JS -

i trying call js event, depending on button press, (there 3 buttons) want css change font-size (differently each button), have not work. can help? body { background-image: url("back2.jpg"); background-size: 100% 100%; } .buttonsize1{ font-size: 3px; } .buttonsize2{ font-size: 26px; } .buttonsize3{ font-size: 45px; } .fixed { position: fixed; top: 100px; left: 0px; width: 150px; border: #0e6b5b 3px solid; background-color: #ff9933; } p { padding-left: 100px; } td { padding-top: 10px; padding-bottom: 50px; text-align: center; font-family: "lucida console", monaco, monospace; } .opac { opacity: 0.5; filter: alpha(opacity=10); /* ie8 , earlier */ } .opac:hover { opacity: 1.0; filter: alpha(opacity=100); /* ie8 , earlier */ } .maintable{ border: #0e6b5b 3px solid; background-color: #ff9933; w...

react native flexbox split screen -

i trying split screen using flexbox, not getting result desire, here have <view style={{flex: 1}}> <view style={{flex: 1}}>{/* half of screen */}</view> <view style={{flex: 1}}>{/* other half */} {/*<swiper>*/} <view style={{flex: 1}}>{/* quarter of other half */}</view> <view style={{flex: 1}}>{/* quarter of other half */}</view> <view style={{flex: 1}}>{/* quarter of other half */}</view> <view style={{flex: 1}}>{/* quarter of other half */}</view> {/*</swiper>*/} </view> </view> the problem having other half of screen expands take size of full screen, appended first half without taking consideration bounded half exist in screenshot how should approach this? try giving flexdirection: 'row' style outermost view.

arrays - c# recursive step method -

i'm trying make recursive method check if last number (always 0) in integer array (with > 0 integers) reachable increasing (or decreasing) index of array value of array element of current index, while staying within bounds of array. example: say have following array, , start index == 0: int[] arr = {3, 6, 4, 1, 3, 4, 2, 5, 3, 0}; step 0 : index = 0, value = 3 step 1 : index = 3, value = 1 step 2 : index = 4, value = 3 step 3 : index = 7, value = 5 step 4 : index = 2, value = 4 step 5 : index = 6, value = 2 step 6 : index = 8, value = 3 step 7 : index = 5, value = 4 step 8 : index = 9, value = 0 -- end my current code: static bool solveable(int index, int[] arr) { if (arr[index] == 0) return true; if (index + arr[index] < arr.length) return solveable(index + arr[index], arr); if (index - arr[index] >= 0) retu...

mysql - Need to use temporary variable to make REPLACE of SUBSTRING_INDEX work -

we're running mysql 5.5.47 on number of debian servers. on of them, we're seeing following strange behavior: mysql> set @tkey:='ardard:fae590c4.ffa2.11e5.a318.0cc47a39aeb4-1460351116'; mysql> select replace(substring_index(substring_index(@tkey,':',-1),'-',1), '.','-') guid; +--------------------------------------+ | guid | +--------------------------------------+ | fae5a2.1--0cc47a 9ae47a 9aeb4a 9aeb4 | +--------------------------------------+ this supposed extract middle part of @tkey (between : , - ) , replace periods hyphens. spaces coming from? other parts of result seem jumbled up: 9aeb4 has been duplicated, a2.1 has been shifted left. this doesn't happen if assign substring_index intermediate variable. mysql> set @temp = substring_index(substring_index(@tkey,':',-1),'-',1); mysql> select replace(@temp, '.', '-') guid; +---------------...

javascript - cannot create object in IE using new Keyword -

var com = {}; var com.project = function(){ this.display = function(){ alert("hai....."); } } var project_obj = new com.project(); while creating project_obj got error in ie9 "object doesn't support action" this code working in firefox , chrome. have given sample code. i'm trying use classes , package concept in javastript. i don't know why error came in ie. this illegal in browsers , raises syntax error : var com.project = function(){ you may : var com = {}; // whatever com.project = function(){

javascript - Why is only the last object's function getting called here? -

wow. figured causing bug, can't figure out why. have object property (excuse massive code dump) // relatives second indices in video events // called when video reaches second this.pausepoints = [ { sec: 10, name: "point number 1", passed: false, func: (function(that) { this.$layer = that.getlayerelement(10); this.$layer.hide(); this.to = function () { that.videlem.pause(); // pause video $(window).resize(); // re-proportion stuff // point 3 mouse pointers var $mptrs = this.$layer.find('.filmstrip-pointer'); (var = 0; < $mptrs.length; ++i) { (function (j) { settimeout(function () { point($mptrs.eq(j)); }, j * 1000); ...

Ruby: How to execute only one if condition in a loop? -

i trying have 1 of if conditions print. subnet = ['10.14.1.32/27', '10.17.8.2/29'] system = gets.chomp subnet.each |cidr| address_space = netaddr::cidr.create(cidr) if address_space.contains? system puts "found" else puts "not found" end end the output 10.17.8.3 be not found found how 1 response? tried using breaks doesn't work. all! the trick use enumerable#find method: subnet = ['10.14.1.32/27', '10.17.8.2/29'].collect |cidr| netaddr::cidr.create(cidr) end system = gets.chomp found = subnet.find |cidr| cidr.contains?(system) end if (found) puts "found" else puts "not found" end that return either cidr object matched or nil if nothing did.

asp.net mvc - Setting a razor variable to the value of a dropdown -

Image
i have form inside of modal takes in list of total ec2 instances. trying adjust second drop down value of first 1 second drop down sees instances relative volumes. <form action="/s3/attachvolume/" method="post"> <div class="form-group"> <p>please double check ids of instance , volume</p> <label for="instanceid">instanceid:</label> <select class="form-control text-center" name="instanceid" id="instances" style="margin: 0 auto"> @for (var = 0; <= totalcount - 1; i++) { foreach (var instances in model.instances.reservations[i].instances) { <option>@instances.instanceid</option> } } </select> <label for="type">volume id:</label> <sele...

java - How to enable debug logging for Tomcat native/APR SSL -

i'm using tomcat "native" apr provide ssl. connector looks like: <connector port="8443" protocol="org.apache.coyote.http11.http11aprprotocol" sslenabled="true" sslverifyclient="require" sslcertificatefile="..." sslcertificatekeyfile="..." sslpassword="..." sslcacertificatefile="..." maxthreads="200" scheme="https" secure="true"/> i'm having trouble apr side refusing certificates , want debug this. how can enable debug output (logging) ssl session on tomcat/apr side? adding "javax.net.debug=ssl" doesn't work, of course, since apr binary handling ssl, not java. i have javax.net.debug=ssl output on client side, that's not enough info since error being sent server (tomcat/apr).

opengl - How to simulate mathimatically correct shadows of transparent objects? -

Image
i want simulate shadows casted complex , composite transparent objects. shadows must mathematically correct particular light source (at least point light). think true graphical library, it? than, there must not refraction @ all. image not want of course. does opengl can this? if can not should use instead? upd. need path tracer. there wich use programmatically: give file of 3d-scene objects , result of tracing? this shadows must mathematically correct there's no such thing mathematically correct or wrong illumination. mean physically correct . images want create them rely on light propagation. way simulate light propagation shoot virtual photons scene , follow path. called path tracing . does opengl can this? opengl draws points, lines , triangles… 1 @ time, without concept of scene or models. old, fixed function pipeline opengl had simple blinn illumination model built in, did calculate "light" value per vertex based on surface or...

ios - GKMatchmaker findMatchForRequest invite never received -

i'm trying invite nearby players match, invite either never sent or never received. gkmatchmaker startbrowsingfornearbyplayerswithhandler works , returns nearby players on same wifi, use findmatchforrequest , returns match without players, , players try invite never receive invite notification. here code. i start authenticating local player: gklocalplayer.localplayer.authenticatehandler= ^(uiviewcontroller *controller, nserror *error) { if (error) { nslog(@"%s:: error authenticating: %@", __pretty_function__, error.localizeddescription); return; } if(controller) { // user has not yet authenticated [pviewcontroller presentviewcontroller:controller animated:yes completion:^(void) { [self lookfornearbyplayers]; }]; return; } [self lookfornearbyplayers]; }; -(void)lookfornearbyplayers { if(!gklocalplayer.localplayer.authenticated) { nslog(@"%s:: u...