Search Results

Search found 847 results on 34 pages for 'jim coffman'.

Page 26/34 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • STL vectors with uninitialized storage?

    - by Jim Hunziker
    I'm writing an inner loop that needs to place structs in contiguous storage. I don't know how many of these structs there will be ahead of time. My problem is that STL's vector initializes its values to 0, so no matter what I do, I incur the cost of the initialization plus the cost of setting the struct's members to their values. Is there any way to prevent the initialization, or is there an STL-like container out there with resizeable contiguous storage and uninitialized elements? (I'm certain that this part of the code needs to be optimized, and I'm certain that the initialization is a significant cost.) Also, see my comments below for a clarification about when the initialization occurs. SOME CODE: void GetsCalledALot(int* data1, int* data2, int count) { int mvSize = memberVector.size() memberVector.resize(mvSize + count); // causes 0-initialization for (int i = 0; i < count; ++i) { memberVector[mvSize + i].d1 = data1[i]; memberVector[mvSize + i].d2 = data2[i]; } }

    Read the article

  • Why do I get null objects in a many-to-many bag?

    - by Jim Geurts
    I have a bag defined for a many-to-many list: <class name="Author" table="Authors"> <id name="Id" column="AuthorId"> <generator class="identity" /> </id> <property name="Name" /> <bag name="Books" table="Author_Book_Map" where="IsDeleted=0" fetch="join"> <key column="AuthorId" /> <many-to-many class="Book" column="BookId" where="IsDeleted=0" /> </bag> </class> If I return all author objects using something like the following, I will get what initially appeared to be duplicate Author records: Session.Query<Author>().List<Author>() The extra author objects are created when an author is mapped to Book objects that have IsDeleted = 1 and IsDeleted = 0. Rather than creating one Author object with an enumerable that contains only the books with IsDeleted = 0, it will create two author objects. The first author object has a Books enumerable that contains books with IsDeleted = 0. The second author object will contain an enumerable of null book objects. Similarly, if an object only has one book map, and that map points to a book with IsDeleted = 1, then an author object is returned with a Books collection having one null object. I'm thinking part of the problem stems from the map table objects linking to rows that satisfy the where condition on the bag object but do not meet the many-to-many where condition. This is happening with NHibernate version 3.0.0.4980. Is this a configuration issue or something else?

    Read the article

  • Learning SQL & Microsoft Data Services stack - Where to start?

    - by Jim
    I'm trying to learn the Microsoft data / service stack. I want to build a database in SQL Azure and expose it to a c# client application. I've never worked with any SQL database technology. Looking online, everything just seems so confusing -- too many technologies, hard to tell what's new vs what's old. What's the latest technologies to look at, and what (books?) should I be reading?

    Read the article

  • Generating jquery 'rules' from business model to UI in asp.net mvc

    - by jim
    Hi all, I've had a good look around and am certain that there's no matching question on SO, so here goes. Has anyone created a 'helper' method on their model that generates jquery (or plain javascript) rules validation dynamically, based on the criteria/rules that are contained within the object and taken from a repository (i.e. DB). What i'm thinking of is a discrete set of partial views (and associated models) that have rules at the business logic 'level' and rather than (or in combination with) validating the rule(s) at postback, translating the same rules into tightly focussed jquery methods that work identically at client (js) and server (c#) levels. I can see benefits here re performance. Also, the rules definitions could be created in a single place (in c#) and the jquery generated off of that, thus allowing single edits to update both code streams. I appreciate that there would be limitations imposed by language specific contstraints but the general principle could be quite interesting if used appropriately. I'm also aware that testibility could be an issue when using two different language structures and hoping to achieve similar test outcomes - but those aside... any thoughts or experiences of similar out there?? cheers jimi

    Read the article

  • Any way to surround code block with Curly Braces {} in VS2008?

    - by Jim McKeeth
    I always find myself needing to enclose a block of code in curly braces { }, but unfortunately that isn't included in the C# surround code snippets, which seems to be an oversight. I couldn't find anything on building your own surround snippets either (just other kinds of snippets). I am actually running Resharper too, but it doesn't seem to have this functionality either (or I haven't figured how to activate it). We have a coding standard of including even a single line of code after an if or else in curly braces, so if I could just make Resharper do that refactor automatically that would be even better!

    Read the article

  • Decentralized Chat feature in C#/WPF?

    - by Jim Beam
    What are some options for implementing a chat feature in a C#/WPF desktop application? Is it possible to do this without a central server? I have a desktop app and 1 user may be logged in at one time or 50 users may be logged in. I would like to add a chat feature that will allow them to talk to each other without relying on a central server. If I do have to use a central server, I assume that WCF would be the best option? Are there any solid examples of this with WCF?

    Read the article

  • stripping random number with substr problem

    - by Jim
    Using a random number to be included with another character. Then I want to strip out the random number and just leave the other character. I have this code that generates the random number (8 characters long) consistently. If you hit your refresh button multiple times, the “ID” field disappears even though the “Random Number” plus “ID” are still there. Not sure what is happening to the random number on refresh in the substr function. This is the code: // Begin Create Random ID Code ///////////////////////////////////////// function gRanStr1() { $length1 = 8; $characters = “0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ”; for ($p = 0; $p < $length1; $p++) { $lcrs1 .= $characters[mt_rand(0, strlen($characters)-1)]; } $lcrs9 = str_replace(' ', '', $lcrs9); return $lcrs1; } // End Create Random ID Code ///////////////////////////////////////// // Begin Decode Random ID Code ///////////////////////////////////////// $TrkR99 = "c"; $ResHeadID = gRanStr1() . $TrkR99; $ResHeadID = preg_replace('/[\s]+/',' ',$ResHeadID); echo "”; echo $ResHeadID . ” = echo of Random Number plus ID“; for($i=0; $i if ($ResHeadID == "") { ""; } else { $ResHeadID = preg_replace('/[\s]+/',' ',$ResHeadID); $TrkRa1 = substr($ResHeadID, $Index1 + 8, 1); } $dTrkRes = $TrkRa1; echo $TrkRa1 . " = echo of ID after random number stripped.“; echo “”; // End Decode Random ID Code /////////////////////////////////////////

    Read the article

  • Jquery return element html instead of content

    - by jim smith
    I have something like this <ul> <li class="aclass" id="a">content</li> <li class="aclass" id="b">content</li> <li class="aclass" id="c">content</li> <li class="aclass" id="d">content</li> <li class="aclass" id="e">content</li> <li class="aclass" id="f">content</li> </ul> I have code like $(".aclass").live("mousedown",function() { alert($this.html()); }); This will alert the content, what I would like to do is alert the entire element like <li class="aclass" id="f">content</li> I've tried $(this).parent() but that returns the whole UL

    Read the article

  • WPF - Weird results with DataGrid - extra line for editing entries

    - by Jim Beam
    Working with WPF and C#. I have a page with a datagrid that lists a series of objects with List as the DataContext. I recently had it working in the code behind and the Datagrid would show the extra line at the bottom of the datagrid for new entries. Now, I have moved the exact same code to its own library project. The data still appears but the extra line for entry does not and users cannot add a new record. I have already tried using grid.CanUserAddNew = true; but that does not solve it. So, it must be something in the List object - it's the exact same code as before, only pulling from a library. Help.

    Read the article

  • How to convert jquery collection to xml string for an ajax request

    - by Jim
    I created a jquery collection that stores xml as follows: var rh_request = $('') .attr('user_id', user_id) .attr('company_id', company_id) .attr('action', 'x'); I want to post it to my server via an ajax request as follows: $.ajax({ type: "POST", url: mywebsiteURL, processData: false, dataType: "xml", data: rh_request.html(), success: mycallbackfunction }); My problem is that the "data" parameter of the ajax call needs a string version of the xml and it seems neither Jquery's .html() or .text() function yields this. I have older code that used straight javascript to form the outgoing xml and calling the DOM .xml() function yielded a string that worked. How is this done with a jquery collection???

    Read the article

  • How do the do that? Transparent foreground on a web page

    - by Jim Beam
    I really can't find the right Google terms to track this down. But you're all quite smart so thought I'd post it here. You know how sometimes you are on a good site and you click a button (like to submit a form) and the form doesn't go away, instead, the foreground becomes transparent and it contains a message of some kind, or another page. The message is at the forefront but the previous page is still mostly visible behind it - how do they do that? I'm assuming it's an AJAX-esque trick.

    Read the article

  • IE8 Using Google Font on ENTIRE Page Instead of Just Selected Text

    - by Jim
    All my web searches for Google Fonts with IE8 show people talking about google fonts just not loading or not showing up. I don't have that problem. Instead IE8 is loading my Google Font just fine, but its applying the font to ALL the type on the page! Things seem to be fine in other browsers. Is there some kind of glitch in my CSS that IE is choking on? http://nbkclientsite.fuzzpopstudio.com/ Ok here's some of the relevant css: body { font-size: 16px; font-size: 1rem; font-family: Helvetica-Neue,Helvetica, Arial, sans-serif; text-rendering: optimizeLegibility; color: #444; } .contact-us-text { font-family: 'Arvo', serif; font-size: 150%; color: #2770b4; } .contact-us-phone { font-family: 'Arvo', serif; font-size: 175%; } Everything pertinent should be in just one style sheet. You can easily view it with Firebug or Chrome's Inspector or whatever you want. In FF and Chrome, everything is inheriting Helvetica or Arial as it should be. But not in IE8. You'd have to use Firebug and view the entire stylesheet if you want to see more.

    Read the article

  • Should we point to an NSManagedObject entity with weak instead of strong pointer?

    - by Jim Thio
    I think because NSManagedObject is managed by the managedObject context the pointer should be weak. Yet it often goes back to 0 in my cases. for (CategoryNearby * CN in sorted) { //[arrayOfItems addObject:[NSString stringWithFormat:@"%@ - %d",CN.name,[CN.order intValue]]]; NearbyShortcutTVC * tvc=[[NearbyShortcutTVC alloc]init]; tvc.categoryNearby =CN; // tvc.titleString=[NSString stringWithFormat:@"%@",CN.name]; // tvc.displayed=CN.displayed; [arrayOfItemsLocal addObject:tvc]; //CN PO(tvc); PO(tvc.categoryNearby); while (false); } self.arrayOfItems = arrayOfItemsLocal; PO(self.categoriesNearbyInArrayOfItems); [self.tableViewa reloadData]; ... Yet somewhere down the line: tvc.categoryNearby becomes nil. I do not know how or when or where it become nil. How do I debug this? Or should the reference be strong instead? This is the interface of NearbyShortcutTVC by the way @interface NearbyShortcutTVC : BGBaseTableViewCell{ } @property (weak, nonatomic) CategoryNearby * categoryNearby; @end To make sure that we're talking about the same object I print all the memory addresses of the NSArray They're both the exact same object. But somehow the categoryNearby property of the object is magically set to null somewhere. self.categoriesNearbyInArrayOfItems: ( 0x883bfe0, 0x8b6d420, 0x8b6f9f0, 0x8b71de0, 0xb073f90, 0xb061a10, 0xb06a880, 0x8b74940, 0x8b77110, 0x8b794e0, 0x8b7bf40, 0x8b7cef0, 0x8b7f4b0, 0x8b81a30, 0x88622d0, 0x8864e60, 0xb05c9a0 ) self.categoriesNearbyInArrayOfItems: ( 0x883bfe0, 0x8b6d420, 0x8b6f9f0, 0x8b71de0, 0xb073f90, 0xb061a10, 0xb06a880, 0x8b74940, 0x8b77110, 0x8b794e0, 0x8b7bf40, 0x8b7cef0, 0x8b7f4b0, 0x8b81a30, 0x88622d0, 0x8864e60, 0xb05c9a0 )

    Read the article

  • jQuery $.post & $.append & IE6

    - by Jim
    I'm having a weird problem with jQuery and IE6. Script works on IE7+ and with all other browsers I have tried it. I can't post the full script, but what it does is this: $.post("file.php",{'foo':'bar'},function(data){ $('#target').append(data) }) When I run the code in IE6, #target just shows ? and a white char with a hole in the middle. I have no idea what this second char is. My initial thought was that this was some sort of content-type problem because the file.php just echoes answer without any header information. I added Content-type: text/html with header() but didn't help. Any suggestions?

    Read the article

  • C# Serial Communications - Received Data Lost

    - by Jim Fell
    Hello. Received data in my C# application is getting lost due to the collector array being over-written, rather than appended. private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { pUartData_c = serialPort1.ReadExisting().ToCharArray(); bUartDataReady_c = true; } catch ( System.Exception ex ) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } In this example pUartData_c is over-written every time new data is received. On some systems this is not a problem because the data comes in quickly enough. However, on other systems data in the receive buffer is not complete. How can I append received data to pUartData_c, rather than over-write it. I am using Microsoft Visual C# 2008 Express Edition. Thanks.

    Read the article

  • TabBar Stop The Popping

    - by Jim Bonner
    If have a Navigation Bar and a Tab Bar in one of my views. This is all working fine. One of the Tab Bar items requires pushing several other view controllers on the navigation stack before I get the where I need to be. This is also working. When I click on the tab bar item, it marches right back up the stack. How can I make the desired controller stick in the tab bar item?

    Read the article

  • How do I import facebook friends from another website

    - by Jim Zimmerman
    I am looking for a way to connect to facebook by allowing the user to enter in their username and password and have our app connect to their account and get their contacts so that they can invite them to join their group on our site. I have written a facebook app before, but this is not an app as much as it is a connector so that they can invite all their friends or just some to the site we are working on. I have seen several other sites do this and also connect to Yahoo, Gmail and Hotmail contacts. I dont think they are using Facebook Connect to do this since it is so new, but they may be. Any solution in any language is fine as I can port whatever example to use C#. I cannot find anything specifically on Google or Facebook to address this specific problem. Any help is appreciated. I saw a first answer get removed that had suggested i might need to scrape the friends page. The more I look around, this might be what i need to do. Any other way i think will require the person to add it as an app. I am wondering how a answer can get removed, maybe that user deleted it.

    Read the article

  • assignment not working in a dll exported C++ class

    - by Jim Jones
    Using VS 2008 Have a C++ class in which I'm calling functions from a 3rd party dll. The definition in the header file is as follows: namespace OITImageExport { class ImageExport { private: SCCERR seResult; /* Error code returned. */ VTHDOC hDoc; /* Input doc handle returned by DAOpenDocument(). */ VTHEXPORT hExport; /* Handle to the export returned by EXOpenExport(). */ VTDWORD dwFIFlags; /* Used in setting the SCCOPT_FIFLAGS option. */ VTCHAR szError[256]; /* Error string buffer. */ VTDWORD dwOutputId; /* Output Format. */ VTDWORD dwSpecType; public: ImageExport(const char* outputId, const char* specType); void ProcessDocument(const char* inputPath, const char* outputPath); ~ImageExport(); }; } In the constructor I initialize two of the class fields having values which come from enumerations in the 3rd party dll: ImageExport::ImageExport(const char* outputId, const char* specType) { if(outputId == "jpeg") { dwOutputId = FI_JPEGFIF; } if(specType == "ansi") { dwSpecType = IOTYPE_ANSIPATH; } seResult = DAInit(); if (seResult != SCCERR_OK) { DAGetErrorString(seResult, szError, sizeof(szError)); fprintf(stderr, "DAInit() failed: %s (0x%04X)\n", szError, seResult); exit(seResult); } } When I use this class inside of a console app, with a main method in another file (all in the same namespace), instantiating the class object and calling the methods, it works like a champ. So, now that I know the basic code works, I open a dll project using the class header and code file. Course I have to add the dll macro, namely: #ifdef IMAGEDLL_EXPORTS #define DLL __declspec(dllexport) #else #define DLL __declspec(dllimport) #endif and changed the class definition to "class DLL ImageExport". Compiled nicely to a dll and .lib file (No errors, No warnings). Now to test this dll I open another console project using the same main method as before and linking to the (dll) lib file. Had problems, which when tracked down were the result of the two fields not being set; both had values of 0. Went back to the first console app and printed out the values: dwOutputId was 1535 (#define FI_JPEGFIF 1535) and dwSpecType was 2 (#define IOTYPE_ANSIPATH 2). Now if I was assigning these values outside of the class, I can see how the visibility could be different, but why is the assignment in the dll not working? Is it something about having a class in the dll?

    Read the article

  • C# BackgroundWorker RunWorkerCompleted Event

    - by Jim Fell
    My C# application has several background workers. Sometimes one background worker will fire off another. When the first background worker completes and the RunWorkerCompleted event is fired, on which thread will that event fire, the UI or the first background worker from which RunWorkerAsync was called? I am using Microsoft Visual C# 2008 Express Edition. Any thoughts or suggestions you may have would be appreciated. Thanks.

    Read the article

  • Simple Regex Question

    - by Jim B
    Hey Everyone, I need to search a bunch of files for anything that contains either "tblPayment" or "tblInvoice" I also want to match any tables named "tblPaymentMethod", "tblInvoiceItem", "tblInvoicePayment" Anybody care to help me out with how to write a regular expression for this? Thanks again!

    Read the article

  • Map a struts2 action result to a controller instead of a jsp

    - by Jim
    Hello, I'm working on on a site built using struts2. The vast majority of our targets generate xml, so mapping the result to a jsp page makes sense. A couple of our targets actually generated binaries. I'm wondering if there is a convenient way to say that the result should come from a servlet/controller instead of a jsp. Obviously this could be done by modifying the web.xml so the struts filter doesn't apply to those targets and mapping those targets as servlets, but this is non-ideal. Currently, the struts filter applies to the entire site, and we would like to keep it that way. Ideas? Thanks!

    Read the article

  • How do I convert an arbitrary list of strings to a SQL rowset?

    - by Jim Kiley
    I have a simple list of strings, which may be of arbitrary length. I'd like to be able to use this list of strings as I would use a rowset. The app in question is running against SQL Server. To be clearer, if I do SELECT 'foo', 'bar', 'baz' I get 'foo', 'bar', and 'baz' as fields in a single row. I'd like to see each one of them as a separate row. Is there a SQL (or SQLServer-specific) function or technique that I'm missing, or am I going to have to resort to writing a function in an external scripting language?

    Read the article

  • How can a class's memory-allocated address be determined from within the contructor?

    - by Jim Fell
    Is it possible to get the memory-allocated address of a newly instantiated class from within that class's constructor during execution of said constructor? I am developing a linked list wherein multiple classes have multiple pointers to like classes. Each time a new class instantiates, it needs to check its parent's list to make sure it is included. If I try to do something like this: MyClass() // contructor { extern MyClass * pParent; for ( int i = 0; i < max; i++ ) { pParent->rels[i] == &MyClass; // error } } I get this error: error C2275: 'namespace::MyClass' : illegal use of this type as an expression Any thoughts or suggestions would be appreciated. Thanks.

    Read the article

  • Concurrent Threads in C# using BackgroundWorker

    - by Jim Fell
    My C# application is such that a background worker is being used to wait for the acknowledgement of some transmitted data. Here is some psuedo code demonstrating what I'm trying to do: UI_thread { TransmitData() { // load data for tx // fire off TX background worker } RxSerialData() { // if received data is ack, set ack received flag } } TX_thread { // transmit data // set ack wait timeout // fire off ACK background worker // wait for ACK background worker to complete // evaluate status of ACK background worker as completed, failed, etc. } ACK_thread { // wait for ack received flag to be set } What happens is that the ACK BackgroundWorker times out, and the acknowledgement is never received. I'm fairly certain that it is being transmitted by the remote device because that device has not changed at all, and the C# application is transmitting. I have changed the ack thread from this (when it was working)... for( i = 0; (i < waitTimeoutVar) && (!bAckRxd); i++ ) { System.Threading.Thread.Sleep(1); } ...to this... DateTime dtThen = DateTime.Now(); DateTime dtNow; TimeSpan stTime; do { dtNow = DateTime.Now(); stTime = dtNow - dtThen; } while ( (stTime.TotalMilliseconds < waitTimeoutVar) && (!bAckRxd) ); The latter generates a very acurate wait time, as compared to the former. However, I am wondering if removal of the Sleep function is interferring with the ability to receive serial data. Does C# only allow one thread to run at a time, that is, do I have to put threads to sleep at some time to allow other threads to run? Any thoughts or suggestions you may have would be appreciated. I am using Microsoft Visual C# 2008 Express Edition. Thanks.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >