Search Results

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

Page 39/316 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • How to generate a random BigInteger value in Java?

    - by Bill the Lizard
    I need to generate arbitrarily large random integers in the range 0 (inclusive) to n (exclusive). My initial thought was to call nextDouble and multiply by n, but once n gets to be larger than 253, the results would no longer be uniformly distributed. BigInteger has the following constructor available: public BigInteger(int numBits, Random rnd) Constructs a randomly generated BigInteger, uniformly distributed over the range 0 to (2numBits - 1), inclusive. How can this be used to get a random value in the range 0 - n, where n is not a power of 2?

    Read the article

  • how to generate JMX MXBean compatible java class model from JAXB?

    - by yucubby
    From the JMX MXBean specification, a java class type J must satisfy Either if J has at least one public constructor with a ConstructorProperties annotation, Or if J has a public no-arg constructor, and for every getter in J with type T and name N there is a corresponding setter with the same name and type So how can I use JAXB to generate JAVA class model which satisfy the MXBean constrain? Thanks YU

    Read the article

  • What's the best way to generate an API reference document using a Rails routes.rb file?

    - by RNHurt
    I am trying to document the API for my Rails application and I can't help but wonder if there is a better way to generate an XML file based on my routes.rb file. I'm envisioning something similar to the output of rake routes but in a more friendly, XML type format. Corey has some interesting ideas about using reflection/introspection on the routes file here but it's not quite what I need. Please tell me this is a solved problem and I'm not the first one to think of this. :)

    Read the article

  • How to generate unique serial number of machine in Delphi?

    - by noxwow
    Hi, I have question how to generate unique serial number of machine in Delphi? I tried to do this using the ID the motherboard or processor, but unfortunately it's unfortunately supported. Partition serial numbers, etc. fall off, because it is changing after the formatted. I'm looking for something that doesn't change after the formatted. Has anyone any idea?

    Read the article

  • How do I generate Entity Framework 4.0 classes from the command line that have different names than

    - by Josh Kodroff
    I want to generate Entity Framework 4.0 classes from a (legacy) database from a command line, but I have 2 transformations I want: Tables/columns are lowerCamelCase and I want my classes/members to be UpperCamelCase. I want to suffix my classes with "Dto". Any idea how this might be accomplished? I'm a total newbie to EF, but I have a decent understanding of Linq to Sql and was able to accomplish the same task by doing: sqlmetal - dbml - xml mapping file and .cs file.

    Read the article

  • How do I generate a RouteLink to a route in a different area?

    - by Max Schmeling
    I have two different areas, and I have a route in one of those areas that is specific to that area, but I need to generate a link to that route using Html.RouteLink from another area (it's how you get over into the new area) but it won't work... It doesn't seem possible to use RouteLink to routes in a different area. What is the best way around this? Should I just define a new route in the other area and name it differently?

    Read the article

  • Can emacs generate a table of comments and number sections of a document?

    - by mp3foley
    I'm writing a plain text document with numbered sections or chapters and am wondering if emacs can help with numbering and re-numbering sections. And of course would be great if it could then generate a table of contents as well. I have had a search on google and looked through the emacs wiki but did not come up with anything other than for latex stuff and possibly muse mode, but I would like to keep this as a plain text README style document. Thanks for any help or suggestions.

    Read the article

  • I need to generate a string of 7 chars that is based on the id of the row.

    - by Totty
    I need to generate a string of 7 chars that is based on the id of the row. So knowing the id of the image and a secret key, i should get the generated string. the string must contain chars from "a" to "z" and numbers from 0 to 9. I have a dir that contains photos like this dir/p3/i2/s21/thumb.jpg the generated string is p3i2s21, then is used to calculate the path of the image.

    Read the article

  • How do I generate C# code from WADL files?

    - by Anders Sandvig
    I am looking for a code generator than can generate C# code to access RESTful web services described by WADL files in a way similar to how wadl2java works. Doing som searching I came across the rest-api-code-gen project on Google Code, but although the latest source does in fact support C#, the REST Describe & Compile demo site does not. (The C# button is there, but it's disabled.) I realize I could download the source and set up my own server with the latest version, but I would prefer not to, as what I need is a command line tool and not a web application with dependencies to Google Web Toolkit. I guess I could write my own a command line tool based on the same source code, but if it has already been done, or other tools can do the job, I'd rather avoid it. So, I'm wondering, are there any tools like that out there?

    Read the article

  • DBD::CSV: How can I generate different behavior with the two f_ext-options ".csv" and ".csv/r"?

    - by sid_com
    This is from the DBD::File-documentation: f_ext This attribute is used for setting the file extension where (CSV) files are opened. There are several possibilities. DBI:CSV:f_dir=data;f_ext=.csv In this case, DBD::File will open only table.csv if both table.csv and table exist in the datadir. The table will still be named table. If your datadir has files with extensions, and you do not pass this attribute, your table is named table.csv, which is probably not what you wanted. The extension is always case-insensitive. The table names are not. DBI:CSV:f_dir=data;f_ext=.csv/r In this case the extension is required, and all filenames that do not match are ignored. It was not possible for me to generate different behavior with the two options ".csv/r" and ".csv". Could someone show me an example, where I can see the difference between ".csv/r" and ".csv"?

    Read the article

  • How to generate and print large XPS documents in WPF?

    - by bitbonk
    I would like to generate (and then print or save) big XPS documents (400 pages) from my WPF application. We have some large amount of in-memory data that needs to be written to XPS. How can this be done without getting an OutOfMemoryException? Is there a way I can write the document in chunks? How is this usually done? Should I not be using XPS for large files in the first place? The root cause of the OutOfMemoryException seems to be the creation of the huge FlowDocument. I am creating the full FlowDocument and then sending it to the XPS document writer. Is this the wrong approach?

    Read the article

  • How do you use the LINQ to SQL designer to generate accessor methods for subclasses?

    - by Pricey
    Above is the LINQ to SQL designer view for my data context. Below is the relevant code: public System.Data.Linq.Table<ActivityBase> ActivityBases { get { return this.GetTable<ActivityBase>(); } } ... [Table(Name="dbo.Activities")] [InheritanceMapping(Code="1", Type=typeof(ActivityBase), IsDefault=true)] [InheritanceMapping(Code="2", Type=typeof(Project))] [InheritanceMapping(Code="3", Type=typeof(ProjectActivity))] [InheritanceMapping(Code="5", Type=typeof(Task))] [InheritanceMapping(Code="4", Type=typeof(Activity))] public abstract partial class ActivityBase : INotifyPropertyChanging, INotifyPropertyChanged { ... Is there a way to generate accessor methods for the subclasses as shown in the inheritance mapping above (Project, Task, etc...) without doing it manually? I added them manually but then a change in the designer overwrites any manual changes. Am i doing this wrong? should I not be making accessors for the sub classes? filtering from ActivityBase seems worse to me. Thanks for any help on this.

    Read the article

  • How to generate entity classes from nhibernate mapping files during runtime.

    - by Denis Rosca
    Hello, i need some help with c# and nhibernate. I'm working on a project that requires the entity classes to be generated from hbm files at runtime. I get the mapping files from a service, and then need to generate the classes dynamicaly and configure nhibernate to use them. The problem is that i'm new to nhibernate and not much of a pro in c#, so me writing the piece of code that achieves this is very error-prone. I was wondering if you know of any open source software that i could use. Worst case scenario (if can't find anything that even remotely resembles what i need), do you guys have some advice on where should i start? Maybe some links ? Thanks, Denis.

    Read the article

  • Is it possible to generate dynamic proxy for static class or static method in C#?

    - by Jeffrey
    I am trying to come up with a way that (either static or instance) method calls can be intercepted by dynamic proxy. I want to implement it as c# extension methods but stuck on how to generate dynamic proxy for static methods. Some usages: Repository.GetAll<T>().CacheForMinutes(10); Repository.GetAll<T>().LogWhenErrorOccurs(); //or var repo = new Repository(); repo.GetAll<T>().CacheForMinutes(10); repo.GetAll<T>().LogWhenErrorOccurs(); I am open to any library (linfu, castle.dynamic proxy 2 or etc). Thanks!

    Read the article

  • How to generate all variations with repetitions of a string?

    - by Svenstaro
    I want to generate all variations with repetitions of a string in C++ and I'd highly prefer a non-recursive algorithm. I've come up with a recursive algorithm in the past but due to the complexity (r^n) I'd like to see an iterative approach. I'm quite surprised that I wasn't able to find a solution to this problem anywhere on the web or on StackOverflow. I've come up with a Python script that does what I want as well: import itertools variations = itertools.product('ab', repeat=4) for variations in variations: variation_string = "" for letter in variations: variation_string += letter print variation_string Output: aaaa aaab aaba aabb abaa abab abba abbb baaa baab baba babb bbaa bbab bbba bbbb Ideally I'd like a C++ program that can produce the exact output, taking the exact same parameters. This is for learning purposes, it isn't homework. I wish my homework was like that.

    Read the article

  • is there a way to generate pdf containing non-ascii symbols with pisa from django template?

    - by mihailt
    Hi. i'm trying to generate a pdf from template using this snippet: def write_pdf(template_src, context_dict): template = get_template(template_src) context = Context(context_dict) html = template.render(context) result = StringIO.StringIO() pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("UTF-8")), result) if not pdf.err: return http.HttpResponse(result.getvalue(), mimetype='application/pdf') except Exception('PDF error') but all non-latin symbols are not showing correctly, the template and view are saved using utf-8 encoding. i've tried saving view as ANSI and then to user unicode(html,"UTF-8"), but it throws TypeError. Also i thought that maybe it's because the default fonts somehow do not support utf-8 so according to pisa documentation i tried to set fontface in template body in style section. that still gave no results. Does any one have some ideas how to solve this issue?

    Read the article

  • Is using value converters to generate GUI-friendly strings a misuse of value converters?

    - by tempy
    Currently, I use value converters to generate user-friendly strings for the GUI. As an example, I have a window that displays the number of available entities in the status bar. The Viewmodel simply has an int dependency property that the calling code can set, and then on the binding for the textbox that displays the number of entities, I specify the int dependency property and a value converter that changes "x" into "x entities available". My code is starting to become littered with these converters, and I have a large number of annoying resource declarations in my XAML, and yet I like them because all the GUI-specific string formatting is being isolated in the converters and the calling code doesn't have to worry about it. But still, I wonder if this is not the purpose that value converters were made for.

    Read the article

  • How to call a Thor task multiple times?

    - by deepak
    Thor like Rake (and Make) has task management. If I call a task multiple times, it will effectively call the task only once. How can I call a task multiple times? I tried modifying the @_invocations hash, but that did not work: require 'csv' require './config/environment' class MisReport < Thor desc "all", "generate mysql and postgres mis" def all generate("pg_mis_report", "pg") generate("mysql_mis_report", "mysql") end desc "generate", "generate mis report" def generate(file_name = "mis_report_#{Time.now.to_s(:number)}", connection = "postgres") if connection == "pg" puts "== postgres database" ActiveRecord::Base.establish_connection :development_mysql else puts "== mysql database" ActiveRecord::Base.establish_connection :development end # generate MIS puts puts "mis file is at: #{file_path}" end end

    Read the article

  • What is the best way to generate a sitemap?

    - by Zakaria
    Hi everybody, I need to build a sitemap for my website. The url will be "www.example.com/mysitemap.html". I know that there are some tools that generate automatically an XML file that contains the reachable URLs and also improve the SEO. So my questions are: How can I build this HTML page going from the generated XML? Or am I wrong and this kind of HTML page is built manually? If not, how do we integrate the XML and convert it to the website? Thank you very much. Regards.

    Read the article

  • How to generate C# documentation to a CHM or HTML file?

    - by BrunoLM
    Is there a way to generate a readable document file from the documentation on the code directly from Visual Studio? (also considering 2010) If there isn't, what should I use to create a CHM or HTML file? Code example: /// <summary> /// Convert a number to string /// </summary> /// <param name="number">An integer number to be converted to string</param> /// <returns>Number as string</returns> /// <example> /// <code> /// var s = MyMethod(5); /// </code> /// </example> /// <exception cref="Exception">In case it can't convert</exception> /// <remarks> /// Whatever /// </remarks> public string MyMethod(int number) { return number.ToString(); }

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >