Search Results

Search found 29841 results on 1194 pages for 'random number generator'.

Page 19/1194 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Thoughts on my new template language/HTML generator?

    - by Ralph
    I guess I should have pre-faced this with: Yes, I know there is no need for a new templating language, but I want to make a new one anyway, because I'm a fool. That aside, how can I improve my language: Let's start with an example: using "html5" using "extratags" html { head { title "Ordering Notice" jsinclude "jquery.js" } body { h1 "Ordering Notice" p "Dear @name," p "Thanks for placing your order with @company. It's scheduled to ship on {@ship_date|dateformat}." p "Here are the items you've ordered:" table { tr { th "name" th "price" } for(@item in @item_list) { tr { td @item.name td @item.price } } } if(@ordered_warranty) p "Your warranty information will be included in the packaging." p(class="footer") { "Sincerely," br @company } } } The "using" keyword indicates which tags to use. "html5" might include all the html5 standard tags, but your tags names wouldn't have to be based on their HTML counter-parts at all if you didn't want to. The "extratags" library for example might add an extra tag, called "jsinclude" which gets replaced with something like <script type="text/javascript" src="@content"></script> Tags can be optionally be followed by an opening brace. They will automatically be closed at the closing brace. If no brace is used, they will be closed after taking one element. Variables are prefixed with the @ symbol. They may be used inside double-quoted strings. I think I'll use single-quotes to indicate "no variable substitution" like PHP does. Filter functions can be applied to variables like @variable|filter. Arguments can be passed to the filter @variable|filter:@arg1,arg2="y" Attributes can be passed to tags by including them in (), like p(class="classname"). You will also be able to include partial templates like: for(@item in @item_list) include("item_partial", item=@item) Something like that I'm thinking. The first argument will be the name of the template file, and subsequent ones will be named arguments where @item gets the variable name "item" inside that template. I also want to have a collection version like RoR has, so you don't even have to write the loop. Thoughts on this and exact syntax would be helpful :) Some questions: Which symbol should I use to prefix variables? @ (like Razor), $ (like PHP), or something else? Should the @ symbol be necessary in "for" and "if" statements? It's kind of implied that those are variables. Tags and controls (like if,for) presently have the exact same syntax. Should I do something to differentiate the two? If so, what? This would make it more clear that the "tag" isn't behaving like just a normal tag that will get replaced with content, but controls the flow. Also, it would allow name-reuse. Do you like the attribute syntax? (round brackets) How should I do template inheritance/layouts? In Django, the first line of the file has to include the layout file, and then you delimit blocks of code which get stuffed into that layout. In CakePHP, it's kind of backwards, you specify the layout in the controller.view function, the layout gets a special $content_for_layout variable, and then the entire template gets stuffed into that, and you don't need to delimit any blocks of code. I guess Django's is a little more powerful because you can have multiple code blocks, but it makes your templates more verbose... trying to decide what approach to take Filtered variables inside quotes: "xxx {@var|filter} yyy" "xxx @{var|filter} yyy" "xxx @var|filter yyy" i.e, @ inside, @ outside, or no braces at all. I think no-braces might cause problems, especially when you try adding arguments, like @var|filter:arg="x", then the quotes would get confused. But perhaps a braceless version could work for when there are no quotes...? Still, which option for braces, first or second? I think the first one might be better because then we're consistent... the @ is always nudged up against the variable. I'll add more questions in a few minutes, once I get some feedback.

    Read the article

  • A Hover Ad Generator Guide

    While popup ads have been the subject of controversy among many webmasters and Internet users, the fact remains that they can be extremely lucrative. Because many webmasters have been afraid to use popups due to the controversy that surrounds them, the few webmasters who endorse them have been able to make enormous profits. However, these profits haven't come without problems and limitations.

    Read the article

  • Super-quick MIDI generator with nonrestrictive license?

    - by Ricket
    I'm working on my Ludum Dare entry and trying to figure out how in the world I'm ever going to get background music. I found WolframTones, but the license is too restrictive: Unless otherwise specified, this Site and content presented on this Site are for your personal and noncommercial use. You may not modify, copy, distribute, transmit, display, perform, reproduce, publish, license, create derivative works from, transfer, or sell any information or content obtained from this Site. For commercial and other uses, contact us. But I really like the interface! It's a lot like sfxr - click a genre and download a song. That's so cool. Is there another program that does this same sort of thing but without a restrictive license, so that I can generate a bgm and use it in my game?

    Read the article

  • Simple dependency tree diagram generator

    - by foampile
    I have a need to produce a simple dependency tree diagram. The input data would be in the following simple format: ITEM_NAME DEPENDENCY ---------------------------- ITEM_101 ITEM_75 ITEM_102 ITEM_77 ITEM_102 ITEM_61 ITEM_102 ITEM_11 This means that ITEM_101 depends on ITEM_75 and ITEM_102 depends on items ITEM_77, ITEM_61 and ITEM_11. So the diagram would have items ITEM_77, ITEM_61 and ITEM_11 in one vertical level and ITEM_102 would be below it with a line connecting each of the three dependencies to ITEM_102. The same would be for ITEM_101, ITEM_75 would be somewhere above it and there would be a line connecting it. In the real world this tree represents a hierarchy of scheduling jobs. We have a very extensive workload automation hierarchy in Autosys and I have heard that its front end utility has something like this tree visual representation, however, for some reason, that utility has been disabled by admins. My business users want to see this hierarchy in an easy-to-consume format. I was hoping that I won't have to program something like this from scratch because it seems like quite a common reporting requirement and the input data is simply formatted. My question is: is there a FOSS tool that takes standardized data input and produces such a hierarchical tree? Thanks

    Read the article

  • Architecture of a "website generator" web application

    - by Resorath
    What is the most maintainable and efficient way to architect a web application who's purpose is to host and generate websites which can be customized to a certain degree? There are a lot of these style of applications in the wild that generate all kinds of sites, from sites that host World of Warcraft guilds like guildlaunch to other sites like my wedding for wedding site hosting. My question is, what is the basic architecture that these sites operate on? I imagine there are two ways of thinking about this. A central set of code that all sites on the host run against, and it acts differently based on which site was visited. In this manner, when the base code is updated all sites are updated simultaneously. Or, the code for an individual site exists in a silo, and is simply replicated to a new directory each time a site is created. When an update needs to be applied, the code is pushed out to each site silo. In my case, I am working in PHP with the CodeIgniter framework, however the answer need not be limited to this case. Which method (if any) creates a more maintainable and efficient architecture to manage this style of web application?

    Read the article

  • C# and SQL data layer code generator

    I've created a simple yet efficient tool to help generate stored procedures and a C# data access layer from a table.  Instead of using an ORM, this uses standard ADO .NET (SqlConnection, SqlDataReader, etc).  Check it out at www.asteio.com.  It's saved me a ton of time and I'm hoping it does the same for you....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • How to generate a random number, then display it on screen?

    - by Dan
    Ok, im fairly new to android but i have managed to teach myself the basics, i am making an app where you press a button , and a new screen opens and it shows a randomly generated number, the only problem is i dont know how to generate and display the random number, i have been searching the web for ages and have only found little snippets of information , that dosent really make sense to me. :/ If someone could help me , or even give me just a little bit of info that should guide me in the right direction it would be great

    Read the article

  • How to pick random (small) data samples using Map/Reduce?

    - by Andrei Savu
    I want to write a map/reduce job to select a number of random samples from a large dataset based on a row level condition. I want to minimize the number of intermediate keys. Pseudocode: for each row if row matches condition put the row.id in the bucket if the bucket is not already large enough Have you done something like this? Is there any well known algorithm? A sample containing sequential rows is also good enough. Thanks.

    Read the article

  • What's the best way to customize / add pages to the admin generator?

    - by Guillaume Flandre
    I'm using Symfony 1.4 and Doctrine. My application's backend was built using Symfony's admin generator. It works great when I want to display basic stuff. But tehre's not a lot of documentation on how to enhance it and add new pages. Let's take an example: I want to list published items on one page and to-be-published items on another one. I've used several ways to that in my application but can't figure out what the best way is: playing with filters and then modify templates depending on where you are? creating another module calling a different table_method? some other technique I don't know about? What's the best practice here? How do you guys usually do to customize your admin?

    Read the article

  • Repeated calls with random Javascript append to the URL

    - by cjk
    I keep getting calls to my server where there is random Javascript appended on the end of lots of the calls, e.g.: /UI/Includes/JavaScript/).length)&&e.error( /UI/Includes/JavaScript/,C,!1),a.addEventListener( /UI/Includes/JavaScript/),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement( /UI/Includes/JavaScript/&&a.getAttributeNode( /UI/Includes/JavaScript/&&a.firstChild.getAttribute( /UI/Includes/JavaScript/).replace(bd, /UI/Includes/JavaScript/)),a.getElementsByTagName( The user agent is always this: Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+2.0.50727) I have jQuery, Modernizr and other JS and originally thought that some browser was messing up it's JS calls, however this particular IP address hasn't requested any images so I'm wondering if it is some kind of attack. Is this a common occurence?

    Read the article

  • 12.04 Random sounds sometimes after startup

    - by Timothy Duane
    I'm not quite sure what the sound is, but it has only started happening in the last two days. The only way I can describe it would be that it sounds like a wooden xylophone being tapped lightly. It will play at random intervals ranging between 1 second to a couple minutes for up to a half hour (from what I have noticed) after startup. If anybody has any ideas as to what is causing this or how to fix it I would appreciate it. System information: Computer: Toshiba Satellite L655-S5160 Audio Driver: Conexant Audio Driver(v4.119.0.60; 07-14-2010; 41.89M)

    Read the article

  • Execure a random command from .txt file?

    - by Alberto Burgos
    I have a Ubuntu server, and I'm trying to print a Twitter quote using the app "twidge". So I made a list of tweets on a .txt file. I want to print one tweet (per line) from that file and send it to Twitter via twidge (or what ever other method was possible). I can print a random phrase with shuf: shuf -n 1 /var/www/tweets.txt and it works. It sends me back one of the tweets, but, it does not send it to Twitter, even if the "in line" phrase is a command. i.e: twidge update "bla bla bla" It just prints on the screen, but don't send it to Twitter. I tried turning the .txt to .sh, but don't work... any idea? by the way, i want to use it with crontab, something like this: 15 * * * * shuf -n 1 /var/www/tweets.txt

    Read the article

  • Random freezes on MBP9,2 + Ubuntu 12.04

    - by EnToutCas
    I have a MBP9,2 (mid-2012) at work. I put Ubuntu 12.04 on it after some efforts. Everything works more or less now, except I get random freezing every now and then. I have to power off the machine to restore it. Wondering if anyone had the similar issue. My setup: MacBook Pro 9,2 (mid 2012) Ubuntu 12.04 (installed using the special image for Macs) No proprietary drivers xmonad on Unity 2D So far the freezes look to be sporadic and spontaneous.

    Read the article

  • Random/Procedural vs. Previously Made Level Generation

    - by PythonInProgress
    I am making a game (called "Glory") that is a top-down explorer game, and am wondering what the advantages/disadvantages of using random/procedural generation vs. pre-made levels are. There seems to be few that i can think of, other than the fact that items may be a problem to distribute in randomly generated terrain, and that the generated terrain may look weird. The downside to previously made levels is that I would need to make a level editor, though. I cannot decide what is better to use.

    Read the article

  • Algorithm to generate N random numbers between A and B which sum up to X

    - by Shaamaan
    This problem seemed like something which should be solvable with but a few lines of code. Unfortunately, once I actually started to write the thing, I've realized it's not as simple as it sounds. What I need is a set of X random numbers, each of which is between A and B and they all add up to X. The exact variables for the problem I'm facing seem to be even simpler: I need 5 numbers, between -1 and 1 (note: these are decimal numbers), which add up to 1. My initial "few lines of code, should be easy" approach was to randomize 4 numbers between -1 and 1 (which is simple enough), and then make the last one 1-(sum of previous numbers). This quickly proved wrong, as the last number could just as well be larger than 1 or smaller than -1. What would be the best way to approach this problem? PS. Just for reference: I'm using C#, but I don't think it matters. I'm actually having trouble creating a good enough solution for the problem in my head.

    Read the article

  • Calculate random points (pixel) within a circle (image)

    - by DMills
    I have an image that contains a circles at a specific location, and of a specific diameter. What I need to do is to be able to calculate random points within the circle, and then manipulate said the pixels they correlate to. I have the following code already: private Point CalculatePoint() { var angle = _random.NextDouble() * ( Math.PI * 2 ); var x = _originX + ( _radius * Math.Cos( angle ) ); var y = _originY + ( _radius * Math.Sin( angle ) ); return new Point( ( int )x, ( int )y ); } And that works fine for finding all the points at the circumference of the circle, but I need all points from anywhere in the circle. If this doesn't make sense let me know and I will do my best to clarify.

    Read the article

  • Sqlite catalog and schema settings (for MyBatis generator)

    - by user1769754
    I have been trying to use the MyBatis generator on a Sqlite database but can't seem to find what settings to use for the XML attributes catalog and schema. The generator errors with "Generation Warnings Occured: Table configuration with catalog main, schema sqlite_master, and table testTable did not resolve to any tables" I can't find much from the sqlite website other than this which gives something like catalog = main, schema = sqlite or sqlite_master My generator XML file is <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" > <generatorConfiguration > <context id="context"> <jdbcConnection driverClass="org.sqlite.JDBC" connectionURL="jdbc:sqlite:testDB.sqlite" userId="" password="" ></jdbcConnection> <javaModelGenerator targetPackage="model" targetProject="test/src" ></javaModelGenerator> <sqlMapGenerator targetPackage="model" targetProject="test/src" ></sqlMapGenerator> <javaClientGenerator targetPackage="model" targetProject="test" type="XMLMAPPER" ></javaClientGenerator> <table catalog="main" schema="sqlite_master" tableName="testTable" > <property name="useActualColumnNames" value="true"/> </table> </context> </generatorConfiguration> I have also tried other combinations like <table catalog="main" schema="sqlite" tableName="testTable" > <table schema="sqlite" tableName="testTable" > <table schema="sqlite_master" tableName="testTable" > <table schema="main.testTable" tableName="testTable" > Anyone here know the right settings?

    Read the article

  • What is purpuse of T4 Generator in T4toolbox

    - by Fred Yang
    I am using T4toolbox, I am confused what the generator is for. I can run the following public class Generator1 : Generator { protected override void RunCore() { Template1 t = new Template1(); t.Output.File = "t3.txt"; t.Render(); } } or I can run t4 script directly like the following. Template1 t = new Template1(); t.Output.File = "t3.txt"; t.Render(); But I can do the same using t4 script without generator as well. So I mean can do the same thing with two approach "script -- generator -- template" and "script -- template", am I missing something? Thanks

    Read the article

  • Configuring hibernate.reveng.xml to detect a sequence PK generator with hibernate3-maven-plugin and

    - by mmm
    Hi, is there a way to configure hibernate3-maven-plugin so that a sequence generator is detected for a primary-key? I'm using a bottom-up approach for hibernate configuration (which means letting hibernate-tools generate the hibernate configuration using a jdbc-connection for you via reverse-engineering on an existing database schema). I've read this, but also this already (those two can be unrelated, but can also leave a hint). My hibernate.reveng.xml is the following: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" > <hibernate-reverse-engineering> <table name="ORDERS"> <primary-key> <!-- setting up a specific id generator for a table --> <generator class="sequence"> <param name="sequence">ORDERS_ORDER_ID_seq</param> </generator> <key-column name="ORDER_ID"/> </primary-key> </table> </hibernate-reverse-engineering> And I'm expecting it to generate an Orders.hbm.xml file like this: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated 2010-06-06 18:55:42 by Hibernate Tools 3.2.2.GA --> <hibernate-mapping> <class name="some.package.Orders" table="orders" schema="public"> <id name="orderId" type="long"> <column name="order_id" /> <generator class="sequence"> <param name="sequence">ORDERS_ORDER_ID_seq</param> </generator> </id> ... </class> </hibernate-mapping> ...but receiving this instead: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated 2010-06-06 18:55:42 by Hibernate Tools 3.2.2.GA --> <hibernate-mapping> <class name="some.package.Orders" table="orders" schema="public"> <id name="orderId" type="long"> <column name="order_id" /> <generator class="assigned" /> </id> ... </class> </hibernate-mapping> I know my hibernate.reveng.xml is being read by hibernate3-maven-plugin, as I experience maven errors whenever syntax errors appear in the file, so pom.xml seems to be correct and hibernate.reveng.xml syntactically correct. Any clues?

    Read the article

  • Error launching external scanner info generator (sh -c 'g++ -E -P -v -dD )

    - by kranthikumar
    Error launching external scanner info generator (sh -c 'g++ -E -P -v -dD ) (Cannot run program "make": Launching failed) More precisely, the error messages are: Error Launching external scanner info generator - gcc link problem on MingGW Error launching external scanner info generator (sh -c 'g++ -E -P -v -dD C:/Documents and Settings/user1/workspace123/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp ') Error launching external scanner info generator (sh -c 'gcc -E -P -v -dD C:/Documents and Settings/user1/workspace123/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c ') This problem is occurring in eclipse-SDK-3.2.2-win32 with CDT. Can anyone solve this problem? Did anyone have any solution to this problem? Please help to me to solve this problem . Yours faithfully. Anilkumar.k

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >