Search Results

Search found 1685 results on 68 pages for 'no more guessing'.

Page 36/68 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • How do I generate (and label) a random integer with python 3.2?

    - by An hero
    Okay, so I'm admittedly a newbie to programming, but I can't determine how to get python v3.2 to generate a random positive integer between parameters I've given it. Just so you can understand the context, I'm trying to create a guessing-game where the user inputs parameters (say 1 to 50), and the computer generates a random number between the given numbers. The user would then have to guess the value that the computer has chosen. I've searched long and hard, but all of the solutions I can find only tell one how to get earlier versions of python to generate a random integer. As near as I can tell, v.3.2 changed how to generate and label a random integer. Anyone know how to do this? Thanks!

    Read the article

  • Magento cache wrong read permissions?

    - by Lucasmus
    There seems to be a problem in Magento's reading of the var/cache directory. I've disabled Full Page Caching for testing. When I execute the bash command chmod -R 777var/cache/` before loading the page, it loads ~3 seconds quicker (the time it takes before 'mage::dispatch::routers_match' is reached in the Profiler is reduced from ~4 seconds to ~1 second). This speed-up remains a while but then is lost until the chmod is called again. I'm guessing this has to do with writing permissions somehow? The odd thing is, the cache contents are afaik owned by the process that is executing magento (the web user). Does anyone have any clues what could be the problem or what could be changed to prevent this?

    Read the article

  • MySQL: Limit output according to associated ID

    - by Jess
    So here's my situation. I have a books table and authors table. An author can have many books... In my authors page view, the user (logged in) can click an author in a tabled row and be directed to a page displaying the author's books (collected like this URI format: viewauthorbooks.php?author_id=23), very straight forward... However, in my query, I need to display the books for the author only, and not all books stored in the books table (as i currently have!) As I am a complete novice, I used the most simple query of: SELECT * FROM tasks_tb This returns the books for me, but returns every single value (book) in the database, and not ones associated with the selected author. And when I click a different author the same books are displayed for them...I think everyone gets what I'm trying to achieve, I just don't know how to perform the query. I'm guessing that I need to start using more advanced query clauses like INNER JOIN etc. Anyone care to help me out :)

    Read the article

  • How could I do something like this in a XML schema?

    - by chobo2
    Hi I want to mass create some users and I want to set the users timezone automatically. However I am using timezones generated by this Dictionary<string, TimeZoneInfo> storeZoneName = TimeZoneInfo.GetSystemTimeZones().ToDictionary(z => z.DisplayName); So I need the names to be exactly like the ones this list returns. So can I put like a constraint on that xml node that the name has to exactly match one of the names. So I am guessing I will need to write this list somewhere in the file and that's what I am not sure if you can do something like that in a schema.

    Read the article

  • Specific Strings And NSScanner

    - by Garry
    I need to determine whether a string (sourceString) contains another string (queryString) and if it does, at what offset. I'm guessing that NSScanner might do the trick but I don't fully understand the documentation. Let's say sourceString = @"What's the weather in London today?" If I set queryString to equal @"What's the weather", I'd like a method that would determine that, in this case, YES (sourceString does contain queryString) and the offset is 0 (i.e. at the start of sourceString). Any suggestions?

    Read the article

  • mySQL & Relational databases: How to handle sharding/splitting on application level?

    - by Industrial
    Hi everybody, I have thought a bit about sharding tables, since partitioning cannot be done with foreign keys in a mySQL table. Maybe there's an option to switch to a different relational database that features both, but I don't see that as an option right now. So, the sharding idea seems like a pretty decent thing. But, what's a good approach to do this on a application level? I am guessing that a take-off point would be to prefix tables with a max value for the primary key in each table. Something like products_4000000 , products_8000000 and products_12000000. Then the application would have to check with a simple if-statement the size of the id (PK) that will be requested is smaller then four, eight or twelve million before doing any actual database calls. So, is this a step in the right direction or are we doing something really stupid?

    Read the article

  • Constrain a table to have only one row

    - by finnw
    What's the cleanest way to constrain a SQL table to allow it to have no more than one row? This related question discusses why such a table might exist, but not how the constraint should be implemented. So far I have only found hacks involving a unique key column that is constrained to have a specific value, e.g. ALWAYS_0 TINYINT NOT NULL PRIMARY KEY DEFAULT (0) CONSTRAINT CHECK_ALWAYS_0 CHECK (ALWAYS_0 = 0). I am guessing there is probably a cleaner way to do it. The ideal solution would be portable SQL, but a solution specific to MS SQL Server or postgres would also be useful

    Read the article

  • How to make CSS/HTML prototyping faster for engineers without strong CSS skills?

    - by rdeshpande
    I've been developing Ruby on Rails applications for some time, and have often found help to develop generate the templates of HTML with accompanying CSS. However, I'd like to make an attempt at doing this myself. Initial experiments leave me feeling like my process is really slow. I'm writing all my Rails code in VIM, which, with accompanying aliases to run the test suite, is pretty fast for me. However, the back-and-forth between browser/VIM to see new changes seems cumbersome - I'm guessing finding an editor with an embedded browser that constantly sees new changes is ideal for this (any suggestions?) So far I've experimented with Blueprint, which at the onset seems like it will save me a ton of time. However, what other tools have helped you do the PSD-HTML/CSS conversion as fast as you can?

    Read the article

  • Question about the mathematical properties of hashes

    - by levand
    Take a commonly used binary hash function - for example, SHA-256. As the name implies, it outputs a 256 bit value. Let A be the set of all possible 256 bit binary values. A is extremely large, but finite. Let B be the set of all possible binary values. B is infinite. Let C be the set of values obtained by running SHA-256 on every member of B. Obviously this can't be done in practice, but I'm guessing we can still do mathematical analysis of it. My Question: By necessity, C ? A. But does C = A?

    Read the article

  • htaccess redirect conditions

    - by user271619
    I figured out how to redirect someone, if they happen across one particular filename: Redirect /index.php http://www.website.com/#myaccount As you can see, I'm pretty much redirecting that visitor to the same page, which doesn't work. It's an endless look, regardless of the slight/minuscule change. I want to force someone to see a part of the page, by adding the hash. (it's a little weird, I know) I'm guessing this may be a time to use regex in the htaccess file. But I thought I'd ask if there's a simpler way to do this from the htaccess file.

    Read the article

  • Safe to cast pointer to a forward-declared class to its true base class in C++?

    - by Matt DiMeo
    In one header file I have: #include "BaseClass.h" // a forward declaration of DerivedClass, which extends class BaseClass. class DerivedClass ; class Foo { DerivedClass *derived ; void someMethod() { // this is the cast I'm worried about. ((BaseClass*)derived)->baseClassMethod() ; } }; Now, DerivedClass is (in its own header file) derived from BaseClass, but the compiler doesn't know that at the time it's reading the definition above for class Foo. However, Foo refers to DerivedClass pointers and DerivedClass refers to Foo pointers, so they can't both know each other's declaration. First question is whether it's safe (according to C++ spec, not in any given compiler) to cast a derived class pointer to its base class pointer type in the absence of a full definition of the derived class. Second question is whether there's a better approach. I'm aware I could move someMethod()'s body out of the class definition, but in this case it's important that it be inlined (part of an actual, measured hotspot - I'm not guessing).

    Read the article

  • How to use email adresses with special chars such as Ø

    - by Sir Code-A-Lot
    By writing this: var recipient = new MailAddress("name@abcø.dk"); Notice the "ø" in the domain part. I get an exception stating: System.FormatException: The specified string is not in the form required for an e-mail address. at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName) at System.Net.Mail.MailAddress.ParseValue(String address) at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) at System.Net.Mail.MailAddress..ctor(String address) The address used should be perfectly valid. So I'm guessing I have to encode the address somehow?

    Read the article

  • Maven workspace resolution horked

    - by user237815
    I'm using m2eclipse to manage maven projects. Somehow I did a bad thing, and now the system is behaving as if workspace resolution is disabled. I have several projects that depend on a main project. This project has a version of 4.0-SNAPSHOT, and all the dependent projects reference it in the dependencies section of their poms. Everything was working fine until I created an entirely new project and mistakenly copied the pom from the main project into the new project. Suddenly, all of the dependent projects got the error: "The container 'Maven Dependencies" references non existing library C:\users\myusername.m2\com\mydomain\myproject\4.0-SNAPSHOT\myproject-4.0-SNAPSHOT.jar I zapped the offending new project, but the error remains for all the dependent projects. I've made no changes (to my knowledge) in the main project or any of the dependent projects, so I'm guessing something got changed in the Eclipse environment. Does m2eclipse or Maven itself maintain settings anywhere that I can blow away?

    Read the article

  • Rails - Create form fields dynamically and save them

    - by Frexuz
    Im building an ad-system where users can dynamically create 'fields' for each ad type. My models and example values: AdType: | id | name |----|----- | 1 | Hotel | 2 | Apartment AdOption: | id | ad_type_id | name |----|------------|----- | 1 | 1 | Star rating | 2 | 1 | Breakfast included? | 3 | 2 | Number of rooms AdValue: (Example after saving) | id | ad_id | ad_option_id | value |----|-------|---------------|------ | 1 | 1 | 1 (stars) | 5 | 2 | 1 | 2 (breakfast) | true Ad: (Example after saving) | id | description | etc.... |----|-----------------|-------- | 1 | very nice hotel | ....... So lets say I want to create a new ad, and I choose Hotel as the ad type. Then I need my view to dynamically create fields like this: (I'm guessing?) [Label] Star rating: [hidden_field :ad_id] [hidden_field :ad_option_id] [text_field :value] [Label] Breakfast included? [hidden_field :ad_id] [hidden_field :ad_option_id] [text_field :value] And also, how to save the values when the ad record is saved I hope this is understandable. If not just ask and I'll try to clarify.

    Read the article

  • MYSQL Inserting rows that reference main rows.

    - by Andrew M
    I'm transferring my access logs into a database. I've got two tables: urlRequests id : int(10) host : varchar(100) path: varchar(300) unique index (host, path) urlAccesses id : int(10) request : int(10) <-- reference to urlRequests row ip : int(4) query : varchar(300) time : timestamp I need to insert a row into urlAccesses for every page load, but first a row in urlRequests has to exist with the requested host and path so that urlAccesses's row can reference it. I know I can do it this way: A. check if a row exists in urlRequests B. insert a row in urlRequests if it needs it C. insert a row into urlAccesses with the urlRequests's row id referenced That's three queries for every page load if the urlRequests row doesn't exist. I'm very new to MySQL, so I'm guessing that there's a way to go about this that would be faster and use less queries.

    Read the article

  • how to get xml html after transpose and databind()

    - by rlee923
    Hi. I have some code that uses xsl and xml. The Xml control is on the design page. The xml control id is xmlApplication The xmlstring is generated and xsl has the format with all the tables and cells etc. Here is a part of thecode of a page which generates the final product which shows the xml in a certain format. xmlApplication.Document = xmlDoc; xmlApplication.Transform = transApp; xmlApplication.DataBind(); I am guessing after xmlApplication.Databind(), xmlApplication will be converted into something that can be put inside . Is it possible to grab as a string? Please let me know if I have a wrong idea abut this. Thanks a lot.

    Read the article

  • Ext.app.application object is erased after initialization

    - by Queequeg
    I am trying to organize an existing extjs code in a more standard order (extjs wise). extjs version: extjs-4.0.2a. I've worked through the Extjs tutorial example and every thing went well. When I started working on the company's code I've notice there is no use of the application object there for I've added the Ext.application({...}); call. Ext.application({ name: 'FOO', appFolder: 'appFolderName', launch: function() { console.log('application was created'); } }); Upon loading the page I see the console.log output that is included in the "launch" function property - meaning the application object is created but when I look for it ("FOO" object) under the "window" object it is not there. Compering to the tutorial code the application object exist as a property of window. I encounter a few loading problems but I'm guessing the source of it all is this issue. What am I doing wrong? thanks.

    Read the article

  • How do I Benchmark RESTful Service with Variable Parameters?

    - by Eli
    I'm currently working on benchmarking a RESTful service I've made, and part of that is making sure it runs in a reasonable amount of times for a large array of parameters. For example, let's say I have RESTful API of the form some_site.com/item?item_id=y. In that case to be sure my service is working as fast as I'd like it to work, I'd want to try out many values for y one by one, preferably coming from some text file. I can't figure out any way of doing this in ab or httperf. I'm open to using a different benchmarking program if I have, but would prefer something simple and light. What I want to do seems like something pretty standard, so I'm guessing there must already be a program that let's me do it, but an hour or so of googling hasn't gotten me an answer. Ideas?

    Read the article

  • What is the state of model driven development in 2012?

    - by eriktheblond
    I haven't heard a lot of talk lately on model driven development, but some of my company's customers are using it. I know briefly what it is, but after trying to refresh my memory using Google I found that most of the information is from 2006-2007. Was it something that never really took off? More worryingly is the reason why the customers are asking: They want IEC 61508 complience. Is this actually a "not-so-good" idea that will live on simply because it is prescribed by a standard? I have too little experience to say if MDD is good idea or not (I'm guessing the right answer starts with "It depends"...), but the reasons for using it, that is standard complience, seems just wrong.

    Read the article

  • Facebook page linking to external site sign-up process, capture permission to write to wall in process?

    - by steve
    Hi all, Have had a good hunt through the archive but can't find anyone trying to do this... hope someone familiar with the facebook API can confirm if it's possible? Basically I have a client who wants to replicate their membership sign up process in a tab on their facebook page. The form would still submit to their own website to process, we'd just be replicating the form fields. As an additional requirement they want to capture peoples facebook user ID and get permission to post back to a users wall at the same time... The idea being that once the user is a member we can post back to their wall so their friends see that they've signed up... Basically after a sanity check that: 1) these things are possible to do; 2) the best method to build the form in a FB page - I'm guessing using JS to create all fields & ajax to submit to the external site? Thanks Steve

    Read the article

  • After tar extract, Changing Permissions

    - by Moe
    Just a Question Regarding unix and PHP today. What I am doing on my PHP is using the Unix system to untar a tarred file. exec("tar -xzf foo.tar.gz"); Generally everything works fine until I run into this particular foo.tar.gz, which has a file system as follows: Applications/ Library/ Systems/ After running the tar command, it seems that the file permissions get changed to 644 (instead of 755). This causes Permission denied (errno 13) and therefore disabling most of my code. (I'm guessing from lack of privileges) Any way I can stop this tar command completely ruining my permissions? Thanks. Oh and this seems to only happen when I have a foo.tar.gz file that Has this particular file system. Anything else and I'm good.

    Read the article

  • technique for how to debug macros in C

    - by Dervin Thunk
    Hi. So I have the (mostly vilified) #define MAX( a, b ) ( ((a) > (b)) ? (a) : (b) ) somewhere in a program (yes, yes, I know). At some point in the code there is a comparison X>-1?, where X is (as far as I can tell) a (signed) integer. The line is j += MAX(bmGs[i], bmBc[(int)y[i + j]] - m + 1 + i);, where y here is a char*. Not necessarily surprisingly, I find that the macro is returning -1 as the larger number (I'm guessing too long a number for int or an unsigned issue, but I can't find it). I would like to know techniques you guys may have for finding these kinds of errors. Notice that I'm not asking for programming advice about whether or not to use that macro, I'm sure folks are dying to tell me I should refrain from things like that, but the question is going somewhere else. Thanks.

    Read the article

  • FTP/SFTP module for .NET

    - by Angrius
    I am designing an auto downloader using .NET and C#. I was wondering if there is a decent/robust FTP/SFTP module out there that I can use, preferably free of charge. EDIT: I probably should've noted that I am looking for answer from somebody who tried several and found one that works very well. I currently use .NET wrapper for libcurl for FTP and it does not behave right. For example when I connect to FTP site with Filezilla and provide a path, it finds directory just fine. With libcurl, i get a header for 404 page saying path cannot be found. I am guessing that Filezilla gets 'home' directory correctly, and libcurl puts me to the root (i tried no path, and i had no permissions to access that directory). But anyways, I just don't know enough about FTP itself, so I would like something that just works. Thanks!

    Read the article

  • Javascript pass reference by value

    - by Carlos R. Batista
    Im having this weird reference issue when im trying to get a JSON file through query: var themeData; $.getJSON("json/sample.js", function(data) { themeData = data.theme; console.log(themeData.sample[0].description); }); console.log(themeData.sample[0].description); The first console.log works, the second doesnt. Im guessing because "data" already expired by the time the script gets there and themeData is just a mere pointer to "data". Is there a ways I can make sure themeData gets a duplicate of "data" and not just a pointer to it?

    Read the article

  • magento override sort order of product list by subcategories

    - by dardub
    I'm setting up a new store using 1.4.1 I'm trying sort the products in the list by the subcategories they belong to. At the top of list.phtml is $_productCollection=$this->getLoadedProductCollection(); I tried adding sort filters to that by adding the line $_productCollection->setOrder('category_ids', 'asc')->setOrder('name', 'asc'); I also tried addAttributeToSort instead of setOrder. This doesn't seem to have any effect. I'm guessing that $_productCollection is not a model I can sort in this manner. I have been digging around trying to find the correct place to apply the sort method without any success. Can someone tell me the proper place to do this?

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >