Search Results

Search found 1056 results on 43 pages for 'richard chevre'.

Page 32/43 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Will array_unique work also with array of objects?

    - by Richard Knop
    Is there a better way than using array-walk in combination with unserialize? I have two arrays which contain objects. The objects can be same or can be different. I want to merge both arrays and keep only unique objects. This seems to me like a very long solution for something so trivial. Is there any other way? class Dummy { private $name; public function __construct($theName) {$this->name=$theName;} } $arr = array(); $arr[] = new Dummy('Dummy 1'); $arr[] = new Dummy('Dummy 2'); $arr[] = new Dummy('Dummy 3'); $arr2 = array(); $arr2[] = new Dummy('Dummy 1'); $arr2[] = new Dummy('Dummy 2'); $arr2[] = new Dummy('Dummy 3'); function serializeArrayWalk(&$item) { $item = serialize($item); } function unSerializeArrayWalk(&$item) { $item = unserialize($item); } $finalArr = array_merge($arr, $arr2); array_walk($finalArr, 'serializeArrayWalk'); $finalArr = array_unique($finalArr); array_walk($finalArr, 'unSerializeArrayWalk'); var_dump($finalArr);

    Read the article

  • How to split and join array in C++?

    - by Richard Knop
    I have a byte array like this: lzo_bytep out; // my byte array size_t uncompressedImageSize = 921600; out = (lzo_bytep) malloc((uncompressedImageSize + uncompressedImageSize / 16 + 64 + 3)); wrkmem = (lzo_voidp) malloc(LZO1X_1_MEM_COMPRESS); // Now the byte array has 802270 bytes r = lzo1x_1_compress(imageData, uncompressedImageSize, out, &out_len, wrkmem); How can I split it into smaller parts under 65,535 bytes (the byte array is one large packet which I want to sent over UDP which has upper limit 65,535 bytes) and then join those small chunks back into a continuous array?

    Read the article

  • How to delete a Dictionary row that is a Double by using an Int?

    - by Richard Reddy
    Hi, I have a Dictionary object that is formed using a double as its key values. It looks like this: Dictionary<double, ClassName> VariableName = new Dictionary<double, ClassName>(); For my project I have to have the key as the double as I require values like 1.1,1.2,2.1,2.2,etc in my system. Everything in my system works great except when I want to delete all the keys in a group eg all the 1 values would be 1.1,1.2, etc. I can delete rows if I know the full value of the key eg 1.1 but in my system I will only know the whole number. I tried to do the following but get an error: DictionaryVariable.Remove(j => Convert.ToInt16(j.Key) == rowToEdit).OrderByDescending(j => j.Key); Is there anyway to remove all rows per int value by converting the key? Thanks, Rich

    Read the article

  • What are the requirements of a collection type when model binding?

    - by Richard Ev
    I have been reviewing model binding with collections, specifically going through this article http://weblogs.asp.net/nmarun/archive/2010/03/13/asp-net-mvc-2-model-binding-for-a-collection.aspx However, the model I would like to use in my code does not implement collections using generic lists. Instead it uses its own collection classes, which inherit from a custom generic collection base class, the declaration of which is public abstract class CollectionBase<T> : IEnumerable<T> The collections in my POSTed action method are all non-null, but contain no elements. Can anyone advise?

    Read the article

  • Linux: programatically setting a permanent environment variable

    - by Richard
    Hello All, I am writing a little install script for some software. All it does is unpack a target tar, and then i want to permanently set some environment variables - principally the location of the unpacked libs and updating $PATH. Do I need to programmatically edit the .bashrc file, adding the appropriate entries to the end for example, or is there another way? What's standard practice? Thanks

    Read the article

  • Messaging in local network with .NET

    - by Richard
    Hi All, I need to implement some form of communication mechanism in my application, to send notifications/messages from one application instance to all the others. This is a normal scenario where someone adds and item or deletes and item and you want to notify other users that this has happened. The application runs on the client and connects to a database on the local network. So its not like all clients access a server instance of the application. So from what I know I could use MessageQueues or some form of Database polling where I have a table that stores all the messages (not ideal). Issue is I need to implement this very quickly, so sadly can't go very complex but need the quickest easiest solution. thanks for the help!

    Read the article

  • Need data on disk drive management by OS: getting base I/O unit size, “sync” option, Direct Memory A

    - by Richard T
    Hello All, I want to ensure I have done all I can to configure a system's disks for serious database use. The three areas I know of (any others?) to be concerned about are: I/O size: the database engine and disk's native size should either match, or the database's native I/O size should be a multiple of the disk's native I/O size. Disks that are capable of Direct Memory Access (eg. IDE) should be configured for it. When a disk says it has written data persistently, it must be so! No keeping it in cache and lying about it. I have been looking for information on how to ensure these are so for CENTOS and Ubuntu, but can't seem to find anything at all! I want to be able to check these things and change them if needed. Any and all input appreciated.

    Read the article

  • Jquery - Change Background position on 1st click, reset on the 2nd.

    - by Richard
    Evening all! I have half a script that I need to change the CSS background position of an element when it is clicked - this works fine. However I need the CSS to reset the background position to 0 0 on the 2nd click; Help much appreciated! $(document).ready(function(){ $('#login-btn').click(function(){ $('#login-btn').css('backgroundPosition', '0px -39px'); }, function(){ $('$login-btn').css('backgroundPosition', '0px 0px'); }); });

    Read the article

  • Using enums in Java across multiple classes

    - by Richard Mar.
    I have the following class: public class Card { public enum Suit { SPACES, HEARTS, DIAMONDS, CLUBS }; public Card(Suit nsuit, int nrank) { suit = nsuit; rank = nrank; } private Suit suit; private int rank; } I want to instantiate it in another class, but that class doesn't understand the Suit enum. Where should I put the enum to make it publicly visible?

    Read the article

  • "Proxying" HTTP requests

    - by Richard
    Hi all, I have some software which runs as a black box, I have no access to it. This software makes HTTP requests. What I want to do is intercept these requests, forward them on, catch the response, do something with it, before passing the response back to the software. Can this be done? What's the best method? Thanks

    Read the article

  • Cascading MVC controllers with CatchAll Routes

    - by Richard
    Hi, I have an MVC app which has its routes defined with the final route being a catch all route to a "PageController" for a database driven collection of pages. What I want to achieve is to be able to plugin to the app a second controller to the catch all route which the first controller passes on to if it does not find the url recieved in the database. Effectively I want to queue up controllers with catch all actions: public ActionResult PageCatchall(string url) { var page = repository.Get<Page>(string url); if (page != null) { // Handle the request return View(page) } // Otherwise pass to a new controller ???? } Anyone have any good ideas as to how to solve this? I have tried RedirectToAction but that requires that the next controller has a different route to the action. I have tried ActionInvoker but this failed to work the way I did it.

    Read the article

  • How to profiling my C++ application on linux

    - by richard
    HI, I would like to profile my c++ application on linux. I would like to find out how much time my application spent on CPU processing vs time spent on block by IO/being idle. I know there is a profile tool call valgrind on linux. But it breaks down time spent on each method, and it does not give me an overall picture of how much time spent on CPU processing vs idle? Or is there a way to do that with valgrind. Thank you.

    Read the article

  • Unset array element inside a foreach loop

    - by Richard Knop
    So here is my code: <?php $arr = array(array(2 => 5), array(3 => 4), array(7 => 10)); foreach ($arr as $v) { $k = key($v); if ($k > 5) { // unset this element from $arr array } } print_r($arr); // now I would like to get the array without array(7 => 10) member As you can see, I start with an array of sinwgle key = value arrays, I loop thorugh this array and get a key of the current element (which is a single item array). I need to unset elements of the array with key higher than 5, how could I do that? I might also need to remove elements with value less than 50 or any other condition. Basically I need to be able to get a key of the current array item which is itself an array with a single item.

    Read the article

  • How to profile my C++ application on linux

    - by richard
    HI, I would like to profile my c++ application on linux. I would like to find out how much time my application spent on CPU processing vs time spent on block by IO/being idle. I know there is a profile tool call valgrind on linux. But it breaks down time spent on each method, and it does not give me an overall picture of how much time spent on CPU processing vs idle? Or is there a way to do that with valgrind. Thank you.

    Read the article

  • Setting MySQL column names

    - by Richard Mar.
    Say I have these tables: people(id, name), cars(person_id, car) and this query: SELECT c.car FROM people as p, cars as c WHERE c.person_id = p.id AND p.id = 3 I want the c.car column to take its name from the name field in the people table, like this (invalid SQL, just to illustrate): SELECT c.car AS(SELECT name FROM people WHERE id = 3) How do I do that?

    Read the article

  • How to serialize a Linq to Sql object graph without hiding the child's "Parent" member

    - by Richard B
    Without hiding the Child object's reference to the Parent object, has anyone been able to use an XmlSerializer() object to move a Linq to SQL object to an XML document, or is the only appropriate way of handling this to create a custom serialization/deserialization class to handle moving the data to/from the xml document? I don't like the idea of hiding the child object's reference to the parent object is why I'm asking. Thx.

    Read the article

  • encrypting passwords in a python conf file on a windows platform

    - by Richard
    Hello all. I have a script running on a remote machine. db info is stored in a configuration file. I want to be able to encrypt the password in the conf text so that no one can just read the file and gain access to the database. This is my current set up: My conf file sensitive info is encoded with base64 module. The main script then decodes the info. I have compiled the script using py2exe to make it a bit harder to see the code. My question is: Is there a better way of doing this? I know that base64 is not a very safe way of encrypting. Is there a way to encode using a key? I also know that py2exe can be reversed engineered very easily and the key could be found. Any other thoughts? I am also running this script on a windows machine, so any modules that are suggested should be able to run in a windows environment with ease. I know there are several other posts on this topic but I have not found one with a windows solution, or at least one that is will explained.

    Read the article

  • Is it the filename or the whole URL used as a key in browser caches?

    - by Richard Turner
    It's common to want browsers to cache resources - JavaScript, CSS, images, etc. until there is a new version available, and then ensure that the browser fetches and caches the new version instead. One solution is to embed a version number in the resource's filename, but will placing the resources to be managed in this way in a directory with a revision number in it do the same thing? Is the whole URL to the file used as a key in the browser's cache, or is it just the filename itself and some meta-data? If my code changes from fetching '/r20/example.js' to '/r21/example.js', can I be sure that revision 20 of example.js was cached, but now revision 21 has been fetched instead and it is now cached?

    Read the article

  • How do I make image hyperlinks have a background image?

    - by Richard
    I want all .jpg links to have a certain background image. so a link on a page like 'http://mysite/myimage.jpg' would automatically be prefixed with a small icon. Actually all links to images, ie .gif .png as well with the same icon. If the link is to a website, ie .htm/.php/.html/.asp it should have a different image. I want it to be through classes in CSS. Any help appreciated. TIA

    Read the article

  • Customizing compare in bsearch()

    - by Richard Smith
    I have an array of addresses that point to integers ( these integers are sorted in ascending order). They have duplicate values. Ex: 1, 2, 2, 3, 3, 3, 3, 4, 4...... I am trying to get hold of all the values that are greater than a certain value(key). Currently trying to implement it using binary search algo - void *bsearch( const void *key, const void *base, size_t num, size_t width, int ( __cdecl *compare ) ( const void *, const void *) ); I am not able to achieve this completely, but for some of them. Would there be any other way to get hold of all the values of the array, with out changing the algorithm I am using?

    Read the article

  • Real World Examples of read-write in concurrent software

    - by Richard Fabian
    I'm looking for real world examples of needing read and write access to the same value in concurrent systems. In my opinion, many semaphores or locks are present because there's no known alternative (to the implementer,) but do you know of any patterns where mutexes seem to be a requirement? In a way I'm asking for candidates for the standard set of HARD problems for concurrent software in the real world.

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >