Search Results

Search found 1878 results on 76 pages for 'tom kruse'.

Page 46/76 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • PHP Populating array with $variables

    - by Tom
    Hi, I'm trying to create a basic shopping cart, having an issue with the product page allowing users to add more items to their cart then are in stock (I have code in place to prevent this on the view cart page, just not the view product page) This is what I have so far; for ($i = 0; $i < $numItem; $i++) { extract($cartContent[$i]); $subTotal += $price * $cartQuantity; $cartLimiter[$itemNo => $cartQuantity]; Using an array so the position number becomes the item number and the cart quantity becomes the assigned value, however it doesn't seem to like it and throws out on the bottom line of code: Parse error: syntax error, unexpected T_DOUBLE_ARROW, expecting ']' Thanks

    Read the article

  • Flex - Cancel drag operation via keyboard

    - by Tom
    Hello I would like to be able to cancel a drag operation with the Escape key. The following did not work so far: calling stopDrag() on the component -- nothing happens calling DragManager.acceptDragDrop(null) -- nothing happens calling mx_internal function DragManager.endDrag() -- drag partly stops, the drag proxy image disappears but now the drop indicator shows at row 0, and also there's a null error when finally releasing the mouse Anybody else had any luck with this? Thanks!

    Read the article

  • Java: how do I get a class literal from a generic type?

    - by Tom
    Typically, I've seen people use the class literal like this: Class<Foo> cls = Foo.class; But what if the type is generic, e.g. List? This works fine, but has a warning since List should be parameterized: Class<List> cls = List.class So why not add a <?>? Well, this causes a type mismatch error: Class<List<?>> cls = List.class I figured something like this would work, but this is just a plain ol' a syntax error: Class<List<Foo>> cls = List<Foo>.class How can I get a Class<List<Foo>> statically, e.g. using the class literal? I could use @SuppressWarnings("unchecked") to get rid of the warnings caused by the non-parameterized use of List in the first example, Class<List> cls = List.class, but I'd rather not. Any suggestions? Thanks!

    Read the article

  • What could cause xmlrpclib.ResponseError: ResponseError() ?

    - by Tom
    Hi, I am experimenting with XML-RPC. I have the following server script (python): from SimpleXMLRPCServer import SimpleXMLRPCServer server = SimpleXMLRPCServer(('localhost', 9000)) def return_input(someinput): return someinput server.register_function(return_input) try: print 'ctrl-c to stop server' server.serve_forever() except KeyboardInterrupt: print 'stopping' and the following client script: import xmlrpclib server = xmlrpclib.ServerProxy('http://www.example.com/pathto/xmlrpcTester2.py') print server.return_input('some input') I have tested this locally and it works fine. All it does it spit out the input fron the client script, which is right. However, when I try to do it on a remote server I get the following error: Traceback (most recent call last): File "client.py", line 4, in <module> print server.return_input('some input') File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 1199, in __call__ return self.__send(self.__name, args) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 1489, in __request verbose=self.__verbose File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 1253, in request return self._parse_response(h.getfile(), sock) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 1392, in _parse_response return u.close() File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 836, in close raise ResponseError() xmlrpclib.ResponseError: ResponseError() Any ideas what could cause this? Thanks in advance for your help.

    Read the article

  • Is Dynamic Casting Possible in Java

    - by Tom Tucker
    So I have a class of overloaded methods like this: class Foo { public void test(Object value) { ... } public void test(String value) { ... } } I need to pass a property value of a bean to one of these methods depending on its type, but I don't know the actual property type until the runtime. e.g. public void run(Object bean, String propertyName) { Foo foo = new Foo(); foo.test(PropertyUtils.getProperty(bean, propertyName)); } BTW, PropertyUtils.getProperty() is a helper method that returns a value of the specified property on a bean. PropertyUtils.getProperty() returns an Object, so that test(Object value) will be always called and the actual property type will be ignored. I can figure out the propery type in the runtime, even if its value is null. Is there such a thing as dynamic casting in Java? If not, is there a way to have an overloaded method with the correct parameter type called?

    Read the article

  • java multipart POST library

    - by tom
    Is there a multipart POST library out there that achieve the same effect of doing a POST from a html form? for example - upload a file programmingly in Java versus upload the file using a html form. And on the server side, it just blindly expect the request from client side to be a multipart POST request and parse out the data as appropriate. Has anyone tried this? specifically, I am trying to see if I can simulate the following with Java The user creates a blob by submitting an HTML form that includes one or more file input fields. Your app sets blobstoreService.createUploadUrl() as the destination (action) of this form, passing the function a URL path of a handler in your app. When the user submits the form, the user's browser uploads the specified files directly to the Blobstore. The Blobstore rewrites the user's request and stores the uploaded file data, replacing the uploaded file data with one or more corresponding blob keys, then passes the rewritten request to the handler at the URL path you provided to blobstoreService.createUploadUrl(). This handler can do additional processing based on the blob key. Finally, the handler must return a headers-only, redirect response (301, 302, or 303), typically a browser redirect to another page indicating the status of the blob upload. Set blobstoreService.createUploadUrl as the form action, passing the application path to load when the POST of the form is completed. <body> <form action="<%= blobstoreService.createUploadUrl("/upload") %>" method="post" enctype="multipart/form-data"> <input type="file" name="myFile"> <input type="submit" value="Submit"> </form> </body> Note that this is how the upload form would look if it were created as a JSP. The form must include a file upload field, and the form's enctype must be set to multipart/form-data. When the user submits the form, the POST is handled by the Blobstore API, which creates the blob. The API also creates an info record for the blob and stores the record in the datastore, and passes the rewritten request to your app on the given path as a blob key.

    Read the article

  • Can an out-of-process COM object determine its parent process?

    - by Tom Williams
    From an out-of-process COM object (LocalServer32) can I determine the client process that requested the creation of the object? - to be specific I need to get hold of the client processes command line. This question arrises because (due to poor standardisation, implementation and support) the potential 3rd party clients of the object have a variety of idiosyncracies which the object needs to workaround. To do this the object needs to be able to identify its current client. Extending the interface of the COM object so that the client can identify itself is unfortunately not possible ... or to be more precise the interface can be extended but I won't be able to get the clients to call the extension.

    Read the article

  • RSA implementations for Java, alternative to BC

    - by Tom Brito
    The RSA implementation that ships with Bouncy Castle only allows the encrypting of a single block of data. The RSA algorithm is not suited to streaming data and should not be used that way. In a situation like this you should encrypt the data using a randomly generated key and a symmetric cipher, after that you should encrypt the randomly generated key using RSA, and then send the encrypted data and the encrypted random key to the other end where they can reverse the process (ie. decrypt the random key using their RSA private key and then decrypt the data). I can't use the workarond of using symmetric key. So, are there other implementations of RSA than Bouncy Castle?

    Read the article

  • Obtaining FontMetrics before getting a Graphics instance

    - by Tom Castle
    Typically, I'd obtain a graphics instance something like this: BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = img.createGraphics(); However, in the current project I'm working on, the width and height variables above are dependent upon the size of a number of text fragments that will later be drawn onto the graphics instance. But, to obtain the dimensions of the font being used I would usually use the FontMetrics that I get from the graphics object. FontMetrics metrics = g.getFontMetrics(); So, I have a nasty little dependency cycle. I cannot create the graphics object until I know the size of the text, and I cannot know the size of the text until I have a graphics object. One solution is just to create another BufferedImage/Graphics pair first in order to get the FontMetrics instance I need, but this seems unnecessary. So, is there a nicer way? Or is it the case that the width, height etc. properties for a Font are somehow dependent upon what (graphics, component...) the text is to be drawn on?

    Read the article

  • How do I manage dependencies for automated builds on my build server?

    - by Tom Pickles
    I'm trying to implement continuous integration into our day to day workings. In our team, we're moving from just building our code in Visual Studio on our workstations and deploying, to using MSBuild.exe and automating on our build server (which is Jenkins) without the use of Visual Studio. We have external dependencies to references such as Automap in our projects. Because the automap (for example) dll isn't on the build server, the msbuild execution fails, for obvious reasons. There are other dll's which I need to be part of the build, I'm just using automap as an example. So what's the best way to get any dependencies onto the build server as part of the automated build? I've seen references to using a 'lib' folder, but I don't really understand where I should be putting it (in my project, filesystem, SVN ...?), and how the build server will get to it. I've also read that NuGet can do something with dependencies, but my build server isn't connected to the internet, and I don't understand how I can get my build to pull a NuGet package I may have created, and how it works together. Edit: I'm using subversion and we cannot use TeamCity as we would have to buy it and there's zero chance of funding.

    Read the article

  • Dynamic width of DIV (offsetWidth issue).

    - by Tom
    Hi all, I face issue with retrieving (via javascript) width of the div which content is changed (just before reading the widht via offsetWidth) in dynamic way (via changing innerHTML or using createTextNode). Here is some sample code: var con = document.getElementById('avContent'); //content div within page var temp = document.createElement('div');<br /> var text1 = document.createTextNode('CCCCC');<br /> temp.appendChild(text1);<br /> con.appendChild(temp);<br /> var length1 = temp.offsetWidth;<br /> var text2 = document.createTextNode('CCCCC33333333vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv');<br /> temp.removeChild(text1);<br /> temp.appendChild(text2);<br /> con.removeChild(temp);<br /> con.appendChild(temp); var length2 = temp.offsetWidth;<br /> The length1 and length2 do have the same width.. (the same result I get while using innerHTML instead of createTextNode). Looks like it's the same issue like described in following discussion: http://www.webdeveloper.com/forum/showthread.php?t=187716 Does anybody have answer (work around)? Thanks much for help in advance.

    Read the article

  • Interpolation not working on Rails generator

    - by Tom
    For some reason the code I have included below does not interpolate the variables into the template. It simply copies the file over verbatim. I cannot figure out why. https://gist.github.com/60484f7b57b06b6eb3e3 The Rails version is 2.3.4. Thanks in advance!

    Read the article

  • What is the standard way to deploy memcached?

    - by Tom
    I have two IIS servers and two MySQL servers. On all servers I have some available memory (More than a GB). What is the standard way to deploy memcached? Should I add a new server especially for memcached, or should I use my existing servers? If so, which servers? Thanks in advance

    Read the article

  • Native XML WebService With Authentication Basic and SSL

    - by tom
    I'm using 2005 and the Native XML WebServices. The integrated authentication via HTTP:80 works fine. But i need the basic authentication which requires SSL. So if i change the web service to ssl i always get a connection reset (101). I tried several ports 80,443,9999 with the same outcome. What is the error?

    Read the article

  • Using Gradle with an existing Android project

    - by Tom Reznik
    I have an existing Android project with the following structure: - ProjectName -- AndroidManifest.xml -- local.properties -- project.properties -- assets -- libs (containing all jars) -- modules (containing all library projects my project depends on) -- res -- src ---- com/namespace/projectname (all my classes including main activity are here) I haven't been using any specific build system to build my project other than the one provided by default with the Android Studio IDE (though the project was originally created with IntelliJ CE. I would like to use Gradle with the android plugin and do some work on my build process. I have tried several configurations in order to achieve this and have failed to complete a successful build every time. What's the recommended approach in this scenario? should I change my project structure? or is it possible to configure gradle using the existing structure? Any help would be greatly appreciated. Thanks!

    Read the article

  • Android: Showing photos runs out of memory

    - by Tom Beech
    I'm using a dialog box to display images in my android project. The first one opens fine, but when I close it and do the process again to show a different one the app falls over with a memory error (it's running on a samsung galaxy s3 - so shouldnt be an issue). Error: 10-24 11:25:45.575: E/dalvikvm-heap(29194): Out of memory on a 31961104-byte allocation. 10-24 11:25:45.580: E/AndroidRuntime(29194): FATAL EXCEPTION: main 10-24 11:25:45.580: E/AndroidRuntime(29194): java.lang.OutOfMemoryError 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:389) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:418) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.graphics.drawable.Drawable.createFromPath(Drawable.java:882) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.widget.ImageView.resolveUri(ImageView.java:569) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.widget.ImageView.setImageURI(ImageView.java:340) 10-24 11:25:45.580: E/AndroidRuntime(29194): at com.directenquiries.assessment.tool.AddAsset.loadPhoto(AddAsset.java:771) 10-24 11:25:45.580: E/AndroidRuntime(29194): at com.directenquiries.assessment.tool.AddAsset$11.onClick(AddAsset.java:748) 10-24 11:25:45.580: E/AndroidRuntime(29194): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:936) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.widget.AdapterView.performItemClick(AdapterView.java:292) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.widget.AbsListView.performItemClick(AbsListView.java:1359) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2988) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.widget.AbsListView$1.run(AbsListView.java:3783) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.os.Handler.handleCallback(Handler.java:605) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.os.Handler.dispatchMessage(Handler.java:92) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.os.Looper.loop(Looper.java:137) 10-24 11:25:45.580: E/AndroidRuntime(29194): at android.app.ActivityThread.main(ActivityThread.java:4517) 10-24 11:25:45.580: E/AndroidRuntime(29194): at java.lang.reflect.Method.invokeNative(Native Method) 10-24 11:25:45.580: E/AndroidRuntime(29194): at java.lang.reflect.Method.invoke(Method.java:511) 10-24 11:25:45.580: E/AndroidRuntime(29194): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993) 10-24 11:25:45.580: E/AndroidRuntime(29194): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760) 10-24 11:25:45.580: E/AndroidRuntime(29194): at dalvik.system.NativeStart.main(Native Method) Loading code: public void loadPhotoList(){ Cursor f = db.rawQuery("select * from stationphotos where StationObjectID = '"+ checkStationObjectID + "'", null); final ArrayList<String> mHelperNames= new ArrayList<String>(); if(f.getCount() != 0) { f.moveToFirst(); f.moveToFirst(); while(!f.isAfterLast()) { mHelperNames.add(f.getString(f.getColumnIndex("FilePath"))); f.moveToNext(); } } f.close(); final String [] nameStrings = new String [mHelperNames.size()]; for(int i=0; i<mHelperNames.size(); i++) nameStrings[i] = mHelperNames.get(i).toString(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Select Picture"); builder.setItems(nameStrings, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { loadPhoto(mHelperNames.get(item).toString()); } }); AlertDialog alert = builder.create(); alert.show(); } public void loadPhoto(String imagepath){ Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.activity_show_image); dialog.setTitle("Image"); dialog.setCancelable(true); ImageView img = (ImageView) dialog.findViewById(R.id.imageView1); img.setImageResource(R.drawable.ico_partial); Uri imgUri = Uri.parse(imagepath); img.setImageURI(imgUri); dialog.show(); }

    Read the article

  • Is there a Scala version of .irbrc or another way to define some default libraries for REPL use?

    - by Tom Morris
    I've written a little library that uses implicits to add functionality that one only needs when using the REPL in Scala. Ruby has libraries like this - for things like pretty printing, firing up text editors (like the interactive_editor gem which invokes Vim from irb - see this post), debuggers and the like. The library I am trying to write adds some methods to java.lang.Class and java.lang.reflect classes using the 'pimp my library' implicit conversion process to help you go and find documentation (initially, with Google, then later possibly with a JavaDoc/ScalaDoc viewer, and maybe the StackOverflow API eventually!). It's an itch-scratching library: I spend so much time copying and pasting classnames into Google that I figured I may as well automate the process. It is the sort of functionality that developers will want to add to their system for use only in the REPL - they shouldn't really be adding it to projects (partly because it may not be something that their fellow developers want, but also because if you are doing some exploratory development, it may be with just a Scala REPL that's not being invoked by an IDE or build tool). In my case, I want to include a few classes and set up some implicits - include a .jar on the CLASSPATH and import it, basically. In Ruby, this is the sort of thing that you'd add to your .irbrc file. Other REPLs have similar ways of setting options and importing libraries. Is there a similar file or way of doing this for the Scala REPL?

    Read the article

  • Document.oncontextmenu, component is not available (firefox)

    - by Tom J Nowell
    I have a script for a website, and one of the things ti does right at the end if attempt to disable an anti-right click protection in a website if($("span[class=MembersNameDisplay]").exists()){ var list_row = document.getElementsByTagName('script'); if(list_row != null){ list_row[0].parentNode.removeChild(list_row[0]); } } document.oncontextmenu=new Function("return true"); In google chrome this works, however in firefox with greasemonkey, the last line fails and the protection is not removed. Error: Component is not available Line: 171 How do I fix this, and why does it fail under firefox?

    Read the article

  • Silverlight 3 version compatibility

    - by Tom Allen
    We've noticed a compatibility issue with a Silverlight 3 app which runs fine with v3.0.40818, v3.0.50106 and v4.0.50401 but refuses to load in v3.0.40624. Instead it gives a message box saying a more recent version of Silverlight is required. Does anyone know what the changes were between 3.0.40624 and 3.0.40818 or why the app might not be compatible?

    Read the article

  • What's the best way of accessing a DRb object (e.g. Ruby Queue) from Scala (and Java)?

    - by Tom Morris
    I have built a variety of little scripts using Ruby's very simple Queue class, and share the Queue between Ruby and JRuby processes using DRb. It would be nice to be able to access these from Scala (and maybe Java) using JRuby. I've put together something Scala and the JSR-223 interface to access jruby-complete.jar. import javax.script._ class DRbQueue(host: String, port: Int) { private var engine = DRbQueue.factory.getEngineByName("jruby") private var invoker = engine.asInstanceOf[Invocable] engine.eval("require \"drb\" ") private var queue = engine.eval("DRbObject.new(nil, \"druby://" + host + ":" + port.toString + "\")") def isEmpty(): Boolean = invoker.invokeMethod(this.queue, "empty?").asInstanceOf[Boolean] def size(): Long = invoker.invokeMethod(this.queue, "length").asInstanceOf[Long] def threadsWaiting: Long = invoker.invokeMethod(this.queue, "num_waiting").asInstanceOf[Long] def offer(obj: Any) = invoker.invokeMethod(this.queue, "push", obj.asInstanceOf[java.lang.Object]) def poll(): Any = invoker.invokeMethod(this.queue, "pop") def clear(): Unit = { invoker.invokeMethod(this.queue, "clear") } } object DRbQueue { var factory = new ScriptEngineManager() } (It conforms roughly to java.util.Queue interface, but I haven't declared the interface because it doesn't implement the element and peek methods because the Ruby class doesn't offer them.) The problem with this is the type conversion. JRuby is fine with Scala's Strings - because they are Java strings. But if I give it a Scala Int or Long, or one of the other Scala types (List, Set, RichString, Array, Symbol) or some other custom type. This seems unnecessarily hacky: surely there has got to be a better way of doing RMI/DRb interop without having to use JSR-223 API. I could either make it so that the offer method serializes the object to, say, a JSON string and takes a structural type of only objects that have a toJson method. I could then write a Ruby wrapper class (or just monkeypatch Queue) to would parse the JSON. Is there any point in carrying on with trying to access DRb from Java/Scala? Might it just be easier to install a real message queue? (If so, any suggestions for a lightweight JVM-based MQ?)

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >