Daily Archives

Articles indexed Monday April 19 2010

Page 11/113 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Pass in the object a java class is embedded in as a parameter.

    - by Leif Andersen
    I'm building an android application, which has a list view, and in the list view, a click listener, containing an onItemClick method. So I have something like this: public class myList extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { getListView().setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { /* Do something*/ } } } Normally, this works fine. However, many times I find myself needing too preform an application using the outer class as a context. thusfar, I've used: parent.getContext(); to do this, but I would like to know, is that a bad idea? I can't really call: super because it's not really a subclass, just an embedded one. So is there any better way, or is that considered cosure? Also, if it is the right way, what should I do if the embedded method doesn't have a parameter to get the outside class? Thank you.

    Read the article

  • SQLite table query

    - by soclose
    Hi I query the table by using this function below public Cursor getTableInfo() throws SQLException { return db.query(TableName, null, null, null, null, null, null); } I got the error "View Root.handleMessage(Message)line:1704". I could insert the data but can't query the data. I called this function below Cursor c = db.getTableInfo(); int cRow = c.getCount(); if (cRow == 0) { Toast.makeText(NewContact.this, "No Record", Toast.LENGTH_LONG).show(); } Please help me.

    Read the article

  • IoC container configuration

    - by nivlam
    How should the configuration for an IoC container be organized? I know that registering by code should be placed at the highest level in an application, but what if an application had hundreds of dependencies that need to be registered? Same with XML configurations. I know that you can split up the XML configurations into multiple files, but that would seem like it would become a maintenance hassle if someone had to dig through multiple XML files. Are there any best practices for organizing the registration of dependencies? From all the videos and tutorials that I've seen, the code used in the demo were simple enough to place in a single location. I have yet to come across a sample application that utilizes a large number of dependencies.

    Read the article

  • Get a substring of a long string which fits in a width

    - by Lu Lu
    Hello everyone, I have a long string, ex: "Please help me to solve this problem." This string is so long to fit in a width of 100 pixels. I need to get a substring of this string and substring will fit in 100 pixels. Ex: substring "Please help me to sol" is fit in 100 pixels. Please help me how to estimate a substring like this. Thanks. My application is Win Forms and C#.

    Read the article

  • Flex: Why does setting scaleX/Y in mxml effect the components size but setting it in actionscript do

    - by ChrisInCambo
    Hi, I'm playing around with the scaleX/Y in the canvas tag and have noticed some strange behaviour. When I set scale in in mxml the width and height of the canvas are adjusted accordingly. For example if I have a canvas like this: <mx:Canvas width="1000" height="1000" scaleX="0.1" scaleY="0.1" /> The canvas now appears on screen to have a width and height of 100 and if inside my creationComplete callback I check the width and height property they are indeed 100. But if I do exactly the same thing except I set the scaleX/Y property from actionscript the canvas on screen appears to have a width and height of 100 as expected, but when I check the width and height property of the canvas they are still at the previous values of 1000. Could anyone help me understand what is going on and also tell me if there is any method that will refresh the width and height values so that they are correct? Thanks, Chris

    Read the article

  • Problem with non blocking fifo in bash

    - by timdel
    Hi! I'm running a few Team Fortress 2 servers and I want to write a little management script. Basically the TF2 servers are a fg process which provides a server console, so I can start the server, type status and get an answer from it: ***@purple:~/tf2$ ./start_server_testing Auto detecting CPU Using AMD Optimised binary. Server will auto-restart if there is a crash. Console initialized. [bla bla bla] Connection to Steam servers successful. VAC secure mode is activated. status hostname: Team Fortress version : 1.0.6.1/15 3883 secure udp/ip : ***.***.133.31:27600 map : ctf_2fort at: 0 x, 0 y, 0 z players : 0 (2 max) # userid name uniqueid connected ping loss state adr Great, now I want to create a script which sends the command sm_reloadadmins to all my servers. The best way I found to do this is using a fifo named pipe. Now what I want to do is having this pipe readonly and non blocking to the server process, so I can write into the pipe and the server executes it, but still I want to write via console one the server, so if I switch back to the fg process of the server and I type status I want an answer printed. I tried this (assuming serverfifo is mkfifo serverfifo): ./start_server_testing < serverfifo Not working, the server won't start until something is written to the pipe. ./start_server_testing <> serverfifo Thats actually working pretty good, I can see the console output of the server and I can write to the fifo and the server executes the commands, but I can't write via console to the server anymore. Also, if I write 'exit' to the pipe (which should end the server) and I'm running it in a screen the screen window is getting killed for some reason (wtf why?). I only need the server to read the fifo without blocking AND all my keyboard input on the server itself should be send to the server AND all server ouput should be written to the console. Is that possible? If yes, how?

    Read the article

  • tables wrapping to next line when width 100%

    - by jmo
    I'm encountering some weirdness with tables in css. The layout is fairly simple, a fixed-width nav bar on the left and the content on the right. When the content includes a table with a width of 100% the table ends up getting pushed down until it has room to take up the full width of the screen (instead of just the area to the right of the nav bar). If I remove the width=100% from the table's css, then it looks fine, but obviously the table doesn't grow to fill the space of the div. The problem is that i want the table to grow and shrink with the window but still stay in the bounds of its div. Thanks. Here's a simple example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Test</title> <style type="text/css"> #content { padding-right:20px; background:white; overflow:hidden; margin:20px; } #content .column { position:relative; padding-bottom: 20010px; margin-bottom: -20000px; } #center { width:100%; padding-top:15px; } body { min-width:700px; } #left { width: 330px; padding: 0 10px; padding-top:10px; float:left; } .tableData { width:100%; } </style> </head> <body> <div id="content"> <div class="column" id="left"> <div> Some text goes in here<br/> some more text<br/> some more text<br/> some more text<br/> some more text<br/> some more text<br/> </div> </div> <div class="column" id="center"> Some text at the top; <hr/> <table class="tableData"> <thead> <tr><th>A</th><th>B</th><th>C</th></tr> </thead> <tbody> <tr> <td>A1 A1 A1 A1</td> <td>B1 B1 B1 B1</td> <td>C1 C1 C1 C1 C</td> </tr> <tr> <td>A2 A2 A2 A2 </td> <td>B2 B2 B2 B2 </td> <td>C2 C2 C2 C2</td> </tr> <tr> <td>A3 A3 A3 A3 A3 </td> <td>B3 B3 B3 B3 B3 </td> <td>C3 C3 C3 C3 C3</td> </tr> <tr> <td>A4 A4 A4 A4 A4</td> <td>B4 B4 B4 B4 B4</td> <td>C4 C4 C4 C4 C4</td> </tr> </tbody> </table> </div> </div> </body> </html>

    Read the article

  • Spatial Rotation in Gmod Expression2.

    - by Fascia
    I'm using expression2 to program behavior in Garry's mod (http://wiki.garrysmod.com/?title=Wire_Expression2) Okay so, to set the precedent. In Gmod I have a block and I am at a complete loss of how to get it to rotate around the 3 up, down and right vectors (Which are local. ie; if I pitch it 45 degrees the forward vector is 0.707, 0.707, 0). Essentially, From the 3 vectors I'd like to be able to get local Pitch/Roll/Yaw. By Local Pitch Roll Yaw I mean that they are completely independent of one another allowing true 3d rotation. So for example; if I place my craft so its nose is parallel to the floor the X,Y,Z would be 0,0,0. If I turn it parallel to the floor (World and Local Yaw) 90 degrees it's now 0, 0, 90. If I then pitch it (World Roll, Local Pitch) it 180 degrees it's now 180, 0, 90. I've already explored quaternions however I don't believe I should post my code here as I think I was re-inventing the wheel. I know I didn't explain that well but I believe the problem is pretty generic. Any help anyone could offer is greatly appreciated. Oh, I'd like to avoid gimblelock too. Essentially calculating the rotation around each of the crafts up/forward/right vectors using the up/forward/right vectors. To simply the question a generic implementation rather than one specific to Gmod is absolutely fine.

    Read the article

  • How do I replicate the functionality of selecting contacts in messaging app?

    - by Polyomino
    Android's messaging app, located in projects/platform/packages/apps/Mms.git has a class called RecipientsEditor. I would like to be able to create MultiAutoCompleteTextView that will filter contacts the same way, to make contact selection easy in my app. using the mms app is cumbersome since it uses internal apis and has everything split across classes. Has anyone made an easy way to do this?

    Read the article

  • drag and drop with jquery and php

    - by robertdd
    hy, i have a php array with the name of some images! i list all the images use this: $files = $_SESSION['files']; $imgid = $_POST['id']; if ($files){ foreach($files as $image ): print '<li id="liupimages">'."\n"; print '<a href="uploads/'.$image.'"><img id="'.$imgid.'" alt="'.$image.'" src="uploads/'.$image.'"></a>'."\n"; print "</li>\n"; endforeach; print <<<JS <script> $(".thumbs li a").click(function(){ var largePath = $(this).attr("href"); $('.thumbs li').removeClass('thumbac'); $(this).parent().addClass('thumbac'); $("#largeImg").hide() .attr({ src: largePath }) .load(function() { $(this).show(); }); return false; }); </script> JS; } i use jquery-ui to drag and drop images using this function: $(function() { $("#upimagesQueue").sortable({ opacity: 0.6, cursor: 'move', update: function() { //?? } }); }); after i drag and drop one image i want to be able to update the php array to! how to do this?

    Read the article

  • [UIScreen applicationFrame] returning incorrect rectangle on landscape application launch (iPhone/iP

    - by jbrennan
    Having trouble getting the correct bounds for my iPad application when launching it in landscape mode. I have the proper keys set in my Info.plist file, and my view controllers launch properly in landscape (and portrait, natch). In my applicationDidFinishLaunching: method I'm calling a selector after a 3 second delay, and that method makes a call to [[UIScreen applicationFrame]`, but it's returning me a portrait frame (ie height width). Does anyone know how to fix this? It smells like a bug to me (if so I'll file a radar), but if it's intended behaviour, where is it documented?

    Read the article

  • Is this a clean way to manage AsyncResults with Generic Methods?

    - by Michael Stum
    I've contributed Async Support to a Project I'm using, but I made a bug which I'm trying to fix. Basically I have this construct: private readonly Dictionary<WaitHandle, object> genericCallbacks = new Dictionary<WaitHandle, object>(); public IAsyncResult BeginExecute<T>(RestRequest request, AsyncCallback callback, object state) where T : new() { var genericCallback = new RequestExecuteCaller<T>(this.Execute<T>); var asyncResult = genericCallback.BeginInvoke(request, callback, state); genericCallbacks[asyncResult.AsyncWaitHandle] = genericCallback; return asyncResult; } public RestResponse<T> EndExecute<T>(IAsyncResult asyncResult) where T : new() { var cb = genericCallbacks[asyncResult.AsyncWaitHandle] as RequestExecuteCaller<T>; genericCallbacks.Remove(asyncResult.AsyncWaitHandle); return cb.EndInvoke(asyncResult); } So I have a generic BeginExecute/EndExecute method pair. As I need to store the delegate that is called on EndExecute somewhere I created a dictionary. I'm unsure about using WaitHandles as keys though, but that seems to be the only safe choice. Does this approach make sense? Are WaitHandles unique or could I have two equal ones? Or should I instead use the State (and wrap any user provided state into my own State value)? Just to add, the class itself is non-generic, only the Begin/EndExecute methods are generic.

    Read the article

  • problem with drag and drop for the winform using c#

    - by karthik
    I dont have the title bar in my winform, so i need to code drag and drop for the entire form. I am using the below code to do it, which works fine. I have two panels in my form, PanelA and PanelB. During the startup i show PanelA where the drag and drop works perfectly. Later when the user clicks the button in PannelA, i need to make PanelA visible false and show the PanelB My drag and drop is not working when the PanelB is loaded in form. Whats the problem here ? private void SerialPortScanner_MouseUp(object sender, MouseEventArgs e) { this.drag = false; } private void SerialPortScanner_MouseDown(object sender, MouseEventArgs e) { this.drag = true; this.start_point = new Point(e.X, e.Y); } private void SerialPortScanner_MouseMove(object sender, MouseEventArgs e) { if (this.drag) { Point p1 = new Point(e.X, e.Y); Point p2 = this.PointToScreen(p1); Point p3 = new Point(p2.X - this.start_point.X, p2.Y - this.start_point.Y); this.Location = p3; } }

    Read the article

  • How to get interpolated message in NHibernate.Validator

    - by SztupY
    Hi! I'm trying to integrate NHibernate.Validator with ASP.NET MVC client side validations, and the only problem I found is that I simply can't convert the non-interpolated message to a human-readable one. I thought this would be an easy task, but turned out to be the hardest part of the client-side validation. The main problem is that because it's not server-side, I actually only need the validation attributes that are being used, and I don't actually have an instance or anything else at hand. Here are some excerpts from what I've been already trying: // Get the the default Message Interpolator from the Engine IMessageInterpolator interp = _engine.Interpolator; if (interp == null) { // It is null?? Oh, try to create a new one interp = new NHibernate.Validator.Interpolator.DefaultMessageInterpolator(); } // We need an instance of the object that needs to be validated, se we have to create one object instance = Activator.CreateInstance(Metadata.ContainerType); // we enumerate all attributes of the property. For example we have found a PatternAttribute var a = attr as PatternAttribute; // it seems that the default message interpolator doesn't work, unless initialized if (interp is NHibernate.Validator.Interpolator.DefaultMessageInterpolator) { (interp as NHibernate.Validator.Interpolator.DefaultMessageInterpolator).Initialize(a); } // but even after it is initialized the following will throw a NullReferenceException, although all of the parameters are specified, and they are not null (except for the properties of the instance, which are all null, but this can't be changed) var message = interp.Interpolate(new InterpolationInfo(Metadata.ContainerType, instance, PropertyName, a, interp, a.Message)); I know that the above is a fairly complex code for a seemingly simple question, but I'm still stuck without solution. Is there any way to get the interpolated string out of NHValidator?

    Read the article

  • how do you monitor your lamp server?

    - by ajsie
    i wonder how one can monitor a lamp server (ubuntu) on production. are there any standard tools for this to watch the server performance/load in realtime via the browser? how mysql, linux, apache etc are doing... what is best practice regarding this? any tutorials would be great. thanks!

    Read the article

  • Windows Media Player 12 Library import keeps dying

    - by duckworth
    I cannot get WMP 12 to import my library. I have searched around various forums and tried all the common solutions like disabling Media Sharing, deleted my %LOCALAPPDATA%\Microsoft\Media Player directory and tried reimporting, etc. but nothing works. I have even removed the Media features from Windows setup and re-added them. I have a large mp3 collection shared on the network from another Windows box. I add the folder (tried as a mapped drive and UNC path) and it begins importing. After about 30 minutes into the import (the CurrentDatabase_372.wmdb hits just under 400MB) my WMP player stops importing and all of the icons in WMP turn to red x's and my library is gone. I close and reopen WMP 12 and the library is empty and the CurrentDatabase_372.wmdb is small and it strarts importing again. Rinse, lather, repeat. I am going nuts as WMP11 on Vista handles this same setup perfectly. I am at my wits end on what else to try. I am running a legit Windows 7 Ultimate X64 RTM install. Here is a screenshot of what WMP12 looks like when the import dies: Any other ideas? Edit: OK, I Just confirmed this is definitely a problem not specific to my computer or configuration. I just did a clean installation of Windows 7 Ultimate x86 on an old test machine, opened WMP12 and added the same network folder of mp3's and it crashed about an hour into the import with the same appearance as the screenshot I posted above and the library disappears. So the problem has to be one of several things: The large size of the library The fact that the library is on the network A specific file or file is causing it the player to crash

    Read the article

  • scala jpa notifying hibernate

    - by coubeatczech
    Hi, i just tried to play a little with Scala Jpa, Downladed and run the basic lift-jpa-basic maven archetype, it works, but when I try to add my own @Entity, there is Unknown entity exception thrown. So what do I need to tell the environment to notify my entities? Thanks for answering.

    Read the article

  • Is it possible to use jquery to add numbers taken from mysql?

    - by Scarface
    Hey guys quick question. I have a div that gets assigned a number to its id that is taken from the database on page load. I am trying to use jquery to add 1 to that number but for example if the number was 70 to begin with it just becomes 701. Anyone know what I am doing wrong? echo "<div class=\"total\" id=\"$total\">$total</div>"; var total=$(".total").attr("id"); var newtotal=total+1; $('.total').html(newtotal);

    Read the article

  • pure as3 benefits to compiling with flex4 instead of flex3?

    - by jedierikb
    If I have a pure as3 project that I have been compiling with flex3 from mxmlc, is there any reason to switch to using the mxmlc with flex4? I can use all of the flash 10 language features like Vector, 3D, etc., so that is not a reason to switch (or is there something I can't do?). But maybe there is a performance boost? Or is the exact same compiling tool and the flex code base is the only difference?

    Read the article

  • Amazon EC2 and jbossws

    - by avjaz
    Hi - I've deployed a webservice to a Jboss instance running on Amazon EC2. The webservice works fine locally, but when I deploy on EC2, and go to the /jbossws/services page the Endpoint Address for the webservice is the private DNS of the ec2 instance (domU-X-X-X-X etc...), not the public dns (which I would like it to be). I've tried loading the wsdl by changing the private hostname to the public IP; that works, but when I try to call any of the operations I get a HostNotFoundException, I'm guessing due to the fact that the generated wsdl has the stanza: <service name='XXXService'> <port binding='tns:XXXBinding' name='XXXPort'> <soap:address location='http://domU-XX-XX-XX-XX-XX-XX.compute-1.internal:8080/xx/xx/xx'/> </port> </service> where http://domU-XX-XX-XX-XX-XX-XX.compute-1.internal is the internal dns of the ec2 instance. The wsdl is auto generated - Is there a JAXB annotation I can use so that I can force the generated wsdl to use the public dns of the EC2 instance? Many thanks -

    Read the article

  • Getting events out of Facebook?

    - by RD
    Is it possible to get event info from Facebook so the following is true: Add events that are not just your own events (i.e. search for general events and not just grab the events you have set as attended by your user) Specify criteria (e.g. get all events for one specific city) If this is possible, what should one use? where do you start?

    Read the article

  • Adding an encapsulated email (like a forwarded email) from Zend Mail.

    - by Kieran
    I'm trying to get Zend_Mail to send an encapsulated message - as though it's forwarding an email. $attachedContent = "<h1>H1 Email</h1>"; $emailContent = "<h1>Email Content>"; $mail = new Zend_Mail(); $mail->setBodyText('text content'); $mail->setBodyHtml($emailContent); $mail->setFrom('[email protected]', 'GAS'); $mail->addTo('[email protected]', 'GAS'); $at = $mail->createAttachment($attachedContent); $at->type = 'message/rfc822; name="forwarded message"'; $at->disposition = Zend_Mime::DISPOSITION_INLINE; $at->encoding = Zend_Mime::ENCODING_7BIT; $mail->setSubject('Test'); $mail->send(); Mail clients are getting the email, rendering the normal HTML content, and displaying the forwarded message and rendering its contents, however, it's formatting like: <h1>Email Content</h1> Can you see what I'm doing wrong? I've not found anything online, and have tried my best to copy the formatting from looking at email source. Cheers, Kieran

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >