Search Results

Search found 18677 results on 748 pages for 'current'.

Page 79/748 | < Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >

  • How to continue after exception occurred in C#

    - by Manisha
    static string SomeMethodThatMightThrow(string s) { if (s[4] == 'C') throw new InvalidOperationException(); return @"C:\newFolder\" + s; } static void Main(string[] args) { string[] files = { "fileA.txt", "B.txC", "fileC.txt","fileD.txt" }; var exceptionDemoQuery = from file in files let n = SomeMethodThatMightThrow(file) select n; try { foreach (var item in exceptionDemoQuery) { Console.WriteLine("Processing {0}", item); } } catch (InvalidOperationException e) { Console.WriteLine(e.Message); } Console.WriteLine("Press any key to exit"); Console.ReadKey(); } Output is Processing C:\newFolder\fileA.txt Operation is not valid due to the current state of the object. But i need the Output as: Processing C:\newFolder\fileA.txt Operation is not valid due to the current state of the object. Operation is not valid due to the current state of the object. Processing C:\newFolder\fileD.txt Please help in this.............

    Read the article

  • Intellisense in Visual Studio 2010

    - by Erik
    For some reason the Intellisense in vb.net stopped working when I use an Aggregate Lambda expression inside a With statement. With Me.SalesPackage .WebLinks = Sales.Where(Function(f) f.Current.BookerWeb > 0).Count .WebAmount = Aggregate o In Sales.Where(Function(f) f.Current.WebBooker > 0) Into Sum(o.Current.WebPrice) End With If I insert a new line between .WebLinks and .WebAmount and start typing, it works. But it won't work if I do it after the Aggregate statement... Any ideas?

    Read the article

  • wp7 odata v2 dataservicestate save and restore methods tombstoning example needed

    - by MIantosca
    I am looking for an example of how to use the new DataServiceState Save and Restore methods in a WP7 application in order to tombstone a datacontext - I cannot find any examples and the approach I used resulted in an exception this saves the data context correctly PhoneApplicationService.Current.State["DataContext"] = DataServiceState.Save(this.Model.Entities); this attempts to restore it after the app is re-activated var dc = (PhoneApplicationService.Current.State["DataContext"] as DataServiceState).Restore(); but throws an exception An item could not be added to the collection. When items in a DataServiceCollection are tracked by the DataServiceContext, new items cannot be added before items have been loaded into the collection. This is the same exception I get if I try to reload a datacontext that I stored "directly" (without using the DataServiceState.Save method) in the PhoneApplicationService.Current.State. I cannot find any offical documentation on the new ODATA v2 DataServiceState class or examples. thanks Michael

    Read the article

  • Can't run the ActionBarCompat sample

    - by David Miler
    I am having trouble compiling and running the ActionBarCompat sample of Android 16. I have API level 16 as the build target selected, which seems to build fine, but when I try to debug these errors pop up. Of course I could change the min API level in the manifest, but what would be the point of that? I have made no changes to the sample, so how come it is not working properly? Class requires API level 14 (current min is 3): android.view.ActionProvider SimpleMenuItem.java /ActionBarCompat/src/com/example/android/actionbarcompat line 129 Android Lint Problem Class requires API level 14 (current min is 3): android.view.ActionProvider SimpleMenuItem.java /ActionBarCompat/src/com/example/android/actionbarcompat line 134 Android Lint Problem Class requires API level 14 (current min is 3): android.view.MenuItem.OnActionExpandListener SimpleMenuItem.java /ActionBarCompat/src/com/example/android/actionbarcompat line 155 Android Lint Problem I am thoroughly confused, any help would be appreciated.

    Read the article

  • Django - User account with multiple identities

    - by Scott Willman
    Synopsis: Each User account has a UserProfile to hold extended info like phone numbers, addresses, etc. Then, a User account can have multiple Identities. There are multiple types of identities that hold different types of information. The structure would be like so: User |<-FK- UserProfile | |<-FK- IdentityType1 |<-FK- IdentityType1 |<-FK- IdentityType2 |<-FK- IdentityType3 (current) |<-FK- IdentityType3 |<-FK- IdentityType3 The User account can be connected to n number of Identities of different types but can only use one Identity at a time. Seemingly, the Django way would be to collect all of the connected identities (user.IdentityType1_set.select_related()) into a QuerySet and then check each one for some kind of 'current' field. Question: Can anyone think of a better way to select the 'current' marked Identity than doing three DB queries (one for each IdentityType)?

    Read the article

  • Is there a faster way to download a page from the net to a string?

    - by cphil5
    I have tried other methods to download info from a URL, but needed a faster one. I need to download and parse about 250 separate pages, and would like the app to not appear ridiculously slow. This is the code I am currently using to retrieve a single page, any insight would be great. try { URL myURL = new URL("http://www.google.com"); URLConnection ucon = myURL.openConnection(); InputStream inputStream = ucon.getInputStream(); BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); ByteArrayBuffer byteArrayBuffer = new ByteArrayBuffer(50); int current = 0; while ((current = bufferedInputStream.read()) != -1) { byteArrayBuffer.append((byte) current); } tempString = new String(byteArrayBuffer.toByteArray()); } catch (Exception e) { Log.i("Error",e.toString()); }

    Read the article

  • jQuery changing css on navigation when div # scrolls into view

    - by Jonny Wood
    I'm looking to recreate the effect used on this site: http://www.brizk.com/ The site uses one large page that scrolls down. As you scroll down and pass different sections the menu navigation on the left changes css class to "current" as the corresponding div comes into view. I presume this can be done with jQuery using $(window).height(); I'm fairly new to jQuery and what I want to write is something like this (in laymans terms): Get height of browser window – if div#content1 is 100px from top and/or 200px from bottom change menu a#link1 to '.current' – else remove .current from all menu a links ... and repeat for 4 different content divs. Can anyone point me in the right direction..? Thanks.

    Read the article

  • System.Windows.Media.RenderCapability.Tier returns not the render mode

    - by happyclicker
    I use System.Windows.Media.RenderCapability.Tier to show the current render mode within a diagnostics panel of my app. If I force the app (3.5sp1) to change the render-mode through the following code HwndSource hwndSource = PresentationSource.FromVisual(visual) as System.Windows.Interop.HwndSource; HwndTarget hwndTarget = hwndSource.CompositionTarget; hwndTarget.RenderMode = renderMode; neither System.Windows.Media.RenderCapability.TierChanged fires, nor has the System.Windows.Media.RenderCapability.Tier property changed. However the changes are applied to the app. If I look with Perforator, the render mode has been changed to the desired mode. Although I’ve found at many locations that System.Windows.Media.RenderCapability.Tier can be used to detect the current render state (also msdn, see this), it seems, System.Windows.Media.RenderCapability only gives information about the capabilities and not about the current mode. That makes also sense if I look at the name of the class. Is there another source to know how an actual wpf-content is rendered or am I doing something wrong?

    Read the article

  • dynamic text in <h1> tag

    - by Ami
    what would be the impact on SEO of changing the text of the <h1> dynamically on the server side each time the web page loads? I'm not talking about changing the whole text, just part of it, for example if the header contains some fixed text (with keywords of course), and also contains the current date or time/the current number of logged on users/the count of items current in stock/whatever. how would that affect my ranking? is it bad? doesn't make a difference? thanks.

    Read the article

  • Runtime Error in asp.net site?

    - by Surya sasidhar
    hi, I developed a website in asp.net and i place the site in online. I upload my site in online by using CuteFTP. After uploading when i type my url it is giving error like this... Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off". Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.

    Read the article

  • I am attempting to pull all years and terms from database except the last term

    - by Jonathan Moriarty
    I have a logic problem: We have a database that has a donations table with name, address, last donation year, and last donation term (Spring and Fall). We want to pull all donors unless they donated in the last term (Spring or Fall). I have been trying to figure out the logic of pulling all years up to the current year while omitting the last term. So for example this year is 2012 and we are in the Spring term (I defined the spring term between 1/1 and 6/30) so I only want to display donors before and including spring 2011 (we will exclude the current term which is spring 12 and the last term which is fall 2011). The problem is I want to pull sprig 2011, fall 2010, spring 2010 etc, but only omit the current term and last term donated.

    Read the article

  • rearranging a list of months

    - by MacUsers
    How can I list the numbers 01 to 12 (one for each of the 12 months) in such a way so that the current month always comes last where the oldest one is first. In other words, if the number is grater than the current month, it's from the previous year. e.g. 02 is Feb, 2011 (the current month right now), 03 is March, 2010 and 09 is Sep, 2010 but 01 is Jan, 2011. In this case, I'd like to have [09, 03, 01, 02]. This is what I'm doing to determine the year: for inFile in os.listdir('.'): if inFile.isdigit(): month = months[int(inFile)] if int(inFile) <= int(strftime("%m")): year = strftime("%Y") else: year = int(strftime("%Y"))-1 mnYear = month + ", " + str(year) I don't have a clue what to do next. What should I do here?

    Read the article

  • Event in Global.asax file that fires only for once

    - by fiberOptics
    In MVC Global.asax file, we can see the Application_Start where this event fires only for once. But the session is not yet active/available here. So my question is, is there any event in Global.asax file that fired only for once and session is available also? The reason I ask this is because, I use ExpandoObject e.g.: public static dynamic Data { get { #region FAILSAFE if (HttpContext.Current.Session[datakey] == null) { HttpContext.Current.Session[datakey] = new ExpandoObject(); } #endregion return (ExpandoObject)HttpContext.Current.Session[datakey]; } } I want to initialize all of my ExpandoObject at once with the value of null: MyExpando.Data.UserInformation = null; MyExpando.Data.FolderInformation = null; That's why I'm looking for an event that only fired once.

    Read the article

  • How do I conditionally assign ruby variables to javascript variables?

    - by Tony
    I have a website where I need a javascript version of the "current user" object along with the ruby version. I have been assigning these variables doing something like this... Application Controller: def get_user begin @current_user = User.find(session[:user_id]) if session[:user_id] @current_user_json = @current_user.to_json rescue session.delete(:user_id) @current_user = nil @current_user_json = {} end end Web Page: var current_user = null; current_user_json = '<%= @current_user_json %>'; if(current_user_json != ''){ current_user = current_user_json.user; } Even when there is a current user, I get the current user is undefined. Probably because I am putting the current_user_json assignment around single quotes. However, if I don't put it around single quotes, I'll always get a javascript error when no user is logged in because the syntax is invalid - current_user_json = ; I think I am just looking at this completely wrong and there must be a better way. Given that this is probably a common thing to do, I wanted to get other people's opinion on how to create an object in javascript that is a duplicate of the ruby object.

    Read the article

  • Minimum and maximum Date in date Picker in iphone

    - by Iphony
    I want to get minimum and maximum date from date picker but minimum date should be "- 18" of current date and maximum date should be "- 100" of current date. Suppose current year is 2018 then I want minimum date 2000 and maximum date 1918. what I have done so far is : NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *components = [gregorian components:NSYearCalendarUnit fromDate:[NSDate date]]; NSInteger year = [components year]; int mindt = year - 18; int maxdt = year -100; // NSDate * MinDate = [components year] - 18; // NSDate * MaxDate = [components year] - 100; // self.datePicker.minimumDate = MinDate; // self.datePicker.maximumDate = MaxDate; but I cant get this integer to my date formate.. pls suggest any way ...

    Read the article

  • XNA AdGameComponent does not draw

    - by Alex Shkor
    I have following code. But AddGameComponent doesn't draw. protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); var li = new LicenseInformation(); IsTrial = li.IsTrial(); if (IsTrial) { AdGameComponent.Initialize(this, AppID); Components.Add(AdGameComponent.Current); CreateAd(); } } private void CreateAd() { bannerAd = AdGameComponent.Current.CreateAd(AdUnitID, new Rectangle(x, y, width, height), true); AdGameComponent.Current.Enabled = true; } I have tried to set DrawOrder to 1000, but ads still doesn't work.

    Read the article

  • How does lock(syncRoot) make sense on a static method?

    - by Rising Star
    The following code is excerpted from the (Windows Identity Foundation SDK) template that MS uses to create a new Security Token Service Web Site. public static CustomSecurityTokenServiceConfiguration Current { get { HttpApplicationState httpAppState = HttpContext.Current.Application; CustomSecurityTokenServiceConfiguration customConfiguration = httpAppState.Get( CustomSecurityTokenServiceConfigurationKey ) as CustomSecurityTokenServiceConfiguration; if ( customConfiguration == null ) { lock ( syncRoot ) { customConfiguration = httpAppState.Get( CustomSecurityTokenServiceConfigurationKey ) as CustomSecurityTokenServiceConfiguration; if ( customConfiguration == null ) { customConfiguration = new CustomSecurityTokenServiceConfiguration(); httpAppState.Add( CustomSecurityTokenServiceConfigurationKey, customConfiguration ); } } } return customConfiguration; } } I'm relatively new to multi-threaded programming. I assume that the reason for the lock statement is to make this code thread-safe in the event that two web requests arrive at the web site at the same time. However, I would have thought that using lock (syncRoot) would not make sense because syncRoot refers to the current instance that this method is operating on... but this is a static method? How does this make sense?

    Read the article

  • How do I produce an external URL as part of a replace_html call in Ruby on Rails?

    - by vlasits
    Basically, I am attempting to render an external website (the url of which is stored in the database) into a page in my Ruby on Rails app. I have a field in my model 'search' called 'search' that contains web addresses with the form 'www.example.com' or 'example.com'. I am trying to use a link_to_function call with replace_html to replace the 'maincontent' div with an iframe tag using the value of 'search' in the current instance as the src for the tag. My current attempt is the very ugly code below. I'd be grateful for either of the following types of responses: How can I rewrite the concatenation string to work correctly? How can I get the same effect (replacing the current content of the "mainContent" div with an iframe tag using a different method? (I had to modify the code before to remove the < from the iframe) link_to_function h(search.title) do |page| page.replace_html 'mainContent', 'iframe id="embedded" src="http://" + #{search.search} />' end

    Read the article

  • html - how do I make a page load in a new tab in IE8?

    - by erynion
    My website works in Firefox - pages on the site load in the current tab, and links off site load a new tab. IE8 won't behave: target="_blank" opens a whole new window; the other options, _self _top _parent, all open the page in the current tab. I have Firefox set to "Open new windows in a new tab." The links to pages on my site all have target="_self" and Firefox keeps these in the current tab. On the external links I don't have a target set (I added _blank to see if it fixed IE8, and doing that didn't affect Firefox). I can't find an equivalent setting in IE8. Tools-Internet Options-General-Tabs/Settings has an enable tabs box, and a sub-option to automatically switch to newly opened tabs. Is there some html that will work? An IE8 setting I'm missing? Any help appreciated.

    Read the article

  • Runtime Error in asp.net?(online )

    - by Surya sasidhar
    hi, I develop a web application it is working fine in local. When i upload the site in online through CuteFTP it is showing the error like this... Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off". Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL. please help me i place the but even though it is not working it is giving same error. Thank you

    Read the article

  • time(NULL) returning different time

    - by cornerback84
    I am trying to get current time in C using time_t current_time = time(NULL). As I understand, it would return me the current time of system. I am later trying to convert it into GMT time using struct tm* gmt = gmtime(&current_time). I print both times using ctime() and asctime() functions. The current time on my system is GMT + 1. But gmtime() returns me the same time as current_time is. I could not understand why gmtime() is returning me same time. Any help will be appreciated.

    Read the article

  • Using AJAX to return SelectList selected value

    - by Adventure
    At risk of asking the obvious... I need to use AJax.ActionLink to send the current value of a SelectList back to my controller. How do I do that? Below is part of my current View. I need to replace "15" with the current value of the SelectList. <% If Model.ShoppingListNames IsNot Nothing Then%> <%: Html.DropDownList("ShoppingListNames", Model.ShoppingListNames)%> <%: Ajax.ActionLink("Add to List", "AdjustMaterials", "Docs", New With {.userDocId = 15, .prodId = Model.ID, .quantity = 1}, New AjaxOptions With {.OnSuccess = "handleUpdate"})%> <% End If%>

    Read the article

  • Looking for a standard way to manage documents in a WPF application

    - by user322383
    Hi! I'm writing a WPF application that uses one document at a time. Is there any standard way to implement the management of the current document? What I mean are the following functions: New document: if there are not saved changes in the current document, a dialog box opens ('Do you want to save changes to {0}?') with Yes/No/Cancel buttons. If Cancel is hit, the operation stops. Open document: same dialog box as at new document, and an Open dialog opens after Save document: if the current document hasn't been saved, a Save dialog opens Save as: you can imagine... So, is there anything standard in the .NET framework like this or do I have to manually implement it?

    Read the article

  • How to use PHP Time function to set a time variable of '09:30', add a specific amount of seconds and

    - by Henry
    Hi guys, hopefully you can help me here. I have some code (please see below) which takes the current time, then adds specific seconds to the time and re-displays the time 1 minute in the future. Instead of the time being the current time, I want it to be a time which I set - say 9:30. Then I want to be able to add, for example 65 seconds and it shows me 9:31. Please can you show me how to change it from current time, to a specific time I can set myself. Thank you. <?php $my_time = date('h:i:s',time()); $seconds2add = 65; $new_time= strtotime($my_time); $new_time+=$seconds2add; echo date('h:i:s',$new_time); ?>

    Read the article

  • Authenticating model - best practices

    - by zerkms
    I come into ASP.NET from php so the reason why i ask my question is because it's totally different nature of how application works and handles requests. well, i have an exists table with user creditians, such as: id, login, password (sha hashed), email, phone, room i have built custom membership provider so it can handle my own database authentication schema. and now i'm confused, because User.Identity.Name contains only user's login, but not the complete object (i'm using linq2sql to communicate with database and i need in it's User object to work). at php applications i just store user object at some static method at Auth class (or some another), but here at ASP.NET MVC i cannot do this, because static member is shared across all requests and permanent, and not lives within only current request (as it was at php). so my question is: how and where should i retrieve and store linq2sql user object to work with it within current and only current request? (after request processed successfully i expect it will be disposed from memory and on next request will be created again). or i'm following totally wrong way?

    Read the article

< Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >