Search Results

Search found 21097 results on 844 pages for 'check snmp'.

Page 61/844 | < Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >

  • fastest way to check to see if a certain index in a linq statement is null

    - by tehdoommarine
    Basic Details I have a linq statement that grabs some records from a database and puts them in a System.Linq.Enumerable: var someRecords = someRepoAttachedToDatabase.Where(p=>true); Suppose this grabs tons (25k+) of records, and i need to perform operations on all of them. to speed things up, I have to decided to use paging and perform the operations needed in blocks of 100 instead of all of the records at the same time. The Question The line in question is the line where I count the number of records in the subset to see if we are on the last page; if the number of records in subset is less than the size of paging - then that means there are no more records left. What I would like to know is what is the fastest way to do this? Code in Question int pageSize = 100; bool moreData = true; int currentPage = 1; while (moreData) { var subsetOfRecords = someRecords.Skip((currentPage - 1) * pageSize).Take(pageSize); //this is also a System.Linq.Enumerable if (subsetOfRecords.Count() < pageSize){ moreData = false;} //line in question //do stuff to records in subset currentPage++; } Things I Have Considered subsetOfRecords.Count() < pageSize subsetOfRecords.ElementAt(pageSize - 1) == null (causes out of bounds exception - can catch exception and set moreData to false there) Converting subsetOfRecords to an array (converting someRecords to an array will not work due to the way subsetOfRecords is declared - but I am open to changing it) I'm sure there are plenty of other ideas that I have missed.

    Read the article

  • check for several conditions when a user logs in

    - by paul
    I would like to accomplish the following: If a username or password field is null, notify the user. If user name already exists, do not insert into the database and notify user to create a different name. if the username is unique and password is not null, return the username to the user. As of now it always returns "Please enter a different user name." I believe the issue has to do with the database query but I am not sure. If anyone can have a look and see if I am making an error, I greatly appreciate it, thanks. if ($userName or $userPassword = null) { echo "Please enter a user name and password or return to the homepage."; } elseif (mysql_num_rows(mysql_query("SELECT count(userName) FROM logininfo WHERE userName = '$userName'")) ==1) { echo "Please enter a different user name."; } elseif ($userName and $userPassword != null) { echo "Your login name is: $userName"; }

    Read the article

  • Implementing a Version check between an Abstract class and it's implementation

    - by Michael Stum
    I have this abstract class and concrete implementation (they are in different assemblies): public abstract class MyAbstractClass { private static readonly int MyAbstractClassVersion = 1; public abstract int ImplementedVersion { get; } protected MyAbstractClass() { CheckVersion(); } private void CheckVersion() { var message = string.Format( "MyAbstractClass implements Version {0}, concrete is Version {1}", RepositoryVersion, ImplementedVersion); if (!MyAbstractClassVersion.Equals(ImplementedVersion)) throw new InvalidOperationException(message); } } public class ConcreteClass : MyAbstractClass { public ConcreteClass() : base() { // ConcreteClass is guaranteed to have // a constructor that calls the base constructor // I just simplified the example } public override int ImplementedVersion { get { return 2; } } } As you see, I call CheckVersion() from the abstract constructor, to get rid of the "virtual member call in base constructor" message, but I am not sure if that's really the way to do it. Sure, it works, but that doesn't mean it will always work, will it? Also, I wonder if I can get the name of the Concrete Type from the CheckVersion() function? I know that adding new abstract members will force an error anyway (System.TypeLoadException) and I'm not sure if I want this type of strict Versioning, but I'm just curious how it would be done properly given only the abstract class and an implementation (I know I could do it by using interfaces and/or a Factory pattern).

    Read the article

  • Select statement to check multiple rows against 2 variables

    - by Duncan Cook
    I have the following table : alertID inspectorID datelive dateread 1 none 2012-11-06 10:36:03.350 NULL 2 none 2012-11-06 10:36:25.043 NULL 3 none 2012-11-06 10:36:42.433 NULL 1 31030 2012-11-06 10:37:19.193 2012-06-11 10:34:47.000 I want to select the alerts that dont have the inspectors ID against it AND where the alert ID doenst match the one that has the inspectorID against it, ie inspector has read alert 1 so i only want it to return alerts 2 & 3 Am using Classic ASP and MS-SQL Cheers

    Read the article

  • Zend Namespace - Check if Session Exists

    - by Vincent
    All, I am using Zend Framework and Zend_Session to do global session management for my application. I plan to clear all sessions on logout and hence am using the following code: if($this->sessionExists()) { $this->destroy(); } But it seems like it's not doing a good job.. I am getting an error: PHP Warning: session_destroy() [<a href='function.session-destroy'> function.session-destroy</a>]: Trying to destroy uninitialized session How can I get rid of this error? Is there an alternative to sessionExists()?

    Read the article

  • Check if string is serialized in PHP

    - by Industrial
    Hi everyone, I am in the middle of building a cache layer for the Redis DB to my application and I have come to the point where's it's about to take care of arrays. I wonder if there's any good (high performance!) way of controlling an string to be serialized or not with PHP? Thanks a lot!

    Read the article

  • Check if the Form was Shown

    - by serhio
    .NET2 I have a panelChild that is on the panelParent that is in the Form1. When panelParent_Resizes panelChild does a panelChild_HeavyOperation. panelParent rezizes multiple times in InitializeComponent of Form1 and consume a lot of time because of panelChild_HeavyOperation. I decided to reduce the panelChild_HeavyOperation only when the Form1 is shown and has a defined size. by eg. like this: Sub panelChild_HeavyOperation If not FindForm().IsShown then Reuturn ' .... ' End Sub The problem is that IsShown does not exist on a Form...

    Read the article

  • How to Check Authenticity of an AJAX Request

    - by Alex Reisner
    I am designing a web site in which users solve puzzles as quickly as they can. JavaScript is used to time each puzzle, and the number of milliseconds is sent to the server via AJAX when the puzzle is completed. How can I ensure that the time received by the server was not forged by the user? I don't think a session-based authenticity token (the kind used for forms in Rails) is sufficient because I need to authenticate the source of a value, not just the legitimacy of the request. Is there a way to cryptographically sign the request? I can't think of anything that couldn't be duplicated by a hacker. Is any JavaScript, by its exposed, client-side nature, subject to tampering? Am I going to have to use something that gets compiled, like Flash? (Yikes.) Or is there some way to hide a secret key? Or something else I haven't thought of? Update: To clarify, I don't want to penalize people with slow network connections (and network speed should be considered inconsistent), so the timing needs to be 100% client-side (the timer starts only when we know the user can see the puzzle). Also, there is money involved so no amount of "trusting the user" is acceptable.

    Read the article

  • check if sqlserver is installed on a machine thro C#

    - by Skun
    Hey ! I am making an application which is a user interface to access 2 types of databases - SQLite and MSSQL server. The thing is, SQLite doesnt need to be "installed" since its just a flatfile database, but on the other hand, SQLserver (Express/normal) need to be installed before use. My Question is simple: Is there a way by which i can find out if an instance of SQLserver has been installed on the local machine by using a C# program?

    Read the article

  • writing a shell script if statement to check for directory

    - by user1553248
    I need to write a script that will recreate my opt folder if it gets deleted when I remove a package from it. Here's a link to my previous post: dpkg remove to stop processes Now, the issue I'm running into could be better described here: http://lists.debian.org/debian-devel/2006/03/msg00242.html I was thinking of just adding a postrem script which checks if an opt directory exists, and if not, creates one. My experience with shell scripts is pretty limited though..

    Read the article

  • Multiple dropdowns, combination check and filter

    - by Tom
    Using Javascript / jQuery, I'm trying to build a "combination checker" that will take the values of three (but can be more) dropdown lists and filter the options based on a supplied list of allowed combinations. For example: DROPDOWNS Field 1: - value_1 - value_2 Field 2: - value_3 Field 3: - value_4 - value_5 COMBINATIONS - value_1, value_3, value_5 - value_1, value_3, value_4 - value_2, value_3, value_5 When a user selects Field 3 - value_4, the unavailable options will be disabled - ie, Field 1 - value_2 (there is no combination that allows value_2 and value_4 to be selected together). It would be really great if someone could provide some pointers on how this can be achieved or just provide a fresh perspective - I'm going round in circles on this one!

    Read the article

  • jQuery: Hide/Display tabs (and its corresponding content) with check boxes

    - by Ricardo
    Hello, Well, this must be very simple to do for most of you, but I have no idea how to accomplish this. I have a set of tabs and on top of the tabs is a set of checkboxes ; each checkbox 'corresponds' to a tab. What I need is to be able to activate/deactivate each checkbox and have its corresponding tab (and the tab's content) hide/display. Here's my HTML: <div class="show-results-from"> <ul> <li>See results from:</li> <li> <label> <input type="checkbox" name="a" id="a"> Products &amp; Services <span>(16)</span></label> </li> <li> <label> <input type="checkbox" name="b" id="b"> Publications <span>(9)</span></label> </li> <li> <label> <input type="checkbox" name="c" id="c"> Other <span>(150)</span></label> </li> </ul> </div> <ul class="tabs"> <li><span rel="tabs1" class="defaulttab">Products &amp; Services</span></li> <li><span rel="tabs2">Publications</span></li> <li><span rel="tabs3">Other</span></li> </ul> <div class="tab-content" id="tabs1">content</div> <div class="tab-content" id="tabs2">content</div> <div class="tab-content" id="tabs3">content</div> Any help with this is greatly appreciated.

    Read the article

  • C# Check for missing number in sequence

    - by Jon
    I have an List<int> which contains 1,2,4,7,9 for example. I have a range from 0 to 10. Is there a way to determine what numbers are missing in that sequence? I thought LINQ might provide an option but I can't see one In the real world my List could contain 100,000 items so performance is key

    Read the article

  • Using macro to check null values

    - by poliron
    My C code contains many functions with pointers to different structs as parameters which shouldn't be NULL pointers. To make my code more readable, I decided to replace this code: if(arg1==NULL || arg2==NULL || arg3==NULL...) { return SOME_ERROR; } With that macro: NULL_CHECK(arg1,arg2,...) How should I write it, if the number of args is unknown and they can point to different structs?(I work in C99)

    Read the article

< Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >