Posts

Showing posts from April, 2011

java - Get more detailed Spring Bean Initialization Exceptions -

i getting exception when starting tomcat: java.lang.noclassdeffounderror: com/mycompany/mypackage/someclass @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmethods(unknown source) @ java.lang.class.getdeclaredmethods(unknown source) @ org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor.buildlifecyclemetadata(initdestroyannotationbeanpostprocessor.java:194) @ org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor.findlifecyclemetadata(initdestroyannotationbeanpostprocessor.java:176) @ org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor.postprocessmergedbeandefinition(initdestroyannotationbeanpostprocessor.java:122) @ org.springframework.context.annotation.commonannotationbeanpostprocessor.postprocessmergedbeandefinition(commonannotationbeanpostprocessor.java:283) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applymer

Java SOAP Service & JBOSS -

setup vm argument java soap web service ???? i have soap web service want deploy jboss, but need setup vm argument web service. vm argument -dabc.config=file:///foldera/abc.xml how ???? thanks alot elliott answering q.... "modify standalone.sh or (on windows) standalone.bat , restart jboss. – elliott frisch 12

c# - Proper contents of first three lines of xml doc using xsl stylesheet -

i inherited report generator creates xml file , formats using xsl/css. i'm not familiar web page creation. .html file created line of code: xslt.transform(xmlreader.create(xmlstream), writer); and displayed in .net 4.5.2 system.windows.controls.webbrowser object. report looks fine. renders nicely in ie 11, , not in firefox (some background colors missing). more importantly, though, user reporting problems converting .html .pdf using adobe acrobat (some images sized incorrectly) i'm investigating quality of .html formatting. opened .xml file created report generator in visual studio 2013 , flagged first 2 lines problems: <?xml:stylesheet type="text/xsl" href="mydir\report.xsl" ?> <?xml version="1.0"?> <myclass xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> the first line flagged error: "invalid characters in processing instruction target&quo

binary - Why 0A0B0C0D is a 32-bit word/number? -

when discussing endian, instructor gave word 0a0b0c0d in hexadecimal, , why 32-bit word? thanks. preamble: what answer have been had instructor given 000000000a0b0c0dh ? well, answers provided @ergonaut , @kdbanman yield 64-bits. your question: why 32-bit word? the value instructor gave not have 32-bit. considerd 64-bit, 128-bit, or else starting @ 28-bit matter. what important here the position of significant digit . find out translate hexadecimal value 0a0b0c0dh binary equivalent 0000' 1 010'0000'1011'0000'1100'0000'1101b , note 1 left occupies 28th position. remember bit numbering starts right! since 28 bits won't fit in 16-bit word, choose next higher format 32-bit. applying logic value in preamble lead 32-bit number correct answer. when classifying numbers don't consider leading zeroes!

Error with application.ontime method in excel vba -

Image
i havew live data feed in excel, want record data shown here: ] i wrote on code follows option explicit dim schedrecalc date sub recalc() range("a1").value = format(now, "dd-mmm-yy") range("b1").value = format(time, "hh:mm:ss am/pm") call settime end sub sub settime() schedrecalc = + timevalue("00:00:01") application.ontime schedrecalc, "recalc" application.ontime schedrecalc, "record" end sub sub record() ' ' update macro ' worksheets("sheet1") application.screenupdating = false sheet1.range("a1:a169").copy _ destination:=mysheet.range("e9") sheet1.range("e9:e169").insert shift:=xlshifttoright selection.insert shift:=xltoright application.cutcopymode = false end end sub sub disable() on error resume next application.ontime earliesttime:=schedrecalc, proced

objective c - Preferred approach with int values while adding 64-bit support to iOS app -

i updating old ios app not support 64-bit architectures. from apple's conversion procedure, looks converts "int , unsigned int nsinteger , nsuinteger, respectively." however, when doing this, end lot of casting longs during formatting, shown below. concerned performance on 32-bit architectures because of of casting long. //old nsinteger myintvalue = 5; [nsstring stringwithformat:@"%d", myintvalue]; //new nsinteger myintvalue = 5; [nsstring stringwithformat:@"%ld", (long)myintvalue]; an alternative replace usages of nsinteger int, remain 4-byte values, not need cast long when formatting myintvalue. //old nsinteger myintvalue = 5; [nsstring stringwithformat:@"%d", myintvalue]; //new int myintvalue = 5; [nsstring stringwithformat:@"%d", myintvalue]; should latter method avoided particular reason, assuming items change nsinteger int guaranteed fit inside 4-byte int? those castings only way format strings when

javascript - Canvas unable to find context when requestAnimationFrame is called - ES6 -

this question has answer here: how access correct `this` inside callback? 6 answers i experimenting class based code. create class canvas , pass component rendered. problem when browser requests animation frame context lost, , becomes undefined. looking explanation of why case. i not concerned best practice figuring out why context lost. i have attached link example on codepen. http://codepen.io/briandgls/pen/bojorm?editors=001 here js code: class canvas { constructor() { this.canvas = document.getelementbyid('canvas'); this.context = this.canvas.getcontext('2d'); this.width = this.canvas.width = window.innerheight; this.height = this.canvas.height = window.innerwidth; this.components = []; } draw() { this.context.clearrect(0, 0, this.width, this.height); this.context.globalcompositeoperation = 'hard-li

Is there any way to apply a project-wide regex replacement in Powerbuilder? -

i mass replacement in powerbuilder project. (for story, i'd replace ".object." setitem/getitem equivalents, diverse reasons) while won't covering cases, know if there way apply regex find/replace on entire workspace, or @ least on selected pbl files. i have seen other question , i'm wondering if there more simple way exporting (especially reimporting doesn't seem funniest thing do). the best option export , make small application indicating rules make change in exported file, import.

android - why LinearLayouts return null object reference after configuration changes? -

i setting android:configchanges="orientation|screensize" in manifest activity not destroyed , re-created . if tried use of linearlayout objects after screen rotates"first rotation not return error second 1 return error full details " return null ! question linearlayout objects return null after configuration changes if (activity declared in manifest that) ? thanx in advance!

Find clusters in 3D point data using a massively parallel algorithm -

Image
i have large number of points in 3d space (x,y,z) represented array of 3 float structs. have access strong graphics card cuda capability. want following: divide points in array clusters every point within cluster has maximum euclidean distance of x @ least 1 other point within cluster. examle in 2d: the "brute force" way of doing of course calculate distance between every point , every other point, see if of distances below threshold x, , if mark points belonging same cluster. o(n²) algorithm. this can done in parallel in cuda ofcourse n² threads, there better way? the algorithm can reduced o(n) using binning : impose 3d grid spaced x, 3d lattice (each cell of lattice cubic bin); assign each points in space corresponding bin (the bin geometrically contains points); every time need evaluate distances 1 point, use points in bin of point , ones in 26 neighbouring bins (3x3x3 = 27) the points in other bins further x, don't need evaluate distances

bash - checking that the rows in a file have the same number of columns -

i have number of tsv files, , want check each file correctly formatted. primarily, want check each row has right number of columns. there way this? i'd love command line solution if there one. awk '{print nf}' test | sort -nu | head -n 1 this gives lowest number of columns in file on given row. awk '{print nf}' test | sort -nu | tail -n 1 this gives highest number of columns in file on given row. result should same, if columns present. note: gives me error on os x, not on debian... maybe use gawk .

Meteor Iron Router splash message edit -

i change splash message of iron router failure .instead of "organize meteor application" ,add user friendly.how start issue ?? it hard coded here in iron:router repo. can fork , change line yours. but why need this? line 54 here can give idea of how iron:router uses templates. router.prototype.lookupnotfoundtemplate = function () { if (this.options.notfoundtemplate) return this.options.notfoundtemplate; return (this.routes.length === 0) ? no_routes_template : default_not_found_template; }; only if don't have routes defined , no config notfoundtemplate , see such message, define via router config. router.configure({ layouttemplate: 'layout', notfoundtemplate: 'pagenotfound' });

python - Plotting a 2D heatmap with Matplotlib -

Image
using matplotlib, want plot 2d heat map. data n-by-n numpy array, each value between 0 , 1. (i, j) element of array, want plot square @ (i, j) coordinate in heat map, color proportional element's value in array. how can this? the imshow() function parameters interpolation='nearest' , cmap='hot' should want. import matplotlib.pyplot plt import numpy np = np.random.random((16, 16)) plt.imshow(a, cmap='hot', interpolation='nearest') plt.show()

Reversing a css animation -

i have overlay fades in following code, .overlay { background: rgba(32, 79, 156, 0.97); width: 100%; height: 100vh; position: fixed; z-index: 1000; display: none; } .overlay.active { display: block; -webkit-animation-duration: 0.5s; -webkit-animation-name: fadein; animation-duration: 0.5s; animation-name: fadein; } @keyframes fadein { 0% { display:none; opacity: 0; } 1% { display: block ; opacity: 0; } 100% { display: block ; opacity: 1; } } all js toggle class $('.hamburger').on('click', function(){ $('.overlay, .hamburger').toggleclass('active'); }); how can reverse animation? @ moment jumps previous state. animations won't work on display property display:none hides element wouldn't see fade if animation running. can animate opacity property using css transitions this: $(

sql - Data source to equal input box value -

i have excel file updates access database, realised access database regularly changes location file location inputted input box , used. i've tried case select hasn't been successful, here's have far: d = inputbox(prompt:="enter file path", title:="please enter file path", default:="file location") select case strptr(d) case 0 exit sub case else dim cnn object dim lngrow long dim lngid long, lr long, upd long dim strid string lr = thisworkbook.worksheets("update").range("bn" & rows.count).end(xlup).row upd = lr - 1 lngrow = 2 set cnn = createobject("adodb.connection") cnn.open "provider=microsoft.ace.oledb.12.0;" & _ "data source=d" i prefer use filedialog, because better @ preventing invalid input. however, if want use input box, can use dir function validate resolves existing file path. d = inputbox(prompt:="enter file path", title:="please enter file

c# - Serializing collections only one level deep with Entity Framework -

i'm running issue while attempting return recursive serialized objects generated entity framework 6 through web api. here's small example of problem: [serializable] [datacontract] public partial class thing { public thing() { this.otherthings = new hashset<otherthings>(); } [datamember] public int thingid { get; set; } [datamember] public string thingname { get; set; } //not included in serialization public virtual icollection<otherthing> otherthings { get; set; } } [serializable] [datacontract] public partial class otherthing { public otherthing() { this.things = new hashset<things>(); } //i want these [datamember] public int otherthingid { get; set; } [datamember] public string otherthingname { get; set; } //do not want getallthings() avoid circular references public virtual icollection<things> things { get; set; } } the decorators generated context

PHP : how to trigger javascript function from a button in another page -

Image
i have 3 buttons. search button : open popup page. add row button : trigger javascript function add row. select button : trigger javascript function row value , send main page. search , add row buttons in main page, , select button on popup page. i need select button handle javascript function in main page, can remove add row button. to put simple, question how trigger javascript function add row in main page, using select button in popup page? if question isn't clear please ask, thanks. i take general example. (parent window) <html> <script language="javascript"> function openwindow() { window.open("target.html","_blank","height=200,width=400, status=yes,toolbar=no,menubar=no,location=no"); } </script> <body> <form name=frm> <input id=text1 type=text> <input type=button onclick="javascript:openwindow()" value="open window..">

css - How do I compile LESS files every time I save a document? -

i've installed less via npm this $ npm install -g less now every time want compile source files .css, run $ lessc styles.less styles.css is there way via command line make listen when save document compile automatically? the best solution out there i've found 1 recommended on official less website: https://github.com/jgonera/autoless . dead simple use. listens changes in imported files compile.

ios7 - How to set frame to UIBUTTON based on device type? -

i want set frame uibutton based on device 5,6,6plus,i tried below code getting trouble 6plus,for 6,6plus same method (is_iphone_6_6plus)is getting called,what,s wrong code please let me know. #define is_iphone_6_6plus ([[uiscreen mainscreen] bounds].size.height >= 667)?true:false #define is_iphone6plus ([[uiscreen mainscreen] bounds].size.width >= 414)?true:false #define is_iphone_4 ([[uiscreen mainscreen] bounds].size.height == 480)?true:false #define is_iphone_5 ( fabs( ( double )[ [ uiscreen mainscreen ] bounds ].size.height - ( double )568 ) < dbl_epsilon ) - (void)viewdidload { if (is_iphone_5) { loginview.frame = cgrectmake(108, 393, 35, 35); _signinbutton.frame=cgrectmake(173,393, 35,35); } else if (is_iphone_6_6plus) { loginview.frame = cgrectmake(128, 476, 35, 35); _signinbutton.frame=cgrectmake(208,476, 35,35); } else if (is_iphone6plus) { loginview.frame = cgrectmake(118, 506,

python - tornado + momoko doesn't handle connection -

i use tornado (4.2.1) + momoko (2.2.0) + psycopg2 (2.6.1) small web application , works ok until postgresql server close connection. after every db.execute() command receive error message: traceback (most recent call last): file "c:\python27\lib\site-packages\tornado-4.2.1-py2.7-win32.egg\tornado\web.py", line 1415, in _execute result = yield result file "c:\python27\lib\site-packages\tornado-4.2.1-py2.7-win32.egg\tornado\gen.py", line 870, in run value = future.result() file "c:\python27\lib\site-packages\tornado-4.2.1-py2.7-win32.egg\tornado\concurrent.py", line 215, in result raise_exc_info(self._exc_info) file "c:\python27\lib\site-packages\tornado-4.2.1-py2.7-win32.egg\tornado\gen.py", line 876, in run yielded = self.gen.throw(*exc_info) file "server.py", line 63, in cursor = yield self.db.execute(query) file "c:\python27\lib\site-packages\tornad

ios - How to use kCGImageDestinationLossyCompressionQuality in saving GIF from video -

i using regift ( https://github.com/matthewpalmer/regift ) library convert videos gifs, don't how large file size of saved gifs are. library using cgimagedestinationaddimage function add each frame of video file, , 1 of parameters of function dictionary lets specify properties of image, , 1 of properties can set called kcgimagedestinationlossycompressionquality want use try reduce file size. this original code in library defines properties dictionary passed cgimagedestinationaddimage function: let frameproperties = [kcgimagepropertygifdictionary string: [ kcgimagepropertygifdelaytime string: delaytime ]] i'm trying modify dictionary include kcgimagedestinationlossycompressionquality property: let frameproperties = [ kcgimagedestinationlossycompressionquality string: 0.5, kcgimagepropertygifdictionary string: [ kcgimagepropertygifdelaytime string: delaytime ]] but when try re-converting same video file gif, there no difference in quality or file size, m

checkbox - jQuery shows "name" instead of "value" -

i have time table checkbox: <table id="date"> <tr> <th>sun</th> <th>mon</th> <th>tue</th> <th>wed</th> <th>thu</th> <th>fri</th> <th>sat</th> </tr> <tr> <td><input type="checkbox" name="sun" id="sun" value="0" /></td> <td><input type="checkbox" name="mon" id="mon" value="1" /></td> <td><input type="checkbox" name="tue" id="tue" value="2" /></td> <td><input type="checkbox" name="wed" id="wed" value="3" /></td> <td><input type="checkbox" name="thu" id="thu" value="4" /></td>

data structures - Understanding go nested structs -

i'm trying understand nested structs in go, made little test: ( playground ) type struct { string } type b struct { b string } func main() { b := b{a{"a val"}, "b val"} fmt.printf("%t -> %v\n", b, b) // b has nested , values // main.b -> {{a val} b val} fmt.println("b.b ->", b.b) // b's own value // b.b -> b val fmt.println("b.a.a ->", b.a.a) // b's nested value // b.a -> val fmt.println("b.a ->", b.a) // b's nested value? or own value? // b.a -> val } so how , why last 2 lines work? same? should use? they same. see the go spec on selectors : for value x of type t or *t t not pointer or interface type, x.f denotes field or method @ shallowest depth in t there such f . if there not 1 f shallowest depth, selector expression illegal. note means b.a illegal if type b embeds 2 types same f

android - NPE when try to contact with saved data -

i have nullpointerexception when try saved data.i think caused wrong "open" method @ sqlhelper class.and associated wrong context.because when used activity worked,now use fragment , have error. error: 10-10 09:23:03.009 7657-7657/com.example.vnvbnv.myapplication e/androidruntime: caused by: java.lang.nullpointerexception 10-10 09:23:03.009 7657-7657/com.example.vnvbnv.myapplication e/androidruntime: @ com.example.vnvbnv.myapplication.mainlist.displaysavedlv(mainlist.java:168) 10-10 09:23:03.009 7657-7657/com.example.vnvbnv.myapplication e/androidruntime: @ com.example.vnvbnv.myapplication.mainlist.onactivitycreated(mainlist.java:56) mainlist(lines caused error i'll mark "****") : public class mainlist extends listfragment{ sqlhelper dbhelper; listview mainlist; progressbar progbar; private static string url = "https://fierce-citadel-4259.herokuapp.com/hamsters"; private static final string title = "title&quo

mysql - Error: You can't specify target table 'wp_postmeta' for update in FROM clause -

delete wp_postmeta post_id in ( select id wp_posts post_type = 'attachment' , post_parent in ( select post_id wp_postmeta meta_value = 'mycbgenie' ) ) one option can try is: delete `wp_postmeta` `post_id` in ( select `id` `wp_posts` `post_type` = 'attachment' , `post_parent` in ( select `der`.`post_id` (select `post_id` `wp_postmeta` `meta_value` = 'mycbgenie') `der` ) ); sql fiddle demo

javascript - color guessing game.How to stop the loop after guess is right -

how stop loop after guess right. <!doctype html> <html> <body onload = "do_game()"> <script> var target; var color = ["blue", "cyan", "gray", "green", "magenta", "orange", "red", "white", "yellow"].sort(); var guess_input_text; var guess_input; var finished = false; var guesses = 0; × looks post code; please add more details. how stop loop after guess right. //main function function do_game() { var random_color = color[math.floor(math.random() * color.length)]; // random value array target = random_color; while (!finished) { guess_input_text = prompt("i thinking of 1 of these colors:- \n\n" + color.join(", ") + ".\n\nwhat color thi

ios - Core Data NSFetchResultController batch size -

nsfetchresultcontroller nsfetchrequest fetchbatchsize = 20 return entities. can be? didn't use sectionkeypath , tried different sort descriptors, it's still return objects. thanks replies!i explain details. have entity 2 fields - distance , time. have created nsfetchresultcontroller: func noticesfetcher() -> nsfetchedresultscontroller { let fetchrequest = nsfetchrequest() let defaultstore = rkmanagedobjectstore.defaultstore() let entity = nsentitydescription.entityforname("notice", inmanagedobjectcontext: defaultstore.mainqueuemanagedobjectcontext) fetchrequest.entity = entity let distancesortdescriptor = nssortdescriptor(key: "distance", ascending: true) let timesortdescriptor = nssortdescriptor(key: "time", ascending: false) let sortdescriptors = [distancesortdescriptor, timesortdescriptor] fetchrequest.sortdescriptors = sortdescriptors fetchrequest.fetchbatchsize = 20 let resultfetcher

html - Change background image opacity with css -

i want change header's background image opacity css. me please. .intro { display: table; width: 100%; height: auto; padding: 100px 0; text-align: center; color: #fff; background: url(http://lorempixel.com/1910/500/nature/) no-repeat bottom center scroll; background-color: #000; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover; -o-background-size: cover; } <header class="intro"> ... </header> you can change opacity in programs photoshop or gimp. or can opacity in css. don't want since have content in .intro affected it. so suggest following solution .intro { position: relative; z-index: 0; display: table; width: 100%; height: auto; padding: 100px 0; text-align: center; color: black; background-color: transparent; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover;

https - Cloud foundy spring-boot project encounter redirect loop issue -

all, create spring-boot mvc project, , want limit https visit, configure this. package com.example; import org.springframework.boot.springapplication; import org.springframework.boot.autoconfigure.enableautoconfiguration; import org.springframework.boot.autoconfigure.springbootapplication; import org.springframework.context.annotation.configuration; import org.springframework.security.config.annotation.web.builders.httpsecurity; import org.springframework.security.config.annotation.web.configuration.websecurityconfigureradapter; @enableautoconfiguration @springbootapplication public class demo123application { public static void main(string[] args) { springapplication.run(demo123application.class, args); } } @configuration class securityconfiguration extends websecurityconfigureradapter { @override protected void configure(httpsecurity http) throws exception { http.requireschannel().anyrequest().requiressecure(); } } but when visit in chr

java - Applet html embedding and I can't seem to locate the .class from my git repo -

i trying embed java applet webpage. unfortunately, can't put .class file straight server so, going read .class file git repository , pointing archive attribute in html code. this html code: <html> <body> <applet code="dodgemapplet.class" width="640" height="480" archive="https://github.com/smithg017/repo.git"> </applet> </body> </html> i still pretty new html can show me right way should going java applet embedded website? thanks! well, there hidden property didn't know , after digging found property codebase. put this: codebase="https://github.com/smithg017/repo/blob/master/" right after code = "dodgemapplet.class" code name. default in same directory html file. in case, in desktop folder. if class file elsewhere, reference folder class file in under codebase property.

javascript - someting like submenu on input click and close it on losing focus -

i'm trying submenu on input click , close on losing focus jquery. accomplished using mouseup this: $(document).mouseup(function (e){ var container = $(".container"); if (!container.is(e.target) && container.has(e.target).length === 0 && !$(".input").is(e.target)) { $('.submenu').removeclass('submenu'); } }); here results: http://jsfiddle.net/lwfhbdmp/8/ this works ok, think it's complex , maybe there simpler solution this? please help. jsfiddle demo a cleaner solution: $(function(){ var $submenu, conthov = 1, $container = $('.container').hover(function(){ conthov^=1; }); // tog flag on hover $(document).on('mouseup keyup', function( e ){ if(conthov||e.which==27) $submenu.removeclass("submenu"); }); $(".input").on("click", function(e){ $submenu = $(this).closest("div&qu

Setting up the same route for both client and server using iron-router in meteor -

i want set route post requests, server logic , client loads view for same route . so, example, route /myroute have: if (meteor.isclient) { router.route('/myroute'); } if (meteor.isserver) { router.route('/myroute', {where: 'server'}) .post(function() { console.log('this server side'); this.next(); }); } however, server-side not called @ all, , template rendered no console logs on server. how can make work?

Counting Everything Besides Characters in Java -

i need print every character except letters. (commas, spaces, ect.) , display them. here code far, public static void main(string[] args) { string = "elephant"; string b = "elephant"; string c = "this string."; string d = "i r gr8, u r gr8"; int ucounter = 0; int lcounter = 0; int dcounter = 0; int ocounter = 0; (int = 0; < a.length(); i++) { if (character.isuppercase(a.charat(i))) ucounter++; if (character.islowercase(a.charat(i))) lcounter++; if (character.isdigit(a.charat(i))) dcounter++; } system.out.println("string: " + ); system.out.println("\n"); system.out.println("\tlowercase: %d, uppercase: %d, digit: %d, other: " +ucounter); } i having small issue getting them print out numbers after calculating them, separate issue solve on own. have perused forums , cannot seem find how coun

html - Links inheriting div size -

i'm coding basic site skeleton (in case needs know, i'm decently skilled in html, have trouble div s , i'm learning css), , issue occurred links google on site logo , links "contact" , "news" inheriting size of whole fixed banner, named thing . (the banner looks bit odd in snippet, because it's fixed , meant desktop.) my code: ::-moz-selection { color: #ffffff; background: #00ffaa; } ::selection { color: #ffffff; background: #00ffaa; } a:link { text-decoration: none; color: #00ffaa; } a:visited { text-decoration: none; color: #00d486; } a:hover { text-decoration: none; color: #adffe2; } a:active { text-decoration: none; color: #00ffaa } .thing { background: #141414; position: fixed; left: -2%; top: -10px; z-index: 100; width: 200%; height: 10%; } .header { color: #aaaaaa; position: relative; left: 200px; top: -15px; font-size: 300%; } .header:hover {

html - javascript addEventListener in for loops uses last variable for event -

here's code <body> <div id = "elementbox"> </div> <script> var container = document.getelementbyid("elementbox"); function item_select() { alert("e"); var selected_element = document.getelementsbyclassname("on"); selected_element.classname = "off"; alert(selected_element); } (var = 0; < 20; i++) { dive = document.createelement("div"); dive.id = i+1; dive.classname = "off"; if (dive.id === 8) { dive.classname = "on"} dive.innerhtml = "<p>e</p>; (function(i) { dive.addeventlistener("click", function(i) { document.getelementbyid(i).classname = "on"; item_select(); }, true) })(i); container.appendchild(dive); } </script> </body> </html> as can see addeventlistener uses incremente

plot - Set parameters in gnuplot using C++ source code -

i'm trying plot vectors using gnuplot c++ source code. read question how interface c++ gnuplot. this source code: int main() { char * commandsforgnuplot[] = {"set title \"trajectory_arm\"","plot 'data.temp' linespoints"}; double xvals[num_points] = {1.0, 2.0, 3.0, 4.0, 5.0}; double yvals[num_points] = {5.0 ,3.0, 1.0, 3.0, 5.0}; file * temp = fopen("data.temp", "w"); /*opens interface 1 can use send commands if typing * gnuplot command line. "the -persistent" keeps plot open after * c program terminates. */ file * gnuplotpipe = popen ("gnuplot -persistent", "w"); int i; (i=0; < num_points; i++) { fprintf(temp, "%lf %lf \n", xvals[i] , yvals[i]); //write data temporary file } (i=0; < num_commands; i++) { fprintf(gnuplotpipe, "%s \n", commandsforgnuplot[i]); //send commands

events - VBA worksheet_Change Target range values from dropdownlist -

i've been trying run below worksheet_change code, without luck. not errors, changes not trigger code. below more information: actionplan.name referring actual sheet "actionplan" the dropdownlist list datavalidation. data feeded sheet in same workbook. according locals value2, actionplanrange feeding correct values. values of each cell in column "task type" option explicit option base 1 private sub worksheet_change(byval target range) dim actionplanrange range dim tasktypecolumn range dim tasktype range dim actionplantablelastrow long on error goto cleanup application.enableevents = false set actionplanrange = thisworkbook.worksheets("actionplan.name").listobjects("actionplantable").listcolumns("task type").databodyrange if not application.intersect(target, actionplanrange) nothing if target.value <> "one-time" target.offset(0, 1).value = "ongoing" else goto

mysql - How to load configuration variables in rails via yaml files -

i trying use environment variable in config/database.yml . this local_env.yml : # local environment variables mysql_sock: "/tmp/mysql.sock" then check if correct rails console , sure enough: >> irb(main):002:0> env["mysql_sock"] => "/tmp/mysql.sock" however in config/database.yml : default: &default adapter: mysql2 socket: env["mysql_sock"] i following error: mysql2::error: can't connect local mysql server through socket 'env["mysql_sock"]' (2) but... default: &default adapter: mysql2 socket: "/tmp/mysql.sock" works! what going wrong? this practise followed defining configuration variables app ids, secret keys, s3 credentials etc , file put in .gitignore . create yml file settings.yml (generally) or local_env.yml . define keys according environment. development: mysql_sock: "/tmp/mysql.sock" production: mysql_sock: "file path

mysql - Customer Retention Query - Help needed -

i having table named users. trying calculate daily retention rate. field of users table :- id || email|| current_sign_in_at || last_sign_in_at || sign_in_count i trying calculate number of users retaining in past 24 hours. (definition of retained user - user has sign in count =2 within last 24 hours) so, query this select count(*), date(last_sign_in_at) users last_sign_in_at between '2015-09-30' , '2015-10-22' , sign_in_count = '2' group date(last_sign_in_at) gives me results in following way count(*) || date(last_sign_in_at) 659 01/10/2015 492 02/10/2015 360 03/10/2015 421 04/10/2015 535 05/10/2015 641 06/10/2015 657 07/10/2015 so, ideally let's on 2nd 492 users users retained out of 659 users first day. till 4th day fine, increases doesn't make sense. doing wrong here? primary objective calculate users have logged in twice in 24 hours time perio

scala - What is a Singleton Type exactly? -

what singleton type? applications, implications ? examples more welcome , layman terms more welcome ! if think of type set of values, singleton type of value x type contains value ( {x} ). usage examples: pattern matching: case _: foo.type checks matched object same foo using eq , case foo checks it's equal foo using equals . it's needed write down type of object (as type parameter, argument, etc.) for mutable objects guarantee return value of method object (useful method chaining, example from here ): class { def method1: this.type = { ...; } } class b extends { def method2: this.type = { ...; } } you can call new b.method1.method2 , couldn't without this.type because method1 return a .

Find Record in Recordset SQL Server -

i using classic asp produce website , using below sql statement, database sql server 2000. select * dbo.pdbproductview product '" & partnumbersearch &"%';" however require forward , buttons move forward , backwards part number - not sure how achieve - initial thought run sql query , somehow placement of part in part table (product) pick out part before , after it, possible ? you don't version of sql server using. however, if using sql server 2012 or higher, lead , lag functions allow achieve want do. here pretty article can use guide. looks this: select lag(p.firstname) on (order p.businessentityid) previousvalue, p.firstname, lead(p.firstname) on (order p.businessentityid) nextvalue person.person p with lead , lag functions, can indicate how far or forward want look.

swift - How do I SWIPE through ViewControllers using Storyboard ID -

hello guys im noob in programming , im building app im stuck on part when need swipe through viewcontroillers i build them in mainstoryboard , need swipe left , right read on articles can done using storyboard id if can give me simple example of code how swipe left , right on 2 random view controlers using swift thank in advance. you should use uipageviewcontroller. can find examples here: uipageviewcontroller in swift - xcode 6.2 ios 8.2 tutorial an example swift ios 8 uipageviewcontroller application

python - Bokeh: Box Annotation Hover -

is possible display information when hovering on box annotation in bokeh? current work-around encode information want on box annotation's region (duration, mean, var, etc. on time-series windows) in tooltip displayed when hovering on individual points. there large amount of data, when zoomed out, becomes hard hover on individual points. i'd hover on window (the box annotation) , have display information.

hibernate - Unable to access java.sql.DatabaseMetaData -

i trying make hibernate project using maven after running application, giving me below error : slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. initial sessionfactory creation failed.org.hibernate.hibernateexception: unable access java.sql.databasemetadata determine appropriate dialect use exception in thread "main" java.lang.exceptionininitializererror @ com.x.student.impl.studentapp.<init>(studentapp.java:20) @ com.x.student.impl.studentapp.main(studentapp.java:33) caused by: org.hibernate.hibernateexception: unable access java.sql.databasemetadata determine appropriate dialect use @ org.hibernate.dialect.resolver.dialectfactory.determinedialect(dialectfactory.java:140) @ org.hibernate.dialect.resolver.dialectfactory.builddialect(dialectfactory.java:96) @ org.hibernate.cfg.settingsfac

ios - Segue delays UIButton highlight -

please check edit 3 i have uibutton upon pressing need see grayed out immediately. im using code declaration: uibutton *mybutton; mybutton = [[uibutton alloc] init]; //[uibutton buttonwithtype:uibuttontypecustom]; mybutton.frame = cgrectmake(132, 375, 40, 40); buttonimage = [uiimage imagenamed:@"chat.png"]; [mybutton setimage:buttonimage forstate:uicontrolstatenormal]; [mybutton addtarget:self action:@selector(mybuttoninvoked:)forcontrolevents:uicontroleventtouchdown]; [cell.contentview addsubview:mybutton]; and here's method button triggers - (void) mybuttoninvoked:(id)sender { uibutton *catchbutton = (uibutton *)sender; cgpoint buttonposition = [sender convertpoint:cgpointzero toview:self.tableview]; nsindexpath *indexpath = [self.tableview indexpathforrowatpoint:buttonposition]; [uiview animatewithduration:5 delay:0.0 options:uiviewanimationoptionautoreverse | uiviewanimationoptionrepeat | uivie

linux - How can I calculate a block number of where a word is located on disk? -

i want find out block number word "word" using. know blocks start @ 0, thought adding 2114+1 answer, it's not... user@host:~$ strings -td dump.dd|grep "word" 2114 __strtsuper word stored here i know -td brings me offset in decimal, how can calculate block number? need 2114 number? strings offsets in bytes . disk block composed group of bits , commonly 512 (and on bigger disks 4096 ). so, must know block size of disk, convert bytes (1 byte = 8 bits), , divide strings offset number.

-bash: mysql: command not found on wamp 2.5 -

i trying log mysql command line. i first went directory: cd c/wamp/bin/mysql/mysql5.6.17/bin i did this: mysql -u root -p but got error message: -bash: mysql: command not found i should able connect automtically mysql command line. mean mysql should available. this in mysql directory command line: echo.exe mysqladmin.exe innochecksum.exe mysqlbinlog.exe my_print_defaults.exe mysqlcheck.exe myisam_ftdump.exe mysqld.exe myisamchk.exe mysqld_multi.pl myisamlog.exe mysqld-debug.exe myisampack.exe mysqldump.exe mysql.exe mysqldumpslow.pl mysql_client_test.exe mysqlhotcopy.pl mysql_client_test_embedded.exe mysqlimport.exe mysql_config.pl mysqlshow.exe mysql_config_editor.exe mysqlslap.exe mysql_convert_table_format.pl mysqltest.exe mysql_embedded.exe mysqltest_embedded.exe mysql