Posts

Showing posts from February, 2015

java - How do I create a memory for a calculator with hashmap? -

okay building simple postfix calculator in java , asked create couple functions it, 1 struggling memory. heard hashmap, , did research on it, don't think quite understand how implement program yet. way program work user start , postfix calculator , prompted input this: java postfixcalc integer postfix calculator memory > but has option assign variable input, example: > = 3 5 + 1 - 7 > bee = 3 * 21 > bee + 28 > bee 3 % 0 > = 4 4 > 57 57 > 2 c + c not found > mem a: 4 bee: 21 > exit here's code far. im figuring should tokenize input , put in array list first in order variable name, unless theres better way. import java.util.*; import java.io.*; public class program6 { public static void main(string args[]) { system.out.println("servando hernandez"); system.out.println("rpn command line calculator"); scanner scan = new scanner(system.in); system.out.print(">");

javascript - check if function is a generator -

i played generators in nodejs v0.11.2 , i'm wondering how can check argument function generator function. i found way typeof f === 'function' && object.getprototypeof(f) !== object.getprototypeof(function) i'm not sure if (and working in future) way. what opinion issue? we talked in tc39 face-to-face meetings , deliberate don't expose way detect whether function generator or not. reason function can return iterable object not matter if function or generator function. var iterator = symbol.iterator; function notagenerator() { var count = 0; return { [iterator]: function() { return this; }, next: function() { return {value: count++, done: false}; } } } function* agenerator() { var count = 0; while (true) { yield count++; } } these 2 behave identical (minus .throw() can added too)

java - Closing a remote akka actor connection? -

is possible, and/or necessary, close remote actor in akka? i able start akka.actor.actorsystem "server" (in scala): val actorsystem = actorsystem("testserver") val actor = actorsystem.actorof(..., name = "testactor") and connect "client" actorsystem running on seperate jvm: remote = context.actorselection("akka.tcp://testserver@localhost:1234/user/testactor") i able send messages remote , receive response messages. however, when it's time client shutdown see following log messages server actorsystem after client jvm dead: [warn] [04/01/2015 11:27:27.107] [testserver-akka.remote.default-remote-dispatcher-5] ... [akka.tcp://consolesystem@localhost:1236] has failed, address gated [5000] ms. reason is: [disassociated] are these warnings bad? there remote.closeconnection method should calling prevent warning messages? thank in advance. this warning not bad in test example. necessary warn if

java - IntelliJ Spring Gradle Project Annotations Not Working -

so i'm trying start new web project in intellij using spring option in project configuration setups, when project setup, seems though new controllers make ignored though annotate them. @requestmapping seems never mapped. have ever been able access files located in root of web directory. after never being able work switched gradle import additional libraries test project. gradle file looks following: buildscript { repositories { mavencentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.2.release") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'spring-boot' sourcesets { main { java { srcdirs = ['src/main/java'] } } test { java { srcdirs = ['src/main/test'] } } } jar { basename = 'gs-rest-service' version = '0.1.0

ios - Google+ & YouTube Integration -

i have ios app includes sharing links google+ , uploading videos on youtube. first completed sharing links on google+ (followed post: https://developers.google.com/+/mobile/ios/getting-started ) for uploading videos on youtube, followed tutorial (link: https://nsrover.wordpress.com/2014/04/23/youtube-api-on-ios/ ) the problem header files clash giving error “redefinition of enumerator” in xcode 5.1.1. how solve issue? following rather late here: google has restructured entire sdk. upgrading copy of google sign-in sdk version 2.4.0 fixed enum issues me. google recommends using cocoapods manage sdk dependency now, remove old sdk project , add new sdk via cocoapods: pod install google . if not using cocoapods, can manually install sign-in sdk downloading here , linking binary project.

c# - Must declare the scalar variable "@UserName" -

i have make simple login not crash when insert browser (") needed parameterize query string reason im gettin error saying: must declare scalar variable "@username" here code private void dosqlquery() { try { sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings["rolaconnectionstring"].connectionstring); conn.open(); string checkuser = "select * userdata username = @username"; sqlcommand com = new sqlcommand(checkuser, conn); com.parameters.addwithvalue("@username", txtusername.text.trim()); int temp = convert.toint32(com.executescalar().tostring()); conn.close(); if (temp == 1) { conn.open(); string checkpassword = "select password userdata username = @username"; sqlcommand passconn = new sqlcommand(checkpassword, conn); com.parameters.addwithvalue("@username&q

java - Having trouble recursively calling my algorithm -

i'm writing divide , conquer algorithm i'm having trouble recursively calling it. says cannot find symbol method multiply , variables m, e, m public class multiply { private static int randomint(int size) { int maxval = (1 << size) - 1; return (int)(math.random()*maxval); } public static int[] naive(int size, int x, int y) { int[] result = new int[3]; if (size == 1) { result[0] = x*y; } else { int m = size/2; int = x/2; int b = x % (int)math.pow(2,m); int c = y / (int)math.pow(2,m); int d = y % (int)math.pow(2,m); int e = multiply(a,c,m); int f = multiply(b,d,m); int g = multiply(b,c,m); int h = multiply(a,d,m); } return ((int)math.pow(2,2*m)*e) + ((int)math.pow(2,m)*(g+h)) + f; } try multiply.naive(x,y,z) instead of multiply(x,y,z)

user defined types - SQL Azure Create Rule walkaround to use UserDefinedDataType -

create rule not supported on sql azure. there walkaround ? create rule [dbo].[rule1] @variable not null i wanna use userdefineddatatype supported in azure, create strong type email type, percentage type , on. without rules it's useless... solution ? thanks user-defined rules not supported on v1 servers. however, if upgrade server latest sql database v12 update create rule & many other sql server features available. see links below: http://azure.microsoft.com/en-us/documentation/articles/sql-database-preview-whats-new/ http://azure.microsoft.com/en-us/documentation/articles/sql-database-preview-upgrade/

javascript - using slice in angularjs array -

in angularjs app, need manually remove or add old/new data data array (service executed in loop). remove, use slice(); there problem: item correctly removed execverif_distant(); not executed next item. actual code, execverif_distant(); executed each item half time. example, if need remove entire array, half removed. // start loop, search in local datas angular.foreach($scope.seadocument.datas.cages, function(itemlocalcages) { execverif_local(itemlocalcages.url); }); function execverif_local(identifiant) { var itersearch_local = 0; angular.foreach(responsezs, function(itemdistantcages) { if (itemdistantcages.url == identifiant) { itersearch_local++; } }); // if not find local datas in distant datas if (itersearch_local == 0) { // verifitem(); call

android - Play Service 6.5.+ granular dependencies not working correctly -

update: per request, entire dependency declaration build.gradle, list of jars, , dependencies of included library projects listed @ bottom of quesion. i'm working on project uses location, gcm, ads , identity components of google play services (version 7.0.0). i've defined them such in build.gradle of app module: compile 'com.google.android.gms:play-services-location:7.0.0' compile 'com.google.android.gms:play-services-ads:7.0.0' compile 'com.google.android.gms:play-services-identity:7.0.0' compile 'com.google.android.gms:play-services-gcm:7.0.0 note: don't know if it's relevant (i don't expect be), project includes 2 additional library modules, 1 of declares subset of above dependencies: compile 'com.google.android.gms:play-services-location:7.0.0' compile 'com.google.android.gms:play-services-ads:7.0.0' compile 'com.google.android.gms:play-services-identity:7.0.0' still, after trying build app,

javascript - Chart.js in AngularJS tabset does not render -

i using angularjs module based on chart.js display graph. works charm, when display chart in angularjs tabset, graph not render if not first tab. <tabset> <tab heading="tab 1"> <!-- ok --> <canvas class="chart chart-pie" data="[140, 160]" labels="['d1', 'd2']" legend="true"></canvas> </tab> <tab heading="tab 2"> <!-- not render --> <canvas class="chart chart-pie" data="[140, 160]" labels="['d1', 'd2']" legend="true"></canvas> </tab> </tabset> this jsfiddle . manage fix ? thanks as @martin pointed out, issue of chart.js not showing chart when initiliazed in hidden dom element (its height , width remain @ 0px after showing hidden element). this issue tracked here . i share home made solution if blocked components t

Writing a file. Java. Android -

final string rootpath = environment.getexternalstoragedirectory().getabsolutepath() + "/slots/"; final file file = new file(rootpath); file.mkdirs(); final file sdfile = new file(file, "profile.txt"); try { bufferedwriter bw = new bufferedwriter(new filewriter(sdfile)); bw.write(edit.gettext().tostring() + "\n"); bw.write("5000"); } catch (ioexception e) { } in code catches ioexception, file created. please! answers. try this: final string rootpath = environment.getexternalstoragedirectory().getabsolutepath() + "/slots/"; final file file = new file(rootpath); file.mkdirs(); final file sdfile = new file(file, "profile.txt"); try { filewriter fw = new filewriter(sdfile); bufferedwriter bw = new bufferedwriter(fw); bw.write("hello "+"\n"); bw.write("5000"); bw.close(); } catch (ioexception e) { log.e

jquery - pass an javascript object to DOM element data atribute -

if fetch data attributes 1 dom element effective way pass element? example of data attributes needs passed: object {avatar: "...", lname: "...", fname: "...", username: "..."} you can use data method object, set properties in object data values: $('#someelement').data(obj); you can duplicate data 1 element getting data object , use set data: $('#someelement').data($('#sourceelement').data()); demo: $('#div2').data($('#div1').data()); // show in stackoverflow snippet document.write(json.stringify($('#div2').data())); <div id="div1" data-avatar="42" data-lname="pan" data-fname="peter" data-username="peterpan07"></div> <div id="div2"></div> <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>

Different memory usage display in windows Task Manager and tasklist -

Image
i tried migrate redis 2.4.6 2.8.19. run redis using 460 mb db file, found this: >> tasklist | sort .... pycharm.exe 344 console 1 501,860 k python.exe 3544 console 1 206,944 k pythonw.exe 1348 console 1 7,856 k pythonw.exe 6080 console 1 24,852 k qvodwebservice.exe 5392 console 1 208 k redis-server.exe 2512 console 1 1,943,156 k regsrvc.exe 2540 services 0 352 k rundll32.exe 1864 console 1 636 k .... and windows task manager: as u can see, there huge difference in memory usage redis-server. anyone has idea why happening?? in taskmanager choose column "memory - working set" by default displays "memory - private working set&quo

shell exec - How to run cmd commands as administrator from php -

i trying learn php shell_exec() function believe, enables run cmd commands within php script.but in system, when open command prompt , type in command, example, ipconfig , says : 'ipconfig' not recognized internal or external command, operable program or batch file. so in order avoid it, have right click command prompt , select "run administrator" , works fine. now problem when try run similar commands ipconfig inside php script, same error given above. there way solve problem? mean there way run cmd commands administrator inside php? i attaching sample code below, can edit , me out. in advance. here's code : <?php $output = shell_exec('ipconfig 2>&1'); echo $output; ?> output (which wish avoid) 'ipconfig' not recognized internal or external command,operable program or batch file. right click command prompt , select "run administrator" i assume using xampp , defualt install location. if not ser

How does namespacing work at lower levels with form_for in rails? -

my model 'posts' isn't namespaced. my controller namespaced admin/posts_controller.rb , it's new method looks so: class admin::postscontroller < applicationcontroller ..... def edit @post = post.find( params[:id] ) end why work: <%= form_for [:admin, @post] |f| %> but not this: <%= form_for @post |f| %> how form_for mapping @posts variable? why autofill form text-areas when namespace there? a valid @post variable being passed view in both cases.

richfaces - rich:fileupload in rich:popupPanel fails first time, in a large page -

i have rich:datatable , bunch of buttons @ bottom of xhtml. use 1 of buttons show rich:popuppanel upload file. separated rich:popuppanel rich:fileupload different forms based on earlier suggestions. 1st form: <h:form id="form" enctype="multipart/form-data"> <h:panelgrid columns="1" columnclasses="valign"> <rich:messages/> <rich:panel style="width:1100px;"> <f:facet name="header"> <h:outputtext value="mrm segments" /> </f:facet> <rich:datatable value="#{couponcontroller.campaignsegmentdtolist}" var="campaignsegment" id="sas" rowclasses="odd-row, even-row" styleclass="stable" sortmode="single" rowkeyvar="myrow" onrowclick="myfunction()"> &l

batch file - Xampp: Open Apache and MySQL, then Webbrowser -

i need 1 .bat-file which... start xampp apache start xampp mysql-server wait until step 1 , 2 finished open webbrowser , navigate localhost i tryed combine .bat-files xampp-folder, it's stopping @ apache 2 starting ... here file: @echo off cd /d %~dp0 echo please close command shutdown echo apache 2 starting ... apache\bin\httpd.exe cd /d %~dp0 echo please dont close window while mysql running echo mysql trying start echo please wait ... echo mysql starting mysql\bin\my.ini (console) mysql\bin\mysqld --defaults-file=mysql\bin\my.ini --standalone --console "c:\program files (x86)\google\chrome\application\chrome.exe" sleep1 start "localhost" "http://localhost" i'm not expert batch files example wrote myself. launches xampp control-panel ( can configured auto start apache , mysql modules ), browser , editor ( firefox , notepad++ example ). if xampp started same programs closed. @echo off tasklist /fi "imagename

python - Move radial tick labels on a polar plot in matplotlib -

Image
from matplotlib examples : import numpy np import seaborn sbs import matplotlib.pyplot plt r = np.arange(0, 3.0, 0.01) theta = 2 * np.pi * r ax = plt.subplot(111, polar=true) ax.plot(theta, r, color='r', linewidth=3) ax.set_rmax(2.0) ax.grid(true) ax.set_title("a line plot on polar axis", va='bottom') plt.show() how move radial tick labels (0.5, 1.0, 1.5, 2.0) different angle, 120 deg? with version 1.4 or later, can use "set_rlabel_position". e.g. place radial ticks long line at, say, 135 degrees: ax.set_rlabel_position(135) the relevant documentation residing here , bit hidden under "projections". adding line above yields (i don't have seaborn has default matplotlib formatting): prior 1.4, ax.set_rgrids can take angle argument.

c++ - Swift Compiler Error 'iostream' not found -

Image
i've tried implement project i've found on github. https://github.com/hossamghareeb/facebook-pop-tutorial while implementing .h , .m files i've got error saying xcode not find 'iostream' file. i'm working in swift, using bridging-headers use framework. when try build original project works, mine fails. how can add iostream file? thanks in advance! swift bridging not support objective c++ files. means headers consume or expose c++ entites (like std::vector ; std::iostream ) cannot added bridging header. the pop bridging header contains: #import "pop.h" you should #import file in own bridging header, rather trying #import .h files. if need consume of api that's defined in .mm files isn't exposed objective c or plain c header, you'll have make own header file exposes (and back-end implements you've exposed). the reason why can use .mm files in library that's being used swift because swift uses in

java - Eclipse can't start Tomcat with option : takes control of Tomcat installation -

Image
i using ubuntu 14.04 , eclipse luna. work eclipse , tomcat followed steps. 1) installed tomcat using : sudo apt-get install tomcat7 2) eclipse tomcat start , stop works fine below image radio button 1 option (double click server in eclipse). option 1 browser find 404 visit http://localhost:8080/ 3) apply option 2 :use tomcat installation(take control of tomcat installation) like image below it not start server radio option 2. when tried start server find error this i have tried find solution link . applied not worked me. <workspace-directory>\.metadata\.plugins\org.eclipse.core.resources also tried apply link , changed port. not worked. also executed option : cd~/workspaceeclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings rm org.eclipse.wst.server.core.prefs rm org.eclipse.jst.server.tomcat.core.prefs rm org.eclipse.jst.server.tomcat.core.prefs rm org.eclipse.wst.server.core.prefs cd /usr/share/tomcat7 sudo service tomcat7 stop sud

html - IE Flexbox - Child Element does not stretch when using min-height on parent -

please have @ pen: http://codepen.io/anon/pen/zyzlmg what should make red .section element fill blue .container element. works in chrome , ff, not in ie. when setting height instead of min-height , works, need min-height because contained elements might exceed increase size of container. is there way make work? to fix that, needed wrap min-height element in flexbox row. http://s.codepen.io/boomerang/cf5b323f92549ea4b9e9aa3afcee9fc41427899803437/index.html#https://github.com/philipwalton/flexbugs#3-min-height-on-a-column-flex-container-wont-apply-to-its-flex-items not beautiful because have add element "styling", works.

ios - Custom TableViewCell Button should toggle active status and icon of a specific row, but it also changes the icon of other unrelated rows -

i need toggle per-object state (active/inactive) in tableview contains custom objects : want show active objects in tableview , when state of object changes inactive, disappears list. the app working (creating new custom objects, displaying them in tableview , viewing , editing content - including active/inactive status - in detailview...); in case relevant, please consider my project uses core data , use methods populate tableview . i need custom design tableview cells, i've implemented (i have subclass of uitableviewcell , custom cells displaying desired content ) , seems work, it's first time custom cells , must have done wrong... when tap active-inactive button in cell change custom object status (and make disappear list because has become inactive), i want object (its status changes , object disappears list). my issue see image of uibutton (which shows 2 different icons when object active or inactive) of few other rows change inactive icon. button image

android - Update WebView inside ViewPager after AsyncTask -

i have webview inside viewpager . when webview starts load data, needs perform task on urls, ids urls , update view. my problem is, how update webview inside viewpager latest content? viewpager inside fragment . here code: @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.fragment_detail_native, container, false); //.... non-relevant code removed mviewpager = (viewpager) view.findviewbyid(r.id.viewpager); mcustompageradapter = new custompageradapter(items, activity); mviewpager.setadapter(mcustompageradapter); mviewpager.setcurrentitem(position); mviewpager.setonpagechangelistener(new onpagechangelistener() { @override public void onpageselected(int position) { if (mtwopane) monpageselectedlistener.onpageselected(position); } @override public void onpages

sending at commands with c++ on cubietruck -

i have cubieboard3 (cubietruck) , i'm trying send @ commands cb modem, i'm stuck on reading answer modem. c++ code: #include <stdio.h> #include <string.h> #include <iostream> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <termios.h> using namespace std; int main(void) { int fd; /* file descryptor port */ fd = open("/dev/ttys1", o_rdwr | o_noctty | o_ndelay); if (fd == -1)//if not open port { perror("open_port: unable open /dev/ttys1 - "); } else //if port opened { fcntl(fd, f_setfl, fndelay); //sending data std::cout<<"port opened!"<<endl; std::cout<<"sending 'atz\r' "<<endl; int n = write(fd, "atz\r", 4); if (n < 0) fputs("write() of 4 bytes failed!\n", stderr); else std::cout<<"data send!"<<endl; //reading data char buf [10];

Finance - Exchange's order matching algorithms - What if the orders don't match? -

the order matching algorithms popularly used electronic financial exchanges include fifo or pro-rata or other variants. use case order amount matches or within margin of tick happy-path scenario. want know how these algorithms operate when order amount don't match? scenario 1 - if partial fill happens , out of 100 order, 50 orders gets filled. residual order book hold remaining 50. happens these 50? how long have wait? scenario 2 - if buy order $50, , no sell order comes in below $60. happen these kind of orphaned orders?

c++ - Missing libclang_rt.san-x86_64.a file for LLVM compiler-rt -

i've built llvm/clang compiler-rt , tried -fsanitize option. strangely link failed since cannot find libclang_rt.san-x86_64.a . /usr/bin/ld: cannot find /home/hongxu/research/llvm-git/obj/bin/../lib/clang/3.7.0/lib/linux/libclang_rt.san-x86_64.a: no such file or directory clang-3.7: error: linker command failed exit code 1 (use -v see invocation) when changed directory /home/hongxu/research/llvm-git/obj/bin/../lib/clang/3.7.0/lib/linux/ , found there other library files # addresssanitizer libclang_rt.asan_cxx-x86_64.a libclang_rt.asan-preinit-x86_64.a libclang_rt.asan-x86_64.a # dataflowsanitizer libclang_rt.dfsan-libc-x86_64.a libclang_rt.dfsan-x86_64.a # leaksanitizer libclang_rt.lsan-x86_64.a # memorysanitizer libclang_rt.msan-x86_64.a # threadsanitizer libclang_rt.tsan-x86_64.a # undefinedbehaviorsanitizer libclang_rt.ubsan_cxx-x86_64.a libclang_rt.ubsan_standalone_cxx-x86_64.a libclang_rt.ubsan_standalone-x86_64.a libclang_rt.ubsan-x86_64.a and can guess function

c# - Compare AES encryption OpenSSL versus .NET(RijndaelManaged) -

i need encrypt url. according specs of url should (rijndael) encoded using cbc encryption mode, using iv of 0., pkcs7 padding , key length of 128-bit. the decryption of url done in .net environment using rijndaelmanaged class. encrypt using openssl 1.0.2a (c++ unmanaged) , use following code (from internet): // ctx holds state of encryption algorithm doesn't // reset initial state while encrypting more 1 block. evp_cipher_ctx ctx; evp_cipher_ctx_init(&ctx); unsigned char key[] = {0x41, 0x41, 0x45, 0x43, 0x41, 0x77, 0x51, 0x46, 0x43, 0x67, 0x63, 0x49, 0x43, 0x5a, 0x6f, 0x4c }; unsigned char iv[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; assert(sizeof(key) == 16); // aes128 key size assert(sizeof(iv) == 16); // iv aes block size // if data isn't multiple of 16, default behavior pad // n bytes of value n, n number of padding bytes required // make data multiple of block size. pkcs7 padding. // output multiple of bloc

wcf - There was no endpoint listening at net.tcp://localhost:10001 that could accept the message -

i'm having problem when moving wcf service windows 2003 server windows 2008 server. service communicates between web site , windows service on same server. service runs below configurations on both 2003 server , locally on windows 7 computers. on 2008 server, i'm getting following error message exception type : system.servicemodel.endpointnotfoundexception message: there no endpoint listening @ net.tcp://localhost:10001/dcfdirectcert/securityservice accept message. caused incorrect address or soap action. configuration web site <system.servicemodel> <diagnostics> <messagelogging logentiremessage="true" logmalformedmessages="true" logmessagesatservicelevel="true" logmessagesattransportlevel="true" /> </diagnostics> <bindings> <nettcpbinding> <binding name="directcertbindingconfig"> <security mode="no

android - implement onClickListener for Horizontal ScrollView -

i'm populating horizontal scrollview using picasso , problem can't implement onclicklistener because item views of list doesn't have index. xml : <horizontalscrollview android:layout_width="match_parent" android:layout_height="120dp" android:id="@+id/mygallery"> <linearlayout android:id="@+id/channelsscrollview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" /> </horizontalscrollview> and code : private void populateimages() { final list<string> urls = new arraylist<>(); //getting list of urls (int = 0; < activityloading.datachannelsarraylist.get(0).getchannelarraylist().size(); i++) { urls.add(getstring(r.string.get_channels_img_host) + activityloading.datachannelsarraylist.get(0).getchannelarraylist().get(i).getid()); }

git stash apply results in the conflict - why? -

i've tried unstash changes , git reported conflict: auto-merging core/scaldi/modules.scala conflict (content): merge conflict in core/scaldi/modules.scala i'm curious why conflict occurs, since have no changes neither in working directory nor in index: git diff #outputs nothing git diff --cached #outputs nothing git status #outputs `nothing commit, working directory clean` 'm curious why conflict occurs, since have no changes neither in working directory nor in index: it's not enough. seems stashed changes commits ago. assume tree looks this: a------b------c------d[master] \ stashed -------^ (stash apply) sources so stashed file changes of core/scaldi/modules.scala conflicts changes in c or d.

c# - Call method with assembly loaded from GAC -

i trying call save method system.drawing.image object, after loading assembly gac: _drawingassembly = assembly.load ("system.drawing, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a"); _drawingassembly.gettype("image").getmethod("save").invoke(myimageobject, new object[] { path }); but it's not working. can't type reason; returns null: var t = _drawingassembly.gettype("image"); // null you need specify full type name system.drawing.image indicated documentation: https://msdn.microsoft.com/en-us/library/y0cd10tb(v=vs.110).aspx

java - Is there an opposite for the DelayQueue? -

i need queue automatically remove elements older given amount of milliseconds - basically, want items in queue expire after time. i see there delay queue seems doing opposite: 'an element can taken when delay has expired.' (i've never used it). maybe there queue implementation need? better if bounded. if want remove expired objects need delayqueue , thread extract expired objects it, this: static class wrapper<e> implements delayed { e target; long exp = system.currenttimemillis() + 5000; // 5000 ms delay wrapper(e target) { this.target = target; } e get() { return target; } @override public int compareto(delayed o) { return 0; } @override public long getdelay(timeunit unit) { return unit.convert(exp - system.currenttimemillis(), timeunit.milliseconds); } } public static void main(string[] args) throws exception { final delayqueue<wrapper<integer>>

java - redirect doesnt include path -

<rule> <from>^/asd/(.*)/$</from> <to type="temporary-redirect">%{context-path}/?asd=$1</to> </rule> my website hosted myapp.com/testing , jetty context dev so myapp.com/testing/dev/ but when try myapp.com/testing/dev/asd/123/ instead of myapp.com/testing/dev/?asd=123 i redirected myapp.com/dev/?asd=123 i 'm using v 4.0 http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html you have 2 things mucking request. your rewrite filter @ odds whatever have in front of jetty (hardware or software converting browser (http client) requests myapp.com/testing/dev/ jetty's myapp.com/dev/ . jetty isn't aware of /testing/ part of path, rewrite filter cannot add /testing/ piece 302 redirect. either you'll need make product in front of jetty smart enough rewrite location response header, or you'll need adjust rewrite filter include path information product in front of jetty

maven - what are the jars needed to set on classpath during storm hbase integration -

i trying integrate storm , hbase ,and program getting submitted storm topology without error or exception when check logs getting java.lang.runtimeexception: java.lang.classnotfoundexception:org.apache.storm.hbase.bolt.hbasebolt , have added storm-hbase-0.9.3.jar classpath i.e storm lib folder still getting exception @ run time - java.lang.runtimeexception: java.lang.classnotfoundexception: org.apache.storm.hbase.bolt.hbasebolt @ backtype.storm.serialization.defaultserializationdelegate.deserialize(defaultserializationdelegate.java:58) ~[storm-core-0.9.3.jar:0.9.3] @ backtype.storm.utils.utils.deserialize(utils.java:89) ~[storm-core-0.9.3.jar:0.9.3] @ backtype.storm.utils.utils.getsetcomponentobject(utils.java:228) ~[storm-core-0.9.3.jar:0.9.3] @ backtype.storm.daemon.task$get_task_object.invoke(task.clj:73) ~[storm-core-0.9.3.jar:0.9.3] @ backtype.storm.daemon.task$mk_task_data$fn__3131.invoke(task.clj:180) ~[storm-core-0.9.3.jar:0.9