Daily Archives

Articles indexed Monday April 19 2010

Page 6/113 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Resume Activity with back button

    - by Hallik
    I have an application I am creating with a DashboardActivity & a SettingsActivity. On the dashboard, I have one object displayed, but when I go into settings, I want to be able to select/deselect X options. Once the user clicks the back button, I save that data locally and to the server. Once the phone receives a success message from the server that it was stored properly, I want to reload the dashboard. I thought I would do this with the onPause and onResume, but they are called when the DashboardActivity is first created. What would be the best way to reload the dashboard by calling my web service after the settings were saved to the server? Here is what I am doing when the back button is hit @Override public boolean onKeyDown(int keyCode, KeyEvent event) { //Save data to the server once the user hits the back button if ((keyCode == KeyEvent.KEYCODE_BACK)) { SchoolSearchActivity.this.divisionProxy = new DivisionProxy(SchoolSearchActivity.this.saveUserDivisionHandler); SchoolSearchActivity.this.divisionProxy.submitUserDivisions(SchoolSearchActivity.this.userDivisions, SchoolSearchActivity.this.user_id); //SchoolSearchActivity.this.finish(); //Toast.makeText(SchoolSearchActivity.this, "Divisions Saved",Toast.LENGTH_LONG).show(); } return true; } The above opens an HTTP connection, and when the response is received, the handler processes the response. I am going to: 1) throw up a progress dialog box letting the user know it's being submitted to the server, and once a response is received, 2) go back to the previous activity and call the "refresh" webservice again. What's the best way to accomplish 1 & 2?

    Read the article

  • How to temporarily replace one primitive type with another when compiling to different targets in c#

    - by Keith
    How to easily/quickly replace float's for doubles (for example) for compiling to two different targets using these two particular choices of primitive types? Discussion: I have a large amount of c# code under development that I need to compile to alternatively use float, double or decimals depending on the use case of the target assembly. Using something like “class MYNumber : Double” so that it is only necessary to change one line of code does not work as Double is sealed, and obviously there is no #define in C#. Peppering the code with #if #else statements is also not an option, there is just too much supporting Math operators/related code using these particular primitive types. I am at a loss on how to do this apparently simple task, thanks! Edit: Just a quick comment in relation to boxing mentioned in Kyles reply: Unfortunately I need to avoid boxing, mainly since float's are being chosen when maximum speed is required, and decimals when maximum accuracy is the priority (and taking the 20x+ performance hit is acceptable). Boxing would probably rules out decimals as a valid choice and defeat the purpose somewhat. Edit2: For reference, those suggesting generics as a possible answer to this question note that there are many issues which count generics out (at least for our needs). For an overview and further references see Using generics for calculations

    Read the article

  • Swing combo boxes

    - by Dalton Conley
    Alright, so I'm simply defining a combo box like so... JComboBox yearSelect = new JComboBox(); Now, I have not even added this to a panel or anything, I've just defined it. When I run the app, nothing displays.. when I comment out this line.. the app displays the other panels like I want it to.. is there something I'm doing wrong? Maybe I'm forgetting something that has to do with combo boxes? I think it may be something stupid that I'm missing.

    Read the article

  • Traversing from Bookmark Hashtags (#bookmark) in jQuery?

    - by HipHop-opatamus
    I am having trouble traversing from a bookmark has tag in jquery. Specifically, the following HTML: <a id="comment-1"></a> <div class="comment"> <h2 class="title"><a href="#comment-1">1st Post</a></h2> <div class="content"> <p>this is 1st reply to the original post</p> </div> <div class="test">1st post second line</div> </div> I am trying to traverse to where the class = "title", if the page is landed on with a bookmark hashtag in the URL (site.com/test.html#comment-1). The following is my code I'm using for testing: if(window.location.hash) { alert ($(window.location.hash).nextAll().html()); } It executes fine, and returns the appropriate html ( The problem is if I add a selector to it ($(window.location.hash).next('.title').html() ) I get a null result. Why is this so? Is nextAll not the correct Traversing function? (I've also tried next+find to no avail) Thanks!

    Read the article

  • Using Java Executor on AppEngine causes AccessControlException

    - by Drew
    How do you get java.util.concurrent.Executor or CompletionService to work on Google AppEngine? The classes are all officially white-listed, but I get a runtime security error when trying to submit asynchronous tasks. Code: // uses the async API but this factory makes it so that tasks really // happen sequentially Executor executor = java.util.concurrent.Executors.newSingleThreadExecutor(); // wrap Executor in CompletionService CompletionService<String> completionService = new ExecutorCompletionService<String>(executor); final SomeTask someTask = new SomeTask(); // this line throws exception completionService.submit(new Callable<String>(){ public String call() { return someTask.doNothing("blah"); } }); // alternately, send Runnable task directly to Executor, // which also throws an exception executor.execute(new Runnable(){ public void run() { someTask.doNothing("blah"); } }); } private class SomeTask{ public String doNothing(String message){ return message; } } Exception: java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) at java.security.AccessController.checkPermission(AccessController.java:546) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166) at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:191) at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:288) at java.lang.Thread.init(Thread.java:332) at java.lang.Thread.(Thread.java:565) at java.util.concurrent.Executors$DefaultThreadFactory.newThread(Executors.java:542) at java.util.concurrent.ThreadPoolExecutor.addThread(ThreadPoolExecutor.java:672) at java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadPoolExecutor.java:697) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:652) at java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:590) at java.util.concurrent.ExecutorCompletionService.submit(ExecutorCompletionService.java:152) This code works fine when run on Tomcat or via command-line JVM. However, it chokes in the AppEngine SDK Jetty container (tried with Eclipse plugin and the maven-gae-plugin). AppEngine is likely designed to not allow potentially dangerous programs to run, so I could see them completely disabling thread creation. However, why would Google allow you to create a class, but not allow you to call methods on it? White-listing java.util.concurrent is misleading. Is there some other way to do parallel/simultaneous/concurrent tasks on GAE?

    Read the article

  • WSS 3.0/MOSS 2007 Active Directory Forms Based Authentication PeoplePicker no users found

    - by John Haigh
    WSS 3.0/MOSS 2007 Active Directory Forms Based Authentication PeoplePicker no users found After finding these steps online from http://dattard.blogspot.com/2008/11/active-directory-forms-based.html in order to setup Active Directory Forms Based Authentication I was all set to complete this task, except for one problem. These steps are missing one very important vital step in order for FBA to work with Active Directory. A supplement to step 3 before granting access in step 5 through the people picker. You need to specify the Active Directory Provider Name to the people picker, otherwise you will not be able specify users through the Policy for Web Application. <PeoplePickerWildcards>       <clear />          <add key="ADMembershipProvider" value="%" />     </PeoplePickerWildcards> Recently we needed to use Forms Based Authentication with Active Directory from an Extranet. This is how we got it to work. 1. Extend the Web Application Instead of tweaking the internal web app, Extend the web application you want to expose to the Extranet, giving it the required host headers etc. 2. Configure SharePoint Central Admin to use FBA for the "new" Web Applications Login to SharePoint Central Admin Go to Application Management / Application Security / Authentication Providers and Change the Web Application to the one which needs to be configured for Forms Based Authentication Click zone / default, change authentication type to forms and enter ActiveDirectoryMemebershipProvider under membership provider name ( for example , "ADMembershipProvider") and save this change 3. Update the web.config of SharePoint Central admin site under configuration node <connectionStrings> <add name="ADConnectionString" connectionString="LDAP://DynamicsAX.local/CN=Users,DC=DynamicsAX,DC=local /> </connectionStrings> under system.web node <membership defaultProvider="ADMembershipProvider"> <providers> <add name="ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ADConnectionString" connectionUsername="xxx" connectionPassword="yyy" enableSearchMethods="true" attributeMapUsername="sAMAccountName"/> </providers> </membership> 4.Update the web.config of SharePoint Web application Repeat step 3 for the web.config of the SharePoint webapplication to be configured for Forms Based Authentication Change the authentication in web.config to <authentication mode="Forms"> <forms loginUrl="/_layouts/login.aspx"></forms> </authentication> 5. Grant Access on the extended Web Application Your extranet web application is now configured to use FBA. However, until users, who will be accessing the site via FBA, are given permissions for the site, it will be inaccessible to them. To get started, open your browser and navigate to your farm’s Central Administration site. Click on Application Management and then click on Policy for Web Application. Make sure that you are working on the extranet web application. Do the following steps: Click on Add Users. In the Zones drop down, select the appropriate Extranet zone. IMPORTANT: If you select the incorrect zone, you may not be able to resolve user names. Hence, the zone you select must match the zone of the web application that is configured to use FBA. Click the Next button. In the Users edit box, type the name of the FBA user whom you wish to have full control for the site. Click the Resolve link next to the Users edit box. If the web application's FBA information has been configured correctly, the name will resolve and become underlined. Check the Full Control checkbox. Click the Finish button.

    Read the article

  • Best way to use my windows box as a backup?

    - by DFischer
    I put a 1.5 TB HD in my Windows 7 box and my main computer is a MBP. I have a lot of professional files/folders in a FireWire 800 external HD connected to the MBP and I want to use the 1.5 TB HD in my Windows 7 box as a backup for both the HD and MBP. Right now I am just copying files manually to the HD over the network and that's very slow and open to failure (not rsync'd.) Anyone suggest some appropriate solutions? Should I just figure out how to setup RSync on the windows box or is there a better alternative? Thanks!

    Read the article

  • How to show/hide layer by name in GIMP?

    - by parxier
    I received a pack of .psd files from a graphic designer that I need to use in the desktop app I'm developing. I managed to open those file in GIMP (I work on Ubuntu) The problem is that there are too many layers in there and it is very hard to navigate through them to get to the layer I'm interested in. Is there way in GIMP (or maybe plugin?) to show/hide layer by name and/or search for layer with specific name?

    Read the article

  • SQL SERVER – Find Most Active Database in SQL Server – DMV dm_io_virtual_file_stats

    - by pinaldave
    Few days ago, I wrote about SQL SERVER – Find Current Location of Data and Log File of All the Database. There was very interesting conversation in comments by blog readers. Blog reader and SQL Expert Sreedhar has very interesting DMV presented which lists the most active database in SQL Server. For quick reference he has included the size of the disk in KB, MB and GB as well. SELECT DB_NAME(mf.database_id) AS databaseName, name AS File_LogicalName, CASE WHEN type_desc = 'LOG' THEN 'Log File' WHEN type_desc = 'ROWS' THEN 'Data File' ELSE type_desc END AS File_type_desc ,mf.physical_name ,num_of_reads ,num_of_bytes_read ,io_stall_read_ms ,num_of_writes ,num_of_bytes_written ,io_stall_write_ms ,io_stall ,size_on_disk_bytes ,size_on_disk_bytes/ 1024 AS size_on_disk_KB ,size_on_disk_bytes/ 1024 / 1024 AS size_on_disk_MB ,size_on_disk_bytes/ 1024 / 1024 / 1024 AS size_on_disk_GB FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS divfs JOIN sys.master_files AS mf ON mf.database_id = divfs.database_id AND mf.FILE_ID = divfs.FILE_ID ORDER BY num_of_Reads DESC If you like to read and practice with DMVs, I suggest to read the blog of my very good friend Glenn Berry. He is one DMV expert. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • How to append text in php

    - by user225269
    I have this form for inputting the birthday in html. But I only have a single column for storing it in wampserver(Column Birthday). <select title="- Select Month -" name="mm" id="mm" class="" > <option value="" SELECTED >Month</option> <option value="1" >Jan</option> <option value="2" >Feb</option> <option value="3" >Mar</option> <option value="4" >Apr</option> <option value="5" >May</option> <option value="6" >Jun</option> <option value="7" >Jul</option> <option value="8" >Aug</option> <option value="9" >Sep</option> <option value="10" >Oct</option> <option value="11" >Nov</option> <option value="12" >Dec</option> </select> <input title="Day" type="text" onkeypress="return isNumberKey(event)" name="dd" value="" size="1" maxlength="2" id='numbers'/ > <input title="Year" type="text" onkeypress="return isNumberKey(event)" name="yyyy" value="" size="1" maxlength="4" id='numbers'/> </td> Do you have any idea on how I can place those 3 values in the same column?Please help

    Read the article

  • Reading CSV files in numpy where delimiter is ","

    - by monch1962
    Hello all, I've got a CSV file with a format that looks like this: "FieldName1", "FieldName2", "FieldName3", "FieldName4" "04/13/2010 14:45:07.008", "7.59484916392", "10", "6.552373" "04/13/2010 14:45:22.010", "6.55478493312", "9", "3.5378543" ... Note that there are double quote characters at the start and end of each line in the CSV file, and the "," string is used to delimit fields within each line. When I try to read this into numpy via: import numpy as np data = np.genfromtxt(csvfile, dtype=None, delimiter=',', names=True) all the data gets read in as string values, surrounded by double-quote characters. Not unreasonable, but not much use to me as I then have to go back and convert every column to its correct type When I use delimiter='","' instead, everything works as I'd like, except for the 1st and last fields. As the start of line and end of line characters are a single double-quote character, this isn't seen as a valid delimiter for the 1st and last fields, so they get read in as e.g. "04/13/2010 14:45:07.008 and 6.552373" - note the leading and trailing double-quote characters respectively. Because of these redundant characters, numpy assumes the 1st and last fields are both String types; I don't want that to be the case Is there a way of instructing numpy to read in files formatted in this fashion as I'd like, without having to go back and "fix" the structure of the numpy array after the initial read?

    Read the article

  • Why use Python interactive mode?

    - by mvid
    When I first started reading about Python, all of the tutorials have you use Python's Interactive Mode. It is difficult to save, write long programs, or edit your existing lines (for me at least). It seems like a far more difficult way of writing Python code than opening up a code.py file and running the interpreter on that file. python code.py I am coming from a Java background, so I have ingrained expectations of writing and compiling files for programs. I also know that a feature would not be so prominent in Python documentation if it were not somehow useful. So what am I missing?

    Read the article

  • Replace text in folder names

    - by dannyb
    How can I replace the same text in folder names in linux? Say I have "Photos_Jun", "Photos_July", "Photos_Aug", etc. whats the simplest way I can rename them like "Photos Jun", "Photos July", etc (basically I want to replace the underscore with a space " ". I have about 200 of these folders. I was looking at solution: http://stackoverflow.com/questions/1836563/how-can-i-easily-bulk-rename-files-with-perl It looks like what im looking for however, I dont know how to make a regular expression to match folders that are alphanumeric followed by a "_". All files have non-numeric names, so I think [a-zA-Z] is the right way to start. perl -e 'foreach $f (glob("File\\ Name*")) { $nf = $f; $nf =~ s/(\d+)$/sprintf("%03d",$1)/e; print `mv \"$f\" \"$nf\"`;}' Thanks for any help!

    Read the article

  • NSString not applying to UILabel

    - by lyonjtill
    - (void)restoreUserDefaults { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if([defaults objectForKey:@"Exam Name"] == nil) { examName = [[NSString alloc] initWithString:@"Name"]; } else { examName = [[NSString alloc] initWithString:[defaults objectForKey:@"Exam Name"]]; } [examNameLabel setText:examName]; NSLog(@"New Exam Schedule - Exam Name - %@",[defaults objectForKey:@"Exam Name"]); NSLog(@"examName = %@", examName); NSLog(@"examNameLabel = %@", examNameLabel); } Dear all, Basically above is a basic method to change a UILabel to a saved piece of data. I am having a problem making the label change to the NSString examName. I have checked Interface Builder and it's connected up. Any ideas why? Regards Lyon J Till

    Read the article

  • How can I get bitfields to arrange my bits in the right order?

    - by Jim Hunziker
    To begin with, the application in question is always going to be on the same processor, and the compiler is always gcc, so I'm not concerned about bitfields not being portable. gcc lays out bitfields such that the first listed field corresponds to least significant bit of a byte. So the following structure, with a=0, b=1, c=1, d=1, you get a byte of value e0. struct Bits { unsigned int a:5; unsigned int b:1; unsigned int c:1; unsigned int d:1; } __attribute__((__packed__)); (Actually, this is C++, so I'm talking about g++.) Now let's say I'd like a to be a six bit integer. Now, I can see why this won't work, but I coded the following structure: struct Bits2 { unsigned int a:6; unsigned int b:1; unsigned int c:1; unsigned int d:1; } __attribute__((__packed__)); Setting b, c, and d to 1, and a to 0 results in the following two bytes: c0 01 This isn't what I wanted. I was hoping to see this: e0 00 Is there any way to specify a structure that has three bits in the most significant bits of the first byte and six bits spanning the five least significant bits of the first byte and the most significant bit of the second? Please be aware that I have no control over where these bits are supposed to be laid out: it's a layout of bits that are defined by someone else's interface.

    Read the article

  • Fetched Property in XCode Data Model Editor for minimum value

    - by wal
    How do I add a Fetched Property in XCode's Data Model Editor for minimum value of one attribute?? My model: Item (name, note, storedItem) StoredItem (price, item) Item 1 ---> N StoredITem (1->N Relationship) I want that Item has a fetched property named minPrice and its value is the minimum value setted for price in the storedItems. Example: Item1 (banana, storedItem1 ... storedItem4, 10) StoredItem1 (10,item1) StoredItem2 (15,item1) StoredItem3 (30,item1) StoredItem4 (54,item1) What do I put in Destination?? StoredItem? And what do I put in Expression??

    Read the article

  • Reliable portability for C code without relying on the preprocessor

    - by Yktula
    Relying on the preprocessor and predefined compiler macros for achieving portability seems hard to manage. What's a better way to achieve portability for a C project? I want to put environment-specific code in headers that behave the same way. Is there a way to have the build environment choose which headers to include? I was thinking that I'd put the environment-specific headers into directories for specific environments. The build environment would then just copy the headers from the platform's directory into the root directory, build the project, and then remove the copies.

    Read the article

  • [jQuery] [PHP] Image manipulation

    - by robertdd
    hello, I want to do some kind of image editor, after I upload more images i want to make a list with all the thumbnails! after i want to be able to click on one thumb and rotate, duplicate, drag and drop (to change positions of the images), delete the image! all the images i want to be in a php array, if a image is deleted i want to delete the row from array to, if a image is drag and droped i want to change the position in the array to! ok after the user upload all the images and modify some of it how i can make a DONE button to save the positions of the images? for this small project how u suggest me to save the images? (to make a table in mysql and store the names of the images in the database depending on the session id? depending on the IP? any suggestions are welcome! thanks!

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >