Search Results

Search found 2966 results on 119 pages for 'procedural generation'.

Page 16/119 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Source-to-source compiler framework wanted

    - by cheungcc_2000
    Dear all, I used to use OpenC++ (http://opencxx.sourceforge.net/opencxx/html/overview.html) to perform code generation like: Source: class MyKeyword A { public: void myMethod(inarg double x, inarg const std::vector<int>& y, outarg double& z); }; Generated: class A { public: void myMethod(const string& x, double& y); // generated method below: void _myMehtod(const string& serializedInput, string& serializedOutput) { double x; std::vector<int> y; // deserialized x and y from serializedInput double z; myMethod(x, y, z); } }; This kind of code generation directly matches the use case in the tutorial of OpenC++ (http://www.csg.is.titech.ac.jp/~chiba/opencxx/tutorial.pdf) by writing a meta-level program for handling "MyKeyword", "inarg" and "outarg" and performing the code generation. However, OpenC++ is sort of out-of-date and inactive now, and my code generator can only work on g++ 3.2 and it triggers error on parsing header files of g++ of higher version. I have looked at VivaCore, but it does not provide the infra-structure for compiling meta-level program. I'm also looking at LLVM, but I cannot find documentation that tutor me on working out my source-to-source compilation usage. I'm also aware of the ROSE compiler framework, but I'm not sure whether it suits my usage, and whether its proprietary C++ front-end binary can be used in a commercial product, and whether a Windows version is available. Any comments and pointers to specific tutorial/paper/documentation are much appreciated.

    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

  • Generate POCO classes in different project to the project with Entity Framework model

    - by Max
    I'm trying to use the Repository Pattern with EF4 using VS2010. To this end I am using POCO code generation by right clicking on the entity model designer and clicking Add code generation item. I then select the POCO template and get my classes. What I would like to be able to do is have my solution structured into separate projects for Entity (POCO) classes and another project for the entity model and repository code. This means that my MVC project could use the POCO classes for strongly typed views etc and not have to know about the repository or have to have a reference to it. To plug it all together I will have another separate project with interfaces and use IoC. Sounds good in my head I just don't know how to generate the classes into their own project! I can copy them and then change the namespaces on them but I wanted to avoid manual work whenever I change the schema in the db and want to update my model. Thanks

    Read the article

  • Good tools which generate NUnit unit tests for .NET assemblies in Visual Studio 2008

    - by andy
    Hey guys, I'm pretty new to Unit Testing so bare with me. I realize that best best practice is not to auto generate unit tests, however I'd like to use Code Generation to set-up the basic skeleton of the tests. Now, I know Visual Studio 2008 already has the built in "create tests", however, it just creates a flat list of all the classes it's going to test... and it's not for NUnit right? Ideally, I'd like the code generation to follow the folder AND namespace structure of the assembly its generating tests for. Can you guys recommend any good tools which generate NUnit unit tests for .NET assemblies in Visual Studio 2008? cheers!

    Read the article

  • WPF DataGrid AutoColumn generation via ICustomTypeDescriptor.

    - by panamack
    In a test project I've managed to AutoGenerate WPF DataGrid columns in the following scenario, where the data is stored in a Dictionary and binding is performed via PropertyDescriptors: public class People:List<Person>{ ... } public class Person:Dictionary<string,string>,INotifyPropertyChanged,ICustomTypeDescriptor { } The problem I'm having is in my real life project I'm using MVVM so it's *People*ViewModel which inherits ViewModelBase and hence can't inherit List<Person>. I've tried implementing IList<Person> instead with an internal List<Person> and explicitly setting the DataContext to an IList<Person> reference but that didn't work. I've seen a similar post on binding a win forms DataGridView here, so I'm wondering if the same sort of logic applies in WPF and primarily, what exactly causes the ICustomTypeDescriptor implementation to be picked up when inheriting List<T> that is missing when you simply implement IList<T> instead.

    Read the article

  • Zend Pdf generation from an action

    - by Nisanth
    Hi all, I have a controller Employee , in that i have the action detail . The detail action prints like the attached image. Suppose there is a save pdf button, i need to print this page as .pdf.. How can i do this ? Pls help me Thanks in advance Nisanth

    Read the article

  • VB6 ImageList Frm Code Generation

    - by DAC
    Note: This is probably a shot in the dark, and its purely out of curiosity that I'm asking. When using the ImageList control from the Microsoft Common Control lib (mscomctl.ocx) I have found that VB6 generates FRM code that doesn't resolve to real property/method names and I am curious as to how the resolution is made. An example of the generated FRM code is given below with an ImageList containing 3 images: Begin MSComctlLib.ImageList ImageList1 BackColor = -2147483643 ImageWidth = 100 ImageHeight = 45 MaskColor = 12632256 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 3 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = "Form1.frx":0054 Key = "" EndProperty BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = "Form1.frx":3562 Key = "" EndProperty BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = "Form1.frx":6A70 Key = "" EndProperty EndProperty End From my experience, a BeginProperty tag typically means a compound property (an object) is being assigned to, such as the Font object of most controls, for example: Begin VB.Form Form1 Caption = "Form1" ClientHeight = 10950 ClientLeft = 60 ClientTop = 450 ClientWidth = 7215 BeginProperty Font Name = "MS Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty End Which can be easily seen to resolve to VB.Form.Font.<Property Name>. With ImageList, there is no property called Images. The GUID associated with property Images indicates type ListImages which implements interface IImages. This type makes sense, as the ImageList control has a property called ListImages which is of type IImages. Secondly, properties ListImage1, ListImage2 and ListImage3 don't exist on type IImages, but the GUID associated with these properties indicates type ListImage which implements interface IImage. This type also makes sense, as IImages is in fact a collection of IImage. What doesn't make sense to me is how VB6 makes these associations. How does VB6 know to make the association between the name Images - ListImages purely because of an associated type (provided by the GUID) - perhaps because it's the only property of that type? Secondly, how does it resolve ListImage1, ListImage2 and ListImage3 into additions to the collection IImages, and does it use the Add method? Or perhaps the ControlDefault property? Perhaps VB6 has specific knowledge of this control and no logical resolution exists?

    Read the article

  • Automatic INotifyPropertyChanged Implementation through T4 code generation?

    - by chrischu
    I'm currently working on setting up a new project of mine and was wondering how I could achieve that my ViewModel classes do have INotifyPropertyChanged support while not having to handcode all the properties myself. I looked into AOP frameworks but I think they would just blow up my project with another dependency. So I thought about generating the property implementations with T4. The setup would be this: I have a ViewModel class that declares just its Properties background variables and then I use T4 to generate the Property Implementations from it. For example this would be my ViewModel: public partial class ViewModel { private string p_SomeProperty; } Then T4 would go over the source file and look for member declarations named "p_" and generate a file like this: public partial class ViewModel { public string SomeProperty { get { return p_SomeProperty; } set { p_SomeProperty= value; NotifyPropertyChanged("SomeProperty"); } } } This approach has some advantages but I'm not sure if it can really work. So I wanted to post my idea here on StackOverflow as a question to get some feedback on it and maybe some advice how it can be done better/easier/safer.

    Read the article

  • WCF Proxy generation

    - by dragonfly
    Hi, I'm generating proxy using svcutil tool. My contract methods return objects of particular type. However generated proxy client interface has return value of type object. What is more I get exception with message: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail] : The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:name. The InnerException message was 'XML 'Element' 'http://tempuri.org/:name' does not contain expected attribute 'http://schemas.microsoft.com/2003/10/Serialization/:Type'. The deserializer has no knowledge of which type to deserialize. Check that the type being serialized has the same contract as the type being deserialized.'. Please see InnerException for more details. Any ideas what's going on?

    Read the article

  • ASP.NET MVC 2 generation of the List/Index view

    - by Klas Mellbourn
    ASP.NET MVC 2 has powerful features for generating the model-dependent content of the Edit view (using EditorForModel) and Details view (using DisplayForModel) that automatically utilizes metadata and editor (or display) templates: <% using (Html.BeginForm()) {%> <%= Html.ValidationSummary(true) %> <fieldset> <legend><%= Html.LabelForModel() %></legend> <%= Html.EditorForModel() %> <p> <input type="submit" value="Save" /> </p> </fieldset> <% } %> However, I cannot find any comparable tools for the "last" step of generating the Index view (a.k.a. the List view). There I have to hard code the columns first in the row representing the headers and then inside the foreach loop: <h2>Index</h2> <table> <tr> <th></th> <th> ID </th> <th> Foo </th> <th> Bar </th> </tr> <% foreach (var item in Model) { %> <tr> <td> <%= Html.ActionLink("Edit", "Edit", new { id=item.ID }) %> | <%= Html.ActionLink("Details", "Details", new { id=item.ID })%> | <%= Html.ActionLink("Delete", "Delete", new { id=item.ID })%> </td> <td> <%= Html.Encode(item.ID) %> </td> <td> <%= Html.Encode(item.Foo) %> </td> <td> <%= Html.Encode(String.Format("{0:g}", item.Bar)) %> </td> </tr> <% } %> </table> What would be the best way to generate the columns (utlizing metadata such as HiddenInput), with the aim of making the Index view as free of model particulars as Edit and Details?

    Read the article

  • C# and F# lambda expressions code generation

    - by ControlFlow
    Let's look at the code, generated by F# for simple function: let map_add valueToAdd xs = xs |> Seq.map (fun x -> x + valueToAdd) The generated code for lambda expression (instance of F# functional value) will looks like this: [Serializable] internal class map_add@3 : FSharpFunc<int, int> { public int valueToAdd; internal map_add@3(int valueToAdd) { this.valueToAdd = valueToAdd; } public override int Invoke(int x) { return (x + this.valueToAdd); } } And look at nearly the same C# code: using System.Collections.Generic; using System.Linq; static class Program { static IEnumerable<int> SelectAdd(IEnumerable<int> source, int valueToAdd) { return source.Select(x => x + valueToAdd); } } And the generated code for the C# lambda expression: [CompilerGenerated] private sealed class <>c__DisplayClass1 { public int valueToAdd; public int <SelectAdd>b__0(int x) { return (x + this.valueToAdd); } } So I have some questions: Why does F#-generated class is not marked as sealed? Why does F#-generated class contains public fields since F# doesn't allows mutable closures? Why does F# generated class has the constructor? It may be perfectly initialized with the public fields... Why does C#-generated class is not marked as [Serializable]? Also classes generated for F# sequence expressions are also became [Serializable] and classes for C# iterators are not.

    Read the article

  • OpenAL tone generation on iPhone

    - by Sj
    So I have been looking around for some time now on a way to produce a variable tone on the iPhone using OpenAL, the issue being the Apple has deprecated the ALUT part of OpenAL that has the alutCreateBufferWaveform that would be perfect for this. I was wondering if anyone had any idea how to make a tone generator using OpenAL on the iPhone SDK. All I need is the ability to produce a certain frequency tone consistantly over and over again. This is a last resort so sorry if it sounds kind of stupid.

    Read the article

  • Code Golf - Banner Generation

    - by Claudiu
    When thanking someone, you don't want to just send them an e-mail saying "Thanks!", you want to have something FLASHY: Input: THANKS!! Output: TTT H H AAA N N K K SSS !!! !!! T H H A A NNN K K S !!! !!! T HHH AAA NNN KK SSS !!! !!! T H H A A N N K K S T H H A A N N K K SSS !!! !!! Write a program to generate a banner. You only have to generate upper-case A-Z along with spaces and exclamation points (what is a banner without an exclamation point?). All characters are made up of a 3x5 grid of the same character (so the S is a 3x5 grid made of S). All output should be on one row (so no newlines). Here are all the letters you need: Input: ABCDEFGHIJKL Output: AAA BBB CCC DD EEE FFF GGG H H III JJJ K K L A A B B C D D E F G H H I J K K L AAA BBB C D D EE FF G G HHH I J KK L A A B B C D D E F G G H H I J J K K L A A BBB CCC DD EEE F GGG H H III JJJ K K LLL Input: MNOPQRSTUVWX Output: M M N N OOO PPP QQQ RR SSS TTT U U V V W W X X MMM NNN O O P P Q Q R R S T U U V V W W X M M NNN O O PPP Q Q RR SSS T U U V V WWW X M M N N O O P QQQ R R S T U U V V WWW X M M N N OOO P QQQ R R SSS T UUU V WWW X X Input: YZ! Output: Y Y ZZZ !!! Y Y Z !!! YYY Z !!! Y Z YYY ZZZ !!! The winner is the shortest source code. Source code should read input from stdin, output to stdout. You can assume input will only contain [A-Z! ]. If you insult the user on incorrect input, you get a 10 character discount =P. I was going to require these exact 27 characters, but to make it more interesting, you can choose how you want them to look - whatever makes your code shorter! To prove that your letters do look like normal letters, show the output of the last three runs.

    Read the article

  • XML generation error.

    - by Janis Peisenieks
    I'm trying to generate an XML output with Zend_Framework, but this nasty thing keeps popping up: XML Parsing Error: XML or text declaration not at start of entity Location: http://cart/index/kurpirkt Line Number 2, Column 1:<?xml version="1.0" encoding="utf-8"?> ^ As far as I know there are no white-spaces in any of my include files, and even if there were, I think that the ob_clean() function should have taken care of it. Here is my code: public function kurpirktAction() { ob_clean(); // XML-related routine $xml = new DOMDocument('1.0', 'utf-8'); $xml->appendChild($xml->createElement('foo', 'bar')); $output = $xml->saveXML(); // Both layout and view renderer should be disabled Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender(true); Zend_Layout::getMvcInstance()->disableLayout(); // Setting up headers and body $this->_response->setHeader('Content-Type', 'text/xml; charset=utf-8') ->setBody($output); } Any help or suggestions?

    Read the article

  • MonoDevelop: Addin generation issues

    - by calmcajun
    I am having problems creating the root.mrep file for a updated MonoDevelop Addin. The Addin was originally built for MonoDevelop 2.2. I am able to build the updated project but when I use mdrun.exe setup rep-build to generate the .mrep files(main and root) it only generates the main.mrep file and not the root.mrep file. Is there a new way of building the addin that I am missing? I used both setup pack and then setup rep-build. I have listed a snippet of the addin.xml file below: <Addin id = "Addin" namespace = "MonoDevelop" name = "Monobjc development" author = "Rob L" copyright = "" description = "Addin" category = "Mac Development" version = "1.0"> <Runtime> <Import assembly="MonoDevelop.Sample.dll" /> <Import assembly="MonoDevelop.MacDev.dll" /> <Import assembly="Sample.Tools.dll" /> </Runtime> <Dependencies> <Addin id="Core" version="2.4" /> <Addin id="Core.Gui" version="2.4" /> <Addin id="Projects" version="2.4" /> <Addin id="Projects.Gui" version="2.4" /> <Addin id="Ide" version="2.4" /> </Dependencies> <MoreStuffHere /> </Addin>

    Read the article

  • Haystack / Whoosh Index Generation Error

    - by Keith Fitzgerald
    I'm trying to setup haystack with whoosh backend. When i try to gen the index [or any index command for that matter] i receive: TypeError: Item in ``from list'' not a string if i completely remove my search_indexes.py i get the same error [so i'm guessing it can't find that file at all] what might cause this error? it's set to autodiscover and i'm sure my app is installed because i'm currently using it. Full traceback: Traceback (most recent call last): File "./manage.py", line 17, in <module> execute_manager(settings) File "/Users/ghostrocket/Development/Redux/.dependencies/django/core/management/__init__.py", line 362, in execute_manager utility.execute() File "/Users/ghostrocket/Development/Redux/.dependencies/django/core/management/__init__.py", line 303, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/ghostrocket/Development/Redux/.dependencies/django/core/management/__init__.py", line 257, in fetch_command klass = load_command_class(app_name, subcommand) File "/Users/ghostrocket/Development/Redux/.dependencies/django/core/management/__init__.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/Users/ghostrocket/Development/Redux/.dependencies/django/utils/importlib.py", line 35, in import_module __import__(name) File "/Users/ghostrocket/Development/Redux/.dependencies/haystack/__init__.py", line 124, in <module> handle_registrations() File "/Users/ghostrocket/Development/Redux/.dependencies/haystack/__init__.py", line 121, in handle_registrations search_sites_conf = __import__(settings.HAYSTACK_SITECONF) File "/Users/ghostrocket/Development/Redux/website/../website/search_sites.py", line 2, in <module> haystack.autodiscover() File "/Users/ghostrocket/Development/Redux/.dependencies/haystack/__init__.py", line 83, in autodiscover app_path = __import__(app, {}, {}, [app.split('.')[-1]]).__path__ TypeError: Item in ``from list'' not a string and here is my search_indexes.py from haystack import indexes from haystack import site from myproject.models import * site.register(myobject)

    Read the article

  • Feedback on TOC Generation Code

    - by vikramjb
    Hi All I wrote a small code to generate ToC or Hierachical Bullets like one sees in a word document. Like the following set 1. 2 3 3.1 3.1.1 4 5 and so on so forth, the code is working but I am not happy with the code I have written, I would appreciate if you guys could shed some light on how I can improve my C# code. You can download the project from Rapidshare Please do let me know if you need more info. I am making this a community wiki. private void frmMain_Load(object sender, EventArgs e) { this.EnableSubTaskButton(); } private void btnNewTask_Click(object sender, EventArgs e) { this.AddNodes(true); } private void AddNodes(bool IsParent) { TreeNode parentNode = tvToC.SelectedNode; string curNumber = "0"; if (parentNode != null) { curNumber = parentNode.Text.ToString(); } curNumber = this.getTOCReference(curNumber, IsParent); TreeNode childNode = new TreeNode(); childNode.Text = curNumber; this.tvToC.ExpandAll(); this.EnableSubTaskButton(); this.tvToC.SelectedNode = childNode; if (IsParent) { if (parentNode == null) { tvToC.Nodes.Add(childNode); } else { if (parentNode.Parent != null) { parentNode.Parent.Nodes.Add(childNode); } else { tvToC.Nodes.Add(childNode); } } } else { parentNode.Nodes.Add(childNode); } } private string getTOCReference(string curNumber, bool IsParent) { int lastnum = 0; int startnum = 0; string firsthalf = null; int dotpos = curNumber.IndexOf('.'); if (dotpos > 0) { if (IsParent) { lastnum = Convert.ToInt32(curNumber.Substring(curNumber.LastIndexOf('.') + 1)); lastnum++; firsthalf = curNumber.Substring(0, curNumber.LastIndexOf('.')); curNumber = firsthalf + "." + Convert.ToInt32(lastnum.ToString()); } else { lastnum++; curNumber = curNumber + "." + Convert.ToInt32(lastnum.ToString()); } } else { if (IsParent) { startnum = Convert.ToInt32(curNumber); startnum++; curNumber = Convert.ToString(startnum); } else { curNumber = curNumber + ".1"; } } return curNumber; } private void btnSubTask_Click(object sender, EventArgs e) { this.AddNodes(false); } private void EnableSubTaskButton() { if (tvToC.Nodes.Count == 0) { btnSubTask.Enabled = false; } else { btnSubTask.Enabled = true; } } private void btnTest1_Click(object sender, EventArgs e) { for (int i = 0; i < 100; i++) { this.AddNodes(true); } for (int i = 0; i < 5; i++) { this.AddNodes(false); } for (int i = 0; i < 5; i++) { this.AddNodes(true); } }

    Read the article

  • need help figuring out dynamic menu generation in django

    - by photographer
    I need to dynamically generate a code like this in the resulting html: <p>>> gallery one</p> <p><a href="../gallery2">gallery two</a></p> <p><a href="../about">about the author</a></p> <p><a href="../news">our news</a></p> I do have menu_code string variable created in views.py (it is generated depending on an item number of the current page passed — 1 in the case above), which contains that long string with the code shown above. It is (well, supposed to) passed by locals() into the html template (all other variables are passed that way successfully): return render_to_response('gallery_page.html', locals()) I have this: {% include menu_code %} inside the template html. But instead of being interpreted as code it is just shown as text in the browser. What am I doing wrong? How to make it work as a dynamically generated menu?

    Read the article

  • Axis2 Class Generation

    - by Jack
    I have an instance of a derived class (called Child) that I would like to send between the client and server of my web service. However, the method that might be returning this instance, is marked as returning an instance of the parent class (called Parent). For example: public class Service{public Parent createInstanceOfParentOrChildObject();} While Child is not a parameter anywhere in the service nor is it ever specifically named as a return type (only Parent is ever named), it is nonetheless generated and returned inside certain methods (and then cast to Parent). I generated the wsdl file using Axis2 1.4.1 java2wsdl and specifying that it include this class (using the -xc parameter). I did not use Axis2 1.5.1 because it was not honoring the -xc parameter though it looks like that bug is supposedly fixed in Axis2 1.6. I even did a quick check of the generated .wsdl file to ensure that it did indeed include a definition for Child (and, of course, Parent). However, when I used wsdl2java to generate the server-side (and client-side) code, Child was not generated. How can I get wsdl2java to generate Child? I realize that I could do this by hand but I don't want to have to do this for both the client and server. I was also hoping that I could make this as easy as possible for people to use my wsdl to generate their own clients.

    Read the article

  • C# integer primary key generation using Entity Framework with local database file (Sdf)

    - by Ronny
    Hello, I'm writing a standalone application and I thought using Entity Framework to store my data. At the moment the application is small so I can use a local database file to get started. The thing is that the local database file doesn't have the ability to auto generate integer primary keys as SQL Server does. Any suggestions how to manage primary keys for entities in a local database file that will be compatible with SQL Server in the future? Thanks, Ronny

    Read the article

  • Java .doc generation

    - by bozo
    Hi, anyone knows an easy method to generate mail merge .doc file from Java? So, I want to create a Word (95/97) document in Word, put some simple placeholders in it (only single value, no iterators and other advanced tags) like the ones used with mailmerge option, and then at runtime replace those placeholders with values from Java. One option is to use Jasperreports, but this would require that I create exact replica of non-trivial Word document in Jasper format, which is not easy and is hard to change later. Is there some method of filling placeholders in Word from Java, which does not require low-level document alteration with positioning and others low-level .doc tags from code, but something like this: docPreparer.fillPlaceholder('placeholder1', 'my real value from runtime'); Some CRMs do this via ActiveX control for internet explorer, and it works great (they use Word's mailmerge) but I need an all-Java solution. Ideas? Thanks, Bozo

    Read the article

  • Cake php menu generation

    - by RSK
    hai everyone........ I am trying to generate dynamic menu according to the user permission given with ACL component in cake php.. ie., if a user logins, i need to check which all actions are permitted for that specific user and according that list of actions i need to generate menu can any one help me to get all the permitted actions from the acos,aros,acos_aros tables thanks in advance

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >