Posts

Showing posts from September, 2015

mysql - C3P0ConnectionProvider error when deploying on JBoss -

i'm attempting connect mysql database via jpa on jboss server. i following exception when deploying project. 13:04:41,035 error [org.jboss.msc.service.fail] (msc service thread 1-1) msc00001: failed start service jboss.persistenceunit."dryrun.war#dbname": org.jboss.msc.service.startexception in service jboss.persistenceunit."dryrun.war#dbname": failed start service @ org.jboss.msc.service.servicecontrollerimpl$starttask.run(servicecontrollerimpl.java:1767) [jboss-msc-1.0.2.ga.jar:1.0.2.ga] @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) [rt.jar:1.7.0_15] @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) [rt.jar:1.7.0_15] @ java.lang.thread.run(thread.java:722) [rt.jar:1.7.0_15] caused by: javax.persistence.persistenceexception: [persistenceunit: dbname] unable build entitymanagerfactory @ org.hibernate.ejb.ejb3configuration.buildentitymanagerfactory(ejb3configuration.java:914) @ org.hiber...

.net - how do I obtain or create a .srprofile file when nuget doesn't create it? -

to configure , use many features of specrun (beefed version of specflow, cucumber .net), need sort of .sfprofile file. file " default.sfprofile " supposedly , (i assume) typically created when nuget package installed. did not me. is there way trigger creation of " default.sfprofile "? if not, if create myself? if work, please post initial contents of file should be? thanks! the template file in packages\specrun.specflow.1.2.0\content\default.srprofile.pp copy , replace {...} placeholders values. projectid guid.

c++ - How to test/verify that zero-initialization takes place -

i trying test 0 initialization on virtual machine g++ options -std=c++98, -std=c++03, -std=c++11 unfortunately there not many garbage values , see zeros in place shouldn't be. how force random values can test this? #include <iostream> #include <string> using namespace std; class { public: int a; }; class b { public: b(){} int x; }; int main() { { int tab[50000] = {0}; } a; a* aa = new a; b b; b* bb = new b; cout << a.a << endl; cout << aa->a << endl; cout << b.x << endl; cout << bb->x << endl; return 0; } you not guaranteed see random numbers. c/c++ standard says uninitialized values undefined, cannot values have. 0 ok (maybe virual machine zeros memory before allocating). if need random numbers, generate them using <random>

iphone - sqlite file path created using iOS - UIWebView -

in application using sqlite uiwebview store user preferences , details. moving functionality in native objective-c code, , want preserve defaults when application updated. i thinking of accessing .sqlite file objective-c code , transfer preferences in nsuserdefaults . can .sqlite files created uiwebview , whats default location ? if you're on simulator, db files here: /users/<your-user>/library/application\ support/iphone\ simulator/user/applications/<your-app-id>/library/webkit/databases/file__0/<database-name> on device, try: /var/mobile/applications/<your-app-id>/library/webkit/databases/file__0/<database-name>

React Native allow user to reorder elements in a scrollview list -

i'm trying let user reorder elements in scrollview list long-pressing on 1 of elements. we're trying let user use long press pick element of scrollview list, , put element somewhere else in list. have working using animated view, issue it's difficult integrate scrolling , swipe-to-delete animated view. we're hoping add "pick , reorder" scrollview. is there preferred method accomplishing this? touchablewithoutfeedback has onlongpress method, can implement this: _onlongpress() { // perform sort }, <touchablewithoutfeedback onlongpress={ () => this._onlongpress() }> <text>click , hold call onlongpress</text> </touchablewithoutfeedback> as far sorting, can use type of library such lodash or underscore, plus there ways sort using vanilla javascript. check out this thread. i've set basic project using sort function on listview here . https://rnplay.org/apps/mpbktg 'use strict'; var react = requ...

node.js - Webpack/TypeScript Raising Errors When node_modules is Excluded -

Image
i have following webpack , typescript configs: webpack.config.js module.exports = { entry: { dev: './src/ts/site' }, output: { filename: './com/js/site.js' }, resolve: { extensions: ['', '.ts', '.tsx'] }, module: { loaders: [ // typescript { test: /\.tsx?$/, loader: 'ts-loader' } ] } } tsconfig.json { "compileroptions": { "noimplicitany": true, "module": "commonjs" } } i've simplified project include following dependencies: package.json (partial) "typescript": "^1.7.5", "ts-loader": "^0.7.2", "webpack": "^1.12.9" when run webpack, massive slew of errors: the list goes on many many screen lengths, far i've scrolled every 1 duplicate identifier err...

ruby - Why did I get `main.using is permitted only at toplevel` when I used a Refinement in IRB? -

i tried use refinement in irb (v0.9.6, ruby 2.3.0): module foo refine object def foo() "foo" end end end using foo # => runtimeerror: main.using permitted @ toplevel this the exact setup documentation (which results in same error). what went wrong? how fix this? it's either bug or misfeature of irb. well-known due pretty hackish way irb implemented, not behave correctly corner-cases. the incompatibility knows in ruby, methods defined @ top-level become private instance methods of object , whereas in irb, become public instance methods of object . obvious behavioral difference in irb, require_relative doesn't work, because searches relative current file, in irb, there is no current file. there differences in syntax gets accepted, believe, , local variables , when , aren't defined. so, not inconceivable there might behavioral differences wrt. refinements. in fact, myself have encountered error message, , running exact same c...

c# - Coroutine stops working -

i have 2 scripts coroutine in them. works fine in first one, not in second one, no apparent reason. it works in one: using system.collections; using unityengine; using unityengine.ui; using unitystandardassets.imageeffects; public class gamestartcontroller : monobehaviour { public button startbutton; public gameobject cubespawner; // use initialization private void start() { startbutton = startbutton.getcomponent<button>(); } public void startgame() { enablecubespawner(); spawnstartingcubes(); hidestartmenu(); startcoroutine("focuscamera"); playbackgroundmusic(); } // enables cube spawner, can start spawning cubes private void enablecubespawner() { cubespawner.setactive(true); } private void spawnstartingcubes() { cubespawner.getcomponent<cubespawner>().generatestartingcubes(); } private void playbackgroundmusic() { var audio...

parse.com - Android - Parse - deleteInBackground, record not being deleted -

i'm using parse android in order sync data. i'm trying delete object stored in parse cloud via callback returns , there's no exception, logcat message "deleted". but object still exists in table when check parse data. tasttoedit object task class (configured locally in app). parseobject parse_task = new parseobject("task"); parse_task.put("description",tasttoedit.getdescription()); parse_task.put("duedate",tasttoedit.getduedate()); parse_task.put("priority",tasttoedit.getpriority().ordinal()); int com_state = (tasttoedit.getcompleted()) ? 1 : 0; parse_task.put("iscompleted",com_state); parse_task.put("location",0); parse_task.put("category",tasttoedit.gettask_catg().ordinal()); parse_task.put("status", tasttoedit.gettask_sts().ordinal()); //parse_task.deleteinbackground(); parse_task.deleteinbackground(new deletecallback() { ...

javascript - Sorting Azure Mobile Services API -

i want return sorted table rest service, getting last record, doing wrong here? ideally want limit records returned, example top 100 ? thank you rest: https://restname.azure-mobile.net/api/test exports.get = function(request, response) { var collectionofvotes = request.service.tables.gettable('country'); collectionofvotes.orderbydescending('countryname') .read({ success: function(results) { results.foreach(function(r) { response.send(r); //console.log(r); }); }}); }; you're calling method response.send every record returned query . since 1 request sent, 1 of responses returned. if want send records back, should send results passed success callback. also, can limit number of records returned using take method in table / query object, shown below. exports.get = function(request, response) { var collectionofvotes = request.service.tables.gettable('country'); collectionofvotes.orderby...

asp.net - C# Delegate, Label text not changing -

i have created delegate each time click button text within label's text should change reason not work , label's text not change. this aspx page: <body> <form id="form1" runat="server"> <div> <asp:button id="btnfeed" onclick="btnfeed_click" runat="server" text="button" /> <asp:label id="lblraceresults" runat="server" text="label"></asp:label> </div> </form> </body> this aspx.cs page using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; namespace webprogramming3.week_3 { public partial class exercise1 : system.web.ui.page { //only testing static person test_person; static person person2; static person person3; protected void page_load(object sender, eventargs e) ...

Description for URL in Google Sitemap -

is possible specify description url-element in google sitemaps? example (see description-tag): <url> <loc>http://www.example.com/dogs</loc> <description>this page dogs, can find new products dogs here.</description> <changefreq>hourly</changefreq> <priority>1.00</priority> <image:image> <image:loc>http://www.example.com/image.jpg</image:loc> </image:image> </url> <url> <loc>http://www.example.com/cats</loc> <description>this page cats, can find new products cats here.</description> <changefreq>hourly</changefreq> <priority>1.00</priority> <image:image> <image:loc>http://www.example.com/image.jpg</image:loc> </image:image> </url> thank you! second support of google sitemaps can submit rss or atom file (a xml) sitemap. in rss or atom file can put description url. ca...

c++ - How can I define RAND_MAX -

how create program generates ten random numbers 1 -> rand_max ? rand_max must number input user. int main() { using namespace std; int x; int y; random: { x = rand(); cout << x << endl; } y = y + 1; if (y == 10) { return 0; } goto random; } something like: int main() { int randmax; cin >> randmax; (int y = 0; y < 10; y++) { int x = rand() % randmax; // range = [0, randmax) cout << x+1 << endl; // range = [1, randmax] } } oh, , try avoid goto (at least in opinion). here two questions it.

spring - Return Object from controller to ajax -

code below succesfully send string jsp via ajax controller , returning string. how send (from controller ajax) object contains getter , setter or boolean? ajax: $.ajax({ type: 'get', url : 'register/checkusername', data : {'typedtext' : typedtext}, success : function(data) { $('#doesusernameavailable').text("ok " + data); }, error: function(){ $('#doesusernameavailable').text('error'); } }); controller: @requestmapping(value = "/checkusername", method = requestmethod.get) public @responsebody string checkusername(string typedtext, httpservletresponse response){ //some code return boolean or object return "text controller"; } solution: i not post pom.xml. missing: <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>...

scala - Functional Tests in Play 2.4.6 when using compile time DI -

i'm using play 2.4.6 compile time dependency injection , scalatest. controller's constructor has few parameters, , in applicationloader create it. here code: class bootstraploader extends applicationloader { def load(context: context) = { new appcomponents(context).application } } class appcomponents(context: context) extends builtincomponentsfromcontext(context) ningwscomponents { lazy val router = new routes(httperrorhandler, authenticationcontroller, applicationcontroller, assets) lazy val applicationcontroller = new controllers.application() lazy val authenticationcontroller = new controllers.authentication()(configuration, wsapi.client) lazy val assets = new controllers.assets(httperrorhandler) } class authentication(implicit configuration: configuration, val ws: wsclient) extends controller { def login = action { implicit request => unauthorized(s"${redirecturl}") } } class authenticationspec extends playspec oneapppersuite { ...

reactjs - PropType validation is throwing an error because of RoutingContext -

i'm getting following error props validating: warning: failed proptype: required prop assettype not specified in assetmanagementshow . check render method of routingcontext . warning: failed proptype: required prop assettypes not specified in assetmanagementtransactionsfecher . check render method of routingcontext . routes this: <route path='asset_management' component={assetmanagementcontainer} > <indexroute component={assetmanagementindex} /> <route path=':name' component={assetmanagementtransactionsfetcher}> <indexroute component={assetmanagementshow} /> <route path=':transactionkey' component={transactionsshow} /> </route> </route> i'm getting error when trying render assetmanagementshow (and transactionsshow). i'm getting error props of both assetmanagementtransactionsfetcher , assetmanagementshow. the assetmanagementcontainer fetches data , renders chi...

opencart2.x - Opencart Login Issues -

i unable login opencart dashboard. can see login screen , enter passwords. did fresh install. doesn't redirect me dashboard. have read , tried every possible solution. there on server blocking re-direct. this caused .htaccess redirect. happened me because website getting redirected www.example.com session example.com. make sure have same version of url everywhere.

Encoding dec char instead of octal -

i not understand why char test = '\032'; converts to 26 dec '\032' seems interpreted octal, want treated decimal number. i think confused character encoding. can clarify me , give me hint on how convert way want it? in c, '\octal-digit' begins octal-escape-sequence . there no decimal-escape-sequence . code use: char test = 32; to assign value of 32 char , code has many options: // octal escape sequence char test1 = '\040'; // \ , 1, 2 or 3 octal digits char test2 = '\40'; // hexadecimal escape sequence char test3 = '\x20'; // \x , 1 or more hexadecimal digits // integer decimal constant char test4 = 32; // 1-9 , 0 or more decimal digits // integer octal constant char test5 = 040; // 0 , 0 or more octal digits char test6 = 0040; char test7 = 00040; // integer hexadecimal constant char test8 = 0x20; // 0x or 0x , 1 or more hexadecimal digits char test9 =...

sql - Retrieve all records sharing duplicate value from a column -

i return records table share duplicate values given specific column, in case bin column. create table #tempcompany (companyid varchar(6), name varchar(50),bin varchar(6)) insert #tempcompany (companyid,name,bin) select '000001','abc company','000000' union select '000002','def company','000001' union select '000003','ghi company','000001' union select '000004','jkl company','000002' union select '000005','lmn company','000003' union select '000006','opq company','000003' union select '000007','rst company','000003' drop table #tempcompany i return result: companyid name bin 000002 def company 000001 000003 ghi company 000001 000005 lmn company 000003 000006 opq company 000003 000007 rst company 000003 you can using window functions: select tc.* (select tc.*, count(*) on (par...

java - @RestController("/xxx") maping is ignored -

i'am trying create simple, annotation based rest service have 2 distinct endpoints endpoints specified value of @restcontroller annotations. problem url provided in annotations ignored. @restcontroller("/books") public class booksapi { @requestmapping("/getbook") public string getbook() { return "book"; } @restcontroller("/movies") public class moviesapi { @requestmapping("/getmovie") public string getmovie() { return "movie"; } } @configuration @enablewebmvc @componentscan(basepackages = "application.webservices.apis") public class apiconfiguration { } public class apisservletdispacher extends abstractannotationconfigdispatcherservletinitializer { @override protected class<?>[] getrootconfigclasses() { return new class<?>[] {apiconfiguration.class}; } @override protected class<?>[] getservletconfigclasses() { return new class<?>[0]; } @override protected str...

php - is there a better way to do this? fopen, fread, fwrite -

this question has answer here: php increment counting variable in text file 5 answers is there better way this: $countfile = fopen("count.txt", 'r'); $read = fread($ebf, filesize("count.txt")); $ebn = $read+1; fclose($ebf); $ebf = fopen($ebc, 'w'); fwrite($ebf, $ebn); i wrote script counting visits you can achieve same results via file_get_contents , file_put_contents : $read = file_get_contents("count.txt"); $ebn = $read+1; file_put_contents($ebc, $ebn);

SQL Server: Populate (Minute) Date Dimension table -

i'm working on script populate simple date dimension table granularity down minute level. table should contain smalldatetime representing every minute 1/1/2000 12/31/2015 23:59 . here definition table: create table [dbo].[ref_minutedimension] ( [timestamp] smalldatetime not null, constraint [pk_ref_minutedimension] primary key clustered ([timestamp] asc) (fillfactor = 100) ); here latest revision of script: declare @currenttimestamp smalldatetime; select top(1) @currenttimestamp = max([timestamp]) [dbo].[ref_minutedimension]; if @currenttimestamp not null set @currenttimestamp = dateadd(minute, 1, @currenttimestamp); else set @currenttimestamp = '1/1/2000 00:00'; alter table [dbo].[ref_minutedimension] drop constraint [pk_ref_minutedimension]; while @currenttimestamp < '12/31/2050 23:59' begin ;with dateindex ([timestamp]) ( select @currenttimestamp union select dateadd(minute, 1, [timestamp]) date...

ruby - Print job programming not cancelling -

i've created program scan through server specified user , output list of print jobs on server, there output jobs older 2016, , gsub down job id number. then it's suppose cancel job, it's doing saying: cancelling job: 829116 cancel: cancel-job failed: job #829116 not exist! cancelling job: 795259 cancel: cancel-job failed: job #795259 not exist! cancelling job: 795260 cancel: cancel-job failed: job #795260 not exist! cancelling job: 797216 cancel: cancel-job failed: job #797216 not exist! cancelling job: 797217 cancel: cancel-job failed: job #797217 not exist! when exist, if go specific server , run prt_jobs job pops up.. example: #on server ran prt_jobs cdprt11-829116 dij 244736 mon aug 24 06:07:12 2015 closing_2-795259 dlc 228352 tue jul 28 13:43:08 2015 closing_2-795260 dlc 228352 tue jul 28 13:44:05 2015 closing_2-797216 tkb 286720 wed jul 29 13:56:27 2015 closing_2-797217...

C# Desktop application using Google Calendar API .NET v3 -- Howto? -

probably not 1 asking this, found nothing works...it's jungle ;) i have c# desktop app (5-10 user) want connect google calendar. want add, move, delete, update events in calendar. downloaded installed last .net api v.3. from read, difficult part authenticate/connecting procedure. suppose need use oauth 2.0 authentication ? want user authenticate once, not each time want make action (add, move, delete, update).in sample have cut , paste token web page console...not user friendly. , how authenticate 1 times (or put token directly in code not authenticate ?) ? now, can have working sample code in c# make ? thanks helping !! i used similar example here . did create simple web application using sample logic setup initial auth google requires. stepped through , got refresh token state. saved in app setting use later during future getauthorization requests. @ least doing worked well, user never needed authorize long app stayed connected. private iauthorizationsta...

Android Out of Memory Exception & Paused Activities -

Image
i'm working on android app several activities. of time, app works fine, time time out of memory exception occurs. (usually when trying load large background image next activity) i couldn't find obvious memory leaks, created heap dump when exception occurred (like described here ) , tried analyse mat. haven't done before, wasn't sure should looking for. started clicking through larger byte objects , second 1 seems bitmap belonging imagebutton : the path gc roots shows me com.android.internal.policy.impl.phonewindow instance: the thing is, imagebutton in whole application in launch activity , between launch activity , crashing activity @ least 2 more activities. so why image still in heap?? imagebutton defined in layout xml file using android:src attribute, nothing done via code there. there lot of other smaller objects earlier activities in heap. i wrote little helloworld application , took in heap dump of , seems, android keeps objects of previous...

Is it possible to create a pdf with different page sizes in iOS - Objective C? -

i've done multiple times pdf pages @ same size. possible mixed sizes pdf on ios? (like example fixed width , multiple heights pages) i'm finding lot of discordant answers around, , few data on platform-specific capabilities. it has been easy adding every page different mediabox. // start pdf file nsmutabledata *pdffile = [[nsmutabledata alloc] init]; cgdataconsumerref pdfconsumer = cgdataconsumercreatewithcfdata((cfmutabledataref)pdffile); cgrect mediabox = cgrectmake(0, 0, pagesize.width, pagesize.height); cgcontextref pdfcontext = cgpdfcontextcreate(pdfconsumer, &mediabox, null); cgcontextbeginpage(pdfcontext, &mediabox); cgcontextdrawimage(pdfcontext, imagebox, [image cgimage]); cgcontextendpage(pdfcontext); // change mediabox cgcontextbeginpage(pdfcontext, &mediabox); ... etc.... cgcontextendpage(pdfcontext); // close pdf cgcontextrelease(pdfcontext); cgdataconsumerrelease(pdfconsumer);

python - list tkinter combobox options with suboptions -

not sure if i've seen done before combobox without building custom one. i'm building own ebay spider , want user able select list of categories crawl on queries etc. each category has it's own subcategories of course. , can't explicitly select subcategory of category in ebay's advanced search form. however, can send subcategory id form submission request automatically search within subcategory. after crawling on categories on ebays site getting categories -> subcategories category have dictionary looks along lines of this: categories = {main_category_title: [sub_category1, ...., sub_categoryn], ....} i know how subcategories listed combobox doing this: self.categories = ttk.combobox(self, values = list(itertools.chain.from_iterable( (ebay_spider.categories[category] category in ebay_spider.categories)))) while works... it's not want since doesn't allow user select main category containing each subca...

shell - CURL: how to run a single curl command 3 times if it fails with error and condition is not met? -

i'm running curl command inside loop, want if curl command fails, should re-run loop including curl command 3 times .what should right approach of doing that? while [[ "$environment" == "dev" ]]; curl command done you can write separate function below , use: #!/bin/sh count=0 execute_curl () { count=`expr $count + 1` curl command if [ $? -ne 0 ] && [ $count -lt 3 ] execute_curl else return $? fi } while [[ "$environment" == "dev" ]]; execute_curl done

javascript - Loading /register (laravel auth out-of-box) on a modal form submit issue -

i'm using laravel 5.2 , it's own auth api, let's go step step. i'm making website want have sign form inside modal so, use jquery load route /register on modal when click sign up, form load , great when submit form got redirect 302 index. it's not token trouble because i'm loading form ajax , it's creating right token input. idea why laravel having behaviour? thanks.

python - Redirected output from a subprocess call getting lost? -

i have python code goes this, using libraries may or may not have: # open writing vcf_file = open(local_filename, "w") # download region file. subprocess.check_call(["bcftools", "view", options.truth_url.format(sample_name), "-r", "{}:{}-{}".format(ref_name, ref_start, ref_end)], stdout=vcf_file) # close parent process's copy of file object vcf_file.close() # upload file_id = job.filestore.writeglobalfile(local_filename) basically, i'm starting subprocess that's supposed go download data me , print standard out. i'm redirecting data file, , then, subprocess call returns, i'm closing handle file , copying file elsewhere. i'm observing that, sometimes, tail end of data i'm expecting isn't making copy. now, it's possible bcftools not writing data, i'm worried might doing unsafe , somehow getting access file after subprocess.check_call() has returned, before data child process...

How to detect in Jenkins Workflow if parameterized build parameter exists or not? -

what best way can detect if parameter in parameterized build exists or not? closest solution found in groovy: node { groovy.lang.binding mybinding = getbinding() boolean mybool = mybinding.hasvariable("string_param1") echo mybool.tostring() if (mybool) { echo string_param1 echo getproperty("string_param1") } else { echo "string_param1 not defined" } mybool = mybinding.hasvariable("did_not_define_this") if (mybool) { echo did_not_define_this echo getproperty("did_not_define_this") } else { echo "did_not_define_this not defined" } } is using getbinding() proper api this, or there better way? you can use try-catch check existence of parameter: try { echo test1 echo 'test1 defined' } catch (err) { echo 'test1 not defined' }

vba - Object variable or With Block variable not set error when accessing members of BuildingBlockEntries collection -

i attemping access members of template's buildingblockentries collection through macro in microsoft word 2007. collection, first thought for each loop best way to this: each bblock in normaltemplate.buildingblockentries messagebox.show (bblock.name) next bblock however attempt through error: object doesn't support property or method . tried method suggested here : templates.loadbuildingblocks dim ibb integer ibb = normaltemplate.buildingblockentries.count() dim bb word.buildingblock dim integer dim objcounter object if ibb > 0 = 1 ibb objcounter = bb = normaltemplate.buildingblockentries.item(objcounter) messagebox.show (bb.name) next end if however, resulting in error shown in title: object variable or block variable not set . i have tried using integer variable index, i specifically, avail. how can acheive desired effect? wrong attempt? thank help. with 2nd question answer need use set , bb object: set bb...

c# - Regex Expression Incorrect Output -

hey guys i'm trying create regex function in c# search sentence words ending in "es". i'm trying output in format of word1 = bes word2 = mes word3 = ces and on. problem keep getting "errorcs0136" upon compilation. tried using console.writeline() , having counter variable increment on each iteration of loop wouldn't work. here copy of errors i'm getting. much. task1.cs(66,52): error cs1026: unexpected symbol ',', expecting ')' task1.cs(66,55): error cs0136: local variable named 'match' cannot declared in scope because give different meaning 'match', used in 'parent or current' scope denote else task1.cs(66,59): error cs1026: unexpected symbol ')', expecting ')' compilation failed: 3 error(s), 0 warnings below source code. public void numpatternsearch(){ string input3; string pattern = @"\b\w+es\b"; //regex regex = new regex("[*]...

cljsjs jquery rewrite in my clojurescript app -

my program built such following line works under simple compilation (e.g. figwheel): (-> (js/jquery "document") (.ready #(.tooltip (js/jquery "[data-toggle='tooltip']")))) i need work under advanced compilation i've installed , required cljsjs/jquery. however, i'm not sure how rewrite above code utilize cljsjs. know (js/jquery.) returns thing, can .init, i'm flying in dark here. what's equivalent cljsjs version of working code above? what works js/jquery "document" in simple compilation can, after including cljsjs/jquery done js/$ "document" . tooltips need cljsjs/bootstrap, however, after new line is: (-> (js/$ "document") (.ready #(.tooltip (js/$ "[data-toggle='tooltip']"))))

javascript - Header Change on Scroll -

on site creating in want put header changes size on scroll. have done 2 methods should in theory have worked. header part of larger document contains js , when tested other js working don't believe major syntax error. when inspect elemented didn't see errors in console. $(document).on('scroll', function(e) { var value = $(this).scrolltop(); if ( value < 100 ) $("header").css("height", "100px"); else $("header").css("height", "45px"); }); header { height: 300px; background-color: #69d2e7; font-family: 'raleway', sans-serif; z-index: 30; width: 100vw; box-shadow: 1px 1px 10px rgba(40, 40, 40, 0.6); position: fixed; } <header> <a href="index.html"> <h1>meh web design</h1> </a> </header> method attempted did not work was: $(function() { ...

swift - Is there way to get `invalidated` flag from `Results` object? -

i using realm swift. i have object post has relation comments comment objects: final class post: object { var comments: list<comment> = list<comment>() } ... , create results<comment> object transforming list<comment> : let results = post.comments.filter(nspredicate(value: true)).sorted("creationdate") ... , works until delete original post object. when delete post object , call results.count , realm crash advice: important: if see error, please send log help@realm.io. . so understand why crashed how can handle situation when have results object , becomes invalid . this looks bug in realm, being tracked https://github.com/realm/realm-cocoa/issues/3054 . subscribe issue follow progress on fix.

coding style - Haskell similar types copy-paste elimination in case -

case x of cond expr stmt -> checkexprtype expr bool processstmt env stmt return env anothercond expr stmt -> checkexprtype expr bool processstmt env stmt return env how can copy-paste eliminated? you make local definition function of expr , stmt : -- assume inside 'do' block let conditionallike expr stmt = checkexprtype expr bool processstmt env stmt return env case x of cond expr stmt -> conditionallike expr stmt anothercond expr stmt -> conditionallike expr stmt

WebSocket - Javascript client says connected, but Java server doesn't -

i have simple code, yet, doesn't work perfectly. in java server says hello , bye when opening , closing connection , prints sent message: @applicationscoped @serverendpoint("/tictactoe") public class websocketserver { private logger logger = logger.getlogger(this.getclass().getname()); @onopen public void open(session session) { logger.info("websocket: hello - " + session.getid()); } @onclose public void close(session session) { logger.info("websocket: farewell - " + session.getid()); } @onmessage public void messagehandler(string message, session session) { logger.info("websocket: new message - " + message); } } in javascript pretty same in server , sends message when clicking button: var socket = new websocket("ws://localhost:8080/tictactoeztp/tictactoe"); socket.onopen = function (event) { console.log("websocket: connected"); ...

javascript - Last item in the array not selected -

in script: last item not selected apply colorme function var k =0; var userarray = []; var dayarray = []; var dayarray2 = []; var dayarray3 = []; var data = 0; function colorme(param,param_af,param_eve, param2) { /*console.log("day "+param); console.log("user "+param2);*/ //console.log("k= "+k); console.log("data= "+data); userarray.push(param2); //console.log("my "+userarray[k]); dayarray.push(param); dayarray2.push(param_af); //console.log("afternoon "+dayarray2[k]); dayarray3.push(param_eve); //console.log("evening "+dayarray3[k]); //console.log("day "+dayarray[k]); var len = userarray.length; console.log("k= "+k); for(;data < k;data++) { //console.log("data="+ data); var arr = dayarray[data]; var arr2 = dayarray2[data]; var arr3 = dayarray3[data]; $("div.morning_"+userarra...

C# System.Drawing.Rectangle into Ellipse on System.Drawing.Bitmap -

Image
i have facial recognition library working gives me array of rectangle. right i'm using way draw rectangle. foreach (rectangle box in boxes) { (int x = box.x; x <= box.x + box.width; x++) { (int y = box.y; y <= box.y + box.height; y++) { outputbmp.setpixel(x, y, color.fromknowncolor(knowncolor.red)); } } } i'm looking simple as: ellipse ellipse = new ellipse(box); //cast rect ellipse outputbmp.drawellipse(ellipse); which more like: where outline of ellipse touching rectangle corners. based on approach used above, easy draw rectangle ellipse, require me know points in ellipse. wonder if there's make life easier. don't try draw directly bitmap, there higher level object can create, called graphics gives kinds of wonderful drawing tools. faster drawing pixel pixel. you can create graphics given bitmap calling graphics.fromimage , passing in bitmap. must remember ti call dis...

java - Spring RMI refreshStubOnConnectFailure not working -

i read following blog entry here, reconnect rmi client after server restart it states when property refreshstubonconnectfailure set true client rmi try reconnect server. wrote following code test out before put changes system. started server , test program. after few messages server , client talking stopped server. got exception trace none of catch blocks entered. usual confused because thought @ least 1 of catch blocks executed. program output follows. main starting hi there received hi there received hi there received jan 05, 2016 9:32:06 pm org.springframework.remoting.rmi.rmiproxyfactorybean handleremoteconnectfailure warning: not connect rmi service [rmi://127.0.0.1:1099/ping] - retrying exception in thread "main" org.springframework.remoting.remotelookupfailureexception: lookup of rmi stub failed; nested exception java.rmi.connectexception: connection refused host: 127.0.0.1; nested exception is: java.net.connectexception: connection refused @ org.springframewo...