Search Results

Search found 5155 results on 207 pages for 'max hazard'.

Page 53/207 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • How do I add an object to a binary tree based on the value of a member variable?

    - by Max
    How can I get a specific value from an object? I'm trying to get a value of an instance for eg. ListOfPpl newListOfPpl = new ListOfPpl(id, name, age); Object item = newListOfPpl; How can I get a value of name from an Object item?? Even if it is easy or does not interest you can anyone help me?? Edited: I was trying to build a binary tree contains the node of ListOfPpl, and need to sort it in the lexicographic. Here's my code for insertion on the node. Any clue?? public void insert(Object item){ Node current = root; Node follow = null; if(!isEmpty()){ root = new Node(item, null, null); return; }boolean left = false, right = false; while(current != null){ follow = current; left = false; right = false; //I need to compare and sort it if(item.compareTo(current.getFighter()) < 0){ current = current.getLeft(); left = true; }else { current = current.getRight(); right = true; } }if(left) follow.setLeft(new Node(item, null, null)); else follow.setRight(new Node(item, null, null)); }

    Read the article

  • Collision free hash function for a specific data structure

    - by Max
    Is it possible to create collision free hash function for a data structure with specific properties. The datastructure is int[][][] It contains no duplicates The range of integers that are contained in it is defined. Let's say it's 0..1000, the maximal integer is definitely not greater than 10000. Big problem is that this hash function should also be very fast. Is there a way to create such a hash function? Maybe at run time depending on the integer range?

    Read the article

  • Union results of two functions in php class

    - by Max
    I have php class(simple example): <?php class test{ public function __construct() { //some code } public function __destruct() { //some code } public function echo1 { //some code return 1; } public function echo2 { //some code return 2; } } How could I return results of this two functions echo1 and echo2 in class in one row don't creating two new objects for each function?

    Read the article

  • 2 bucks for !! java basic question

    - by Max
    How can I get a specific value from an object? I'm trying to get a value of an instance for eg. ListOfPpl newListOfPpl = new ListOfPpl(id, name, age); Object item = newListOfPpl; How can I get a value of name from an Object item?? Even if it is easy or does not interest you can anyone help me?? Edited: I was trying to build a binary tree contains the node of ListOfPpl, and need to sort it in the lexicographic. Here's my code for insertion on the node. Any clue?? public void insert(Object item){ Node current = root; Node follow = null; if(!isEmpty()){ root = new Node(item, null, null); return; }boolean left = false, right = false; while(current != null){ follow = current; left = false; right = false; //I need to compare and sort it if(item.compareTo(current.getFighter()) < 0){ current = current.getLeft(); left = true; }else { current = current.getRight(); right = true; } }if(left) follow.setLeft(new Node(item, null, null)); else follow.setRight(new Node(item, null, null)); }

    Read the article

  • What do you do in your source control repository when you start a rewrite of a program?

    - by Max Schmeling
    I wrote an application a while back and have been maintaining it for a while now, but it's gotten to the point where there's several major new features to be added, a ton of changes that need made, and I know quite a few things I could do better, so I'm starting a rewrite of the entire program (using bits and pieces from original). My question is, what do you do with SVN at this point? Should I put the new version somewhere else, or should I delete the files I no longer need, add the new files, and just treat it like normal development in SVN? How have you handled this in the past?

    Read the article

  • Unique visitor counting in ASP.NET MVC

    - by Max
    I'd like to do visitor tracking similar to how stackoverflow does it.. By reading through numerous posts, I've figured out some details already: Count only 1 IP hit per 15 minutes (if anonymous) Count only 1 unique user-Login (per day?) Now that leaves the question of the real implementation.. Should I log the two factors live into a table (and increase count) | IP | timestamp | pageurl | Or do the counting AFTERWARDS (e.g. using IIS log files - which don't include the user, right? I know there're some similar posts outside, but NONE really has a great solution in my opinion yet..

    Read the article

  • Splitting a list based on another list values in Mathematica

    - by Max
    In Mathematica I have a list of point coordinates size = 50; points = Table[{RandomInteger[{0, size}], RandomInteger[{0, size}]}, {i, 1, n}]; and a list of cluster indices these points belong to clusterIndices = {1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1}; what is the easiest way to split the points into two separate lists based on the clusterIndices values?

    Read the article

  • Get with the ajax data into a php file

    - by Max Torstensson
    I'm trying to build a login system with ajax and php. I use a log-view where I then save the data in ajax which brings into my doLogin.php (php file). My problem is that php file should never be any ajax data for when I build it into a class and a function VIEW: public function DoLoginBox() { //inloggning form-tagg... return '<p>&nbsp;</p> <div id="content"> <h1>Login Form</h1> <form id="form1" name="form1" action="Handler/doLogin.php" method="post"> <p> <label for="username">Username: </label> <input type="text" name="username" id="username" /> </p> <p> <label for="password">Password: </label> <input type="password" name="password" id="password" /> </p> <p> <input type="submit" id="login" name="login" /> </p> </form> <div id="message"></div> </div>'; } AJAX: <script type="text/javascript"> $(document).ready(function() { $("#login").click(function() { var action = $("#form1").attr('action'); var form_data = { username: $("#username").val(), password: $("#password").val(), is_ajax: 1 }; $.ajax({ type: "POST", url: action, data: form_data, success: function(response) { if(response == 'success') $("#form1").slideUp('slow', function() { $("#message").html("<p class='success'>You have logged in successfully!</p>"); }); else $("#message").html("<p class='error'>Invalid username and/or password.</p>"); } }); return false; }); }); </script PHP: <?php require_once ("UserHandler.php"); class DoLogingHandler{ public function Login (){ $is_ajax = !empty($_REQUEST['is_ajax']); if(isset($is_ajax) && $is_ajax) { $username = $_REQUEST['username']; $password = $_REQUEST['password']; $UserHandler = new UserHandler(); $UserHandler -> controllDB($username,$password); if($username == 'demo' && $password == 'demo') { echo "success"; } } } } ` $DoLogingHandler = new DoLogingHandler(); $DoLogingHandler-Login(); ?

    Read the article

  • traits in php – any real world examples/best practices?

    - by Max
    Traits have been one of the biggest additions for PHP 5.4. I know the synatax and understand the idea behind traits, like horizontal code re-usage for common stuff like logging, security, caching etc. However, I still dont know yet how I would make use of traits in my projects. Are there any open source projects that already use traits? Any good articles/reading material on how to structure architectures using traits?

    Read the article

  • Moving UITableView row to top of list when selected

    - by Max Kilgore
    I am sure this is an easy thing to do. I am very new to objective C (picked up a job the boss was going to outsource) and could use all the help I can get. Just point me in the right direction here. Basically what I want to set up is this: I have a list of phone numbers that expands to as many rows as needed. I have no problem populating and the list works fine, but I would like for all of the recently selected items in the list to be more easily accessible at the top. So, whenever the user "didSelectRowAtIndexPath", I would like the row to move to the top. I just KNOW this is super simple... but I haven't found the solution yet. No hurry. I am just trying to figure things out on my own. Thanks in advance!

    Read the article

  • How to get password html helper to render password on failed validation

    - by Max Schmeling
    I have a form for creating a new account and it has a password field in it. I'm using view models to pass data to the controller action and back to the form view. When the user enters their details in, and clicks submit, if validation fails and it returns them to the same view passing back in the view model, it won't default the password to what they entered. How can I get it to do this? Or should I even try?

    Read the article

  • Center current record in DataGridView

    - by Max
    When programmatically changing the current record in the DataGridView is it possible to make it in such way that this record would be centered (vertically) in the grid? When I change the current record it is shown either as the top row or as the bottom row. I'd like it to be in the middle. Would this be possible/simpler in WPF?

    Read the article

  • EUpdateError exception not recognized when raised in TDatasetProvider.OnUpdateError. Why?

    - by max
    When I re-throw a EUpdateError exception in the TDatasetProvider.OnUpdateError event, it is not recognized as EUpdateError exception in the catch block. It's only recognized as base Excption. try ... //calls the TDatasetPorvider.OnUpdateError event. myClientDataSet.ApplyUpdates(0); ... except on ex: EUpdateError do begin //never goes here //Evaluate ex.ErrorCode end; on ex: Exception do begin //always goes here //the expression (ex is EUpdateError) returns false; end; end; Hiere is the corresponding .OnUpdateError implementaion: procedure MyDataModule.MyDatasetProviderOnUpdateError(..;E: EUpdateError;...); beign //Here, the expression (E is EUpdateException) returns true; raise E; end; The exception is re-thrown, but as it seems the EUpdateError is transformed into a plain base Execption. Does anybody know, why the class type get lost? I would need that type in order to check the .ErrorCode to know what went wrong and to prepare the proper user message.

    Read the article

  • Can't get syntax correct for dynam. create onclick the ie way.

    - by Max
    I was hoping to keep cross-browser compatibility and afaik this is the only issue so far. .setAttribute("onclick", "return showRapidText("+itemnum+");"); This works PERFECT but I'd like to make it IE compatible by putting it in this syntax .onclick = new Function("fnDisplay_Computers('" + alines[i] + "')"); so... I tried .onclick = new Function("showRapidText('" + itemnum + "')"); and .onclick = new Function("return showRapidText('" + itemnum + "')"); and about 40 other ways but nothing works

    Read the article

  • Extension methods on a static object

    - by Max Malygin
    I know (or so I hear) that writing extension methods for a single stand alone .net class (not an implementation of IEnumerable) is potential code smell. However, for the sake of making the life easier I need to attach a method to the ConfigurationManager class in asp.net. It's a static object so this won't work: public static List<string> GetSupportedDomains(this ConfigurationManager manager) { //the manager needs to be static. } So the question is - is it possible to write an extension method for a static class in .net?

    Read the article

  • JclLastExceptStackListToStrings produces an empty string list

    - by Max
    I've installed JCL into Delphi 2010. In the following code try raise Exception.Create('Error Message'); except on E: Exception do begin ResultStatus := JclLastExceptStackListToStrings(sl, True, True, True, True); end; end; Also I have this call in the initialization section: initialization JclStartExceptionTracking; ResultStatus is false and sl is empty. I have set options to generate map and .jdbg files. Other functions, like ProcByLevel work fine. Is there something else I need to do to make JclLastExceptStackListToStrings work? From JclDebug.pas file: Last modified: $Date:: 2010-09-07 19:43:19 +0200 (mar., 07 sept. 2010) Revision: $Rev:: 3331

    Read the article

  • Display the value of a select list without a button

    - by Max Zeygelshefer
    How can I get the value to be displayed after the selection from the list is made, without the use of a button. I tried to implement an onChange event for the select list, and doing away with the button, but I can't get it to work. I'd like the value (1,2,3) to display below the select box after an option (a,b,c) is selected. <script> function displayResult() { this.nextSibling.nodeValue = document.getElementById("mySelect").value; } </script> <body> <form> <select id="mySelect" style="width:220px"> <option value="1">a</option> <option value="2">b</option> <option value="3">c</option> </select> </form> <button type="button" onclick="displayResult.call(this)">List Locations</button>

    Read the article

  • R: Change the fields' (slots') values of the class assigning a value to some other field

    - by Max Li
    Assgning a value to one field, how can I make the other fields changing. Consider the following R5 class C<-setRefClass("C", fields=list(a="numeric",b="numeric") , methods=list( seta = function(x){ a<<-x b<<-x+10 cat("The change took place!") } ) # end of the methods list ) # end of the class Now create the instance of the class c<-C$new() This command c$seta(10) will result in that c$a is 10 and c$b is 20. So it actually works, however, I want to achieve this result by the command c$a<-10 (i.e. after that I want c$b to be equal to 20 as defined in the class in the logic of seta() function) How can I do it?

    Read the article

  • Sharing base object with inheritance

    - by max
    I have class Base. I'd like to extend its functionality in a class Derived. I was planning to write: class Derived(Base): def __init__(self, base_arg1, base_arg2, derived_arg1, derived_arg2): super().__init__(base_arg1, base_arg2) # ... def derived_method1(self): # ... Sometimes I already have a Base instance, and I want to create a Derived instance based on it, i.e., a Derived instance that shares the Base object (doesn't re-create it from scratch). I thought I could write a static method to do that: b = Base(arg1, arg2) # very large object, expensive to create or copy d = Derived.from_base(b, derived_arg1, derived_arg2) # reuses existing b object but it seems impossible. Either I'm missing a way to make this work, or (more likely) I'm missing a very big reason why it can't be allowed to work. Can someone explain which one it is? [Of course, if I used composition rather than inheritance, this would all be easy to do. But I was hoping to avoid the delegation of all the Base methods to Derived through __getattr__.]

    Read the article

  • SQL Server Memory Manager Changes in Denali

    - by SQLOS Team
    The next version of SQL Server will contain significant changes to the memory manager component.  The memory manager component has been rewritten for Denali.  In the previous versions of SQL Server there were two distinct memory managers.  There was one memory manager which handled allocation sizes of 8k or less and another for greater than 8k.  For Denali there will be one memory manager for all allocation sizes.   The majority of the changes will be transparent to the end user.  However, some changes will be visible to the user.  These are listed below: ·         The ‘max server memory’ configuration option has new lower limits.  Specifically, 32-bit versions of SQL Server will have a lower limit of 64 MB.  The 64-bit versions will have a lower limit of 128 MB. ·         All memory allocations by SQL Server components will observe the ‘max server memory’ configuration option.  In previous SQL versions only the 8k allocations were limited the ‘max server memory’ configuration option.  Allocations larger than 8k weren’t constrained. ·         DMVs which refer to memory manager internals have been modified.  This includes adding or removing columns and changing column names. ·         The memory manager configuration messages in the error log have minor changes. ·         DBCC memorystatus output has been changed. ·         Address Windowing Extensions (AWE) has been deprecated.   In the next blog post I will discuss the changes to the memory manager DMVs in greater detail.  In future blog posts I will discuss the other changes in greater detail.  

    Read the article

  • Integration testing - can it be done right?

    - by Max
    I used TDD as a development style on some projects in the past two years, but I always get stuck on the same point: how can I test the integration of the various parts of my program? What I am currently doing is writing a testcase per class (this is my rule of thumb: a "unit" is a class, and each class has one or more testcases). I try to resolve dependencies by using mocks and stubs and this works really well as each class can be tested independently. After some coding, all important classes are tested. I then "wire" them together using an IoC container. And here I am stuck: How to test if the wiring was successfull and the objects interact the way I want? An example: Think of a web application. There is a controller class which takes an array of ids, uses a repository to fetch the records based on these ids and then iterates over the records and writes them as a string to an outfile. To make it simple, there would be three classes: Controller, Repository, OutfileWriter. Each of them is tested in isolation. What I would do in order to test the "real" application: making the http request (either manually or automated) with some ids from the database and then look in the filesystem if the file was written. Of course this process could be automated, but still: doesn´t that duplicate the test-logic? Is this what is called an "integration test"? In a book i recently read about Unit Testing it seemed to me that integration testing was more of an anti-pattern?

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >