Search Results

Search found 101 results on 5 pages for 'the neo'.

Page 3/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Reconciling a new BindingList into a master BindingList using LINQ

    - by Neo
    I have a seemingly simple problem whereby I wish to reconcile two lists so that an 'old' master list is updated by a 'new' list containing updated elements. Elements are denoted by a key property. These are my requirements: All elements in either list that have the same key results in an assignment of that element from the 'new' list over the original element in the 'old' list only if any properties have changed. Any elements in the 'new' list that have keys not in the 'old' list will be added to the 'old' list. Any elements in the 'old' list that have keys not in the 'new' list will be removed from the 'old' list. I found an equivalent problem here - http://stackoverflow.com/questions/161432/ - but it hasn't really been answered properly. So, I came up with an algorithm to iterate through the old and new lists and perform the reconciliation as per the above. Before anyone asks why I'm not just replacing the old list object with the new list object in its entirety, it's for presentation purposes - this is a BindingList bound to a grid on a GUI and I need to prevent refresh artifacts such as blinking, scrollbars moving, etc. So the list object must remain the same, only its updated elements changed. Another thing to note is that the objects in the 'new' list, even if the key is the same and all the properties are the same, are completely different instances to the equivalent objects in the 'old' list, so copying references is not an option. Below is what I've come up with so far - it's a generic extension method for a BindingList. I've put comments in to demonstrate what I'm trying to do. public static class BindingListExtension { public static void Reconcile<T>(this BindingList<T> left, BindingList<T> right, string key) { PropertyInfo piKey = typeof(T).GetProperty(key); // Go through each item in the new list in order to find all updated and new elements foreach (T newObj in right) { // First, find an object in the new list that shares its key with an object in the old list T oldObj = left.First(call => piKey.GetValue(call, null).Equals(piKey.GetValue(newObj, null))); if (oldObj != null) { // An object in each list was found with the same key, so now check to see if any properties have changed and // if any have, then assign the object from the new list over the top of the equivalent element in the old list foreach (PropertyInfo pi in typeof(T).GetProperties()) { if (!pi.GetValue(oldObj, null).Equals(pi.GetValue(newObj, null))) { left[left.IndexOf(oldObj)] = newObj; break; } } } else { // The object in the new list is brand new (has a new key), so add it to the old list left.Add(newObj); } } // Now, go through each item in the old list to find all elements with keys no longer in the new list foreach (T oldObj in left) { // Look for an element in the new list with a key matching an element in the old list if (right.First(call => piKey.GetValue(call, null).Equals(piKey.GetValue(oldObj, null))) == null) { // A matching element cannot be found in the new list, so remove the item from the old list left.Remove(oldObj); } } } } It can be called like this: _oldBindingList.Reconcile(newBindingList, "MyKey") However, I'm looking for perhaps a method of doing the same using LINQ type methods such as GroupJoin<, Join<, Select<, SelectMany<, Intersect<, etc. So far, the problem I've had is that each of these LINQ type methods result in brand new intermediary lists (as a return value) and really, I only want to modify the existing list for all the above reasons. If anyone can help with this, would be most appreciated. If not, no worries, the above method (as it were) will suffice for now. Thanks, Jason

    Read the article

  • ASP.Net Web API Routing fails when api is created as a web application under another asp.net site in IIS

    - by neo
    I developed a rest api using ASP.net web api. When I deploy this rest api on iis, I need to create it as a web application under an asp.net web site. When I was deploying the rest api as a new web site in iis, then things worked fine. I was using the following Route api/{controller}/{id}. When I created the rest api as a web application underneath asp.net web site project, I named the web application as api. I can't access the api methods now. Can someone point what I do wrong?

    Read the article

  • Logging Application Block doesn't add log entries to Event Viewer on machines other than that on whi

    - by Neo
    I am using the Logging Application Block (of Microsoft Enterprise Library 5.0) to log exceptions in the Event Viewer that occur in my WPF XBAP application. However, exceptions are only being logged if the application is run on my machine (the machine it was built on). Any other machine it doesn't log anything. I've tried to find a reason why this might be occurring - I've tried setting requirePermission to false - but to no avail. Anyone any ideas on why this might be happening?

    Read the article

  • Library to edit odt documents in php

    - by neo
    I try to edit ODT-documents programmaticly in PHP. In fact I just want to do some text replacement and adding new rows in a table. I know that a normal ODF document is an archive containing XML-files. But before I reinvent the wheel: is there any library which does most of the tasks? Or should I just parse the XML-file in a DOM-parser and modify it?

    Read the article

  • Connect to MySQL via PHP script tunnel

    - by Neo
    Here's the question, I need to connect to a remote MySQL database from my C# Application, problem is the MySQL instance will block all access to all IP's apart from localhost, this can not be changed as its too much of a security issue. The question is, is it possible to connect via a tunnel instead to a php script hosted on the server, this would then act as the mysql connection. Any ideas and suggestions?

    Read the article

  • Having trouble uploading a file

    - by neo skosana
    Hi I am having trouble uploading a file. First of all I have a class: class upload { private $name; private $document; public function __construct($nme,$doc) { $this->setName($nme); $this->setDocument($doc); } public function setName($nme) { $this->name = $nme; } public function setDocument($doc) { $this->document = $doc; } public function fileNotPdf() { /* Was the file a PDF? */ if ($this->document['type'] != "application/pdf") { return true; } else { return false; } } public function fileNotUploaded() { /* Make sure that the file was POSTed. */ if (!(is_uploaded_file($this->document['tmp_name']))) { return true; } else { return false; } } public function fileNotMoved($repositry) { /* move uploaded file to final destination. */ $result = move_uploaded_file($this->document['tmp_name'], "$repositry/$this->name.pdf"); if($result) { return false; } else { return true; } } } Now for my main page: $docName = $_POST['name']; $page = $_FILES['doc']; if($_POST['submit']) { /* Set a few constants */ $filerepository = "np"; $uploadObj = new upload($docName, $page); if($uploadObj->fileNotUploaded()) { promptUser("There was a problem uploading the file.",""); } elseif($uploadObj->fileNotPdf()) { promptUser("File must be in pdf format.",""); } elseif($uploadObj->fileNotMoved($filerepository)) { promptUser("File could not be uploaded to final destination.",""); } else { promptUser("File has been successfully uploaded.",""); } } The errors that I get: Warning: move_uploaded_file(about.pdf)[function.move-uploaded-file]: failed to open stream: No such file or directory in... Warning: move_uploaded_file()[function.move-uploaded-file]: Unable to move 'c:\xampp\tmp\php13.tmp' to 'about.pdf' in... File could not be uploaded to final destination.

    Read the article

  • mysql stored procedures using php

    - by neo skosana
    I have a stored procedure: delimiter // create procedure userlogin(in eml varchar(50)) begin select * from users where email = eml; end// delimiter ; And the php: $db = new mysqli("localhost","root","","houseDB"); $eml = "[email protected]"; $sql = $db-query("CALL userlogin('$eml')"); $result = $sql-fetch_array(); The error that I get from the browser when I run the php script: Fatal error: Call to a member function fetch_array() on a non-object... I am using phpmyadmin version 3.2.4 and mysql client version 5.1.41. Please help. Thank you.

    Read the article

  • mysql data read returning 0 rows from class

    - by Neo
    I am implementing a database manager class within my app, mainly because there are 3 databases to connect to one being a local one. However the return function isn't working, I know the query brings back rows but when it is returned by the class it has 0. What am I missing? public MySqlDataReader localfetchrows(string query, List<MySqlParameter> dbparams = null) { using (var conn = connectLocal()) { Console.WriteLine("Connecting local : " + conn.ServerVersion); MySqlCommand sql = conn.CreateCommand(); sql.CommandText = query; if (dbparams != null) { if (dbparams.Count > 0) { sql.Parameters.AddRange(dbparams.ToArray()); } } MySqlDataReader reader = sql.ExecuteReader(); Console.WriteLine("Reading data : " + reader.HasRows + reader.FieldCount); return reader; /* using (MySqlCommand sql = conn.CreateCommand()) { sql.CommandText = query; if (dbparams != null) { if (dbparams.Count > 0) { sql.Parameters.AddRange(dbparams.ToArray()); } } MySqlDataReader reader = sql.ExecuteReader(); Console.WriteLine("Reading data : " + reader.HasRows + reader.FieldCount); sql.Parameters.Clear(); return reader; }*/ } } And the code to get the results query = @"SELECT jobtypeid, title FROM jobtypes WHERE active = 'Y' ORDER BY title ASC"; //parentfrm.jobtypes = db.localfetchrows(query); var rows = db.localfetchrows(query); Console.WriteLine("Reading data : " + rows.HasRows + rows.FieldCount); while (rows.Read()){ } These scripts return the following : Connecting local : 5.5.16 Reading data : True2 Reading data : False0

    Read the article

  • rewrite all requests from one folder to a parent folder htaccess

    - by Neo
    This one has me stumped, I need to re-write all requests to the javascript folder (js) to a special library handler system. e.g. rewrite http://localhost/admin/js/bar.js --> http://localhost/_lib/=admin/js/bar.js Any ideas? I have tried the following which creates an error RewriteCond %{REQUEST_URI} ^(.*)$ RewriteRule ^(.*)$ /%1/_lib/$1 [NC] (36)File name to long: cannot map GET /admin/js/bar.js to file

    Read the article

  • How to find same-value rectangular areas of a given size in a matrix most efficiently?

    - by neo
    My problem is very simple but I haven't found an efficient implementation yet. Suppose there is a matrix A like this: 0 0 0 0 0 0 0 4 4 2 2 2 0 0 4 4 2 2 2 0 0 0 0 2 2 2 1 1 0 0 0 0 0 1 1 Now I want to find all starting positions of rectangular areas in this matrix which have a given size. An area is a subset of A where all numbers are the same. Let's say width=2 and height=3. There are 3 areas which have this size: 2 2 2 2 0 0 2 2 2 2 0 0 2 2 2 2 0 0 The result of the function call would be a list of starting positions (x,y starting with 0) of those areas. List((2,1),(3,1),(5,0)) The following is my current implementation. "Areas" are called "surfaces" here. case class Dimension2D(width: Int, height: Int) case class Position2D(x: Int, y: Int) def findFlatSurfaces(matrix: Array[Array[Int]], surfaceSize: Dimension2D): List[Position2D] = { val matrixWidth = matrix.length val matrixHeight = matrix(0).length var resultPositions: List[Position2D] = Nil for (y <- 0 to matrixHeight - surfaceSize.height) { var x = 0 while (x <= matrixWidth - surfaceSize.width) { val topLeft = matrix(x)(y) val topRight = matrix(x + surfaceSize.width - 1)(y) val bottomLeft = matrix(x)(y + surfaceSize.height - 1) val bottomRight = matrix(x + surfaceSize.width - 1)(y + surfaceSize.height - 1) // investigate further if corners are equal if (topLeft == bottomLeft && topLeft == topRight && topLeft == bottomRight) { breakable { for (sx <- x until x + surfaceSize.width; sy <- y until y + surfaceSize.height) { if (matrix(sx)(sy) != topLeft) { x = if (x == sx) sx + 1 else sx break } } // found one! resultPositions ::= Position2D(x, y) x += 1 } } else if (topRight != bottomRight) { // can skip x a bit as there won't be a valid match in current row in this area x += surfaceSize.width } else { x += 1 } } } return resultPositions } I already tried to include some optimizations in it but I am sure that there are far better solutions. Is there a matlab function existing for it which I could port? I'm also wondering whether this problem has its own name as I didn't exactly know what to google for. Thanks for thinking about it! I'm excited to see your proposals or solutions :)

    Read the article

  • Does this e-mail-regex exclude valid addresses?

    - by neo
    I tried to create a regular expression which catches all RFC-valid addresses but it's ok if some false-positives come through (though hopefully not so many). This is waht I came up so far: /^\b\S+@\S+\.[^\s@]{2,}\b$/ Is there any RFC-valid address which doesn't match against this expression or do you have any suggestions to improve it? I don't mind the false positives but I would be glad if you show me a few, too.

    Read the article

  • implement multithreading

    - by Neo
    how to to implement multithreading where one thread updating UI and other one is reading the database record in windows application Any guidelines really appreciated...

    Read the article

  • Create SQL parameters programmatically

    - by Neo
    Another annoying one for me but probably something simple. I have a number of possible where clauses for a query based on user input, my question is how can I add these programmatically? For instance: wherequery = @"WHERE fieldname = @p_FieldName AND "; if (txtValue.textLength > 0){ wherequery += "fieldname2 = @p_FieldName2 AND "; } query = @"SELECT * FROM tabe" + wherequery; sql = connection.CreateCommand(); sql.CommandText = query; How would I go about doing the parameters for that? I've tried ArrayLists, Dictionaries and a few other methods but can't find a way of doing it. Ideally I'd want to do something like this: SqlParameter[] sqlparams; wherequery = @"WHERE fieldname = @p_FieldName AND "; if (txtValue.textLength > 0){ wherequery += "fieldname2 = @p_FieldName2 AND "; sqlparams.Parameters.Add("@p_FieldName2 ", SqlDbType.VarChar).Value = txtValue.text; } query = @"SELECT * FROM tabe" + wherequery; sql = connection.CreateCommand(); sql.CommandText = query; sql.Parameters.Add(sqlparams);

    Read the article

  • PHP __call vs method_exists

    - by neo
    The Project I'm working on contains something like a wrapper for call_user_func(_array) which does some checks before execution. One of those checks is method_exists (In Case the supplied first argument is an instance of a class and the second is a method name) The other is_callable. The function will throw an exception if one of those checks fails. My Code contains an array with function names (setFoo, setBar, etc.) and the php magic function for overloading (__call) which handles setting, replacing and deletion of certain variables (better certain array elements). The Problem: method_exists will return false if the function is not defined. Do I have any chance to get a true if the __call function does proper handling of the request?

    Read the article

  • How to transfer large file (File size > Heap Size) over the network?

    - by neo
    How to transfer large file (File size Heap/RAM Size) over the network ? Lets say I have file (size 10GB) I want to transfer it machine a (RAM 512mb) to machine b (RAM 512mb). Want achieve this using java code. First, is it possible ? Any recommendation on framework. If possible, can we speed this up using threading ? Important criteria: file's data sequence needs to be maintained during transfer. Any example will be great help.

    Read the article

  • I having a problem with the mysqli free() member function

    - by neo skosana
    Hi I have code where I connected to the database like so: $db = new mysqli("localhost", "user", "pass", "company"); Now when I query the database like so: //query calls to a stored procedure 'user_info' $result = $db->query("CALL user_info('$instruc', 'c_register', '$eml', '$pass', '')"); //I use the $result This query works well. Now when I try and free that result like so: $result->free(); or $result->close(); It seems like it doesn't do anything because $result is still set. When I try to run another query it gives me this error: Fatal error: Call to a member function fetch_array() on a non-object in... For me to run this other query I have to close the db conection and connect again, then it will work. I want to know if there is a way I could run the other query without having to disconnect and reconnect to the database. thanks in advance.

    Read the article

  • Netbook Wifi activation in OSX/Linux

    - by Klaus
    Hello, I bought a almost no-name netbook (chiligreen netbook neo), and I'm trying to have OSX86 working on it. No problem with the installation, but to activate wifi one must use Fn+F3. Of course it works with Windows, but neither in OSX or Ubuntu... Any idea ? A manual way to do something like http://greg.geekmind.org/eee-control/ ?

    Read the article

  • Wifi Snooping over phone

    - by pulsarjune
    I connect to the wifi acccess-point at work, but recently I suspect that data on my phone is being snooped-out from my phone connected to my office's Wifi network. [Phone Model: Sony Ericsson Xperia Neo V, Android v2.3; Wifi accespoint: Belkin G] How can i check my suspicion? Or What are the ways i could get over them? (obviously i want to stay connected to the wifi n/w) Any thoughts on these points?

    Read the article

  • Cursor freezes for 5 secs every now and then

    - by user20560
    I've installed Ubuntu 11.04 (64bit) on my new Thinkpad Edge 11 laptop from Lenovo with the following specs: Processor type AMD Athlon II Neo Processor Speed 1.8 GHz Memory Type DDR3 SDRAM RAM 2048 MB Hard Drive Type HDD Harddisk 250 GB Grafic processor ATI Mobility Radeon HD 6310 Ubuntu has found all my hardware and it works perfectly. I have one irritating problem though: From time to time (sometimes every minute, other times every hour)the cursor freezes for about 5 sec. This happens independently from the number of processes running on the laptop. It's only the cursor that freezes - I can still tab between windows and use the keyboard. I've installed GPointingDeviceSettings, activating the trackpoint, which btw works perfectly. Also I have installed the ATI Catalyst proprietary display driver. Anyone has an idea of whats wrong? Thank you in advance Best regards, Jens

    Read the article

  • Output the total number of String Characters [migrated]

    - by Programmerwannabe
    My Question is what method should I use if I wanted to get the total number of characters a user inputs? without using arrays, i tried using .length() but it did not return all characters say from the first and lastname, it only returned the first name. Here's an example of my code. (Please dont laugh im really new in programming :) ) System.out.print("Enter your first and last name: "); String yourName = keyboard.next(); System.out.println("Your name has a total of " + yourName.length() + " numbers"); what happened was if i enter say "Neo Matrix" it would only return 3. I appreciate any help. thank you!

    Read the article

  • ATI Driver for HP Pavilion dv2 notebook?

    - by Greg Mattes
    I'm looking for a Windows XP Professional (32-bit) ATI video driver for an HP Pavilion dv2 (model 1118nr). I've downloaded and run several drivers packages, but none have worked so far. The notebook has a sticker on it that reads, "ATI Radeon Premium Graphics 3000 Series" The notebook has an AMD Athlon Neo 64 CPU and it came with Vista 64, but I have a requirement to run 32-bit Windows XP. Does such a driver exist, and if so, where is it? I've tried the AMD ATI graphics drivers portal, but the "Mobility Radeon" section does not list the 3000 series. The "Radeon" section does list the 3000 series, but the package I downloaded and installed from there was not helpful. I also selected "All Graphics - Notebook" on the "Search Drivers and Downloads" page, then selected "Windows XP Professional/Home" on the OS drop down, pressed "Submit", and downloaded and installed the only choice (this single choice is listed twice), but again, it didn't seem to help.

    Read the article

  • Configuring NAT and static IP on Cisco 877W

    - by David M Williams
    Hi all, I'm having trouble setting up a static IP reservation on a network. What I want to do is assign IP 192.168.1.105 to MAC address 00:21:5d:2f:58:04 and then port forward 35394 to it. If it helps, output from show ver says Cisco IOS software, C870 software (C870-ADVSECURITYK9-M), version 12.4(4)T7, release software (fc1) ROM: System bootstrap, version 12.3(8r)YI4, release software I have done this - service dhcp ip routing ip dhcp excluded-address 192.168.1.1 192.168.1.99 ip dhcp excluded-address 192.168.1.200 192.168.1.255 ip dhcp pool ClientDHCP network 192.168.1.0 255.255.255.0 default-router 192.168.1.1 dns-server 192.168.1.1 lease 7 ip dhcp pool NEO host 192.168.1.105 255.255.255.0 hardware-address 0021.5D2F.5804 ip nat inside source static tcp 192.168.1.105 35394 <PUBLIC_IP> 35394 extendable However, the machine is getting assigned IP address 192.168.1.101 not .105 ... any suggestions? Thanks !

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >