Search Results

Search found 2762 results on 111 pages for 'michael turner'.

Page 75/111 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • Is There a Good Pattern for Creating a Unique Id based on a Type?

    - by Michael Kelley
    I have a template that creates a unique identifier for each type it is instanced. Here's a streamlined version of the template: template <typename T> class arType { static const arType Id; // this will be unique for every instantiation of arType<>. } // Address of Id is used for identification. #define PA_TYPE_TAG(T) (&arType<T >::Id) This works when you have an executable made purely of static libraries. Unfortunately we're moving to an executable made up of dlls. Each dlls could potentially have its own copy of Id for a type. One obvious solution is to explicitly instantiate all instances of arType. Unfortunately this is cumbersome, and I'd like to ask if anyone can propose a better solution?

    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

  • Adding gwt project to existing java servlet 3 project

    - by Michael
    I have a standalone gwt project with RPC built with Maven. I also have java servlet 3.0 project. Both the servlet and gwt projects have war packaging but I want to have only one war file so I changed the packaging of the gwt project to jar and included it in my servlet project. Now I have a problem understanding how to wire everything together. Do I need to migrate gwt project's web.xml into the main project web.xml file ? How do I redirect to my gwt project entry index.html ? Thanks.

    Read the article

  • How to access valuestack objects within struts iterator?

    - by Monika Michael
    I have following code - <s:iterator value="reviews"> <img src="<s:property value="#request.restaurant.portalImage.url" />" /> <s:property value="user.firstName" /> <s:property value="user.lastName" /> <s:property value="rating" /> <s:property value="review" /> </s:iterator> reviews is a list of review objects which contain details of a review, such as rating and name of user. My problem is that i'm not able to access any of the objects present on the valuestack within the loop. Outside the loop <s:property value="#request.restaurant.portalImage.url" /> works correctly. But within the loop it prints null. AFAIK an iterator pushes it's collection on the valuestack so that all ognl expressions resolve against it. But I've used # which means I'm explicitly specifying the root object for resolution. Why is it still not working?

    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

  • How to Compute a Database Column in .NET

    - by Michael
    I have a Database named CarsType.accdb there are four fields in the data base Item_Name, Item_Num, Item_Qty, Item_Cost. I am able to get the database to display my data in VisualBasic but I am not sure how to get the total cost to appear in my label (lblTotalCost). I prefer doing it in VB versus writing in my access program. All I am wanting to do it multiply item_qty * Item_Cost How would I go about doing that?

    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

  • 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

  • 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

  • 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

  • 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

  • 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

  • Problem with absolute positioning div over SWF and IE 8.

    - by Michael S. Kelly
    I'm attempting to use the old IFrame-over-SWF trick to get HTML to display "inside" a SWF. I'm following the example provided by Brian Deitte at: http://www.deitte.com/IFrameDemo3/IFrameDemo.html. (The source code can be viewed and downloaded by right-clicking on the SWF and selecting "View Source".) In the latest versions of Firefox, Google, Opera, and Safari on the Mac, it all looks good. But in IE 8 the absolutely positioned div containing the IFrame is positioned too far up and left, and the height and width are considerably smaller. Thoughts?

    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

  • Using a Resource as an Attribute to a HTML Element in ASP.net

    - by Michael Stum
    I would like to have this piece of code in my .aspx file: <input class="ms-ButtonHeightWidth" type="button" name="BtnOK" id="Button2" value="Close" onclick="javascript:HandleOKButtonClick()" accesskey="<%$Resources:wss,okbutton_accesskey%>" /> Unfortunately, ASP.net doesn't seem to like that: An error occurred during the processing of /_layouts/MyPage/Info.aspx. Literal expressions like '<%$Resources:wss,okbutton_accesskey%>' are not allowed. Use <asp:Literal runat="server" Text="<%$Resources:wss,okbutton_accesskey%>" /> instead That doesn't work in this situation as that would mean nesting the Literal between the quotes of the accesskey attribute, which causes a "The tag contains duplicate 'ID' attributes" error. Is there a way to use a string from a resource without having to change the input to an asp:Button? I guess there has to be a way using <%=, but I don't know how I would address the resource itself?

    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

  • Returning from method inside a @synchronized block

    - by Michael Waterfall
    I'd just like to know if it's advised to return from a method within a @synchronized block? For example: - (id)test { @synchronized(self) { if (a) return @"A"; else return @"B"; } } As opposed to: - (id)test { NSString *value; @synchronized(self) { if (a) value = @"A"; else value = @"B"; } return value; } This sample is rather simplistic, but sometimes in a complex method it would make things simpler to be able to return from within a @synchronized block.

    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

  • 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

  • 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

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >