Search Results

Search found 3022 results on 121 pages for 'loose typing'.

Page 74/121 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • How to use OSGi getServiceReference() right

    - by Jens
    Hello, I am new to OSGi and came across several examples about OSGi services. For example: import org.osgi.framework.*; import org.osgi.service.log.*; public class MyActivator implements BundleActivator { public void start(BundleContext context) throws Exception { ServiceReference logRef = context.getServiceReference(LogService.class.getName()); } } My question is, why do you use getServiceReference(LogService.class.getName()) instead of getServiceReference("LogService") If you use LogService.class.getName() you have to import the Interface. This also means that you have to import the package org.osgi.services.log in your MANIFEST.MF. Isn't that completely counterproductive if you want to reduce dependencies to push loose coupling? As far as I know one advantage of services is that the service consumer doesn't have to know the service publisher. But if you have to import one specific Interface you clearly have to know who's providing it. By only using a string like "LogService" you would not have to know that the Interface is provided by org.osgi.services.log.LogService. What am I missing here?

    Read the article

  • jQuery/AJAX type-ahead/auto-complete

    - by Prasad
    I have read several articles/questions/forums discussing the best auto-complete plugin for jQuery. After trying several good ones, I've realized a flaw in most. If you are looking up countries and type 'In', a couple of countries show up. If you continue typing I-n-d-i-a, this results in 5 AJAX calls (see http://www.freeimagehosting.net/uploads/6f1bcd69e1.png) its quite natural that India is a subset of In, so why call again? We need to simply filter the retrieved list client-side. Anyone knows about such an implementation? What is the status of the Jquery Autocomplete feature? I read at StackOverflow that it is no longer available with Jquery; but the Jquery website has a 'New' mark besides the link to Autocomplete. Thanks

    Read the article

  • Google App Engine application instance recycling and response times...

    - by Konrad
    Hi, I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: Uneven response time between connection to server to first byte sent Application instances seem to be too aggressively recycled Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad

    Read the article

  • Automatic type conversion in Java?

    - by davr
    Is there a way to do automatic implicit type conversion in Java? For example, say I have two types, 'FooSet' and 'BarSet' which both are representations of a Set. It is easy to convert between the types, such that I have written two utility methods: /** Given a BarSet, returns a FooSet */ public FooSet barTOfoo(BarSet input) { /* ... */ } /** Given a FooSet, returns a BarSet */ public BarSet fooTObar(FooSet input) { /* ... */ } Now say there's a method like this that I want to call: public void doSomething(FooSet data) { /* .. */ } But all I have is a BarSet myBarSet...it means extra typing, like: doSomething(barTOfoo(myBarSet)); Is there a way to tell the compiler that certain types can automatically be cast to other types? I know this is possible in C++ with overloading, but I can't find a way in Java. I want to just be able to type: doSomething(myBarSet); And the compiler knows to automatically call barTOfoo()

    Read the article

  • MVC using LINQ? - Can't return anonymous types

    - by BlueRaja
    I'd like to implement MVC while using LINQ (specifically, LINQ-to-entities). The way I would do this is have the Controller generate (or call something which generates) the result-set using LINQ, then return that to the View to display the data. The problem is, if I do: return (from o in myTable select o); All the columns are read from the database, even the ones (potentially dozens) I don't want. And - more importantly - I can't do something like this: return (from o in myTable select new { o.column }); because there is no way to make anonymous types type-safe! I know for sure there is no nice, clean way of doing this in 3.5 (this is not clean...), but what about 4.0? Is there anything planned, or even proposed? Without something like duck-typing-for-LINQ, or type-safe anonymous return values (it seems to me the compiler should certainly be capable of that), it appears to be nearly impossible to cleanly separate the Controller from the View.

    Read the article

  • Django forms, inheritance and order of form fields

    - by Hannson
    I'm using Django forms in my website and would like to control the order of the fields. Here's how I define my forms: class edit_form(forms.Form): summary = forms.CharField() description = forms.CharField(widget=forms.TextArea) class create_form(edit_form): name = forms.CharField() The name is immutable and should only be listed when the entity is created. I use inheritance to add consistency and DRY principles. What happens which is not erroneous, in fact totally expected, is that the name field is listed last in the view/html but I'd like the name field to be on top of summary and description. I do realize that I could easily fix it by copying summary and description into create_form and loose the inheritance but I'd like to know if this is possible. Why? Imagine you've got 100 fields in edit_form and have to add 10 fields on the top in create_form - copying and maintaining the two forms wouldn't look so sexy then. (This is not my case, I'm just making up an example) So, how can I override this behavior? Edit: Apparently there's no proper way to do this without going through nasty hacks (fiddling with .field attribute). The .field attribute is a SortedDict (one of Django's internal datastructures) which doesn't provide any way to reorder key:value pairs. It does how-ever provide a way to insert items at a given index but that would move the items from the class members and into the constructor. This method would work, but make the code less readable. The only other way I see fit is to modify the framework itself which is less-than-optimal in most situations. In short the code would become something like this: class edit_form(forms.Form): summary = forms.CharField() description = forms.CharField(widget=forms.TextArea) class create_form(edit_form): def __init__(self,*args,**kwargs): forms.Form.__init__(self,*args,**kwargs) self.fields.insert(0,'name',forms.CharField()) That shut me up :)

    Read the article

  • input type text and onKeyDown not working under IE

    - by dygi
    Hi there. I am writing a WWW application, it has to run under IE. I have the problem with the code that runs under FF, but i can't get it running under IE. // JS code function test() { if (window.event.keyCpde == 13) window.location.href.ssign("myPage.php"); } I've tried some similar ways around window.location and location.href, also document.location. I've read that IE has problems with that, so i ask for a solution. The goal is, that page reloads after typing in some text into <input type='text' name='item_code' onKeyDown='test()'> and click enter. So the result is similar to pressing submit type button below the text input. Within IE it reloads the same page and nothing happens. In FF it correctly works.

    Read the article

  • What is the purpose of link shortener?

    - by gath
    I might be missing something here but am unable to understand the true purpose of link shortener services like bit.ly or is it just a lot of hype! Truly if you type nyti.ms on your URL bar on the browser it takes you to www.nytimes.com, but still what is so hard in typing "nytimes.com! which is far much comprehensible to read and understand leave alone to remember! Does shortening URL serve any purpose in web development? Why should someone want use obscure shortened URL?

    Read the article

  • Post Loading ads - using appendChild to move an IFRAME with text link ads

    - by Prem
    I have changed code around to basically load an add the bottom of the page in a hidden div and attached an onload event handler that called document.getElementById(xxx).appendChild() to take the hidden ad and move it into the right spot in my page. This works GREAT.. however when the ad is a text ad it AFTER i move the ad there is nothing in the rendered Iframe. I did tests to see what it looks like before i move it and sure enough the text links load in the IFRAME but the second i do the appendChild call to move the div that contains the ad i seem to loose the contents of the Iframe. Any ideas whats going on <div id="myad" style="display: none;"> GA_googleFillSlot("MyADSlotName"); </div> <script> window.onload = function() { // leader board document.getElementById('adplaceholder').appendChild(document.getElementById('myAd')); document.getElementById('myAd').style.display = ''; </script> UPDATE: I think what the problem here is that on text ads google writes to the iframe directly inserting the relevant text links where are on other ads it uses the iframe to just point to some src. seems like when i do the appendchild, if there is no "src" set for the iframe after the copy is done the iframe in the new location contains nothing... guess it does a reload on the src? Any way around this??

    Read the article

  • Automatically create an admin user when running Django's ./manage.py syncdb

    - by a paid nerd
    My project is in early development. I frequently delete the database and run manage.py syncdb to set up my app from scratch. Unfortunately, this always pops up: You just installed Django's auth system, which means you don't have any superusers defined. Would you like to create one now? (yes/no): Then you have supply a username, valid email adress and password. This is tedious. I'm getting tired of typing test\[email protected]\ntest\ntest\n. How can I automatically skip this step and create a user programatically when running manage.py syncdb ?

    Read the article

  • External Reference to Richfaces modal

    - by John
    Hi, I need to get a <rich:modalPanel id="mod1" .../> component to load an external page on "show" action, defined as: <a4j:commandButton value="link" id="l1" reRender="mod1" oncomplete="Richfaces.showModalPanel('mod1')"> <f:setPropertyActionListener target="#{mybean.someParam}" value="#{myOtherbean.someOtherparam}" /> </a4j:commandButton> . My first try was with <rich:modalPanel id="mod1"> <ui:include src="#{mybean.generateURL()"/> </rich:modalPanel> but it just throws me a 404 page not found error, typing the generated URL directly into the address bar works perfectly fine. Does anyone know what's causing the problem , or what's the correct way to do this? The system is running on seam/richfaces. Thanks!

    Read the article

  • Language Tricks to Shorten My Java Code?

    - by yar
    I am currently rediscovering Java (working with Ruby a lot recently), and I love the compilation-time checking of everything. It makes refactoring so easy. However, I miss playing fast-and-loose with types to do an each loop. This is my worst code. Is this as short as it can be? I have a collection called looperTracks, which has instances that implement Looper. I don't want to modify that collection, but I want to iterate through its members PLUS the this (which also implements Looper). List<Looper> allLoopers = new ArrayList<Looper>(looperTracks.length + 1); for (LooperTrack track : looperTracks) { allLoopers.add(track); } allLoopers.add(this); for (Looper looper : allLoopers) { // Finally! I have a looper I'm particularly concerned about any features that are new to Java from 1.5 on that I may have missed. For this question I am not asking about JRuby nor Groovy, though I know that they would work for this. Edit: Sorry (too much Ruby!)... looperTracks is of type LooperTrack[] and LooperTrack implements Looper.

    Read the article

  • div insert in div

    - by lolalola
    Hi, what's wrong with this code? Now disappear background and div after this code show incorrect. But why when i delete "float: left", everything looks good. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <style type="text/css"> #first{ width: 200px; background-color: #345752; } #left_b{ background:transparent url('img/left.png'); background-position: left top; background-repeat: repeat-y; min-height: 30px; } #right_b{ background:transparent url('img/right.png'); background-position: right top; background-repeat: repeat-y; } #text{ float: left; width: 50px; height: 30px; } #text2{ float: left; width: 70px; height: 30px; } </style> </head> <body> <div id = "first"> <div id = "left_b"> <div id = "right_b"> <div id = "text"> text 1 </div> <div id = "text2"> text 2 </div> </div> </div> </div> </body> </html>

    Read the article

  • Excel Range Format: Number is automatically formatted when Range::Value2 is set

    - by A9S6
    I have an Excel addin written in C# that imports a text file into Excel worksheet. Some of the fields in the file are text and some oare numbers. Problem Steps: Change the System's Regional Settings to Dutch (Belgium) Open Excel and import the file into Excel. Records contain values such as 78,1118 which gets converted to 781.118. Note that in Dutch(Belgium), COMMA is the decimal character and DOT is the thousand character. I do not require the number to be formatted automatically but just want to display whatver I get from the file (78,1118). If I set the cell's NumberFormat to "@" i.e. Text, then it displays an error (SmartTag) saying "Number stored as Text". I know I can change the settings by going to the "Options" box but I dont want to change any user options in Excel for this. I have tried setting the cell's Value2 with an "'" (apostrophe) but the same error is displayed. If I set the cell's format to something else after the value is set then the actual value changes and I loose the decimal. Is there a way in Excel to just display the value and NOT display the "Number Stored as Text" error in cell?

    Read the article

  • Aptana CSS hinting inside jQuery

    - by Arpinum
    I have code hinting for Aptana setup for jQuery. However, many jQuery actions use strings, which Aptana does not provide hinting. How can I have Aptana give hinting for html and CSS when I am typing inside a string? $(function() { $("#theList tr:even").addClass("stripe1"); $("#theList tr:odd").addClass("stripe2"); }); I have an id="thelist", but since I am inside a double quote, Aptana provides no help. Similarly, .stripe1 and .stripe2 are not hinted. I know CSS and HTML hinting are turned on. If Aptana cannot provide this feature, are there other code editors that will?

    Read the article

  • JAX-WS and JPA, how to load stub objects using JPA?

    - by opensas
    I'm trying to develope a soap web service that has to access a mysql db. I have to replicate an existing service, so I created all the stub object from it's wsdl file Netbeans created all the necessary stuff for me (new, web service from wsdl), it works ok... Now I'm trying to use JPA to load all those objects from the database. So far I was going fine, I created the classes using (new, entity class from database), and then copied all the annotations to the classes generated by wsimport, and it was working fine. The problem is that netbeans insists on running wsimport again, and then I loose all my annotations... Is there some way to tell netbeans not to regenerate those files? I think this situation shoulb be pretty common, I mean developing a web service from a wsdl and then having to fill those objects with data using JPA. what would be the correct aproach to this kind of situation? thanks a lot saludos sas I've also tried inheriting from the stubs, and addign there the persistence annotations, but I had troubles with overlaping members, I'm redeclaring protected properties...

    Read the article

  • DIV Overlaying DIV, links in backmost DIV non-accessible

    - by Shawn
    I have a photoshop image that is 500x600 that I am using as a background image for the first div. The second div sits over top of the first div and is populated with images. The z-index of the first div is set to 100. The effect is the photoshop image sits over top of all of the smaller images. The photoshop image is a letter with the inner-content of it set to be transparent and the small images create the filling. Each of the small images however is a link, but none of the links are accessible. How can I remedy that? I would post the code here, but I have absolutely no clue how to format it. I quite simply do not understand typing a backtick followed by the tab key and then a dollar sign. All that ends up is I type a backtick here followed by a dollar sign in the Tags section below.

    Read the article

  • PHP Localization Best Practices? gettext?

    - by nute
    We are in the process of making our website international, allowing multiple languages. I've looked into php's "gettext" however, if I understand it right, I see a big flaw: If my webpage has let's say "Hello World" as a static text. I can put the string as <?php echo gettext("Hello World"); ?>, generate the po/mo files using a tool. Then I would give the file to a translator to work on. A few days later we want to change the text in English to say "Hello Small World"? Do I change the value in gettext? Do I create an english PO file and change it there? If you change the gettext it will consider it as a new string and you'll instantly loose the current translation ... It seems to me that gradually, the content of the php file will have old text everywhere. Or people translating might have to be told "when you see Hello World, instead, translate Hello Small World". I don't know I'm getting confused. In other programming languages, I've seen that they use keywords such as web.home.featured.HelloWorld. What is the best way to handle translations in PHP? Thanks

    Read the article

  • UISearchDisplayController changing row height

    - by tewha
    I've set my UITableView row height to in Interface Builder to 54.0. I have a UISearchDisplayController on that view. When the user taps the search bar in it, the table resizes properly. However, when they start typing (and actually doing the search) the row height decreases. It stays wrong until the search taps Cancel. I could find no documentation on this behavior on Apple's site. I've tried setting the row height in UISearchDisplayDelegate delegate calls. This might be the right approach, but I don't know the details and couldn't get it ti work. I've also tried implementing -- (CGFloat)tableView:(UITableView *)tableView -heightForRowAtIndexPath:(NSIndexPath *)indexPath;. This worked, but I have thousands of entries in this list and can't take the performance hit. What's the right way to fix this?

    Read the article

  • How to test an HTTP 301 redirect?

    - by NoozNooz42
    How can one easily test HTTP return codes, like, say, a 301 redirect? For example, if I want to "see what's going on", I can use telnet to do something like this: ... $ telnet nytimes.com 80 Trying 199.239.136.200... Connected to nytimes.com. Escape character is '^]'. GET / HTTP/1.0 (enter) (enter) HTTP/1.1 200 OK Server: Sun-ONE-Web-Server/6.1 Date: Mon, 14 Jun 2010 12:18:04 GMT Content-type: text/html Set-cookie: RMID=007af83f42dd4c161dfcce7d; expires=Tuesday, 14-Jun-2011 12:18:04 GMT; path=/; domain=.nytimes.com Set-cookie: adxcs=-; path=/; domain=.nytimes.com Set-cookie: adxcs=-; path=/; domain=.nytimes.com Set-cookie: adxcs=-; path=/; domain=.nytimes.com Expires: Thu, 01 Dec 1994 16:00:00 GMT Cache-control: no-cache Pragma: no-cache Connection: close <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> ... Which is an easy way to access quite some infos. But now I want to test that a 301 redirect is indeed a 301 redirect. How can I do so? Basically, instead of getting a HTTP/1.1 200 OK I'd like to know how I can get the 301? I know that I can enter the name of the URL in a browser and "see" that I'm redirected, but I'd like to know what tool(s) can be used to actually really "see" the 301 redirect. Btw, I did test with a telnet, but when I enter www.example.org, which I redirected to example.org (without the www), all I can see is an "200 OK", I don't get to see the 301.

    Read the article

  • jQuery Autocomplete problem - Shift Key behaves same as Return Key

    - by user237005
    See: http://www.airbnb.com/ In the search bar, start typing "san f" (no quotes, all lowercase), then hit Return (or Enter). "San Francisco" is autocompleted. This is good! Now clear the search field and start over. type "San F" and boom - "San Francisco" is autocompleted as soon as you hit Shift. This is not expected. This happens in FF & Safari, but is untested elsewhere. I've looked through the jQuery Autocomplete Source Code and everything looks normal. Has anyone experienced this before?

    Read the article

  • Is there a rake task for advancing or retreating your schema version by exactly one?

    - by user30997
    Back when migration version numbers were simply incremented as you created migrations, it was easy enough to do: rake migrate VERSION=097 rake migrate VERSION=098 rake migrate VERSION=099 rake migrate VERSION=100 ...but we now have migration numbers that are something like YYYYMMDDtimeofday. Not that this is a bad thing - it keeps the migration version collisions to a minimum - but when I have 50 migrations and want to step through them one-at-a-time, it is a hassle: rake migrate VERSION=20090129215142 rake migrate VERSION=20090129219783 ...etc. I have to have a list of all the migrations open in front of me, typing out the version numbers to advance by one. Is there anything that would have an easier syntax, like: rake migrate VERSION=NEXT or rake migrate VERSION=PREV ?

    Read the article

  • Jenkins slave jobs failing on "Unexpected termination of channel"

    - by Clark Wright
    I am currently seeing a set of errors across my builds. Is this expected behaviour if you loose Jenkins (say to a box crash, or a kill -9)? Or is there something worse going on (like a bad network connection)? The stack and error is: FATAL: hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel hudson.remoting.RequestAbortedException: hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel at hudson.remoting.Request.call(Request.java:149) at hudson.remoting.Channel.call(Channel.java:681) at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:158) at $Proxy175.join(Unknown Source) at hudson.Launcher$RemoteLauncher$ProcImpl.join(Launcher.java:861) at hudson.Launcher$ProcStarter.join(Launcher.java:345) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:82) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703) at hudson.model.Build$RunnerImpl.build(Build.java:178) at hudson.model.Build$RunnerImpl.doRun(Build.java:139) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:473) at hudson.model.Run.run(Run.java:1410) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:238) Caused by: hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel at hudson.remoting.Request.abort(Request.java:273) at hudson.remoting.Channel.terminate(Channel.java:732) at hudson.remoting.Channel$ReaderThread.run(Channel.java:1157) Caused by: java.io.IOException: Unexpected termination of the channel at hudson.remoting.Channel$ReaderThread.run(Channel.java:1133) Caused by: java.io.EOFException at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2554) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1297) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at hudson.remoting.Channel$ReaderThread.run(Channel.java:1127)

    Read the article

  • Use of "setTimeout()" in my jQuery Expression

    - by Aaron Salazar
    I'm trying to add the JavaScript function setTimeout() to my jQuery expression. Without the setTimeout() my function loads a partial view with updated information when I enter text into my textbox. But, it loads the information with every keystroke. My logic is that if I can put in a timer then when the user stops typing, a second later the data is updated. As you can see I tried to put a setTimer() in but it doesn't seem to be working. $(function() { $('#DocId').live('keyup', function() { setTimeout(var styleValue = $(this).val(); $('#tableContent').load( '/CurReport/TableResults', { style: $(this).val()}), 1000); }), }); Thank you, Aaron

    Read the article

  • How do you mock a Sealed class?

    - by Brett Veenstra
    Mocking sealed classes can be quite a pain. I currently favor an Adapter pattern to handle this, but something about just keeps feels weird. So, What is the best way you mock sealed classes? Java answers are more than welcome. In fact, I would anticipate that the Java community has been dealing with this longer and has a great deal to offer. But here are some of the .NET opinions: Why Duck Typing Matters for C# Develoepers Creating wrappers for sealed and other types for mocking Unit tests for WCF (and Moq)

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >