Search Results

Search found 7897 results on 316 pages for 'generate'.

Page 125/316 | < Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >

  • How to properly downcast in C# with a SWIG generated interface?

    - by JG
    I've got a very large and mature C++ code base that I'm trying to use SWIG on to generate a C# interface for. I cannot change the actual C++ code itself but we can use whatever SWIG offers in the way of extending/updating it. I'm facing an issue where a function C++ is written as such: A* SomeClass::next(A*) The caller might do something like: A* acurr = 0; while( (acurr = sc->next(acurr)) != 0 ){ if( acurr isoftype B ){ B* b = (B*)a; ...do some stuff with b.. } elseif( acurr isoftype C ) ... } Essentially, iterating through a container elements that depending on their true type, do something different. The SWIG generated C# layer for the "next" function unfortunately does the following: return new A(); So the calling code in C# land cannot determine if the returned object is actually a derived class or not, it actually appears to always be the base class (which does make sense). I've come across several solutions: Use the %extend SWIG keyword to add a method on an object and ultimately call dynamic_cast. The downside to this approach, as I see it, is that this requires you to know the inheritance hierarchy. In my case it is rather huge and I see this is as a maintenance issue. Use the %factory keyword to supply the method and the derived types and have SWIG automatically generate the dynamic_cast code. This appears to be a better solution that the first, however upon a deeper look it still requires you to hunt down all the methods and all the possible derived types it could return. Again, a huge maintenance issue. I wish I had a doc link for this but I can't find one. I found out about this functionality by looking through the example code that comes with SWIG. Create a C# method to create an instance of the derived object and transfer the cPtr to the new instance. While I consider this clumsy, it does work. See an example below. public static object castTo(object fromObj, Type toType) { object retval = null; BaseClass fromObj2 = fromObj as BaseClass; HandleRef hr = BaseClass.getCPtr(fromObj2); IntPtr cPtr = hr.Handle; object toObj = Activator.CreateInstance(toType, cPtr, false); // make sure it actually is what we think it is if (fromObj.GetType().IsInstanceOfType(toObj)) { return toObj; } return retval; } Are these really the options? And if I'm not willing to dig through all the existing functions and class derivations, then I'm left with #3? Any help would be appreciated.

    Read the article

  • Triggers in NHibernate

    - by Felipe
    Hi everybody, I'd like to know if is there something like a Trigger (of databases) in NHibernate that I can use per entity ? I'd like to make a history of each record, and with triggers I can compare the old value and new value of each property and generate a register of history. I've heard about Audit in NHibernate, but it's for all entities, if there isn't another way... how Can I separete a block per entity ? Thanks

    Read the article

  • Sqlalchemy complex in_ clause

    - by lostlogic
    I'm trying to find a way to cause sqlalchemy to generate sql of the following form: select * from t where (a,b) in ((a1,b1),(a2,b2)); Is this possible? If not, any suggestions on a way to emulate it? Thanks kindly!

    Read the article

  • Telerick java script resize problem

    - by Maki
    Hi! I' have an telerick asp.net control that generate an html code that contains 2 div's, I resize this div's using js, after that this page is loading in iframe and my div's resize to defalult values, where is the problem??

    Read the article

  • Generating a URL pattern when provided a set of 5 or so URLs

    - by ryan
    Provided with a set of URLs, I need to generate a pattern, For example: http://www.buy.com/prod/disney-s-star-struck/q/loc/109/213724402.html http://www.buy.com/prod/samsung-f2380-23-widescreen-1080p-lcd-monitor-150-000-1-dc-8ms-1920-x/q/loc/101/211249863.html http://www.buy.com/prod/panasonic-nnh765wf-microwave-oven-countertop-1-6-ft-1250w-panasonic/q/loc/66357/202045865.html http://www.buy.com/prod/escape-by-calvin-klein-for-women-3-4-oz-edp-spray/q/loc/66740/211210860.html http://www.buy.com/prod/v-touch-8gb-mp3-mp4-2-8-touch-screen-2mp-camera-expandable-minisd-w/q/loc/111/211402014.html Pattern is http://www.buy.com/prod/[^~]/q/loc/[^~].html

    Read the article

  • How to implement a link that can get bonus for 5 times by different people on a Social Network?

    - by Jian Lin
    How can we generate a link that can be clicked on by 5 different people on a Social Network game, so that each of the five people can get a bonus? The link will be published as a "newsfeed" on the Social Network such as Facebook. The link shouldn't be easily "generated" by any people as a cheating method. Also, what database table(s) should be added to handle: 1) the bonus can be claimed up to 5 times 2) must be claimed by different people ?

    Read the article

  • QT/PyQT best practice for using QT Designer

    - by pierocampanelli
    What is your development approach with QT/PYQT and QT Designer ? Are you doing this: Put all components on the panel (without any layout) and arrange them Put components in layout (Align Vertically/Horizontally/Form/Grid) Generate UI file and start coding how do you manage when you have custom widget ? For example when you have to fine tune behaviour of a QButton or QLineEdit ? Is it possible to add this custom widget to designer?

    Read the article

  • Telerik java script resize problem

    - by Maki
    I have an Telerik asp.net control that generate an html code that contains 2 div's, I resize this div's using js, after that this page is loading in iframe and my div's resize to default values, where is the problem??

    Read the article

  • MovableType: Is it possible to have a rss feed for "todays" entries?

    - by tomwolber
    Background Our email vendor supports rss feeds for dynamic content, which we use successfully for "daily headline" type emails. This is a great help in automating many different emails that we don't have staffing to create daily. One of our staff as requested that his daily email (which has recent headlines from his Movable Type blog) only have headlines from entries posted on that day. My Question Since we use Movable Type for his blog, is there a way to generate a rss feed that only contains items posted on the current day?

    Read the article

  • Information Extraction Toolkits

    - by MathGladiator
    I'm looking for information extraction libraries where I can have semi structured information that may have either hidden or incomplete data. I want to train some classifiers to pull out content based on the structure. I'm working on building a tool where I can select text in the browser, and it will generate (via some web service call) a classifier that can be used on other documents to pull out text. I'm primarily looking at how the structure of the document can be used to indicate what the content is.

    Read the article

  • What is the average color of a star?

    - by RCIX
    I am trying to procedurally generate point stars to create a starfield background for my game. I want to weight the color production based on an average star's real color. Can anyone point me in the direction of this sort of data?

    Read the article

  • Getting shortest path between 2 nodes in quickgraph

    - by Xtapodi
    Hello, i want to ask if there is any way to generate the shortest path from node A to node B without generating the shortest paths to all the other nodes (stop when node B is in the examined set) with A-star in QuickGraph. I want to plug QuickGraph into a game and thus generating all the paths is not allowed from the time limitations the environment imposes. Any other suggestions to solve my problem in C# are welcome Thanks in advance, Xtapodi

    Read the article

  • XQuery: Inserting Nodes

    - by CoolGravatar
    I'm reading in an XML file using XQuery and want to insert several nodes/elements and generate a new XML file. How can I accomplish this? I've tried using the replace() function, but, it looks like all my XML tags are being stripped when I call doc() to load my document. So calling replace() isn't any good if my XML tags are being removed. Any help? Are there other technologies I can use?

    Read the article

  • Visual studio ORM designer option

    - by stackoverflowuser
    linq to sql visual studio Object-Relational designer generates C# entity class names same as the table names (except pluralizing it). so if the table name is authors it generates entity class with name "author". If the table name is Customers it generates class with name "Customer". Is there any option that can be set to make the designer generate entity class names as pascal cased. I am using VS 2010 if that makes any difference. Thanks.

    Read the article

  • AutoGen DB models for ASP .NET

    - by Tereno
    Hi there, I am wondering if there's anything out there for ASP .NET that is similar to Django or Ruby on Rails. Specifically, I'm looking for something that allows me to auto-generate the database models by specifying my classes in the controller and what not. Would I be able to achieve those functionality with IronPython or IronRuby? Thanks!

    Read the article

  • Should I remove Etag for htm and php pages?

    - by Castor
    I generate htm files dynamically using php and .htaccess. I read somewhere that I should remove Etags for files of type text/html? Is that correct? I am wondering if I use etags and If i don't change the content, I could save some bandwidth. I would appreciate if you guys could tell me if I can use etags for htm files.

    Read the article

  • iPhone Excel generation

    - by satyam
    I'm creating an application that generates purchase order. I'm able to create text file from the details entered by user. I would like to generate an Excel which looks much better than a normal text file. Is there any open source library that I can use in my application?

    Read the article

  • Which CDN offers rewrite rules for urls

    - by Marc
    I'm looking for a Content Delivery Network which offers the ability to make images available through multiple urls while they exist physically only one time. I want to generate seo friendly image urls with the relevant keywords in different languages. Thanks for your advice!

    Read the article

  • IIS failed request log viewer

    - by Cédric Boivin
    Hello, It's there an existing application to visualize IIS 7.0 failed request log ? I know you can use IE to analyse the xml log file, and we get a visual generate by the xsl file, but my xml log file have 97 MO and the IE performance is not got. I cannot view the performance log, because i beleive there a javascript error generated. Thanks

    Read the article

  • View dynamic code in Visual Studio

    - by Robert
    I generate a dynamic assembly with CSharpCodeProvider, from a C# source saved into a string. I can run the synamic code at runtime, but if I pause the execution Visual Studio doesn't show me the dinamic source code in the call stack. It says "External code" and I can't step into that source code. I think VS can't find PDB or other debug info. Can you help me?

    Read the article

  • T4 Controller Template to trigger View Generation

    - by DrydenMaker
    I have been using some customized MVC templates that really improve my productivity. However, I would like to take it to the next level. I generate a controller template for each table in my app. The controller has Edit, List, Details, and Delete actions. What I would like to do, is at the same time trigger the generation of the views for those actions. Does anyone have a reference or have suggestions on how this can be done?

    Read the article

  • Translate C# code into AST?

    - by Erik Forbes
    Is it currently possible to translate C# code into an Abstract Syntax Tree? Edit: some clarification; I don't necessarily expect the compiler to generate the AST for me - a parser would be fine, although I'd like to use something "official." Lambda expressions are unfortunately not going to be sufficient given they don't allow me to use statement bodies, which is what I'm looking for.

    Read the article

  • How does the hash part in hash maps work?

    - by sub
    So there is this nice picture in the hash maps article on Wikipedia: Everything clear so far, except for the hash function in the middle. How can a function generate the right index from any string? Are the indexes integers in reality too? If yes, how can the function output 1 for John Smith, 2 for Lisa Smith, etc.?

    Read the article

< Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >