Search Results

Search found 2682 results on 108 pages for 'michael rut'.

Page 72/108 | < Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >

  • Design: How to declare a specialized memory handler class

    - by Michael Dorgan
    On an embedded type system, I have created a Small Object Allocator that piggy backs on top of a standard memory allocation system. This allocator is a Boost::simple_segregated_storage< class and it does exactly what I need - O(1) alloc/dealloc time on small objects at the cost of a touch of internal fragmentation. My question is how best to declare it. Right now, it's scope static declared in our mem code module, which is probably fine, but it feels a bit exposed there and is also now linked to that module forever. Normally, I declare it as a monostate or a singleton, but this uses the dynamic memory allocator (where this is located.) Furthermore, our dynamic memory allocator is being initialized and used before static object initialization occurs on our system (as again, the memory manager is pretty much the most fundamental component of an engine.) To get around this catch 22, I added an extra 'if the small memory allocator exists' to see if the small object allocator exists yet. That if that now must be run on every small object allocation. In the scheme of things, this is nearly negligable, but it still bothers me. So the question is, is there a better way to declare this portion of the memory manager that helps decouple it from the memory module and perhaps not costing that extra isinitialized() if statement? If this method uses dynamic memory, please explain how to get around lack of initialization of the small object portion of the manager.

    Read the article

  • Extracting specific files from ZIP in PHP

    - by Michael
    If I have a ZIP file whose structure is: -directory1 DIR -files in here -directory2 DIR -more files in here Using pclzip.lib.php how can I open up this ZIP file and extract directory1 (recursive) into a directory and then extract directory2 (recursive) into another directory.

    Read the article

  • Placing PHP array values into a javascript array?

    - by Michael Harringon
    Is these a way i can loop through a PHP array and have the data outputted into a JavaScript array? For example, the JS script below will not work var mon_Loop = <?php echo $rowCount_Mon ?>; var mon_Events = new Array(); for(i = 0; i < mon_Loop; i++) { mon_Events[i] = <?php $divMon[i] ?> } I Know its because the "i" is not a php variable so therefore invalid inside the php section, but its just an way to show what i would like to achieve. The $rowCount variable count the number of rows and is then used to for the loop. Lets say, for example that I want to place the contents of the PHP array "$divMon[0]" into the javascript array mon_Events[0]. I know that i can do it manually, like below mon_Events[0] = <?php echo $divMon[0] ?> But i have lots of these and therefore need the loop, Is there some JS or PHP that could do this? Cheers.

    Read the article

  • Displaying mysql results as an object?

    - by Michael
    If I have a database with the structure: ___id_____|____value____ 1 | value1 2 | value2 3 | value3 How can I pull data from this MySQL database in PHP and have it formatted like this: Array ( [0] => stdClass Object ( [id] => 1 [value] => value1 ) [1] => stdClass Object ( [id] => 2 [value] => value2 ) [2] => stdClass Object ( [id] => 3 [value] => value3 ) )

    Read the article

  • reverse loop for date display

    - by Michael
    Hi, I've been trying to figure this out, and can't seem to get it Here is the code.. $m= date("m"); $de= date("d"); $y= date("Y"); for($i=0; $i<=6; $i++){ echo "<br>"; echo date('m/d',mktime(0,0,0,$m,($de+$i),$y)); echo "<br>"; } That displays this 04/08 04/07 04/06 04/05 04/04 04/03 04/02 That is exactly what I want but I want it to flip around so echos it would like this 04/02 04/03 04/04 04/05 04/06 04/07 04/07 How would I do this? Thank you in advance!

    Read the article

  • UITableView: NSMutableArray not appearing in table

    - by Michael Orcutt
    I'm new to objective c and iPhone programming. I can't seem to figure out why no cells will fill when I run this code. The xml content displays in the console log and xcode displays no errors. Can any help? - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { if(![elementName compare:@"Goal"] ) { tempElement = [[xmlGoal alloc] init]; } else if(![elementName compare:@"Title"]) { currentAttribute = [NSMutableString string]; } else if(![elementName compare:@"Progress"]) { currentAttribute = [NSMutableString string]; } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if(![elementName compare:@"Goal"]) { [xmlElementObjects addObject:tempElement]; } else if(![elementName compare:@"Title"]) { NSLog(@"The Title of this event is %@", currentAttribute); [tempElement setTitled:currentAttribute]; } else if(![elementName compare:@"Progress"]) { NSLog(@"The Progress of this event is %@", currentAttribute); [tempElement setProgressed:currentAttribute]; } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if(self.currentAttribute) { [self.currentAttribute appendString:string]; } } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [xmlElementObjects count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [mtableview dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... cell.textLabel.text = [xmlElementObjects objectAtIndex:indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { }

    Read the article

  • Problems with a from CSS

    - by Michael
    I am trying to create a fairly basic form with in my maincontent. I am sure I am coding things incorrectly and it is driving me crazy. Note my code. I get extremely wide vertical spacing in IE 7 and the bacground color between the field sets does not work correctly. All is good in FF. My CSS is: fieldset { margin: 1.5em 0 0 0; padding: 0; border-style: none; border-top: 1px solid #BFBAB0; background-color: #FFFFFF; } legend { margin-left: 1em; color: #000000; font-weight: bold; } fieldset ol { padding: 1em 1em 0 1em; list-style: none; } fieldset li { padding-bottom: 1em; } fieldset.submit { border-style: none; } { var w = document.myform.mylist.selectedIndex; var selected_text = document.myform.mylist.options[w].text; alert(selected_text); } label em { display: block; color: #900; font-size: 85%; font-style: normal; text-transform: uppercase; } This is my html code. <div id="mainContent1"> <form name="myform"> <label for="mylist"><strong>Select an Account Type:</strong></label> <select name="mylist"><option value="traditional">Traditional Account</option> <option value="paperless">Paperless Account</option> </select> </form> <br /><a> </a> <form action="example.php"> <fieldset> <legend>Contact Details</legend> <ol> <li> <label for="name">Name:</label> <input id="name" name="name" class="text" type="text" /> <label for="name"> <em>required</em> </label> </li> <li> <label for="email">Email address:</label> <input id="email" name="email" class="text" type="text" /> <label for="name"> <em>required</em> </li> <li> <label for="phone">Telephone:</label> <input id="phone" name="phone" class="text" type="text" /> <label for="name"> <em>required</em> <ol> <li> <input id="option1" name="option1" class="checkbox" type="checkbox" value="1" /> <label for="option1">Savings</label> </li> <li> <input id="option2" name="option2" class="checkbox" type="checkbox" value="1" /> <label for="option2">Checkings</label> </li> </ol> </fieldset> <fieldset> <legend>Delivery Address</legend> <ol> <li> <label for="address1">Address 1:</label> <input id="address1" name="address1" class="text" type="text" /> </li> <li> <label for="city">City:</label> <input id="city" name="city" class="text" type="text" /> </li> <li> <label for="postcode">Zip Code:</label> <input id="postcode" name="postcode" class="text textSmall" type="text" /> </li> <li> <label for="country">Country:</label> <input id="country" name="country" class="text" type="text" /> </li> </ol> </fieldset> <fieldset class="submit"> <input class="submit" type="submit" value="Submit" /> </fieldset> <fieldset class="clear"> <input class="clear" type="clear" value="Submit" /> </fieldset> </form>

    Read the article

  • Autofac: Reference from a SingleInstance'd type to a HttpRequestScoped

    - by Michael Wagner
    I've got an application where a shared object needs a reference to a per-request object. Shared: Engine | Per Req: IExtensions() | Request If i try to inject the IExtensions directly into the constructor of Engine, even as Lazy(Of IExtension), I get a "No scope matching [Request] is visible from the scope in which the instance was requested." exception when it tries to instantiate each IExtension. How can I create a HttpRequestScoped instance and then inject it into a shared instance? Would it be considered good practice to set it in the Request's factory (and therefore inject Engine into RequestFactory)?

    Read the article

  • Problem passing a reference as a named parameter to a variadic function

    - by Michael Mrozek
    I'm having problems in Visual Studio 2003 with the following: void foo(const char*& str, ...) { va_list args; va_start(args, str); const char* foo; while((foo = va_arg(args, const char*)) != NULL) { printf("%s\n", foo); } } When I call it: const char* one = "one"; foo(one, "two", "three", NULL); I get: Access violation reading location 0xcccccccc on the printf() line -- va_arg() returned 0xcccccccc. I finally discovered it's the first parameter being a reference that breaks it -- if I make it a normal char* everything is fine. It doesn't seem to matter what the type is; being a reference causes it to fail at runtime. Is this a known problem with VS2003, or is there some way in which that's legal behavior? It doesn't happen in GCC; I haven't tested with newer Visual Studios to see if the behavior goes away

    Read the article

  • On Render Callback For G+ Button

    - by Michael Robinson
    How might I go about performing an action only when a G+ button has finished rendering? Facebook allows one to do this using the following: FB.XFBML.parse(document, function() { alert('rendering done'); }); I've perused Google's documentation, but didn't see anything helpful. Currently my workaround is to monitor the G+ element until certain elements have been added, then perform my action: (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; po.onload = function() { var awaitRender = function(element) { if (element.firstChild && element.firstChild.firstChild && element.firstChild.firstChild.tagName.toUpperCase() === 'IFRAME') { alert('rendered!'); } else { window.setTimeout(function() { awaitRender(element) }, 100); } }; var buttons = document.getElementsByClassName('googleplus-button'); for(var i = 0; i < buttons.length; i++) { awaitRender(buttons[i]); } } var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); I'd like to know please, if there is either: A correct way one should do this for G+ buttons A better implementation that what I've hacked together above

    Read the article

  • N-gram split function for string similarity comparison

    - by Michael
    As part of excersise to better understand F# which I am currently learning , I wrote function to split given string into n-grams. 1) I would like to receive feedback about my function : can this be written simpler or in more efficient way? 2) My overall goal is to write function that returns string similarity (on 0.0 .. 1.0 scale) based on n-gram similarity; Does this approach works well for short strings comparisons , or can this method reliably be used to compare large strings (like articles for example). 3) I am aware of the fact that n-gram comparisons ignore context of two strings. What method would you suggest to accomplish my goal? //s:string - target string to split into n-grams //n:int - n-gram size to split string into let ngram_split (s:string, n:int) = let ngram_count = s.Length - (s.Length % n) let ngram_list = List.init ngram_count (fun i -> if( i + n >= s.Length ) then s.Substring(i,s.Length - i) + String.init ((i + n) - s.Length) (fun i -> "#") else s.Substring(i,n) ) let ngram_array_unique = ngram_list |> Seq.ofList |> Seq.distinct |> Array.ofSeq //produce tuples of ngrams (ngram string,how much occurrences in original string) Seq.init ngram_array_unique.Length (fun i -> (ngram_array_unique.[i], ngram_list |> List.filter(fun item -> item = ngram_array_unique.[i]) |> List.length) )

    Read the article

  • Composer does not find dependencies of vcs repository

    - by Michael Freund
    i've got a strange problem ... project-a is my main project. project-b is my library, checked in to subversion composer.json of project-b { "name": "fragger/baseclasses", "version" : "0.0.1-dev", "description": "Baseclasses and Interfaces", "require": { "silex/silex": "1.0.x-dev", "3rd-party/smarty": "3.*", "swiftmailer/swiftmailer": "4.2-dev" }, "autoload": { "psr-0": { "baseclasses": "src/" } } } and composer.json of project-b { "repositories" : [ { "type": "vcs", "url" : "svn+ssh://....." } ], "require": { "fragger/baseclasses": ">=0.0.1-dev" } } output of install command php composer.phar install Loading composer repositories with package information Installing dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for fragger/baseclasses >=0.0.1-dev -> satisfiable by fragger/baseclasses dev-trunk. - fragger/baseclasses dev-trunk requires silex/silex 1.0.x-dev -> no matching package found. But a composer install in project a alone, works fine

    Read the article

  • Is it safe to catch EXCEPTION_GUARD_PAGE

    - by Michael J
    Environment is VC++ 9 on various Win platforms (XP and later) I'm writing an unhandled exception handler. I have a vague recollection from my kernel days that it was bad to catch an EXCEPTION_GUARD_PAGE, as this was generated to tell the OS to enlarge the stack. My question is twofold: Can such an exception occur in user space? If so, is it safe to catch it? I'm not especially interested in doing anything with it. I just want to know if I need to put special code in to not catch it (as I'm catching everything at the moment).

    Read the article

  • creating a custom upload progress bar

    - by michael
    hi, i have seen all the upload progress bar plugins , widgets, etc. they all suck. their either too bulky with too much useless code or they dont work. what i want to know is where can i read up on how to display an easy upload progress indicator. most browsers have a status progress bar on them below but it isnt very professional to use just that when dealing with clients. how does the browser do it? i want to know the internals of how the browser work with indication a status of something uploading and maybe i can make something using php & jquery. thanks

    Read the article

  • If a nonblocking recv with MSG_PEEK succeeds, will a subsequent recv without MSG_PEEK also succeed?

    - by Michael Wolf
    Here's a simplified version of some code I'm working on: void stuff(int fd) { int ret1, ret2; char buffer[32]; ret1 = recv(fd, buffer, 32, MSG_PEEK | MSG_DONTWAIT); /* Error handling -- and EAGAIN handling -- would go here. Bail if necessary. Otherwise, keep going. */ /* Can this call to recv fail, setting errno to EAGAIN? */ ret2 = recv(fd, buffer, ret1, 0); } If we assume that the first call to recv succeeds, returning a value between 1 and 32, is it safe to assume that the second call will also succeed? Can ret2 ever be less than ret1? In which cases? (For clarity's sake, assume that there are no other error conditions during the second call to recv: that no signal is delivered, that it won't set ENOMEM, etc. Also assume that no other threads will look at fd. I'm on Linux, but MSG_DONTWAIT is, I believe, the only Linux-specific thing here. Assume that the right fnctl was set previously on other platforms.)

    Read the article

  • iPhone iOS4: API for AVRCP (ff/rewind commands on Bluetooth headsets)

    - by Michael Kessler
    Hi, I know that AVRCP abilities were added to iOS 4.1 (in iPod application now you can forward and rewind songs by using hardware buttons on supporting headsets). I am trying to find any API for using these abilities in a music application that I work on. The requirement is to catch play/stop, forward and rewind buttons events from the headset. Any information will be more than welcome. Thank you.

    Read the article

  • php/mysql show data from chosen checkboxes

    - by Michael
    Hi. I have a table called FRUIT id type daysold 1 banana 5 2 apple 6 3 apple 4 4 peach 2 5 banana 6 What I would like is to have 3 checkboxes: Banana [ ] Apple [ ] Peach [ ] SUBMIT Then if I've only checked "Banana" and "Peach" the mysql output should only show me the rows that matches those two types. And the checkboxes should remain checked to highlight what was chosen. I can make the checkboxes but then that's about it really. I don't know how to properly get the info from the checkboxes and down to the WHERE argument in the MYSQL-code. Especially not with two types chosen. If it was just a dropdown menu with a single choice then I'd add the choice to the url and put WHERE type='$choice' - but I'm struggling with the multiple choices. I'm a bit of a novice at both php and mysql, so I'm a bit lost on this one.

    Read the article

  • Regex Lookaheads

    - by Michael
    Need to capture content of root <pubDate> element, but in document it can be either within <item> element or within <channel> element. Also <item> is child of <channel> I'll bring example <channel> ... <pubDate>10/2/2010</pubDate> ... <item> ... <pubDate>13/2/2029</pubDate> ... </item> ... </channel> need to capture 10/2/2010 With the <item> no problem, can capture it, along with its <pubDate>.

    Read the article

  • .NET 3.5 C# does not offer what I need for locking: Count async saves until 0 again.

    - by Frank Michael Kraft
    I have some records, that I want to save to database asynchronously. I organize them into batches, then send them. As time passes, the batches are processed. In the meanwhile the user can work on. There are some critical operations, that I want to lock him out from, while any save batch is still running asynchronously. The save is done using a TableServiceContext and method .BeginSave() - but I think this should be irrelevant. What I want to do is whenever an async save is started, increase a lock count, and when it completes, decrease the lock count so that it will be zero as soon as all have finished. I want to lock out the critical operation as long as the count is not zero. Furthermore I want to qualify the lock - by business object - for example. I did not find a .NET 3.5 c# locking method, that does fulfil this requirement. A semaphore does not contain a method to check, if the count is 0. Otherwise a semaphore with unlimited max count would do.

    Read the article

  • Is it safe to call a function to intialize a class in a ctor list?

    - by Michael Dorgan
    I have Angle class that I want initialized to a random value. The Angle constructor can accept an int from a random() function. Is it safe to place this call in the ctor list: foo::foo() : Angle(random(0xFFFF)) {...} or do I have to do it in the body of the constructor? foo::foo() { Angle = Angle(random(0xFFFF)); ...} If it matters, the foo class is derived from another class and does have virtual methods. In addition, no exception handling is allowed in our app.

    Read the article

  • Replicate Printed Form With Web Form

    - by Michael
    I'm hoping people have some ideas to help solve this problem. I am developing a C# ASP.NET website and the client requires an online form that users will fill in and submit. OK, so far so good..... Imagine, say, a form that you fill in on paper - they normally have a distinctive look specific to the company and will be filed, quite possibly as a legally binding document. I need to have an online form that when submitted emails the client with something they can print out and will look exactly like their printed forms. As this is web based, I think the option of capturing a screenshot are out the question, so I'm wondering how best to approach this? Even if I just had a form that captures the data presented how I want, how could I translate this data into the view they want? Any ideas and suggestions greatly appreciated.

    Read the article

  • .NET C# setting the value of a field defined by a lambda selector

    - by Frank Michael Kraft
    I have a generic class HierarchicalBusinessObject. In the constructor of the class I pass a lambda expression that defines a selector to a field of TModel. protected HierarchicalBusinessObject (Expression<Func<TModel,string>> parentSelector) A call would look like this, for example: public class WorkitemBusinessObject : HierarchicalBusinessObject<Workitem,WorkitemDataContext> { public WorkitemBusinessObject() : base(w => w.SuperWorkitem, w => w.TopLevel == true) { } } I am able to use the selector for read within the class. For example: sourceList.Select(_parentSelector.Compile()).Where(... Now I am asking myself how I could use the selector to set a value to the field. Something like selector.Body() .... Field...

    Read the article

< Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >