Daily Archives

Articles indexed Wednesday April 28 2010

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

  • What happens on Activity.finish() with AsyncTask still running in background?

    - by stormin986
    What happens on Activity.finish() with an AsyncTask still running in background? Does it just pop the Activity off the Activity Stack, but wait to destroy the Activity object until the AsyncTask fully completes (since the AsyncTask is an inner class of my Activity)? Also, would it act any differently if the AsyncTask were a public, non-inner class that held no references to the instance of the Activity?

    Read the article

  • I'm capturing keys on my WinForm but I'm trying to see if the pressed key is a 'String' - getting an

    - by Sergio Tapia
    Here's my code: void gkh_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == neededLetter as Keys) { if (neededLetter == "n") { neededLetter = "o"; } else if (neededLetter == "o") { neededLetter = "t"; } else if (neededLetter == "t") { neededLetter = "e"; } else if (neededLetter == "e") { this.Show(); } } else { neededLetter = "n"; } } I'm getting an error on the first If block: The as operator must be used with a reference type or nullable type

    Read the article

  • Safe deployment of ASP.Net applications

    - by gatapia
    Hi All, I have an asp.net app that I want to deploy safely (with as little down time possible). I would love to do something like blue green deployment but without the need for a second web server. So, I know I can use load balancing, etc but I need a quick and cheap approach. I was thinking of doing something like: Setting up another website (copy of original) in IIS, currently I use host headers to direct traffic across sites). I could then view the new site locally until the site is totally online (due to NHibernate start up and various other high intensity tasks this takes a while). Once site 2 is totally started I would then change host headers around giving me a much much smaller down time. So my question is. Has anyone done anything like this? Will IIS restart my app pool or application when changing host headers (making this useless)? Any other options? Thanks for your help all. Guido

    Read the article

  • Passing filtering functions to Where() in LINQ-to-SQL

    - by Daniel
    I'm trying to write a set of filtering functions that can be chained together to progressively filter a data set. What's tricky about this is that I want to be able to define the filters in a different context from that in which they'll be used. I've gotten as far as being able to pass a very basic function to the Where() clause in a LINQ statement: filters file: Func<item, bool> returnTrue = (i) => true; repository file: public IQueryable<item> getItems() { return DataContext.Items.Where(returnTrue); } This works. However, as soon as I try to use more complicated logic, the trouble begins: filters file: Func<item, bool> isAssignedToUser = (i) => i.assignedUserId == userId; repository file: public IQueryable<item> getItemsAssignedToUser(int userId) { return DataContext.Items.Where(isAssignedToUser); } This won't even build because userId isn't in the same scope as isAssignedToUser(). I've also tried declaring a function that takes the userId as a parameter: Func<item, int, bool> isAssignedToUser = (i, userId) => i.assignedUserId == userId; The problem with this is that it doesn't fit the function signature that Where() is expecting: Func<item, bool> There must be a way to do this, but I'm at a loss for how. I don't feel like I'm explaining this very well, but hopefully you get the gist. Thanks, Daniel

    Read the article

  • PostGreSQL load increasing over time, why?

    - by TravisO
    It's a CentOS server (I don't know the specs) and just before anybody states the obvious, keep in mind these mitigating factors: the server does a nightly VACUUM job all the tables are indexed it's pretty much read only (meaning the DBs are not increasing in size) the number of queries being ran has been the same every month Here's a graph of the server load:

    Read the article

  • SimpleXMLElement to PHP Array

    - by Codex73
    Variable $d comes from file_get_contents function to a url. $answer = @new SimpleXMLElement($d); Below is output of the print_r($answer): SimpleXMLElement Object ( [Amount] = 2698 [Status] = OK [State] = FL [Country] = USA ) How can I retrieve value of each element and add to an array? can't figure it out.

    Read the article

  • build version - iphone app (xcode)

    - by peter61
    For one of my applications in xcode, I have the option to build for many different versions ranging from 3.0 to 3.1.3. Now when I make a new application, I only have the option to build this new application for 3.1.3. I can't seem to find where this project setting is. How can I build my application for 3.0? Thanks.

    Read the article

  • Add Checkbox column in flexigrid

    - by Ramji
    The issue about jquery flexigrid using php. unfortunately http://flexigrid.info site is down very often so managed to take some sample code from http://sanderkorvemaker.nl/test/flexigrid/ and worked based on that. The above sample code works now I need to create a grid with a column with checkboxes, So that I can click a couple of those checkboxes and click delete button it should get all the id in which the checkboxes are checked to and create a delete query and execute. Can anyone give me an example please Thanks in advance

    Read the article

  • CSS/JS Problems IE7 Suggestions

    - by wuntee
    I have been having some serious issues trying to get this web page I have been working on working correctly with IE7 (ff/chrome/safari/ie8 all work fine). I have corrected all HTML and CSS issues, but it still does not render the same in IE7. I have been working on this for months, and was wondering if the community could give me some help: http://victoriakwasinski.com/ Thanks.

    Read the article

  • Options for installing software on Amazon EC2 Windows instances

    - by gareth_bowles
    I've been running Linux servers on Amazon EC2 for a while now; the experience has been great. I've recently needed to bring up a Windows server to run some Windows-only software that our product needs to use, and am running into a problem figuring out how to install the software, which is only available on DVD. With Linux I can just install packages from a Web-based repository and take advantage of EC2's fast network throughput, but so far on the Windows instance I've had to upload my ISO images to EC2 and mount them from the Windows EC2 instance. For some reason I'm getting really slow upload speeds to EC2, even though the regular upload speed from our office is pretty good (around 7Mbps). I've also tried mounting the DVD drive on my machine as a local drive on the EC2 instance via Remote Desktop, and then running the software install from the local drive, but I run into the same slow upload speed issue. Does anyone have a better way to install software from physical media onto an EC2 instance ?

    Read the article

  • What cable is this?

    - by terrani
    Hi, I have a broken freestyle solo keyboard. The keyboard is separated into two as shown here http://www.ergocanada.com/products/keyboards/freestyle/freestyle_solo_690x375.jpg. I cut linking cable so..I need a new one. Here is a picture of the cable. http://img535.imageshack.us/img535/1310/img5180o.jpg what type of cable is this?

    Read the article

  • DoubleCommand Non-Functional on 10.6.3.

    - by Tim Visher
    I have a 1st or 2nd generation MacBook running 10.6.3. I want to remap my enter key to Ctrl and my right option key to enter (Emacs… yeah) and DoubleCommand seems to be precisely what the doctor ordered. Unfortunately, after having installed the latest version, it seems to be doing absolutely nothing. The correct settings are saved and active, but none of the remapping is taking effect. Are there any known issues with other OS X plug-ins (I run pretty heavily modified) or extensions that I should be aware of? What could the issue be? I initially tried to set only the User settings and then logged out and logged back in but nothing happened. I then tried saving them to System as well and logged out and in and nothing. Then I restarted the machine… twice… and nothing happened. Thanks in advance!

    Read the article

  • touchesBegan / Ended incorrectly identifying second, third, etc. touch

    - by Rob
    I have an issue where touchesBegan and touchesEnded are incorrectly identifying my second, third, etc touch if I continue to hold down my first touch. If I lift my finger up off the first touch, then it will recognize the next touch just fine. It's only when I hold my first touch down continuously and then try and touch a different area with a different finger at the same time. It will then incorrectly register that second touch as being from the first touch again. Any insights into how I can fix this? - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* touch = [touches anyObject]; NSString* filename = [listOfStuff objectAtIndex:[touch view].tag]; // do something with the filename now } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { ITouch* touch = [touches anyObject]; NSString* buttonPressed = [listOfStuff objectAtIndex:[touch view].tag]; // do something with this info now }

    Read the article

  • opening a new page and passing a parameter to it with Javascript

    - by recipriversexclusion
    I have a JS function that processes XML I GET from a server to dynamically create a table as below // Generate table of services by parsing the returned XML service list. function convertServiceXmlDataToTable(xml) { var tbodyElem = document.getElementById("myTbody"); var trElem, tdElem; var j = 0; $(xml).find("Service").each(function() { trElem = tbodyElem.insertRow(tbodyElem.rows.length); trElem.className = "tr" + (j % 2); // first column -> service ID var serviceID = $(this).attr("service__id"); tdElem = trElem.insertCell(trElem.cells.length); tdElem.className = "col0"; tdElem.innerHTML = serviceID; // second column -> service name tdElem = trElem.insertCell(trElem.cells.length); tdElem.className = "col1"; tdElem.innerHTML = "<a href=javascript:showServiceInfo(" + serviceID + ")>" + $(this).find("name").text() + "</a>"; j++; }); // each service } where showServiceInfo retrieves more detailed information about each service from the server based on the serviceID and displays it in the same page as the services table. So far so good. But, it turns out that I have to display the detailed service information in another page rather than the same page as the table. I have creates a generic service_info.html with an empty layout template, but I don't understand how to pass serviceID to this new page so that it gets customized with the detailed service info. How can I do this? Or, is there a better way to handle these situations? Thanks!

    Read the article

  • Thoughts on a Shoutbox anyone?

    - by sologhost
    I'm wanting to create a shoutbox, though I'm wondering if there is another way to go about this rather than using setInterval to query the database for new shouts every number of seconds. Honestly, I don't like having to go about it this way. Seems a bit redundant and repetitive and just plain old wrong. Not to mention the blinking of the shouts as it grabs the data. So I'm wondering on how the professionals do this? I mean, I've seen shoutboxes that work surperb and doesn't seem to be using any setInterval or setTimeout javascript functions to do this. Can anyone suggest any ideas or an approach to this that doesn't use setInterval or setTimeout?? Thanks :)

    Read the article

  • WCF and streaming requests and responses

    - by Cheeso
    Is it correct that in WCF, I cannot have a service write to a stream that is received by the client? My understanding is that streaming is supported in WCF for requests, responses, or both. Is it true that in all cases, the receiver of the stream must invoke Read ? I would like to support a scenario where the receiver of the stream can Write on it. Is this supported? Let me show it this way. The simplest example of Streaming in WCF is the service returning a FileStream to a client. This is a streamed response. The server code is like this: [ServiceContract] public interface IStreamService { [OperationContract] Stream GetData(string fileName); } public class StreamService : IStreamService { public Stream GetData(string filename) { FileStream fs = new FileStream(filename, FileMode.Open) return fs; } } And the client code is like this: StreamDemo.StreamServiceClient client = new WcfStreamDemoClient.StreamDemo.StreamServiceClient(); Stream str = client.GetData(@"c:\path\to\myfile.dat"); do { b = str.ReadByte(); //read next byte from stream ... } while (b != -1); (example taken from http://blog.joachim.at/?p=33) Clear, right? The server returns the Stream to the client, and the client invokes Read on it. Is it possible for the client to provide a Stream, and the server to invoke Write on it? In other words, rather than a pull model - where the client pulls data from the server - it is a push model, where the client provides the "sink" stream and the server writes into it. Is this possible in WCF, and if so, how? What are the config settings required for the binding, interface, etc? The analogy is the Response.OutputStream from an ASP.NET request. In ASPNET, any page can invoke Write on the output stream, and the content is received by the client. Can I do something similar in WCF? Thanks.

    Read the article

  • Group and sort blog posts by date in Rails

    - by Senthil
    I've searched all over web and have not found the answer. I'm trying to have a very standard archive option for my blog based on date. A request to url blog.com/archive/2009 shows all posts in 2009, blog.com/archive/2009/11 shows all posts in November 2009 etc. I found two different of code but not very helpful to me. def display_by_date year = params[:year] month = params[:month] day = params[:day] day = '0'+day if day && day.size == 1 @day = day if (year && month && day) render(:template => "blog/#{year}/#{month}/#{date}") elsif year render(:template => "blog/#{year}/list") end end def archive year = params[:year] month = params[:month] day = params[:day] day = '0'+day if day && day.size == 1 if (year && month && day) @posts_by_month = Blog.find(:all, :conditions => ["year is?", year]) else @posts_by_month = Blog.find(:all).group_by { |post| post.created_at.strftime("%B") } end end Any help is appreciated.

    Read the article

  • NSFILEMANAGER CRASHING IN APP DELEGATE

    - by theiphoneguy
    I have this code in a method called from applicationDidFinishLaunching. It works in the simulator, but crashes on the iPhone. There are about 1,600 2KB mp3 files being copied in this operation. If I try to instantiate the app multiple times, it will eventually copy more each time until the app eventually will start without crashing. I am releasing everything I allocate. I have about 20GB disk space free on the iPhone. If I progressively comment out code and run it on the iPhone, the copyItemAtPath seems to be the suspect. (void)createCopyOfAudioFiles:(BOOL)force { @try { NSError *error; NSString *component; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSFileManager *fileManager = [[NSFileManager alloc] init]; NSEnumerator *enumerator = [[[NSBundle mainBundle]pathsForResourcesOfType:@"mp3" inDirectory:nil] objectEnumerator]; while ((component = [enumerator nextObject]) != nil) { NSArray *temp = [component componentsSeparatedByString:@".app/"]; NSString *file = [NSString stringWithFormat:@"%@", [temp objectAtIndex:1]]; NSString *writableAudioPath = [documentsDirectory stringByAppendingPathComponent:file]; BOOL success = [fileManager fileExistsAtPath:writableAudioPath]; if (success &amp;&amp; !force) { continue; } else if (success &amp;&amp; force) { success = [fileManager removeItemAtPath:writableAudioPath error:&amp;error]; } success = [fileManager copyItemAtPath:component toPath:writableAudioPath error:&amp;error]; if (!success) { @throw [NSException exceptionWithName:[error localizedDescription] reason:[error localizedFailureReason] userInfo:nil]; } } [fileManager release]; } @catch (NSException *exception) { NSLog(@"%@", exception); @throw [NSException exceptionWithName:exception.name reason:exception.reason userInfo:nil]; } @finally { } }

    Read the article

  • What's the Matlab equivalent of NULL, when it's calling COM/ActiveX methods?

    - by David M
    Hi, I maintain a program which can be automated via COM. Generally customers use VBS to do their scripting, but we have a couple of customers who use Matlab's ActiveX support and are having trouble calling COM object methods with a NULL parameter. They've asked how they do this in Matlab - and I've been scouring Mathworks' COM/ActiveX documentation for a day or so now and can't figure it out. Their example code might look something like this: function do_something() OurAppInstance = actxserver('Foo.Application'); OurAppInstance.Method('Hello', NULL) end where NULL is where in another language, we'd write NULL or nil or Nothing, or, of course, pass in an object. The problem is this is optional (and these are implemented as optional parameters in most, but not all, cases) - these methods expect to get NULL quite often. They tell me they've tried [] (which from my reading seemed the most likely) as well as '', Nothing, 'Nothing', None, Null, and 0. I have no idea how many of those are even valid Matlab keywords - certainly none work in this case. Can anyone help? What's Matlab's syntax for a null pointer / object for use as a COM method parameter? Update: Thanks for all the replies so far! Unfortunately, none of the answers seem to work, not even libpointer. The error is the same in all cases: Error: Type mismatch, argument 2 This parameter in the COM type library is described in RIDL as: HRESULT _stdcall OurMethod([in] BSTR strParamOne, [in, optional] OurCoClass* oParamTwo, [out, retval] VARIANT_BOOL* bResult); The coclass in question implements a single interface descending from IDispatch.

    Read the article

  • django forms- register user script

    - by itsandy
    Hi all, I want to make something like http://www.djangosnippets.org/accounts/register/ using django..the register form. I am new to django. i have made a simple view form using django forms but unable o understand how to connect my form to a database. Im using postgresql. is there an easy way to use some snippet or script to achieve this. Please Help

    Read the article

  • How to add the coding for displaying the address when a particular set of latitude and longitude is

    - by KKC
    import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.AdapterView.OnItemSelectedListener; public class PopularAttractions extends MapActivity { private String[ ][ ] locations = { {"Singapore Zoological Garden","1.40502,103.793449"}, {"Singapore Night Safari","1.4037,103.789467"}, {"Jurong BirdPark","1.32005,103.707153"}, {"Jurong Reptile Park","1.321177,103.708486"}, {"Singapore Botanic Garden","1.31471,103.815689"}, {"Sungei Buloh Wetland Reserver","1.445144,103.729595"}, {"Escape Theme Park","1.38104,103.936928"}, {"Snow City","1.32823,103.74263"}, {"Super Ice World","1.300422,103.875348"}, {"Chinatown Heritage Center","1.2836,103.84425"}, {"Singapore Science Center","1.3249,103.740578"}, {"Red Dot Design Museum","1.277762,103.846225"}, {"G-Max Reverse Bungy","1.2906,103.845322"}, {"NEWater Visitor Center","1.33105,103.955311"} }; private Spinner spinnerView; private MapView mapView; private MapController mc; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); spinnerView = (Spinner) this.findViewById(R.id.spinner1); mapView = (MapView) findViewById(R.id.mapview1); mc = mapView.getController(); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_dropdown_item); //--add the various locations--- for(int i = 0; i < locations.length; i++) adapter.add(locations[i][0]); adapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item); spinnerView.setAdapter(adapter); spinnerView.setOnItemSelectedListener(selectListener); gotoSelected(); } //---when user selects an item--- private OnItemSelectedListener selectListener = new OnItemSelectedListener() { //---these are two methods you need to implement--- public void onItemSelected( AdapterView<?>parent, View v, int position, long id) { gotoSelected(); } public void onNothingSelected(AdapterView<?> arg0) {} }; //---when an item has been selected--- public void gotoSelected() { int index = spinnerView.getSelectedItemPosition(); String[] coordinates = locations[index][1].split(","); double lat = Double.parseDouble(coordinates[0]); double lng = Double.parseDouble(coordinates[1]); GeoPoint location = new GeoPoint ( (int)(lat * 1E6), (int)(lng * 1E6)); mc.animateTo(location); mc.setZoom(16); if (mapView.isSatellite()) mapView.setSatellite(false); else mapView.setStreetView(true); mapView.invalidate(); } public boolean onKeyDown(int keyCode, KeyEvent event) { MapController mc = mapView.getController(); switch (keyCode) { case KeyEvent.KEYCODE_3: mc.zoomIn(); break; case KeyEvent.KEYCODE_1: mc.zoomOut(); break; } return super.onKeyDown(keyCode, event); } @Override protected boolean isRouteDisplayed(){ //TODO Auto-generated method sub return false; } }

    Read the article

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