Search Results

Search found 28877 results on 1156 pages for 'do good'.

Page 56/1156 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • Good code architecture for this problem?

    - by RCIX
    I am developing a space shooter game with customizable ships. You can increase the strength of any number of properties of the ship via a pair of radar charts*. Internally, i represent each ship as a subclassed SpaceObject class, which holds a ShipInfo that describes various properties of that ship. I want to develop a relatively simple API that lets me feed in a block of relative strengths (from minimum to maximum of what the radar chart allows) for all of the ship properties (some of which are simplifications of the underlying actual set of properties) and get back a ShipInfo class i can give to a PlayerShip class (that is the object that is instantiated to be a player ship). I can develop the code to do the transformations between simplified and actual properties myself, but i would like some recommendations as to what sort of architecture to provide to minimize the pain of interacting with this translator code (i.e. no methods with 5+ arguments or somesuch other nonsense). Does anyone have any ideas? *=not actually implemented yet, but that's the plan.

    Read the article

  • Is there a good radixsort-implementation for floats in C#

    - by CommuSoft
    I have a datastructure with a field of the float-type. A collection of these structures needs to be sorted by the value of the float. Is there a radix-sort implementation for this. If there isn't, is there a fast way to access the exponent, the sign and the mantissa. Because if you sort the floats first on mantissa, exponent, and on exponent the last time. You sort floats in O(n).

    Read the article

  • How to write a good PHP database insert using an associative array

    - by Tom
    In PHP, I want to insert into a database using data contained in a associative array of field/value pairs. Example: $_fields = array('field1'=>'value1','field2'=>'value2','field3'=>'value3'); The resulting SQL insert should look as follows: INSERT INTO table (field1,field2,field3) VALUES ('value1','value2','value3'); I have come up with the following PHP one-liner: mysql_query("INSERT INTO table (".implode(',',array_keys($_fields)).") VALUES (".implode(',',array_values($_fields)).")"); It separates the keys and values of the the associative array and implodes to generate a comma-separated string . The problem is that it does not escape or quote the values that were inserted into the database. To illustrate the danger, Imagine if $_fields contained the following: $_fields = array('field1'=>"naustyvalue); drop table members; --"); The following SQL would be generated: INSERT INTO table (field1) VALUES (naustyvalue); drop table members; --; Luckily, multiple queries are not supported, nevertheless quoting and escaping are essential to prevent SQL injection vulnerabilities. How do you write your PHP Mysql Inserts? Note: PDO or mysqli prepared queries aren't currently an option for me because the codebase already uses mysql extensively - a change is planned but it'd take alot of resources to convert?

    Read the article

  • What would be a good way to scale images in c#

    - by Younes
    I got a website which contains alot of projects with each project containing a sidebar. In this sidebar it is possible to attach images to a project. The images attached will be shown in a gallery with 3 small thumbs at the bottom and one bigger image at the top of the gallery. The big image will refresh to another image when a visitor clicks on the small thumb @ the bottom of the gallery. The thumbs are no problem, they are shown correctly. My problem is the bigger image at the top of the gallery. The images that get uploaded have a big variety of sizes, while my holder has a width of 239 and height of 179. What would be the best way to scale the images so that they are shwon correctly to the visitors of the website?

    Read the article

  • Looking for examples of good IDEs to analyze for Form/Report design

    - by Paul Sasik
    I am working on a basic form/report designer. Some of the features i'm looking to implement are: Single or multiple selection of objects Alignment of objects (when several are selected) Same-sizing of objects (when several are selected) Moving/dragging of selected object(s) Selected object resizing in eight directions (using object grips) For features and look-and-feel I've analyzed and used a mixture of ideas from: MS Visual Studio 200x (most useful so far) Visio Crystal Reports My question is: Have I overlooked some other IDEs that provide these kinds of features that are better and user-friendlier examples of what to do than others i've looked at? (They don't have to be Microsoft products. That's just what i have ready access to.)

    Read the article

  • wanting a good memory + disk caching solution

    - by brofield
    I'm currently storing generated HTML pages in a memcached in-memory cache. This works great, however I am wanting to increase the storage capacity of the cache beyond available memory. What I would really like is: memcached semantics (i.e. not reliable, just a cache) memcached api preferred (but not required) large in-memory first level cache (MRU) huge on-disk second level cache (main) evicted from on-disk cache at maximum storage using LRU or LFU proven implementation In searching for a solution I've found the following solutions but they all miss my marks in some way. Does anyone know of either: other options that I haven't considered a way to make memcachedb do evictions Already considered are: memcachedb best fit but doesn't do evictions: explicitly "not a cache" can't see any way to do evictions (either manual or automatic) tugela cache abandoned, no support don't want to recommend it to customers nmdb doesn't use memcache api new and unproven don't want to recommend it to customers

    Read the article

  • Good looking programs that are built using wxPython for their UI

    - by ChrisC
    I need inspiration and motivation so I'm trying to find examples of different programs that have interesting and attractive UI's created free using wxPython. My searches have been slow to find results. I'm hoping you guys know of some of the best ones out there. btw, I've seen these: http://www.wxpython.org/screenshots.php and the list under "Applications Developed with wxPython" on the wxPython Wikipedia page. Update: only need Windows examples

    Read the article

  • Good error flagging | PHP

    - by Wayne
    For everyone that was thinking of the error_reporting() function, then it isn't, what I need is whenever a MySQL query has been done, and the statement has like if($result) { echo "Yes, it was fine... bla bla"; } else { echo "Obviously, the echo'ing will show in a white page with the text ONLY..."; } Whenever statements have been true or false, I want the error to be appeared when redirected with the header() function and echo the error reporting in a div somewhere on the page. Basically something like this: $error = ''; This part appears inside the div tags <div><?php echo $error; ?></div> So the error part will be echoed when redirected with the header() if($result) { $error = "Yes, it was fine... bla bla"; header("Location: url"); } else { $error = "Something wrong happened..."; header("Location: url"); } But that just doesn't work :(

    Read the article

  • Any good OpenID php consumer libs?

    - by daniels
    I need a php lib that can auth using OpenID against sites offering this service, like Google, Yahoo, Wordpress, etc... Anyone used any lib that actuallly works? I've tryied a few but couldn't get any to auth against Google, Yahoo, or Wordpress.

    Read the article

  • Good way to identify similar images?

    - by Nick
    I've developed a simple and fast algorithm in PHP to compare images for similarity. Its fast (~40 per second for 800x600 images) to hash and a unoptimised search algorithm can go through 3,000 images in 22 mins comparing each one against the others (3/sec). The basic overview is you get a image, rescale it to 8x8 and then convert those pixels for HSV. The Hue, Saturation and Value are then truncated to 4 bits and it becomes one big hex string. Comparing images basically walks along two strings, and then adds the differences it finds. If the total number is below 64 then its the same image. Different images are usually around 600 - 800. Below 20 and extremely similar. Are there any improvements upon this model I can use? I havent looked at how relevant the different components (hue, saturation and value) are to the comparison. Hue is probably quite important but the others? To speed up searches I could probably split the 4 bits from each part in half, and put the most significant bits first so if they fail the check then the lsb doesnt need to be checked at all. I dont know a efficient way to store bits like that yet still allow them to be searched and compared easily. I've been using a dataset of 3,000 photos (mostly unique) and there havent been any false positives. Its completely immune to resizes and fairly resistant to brightness and contrast changes.

    Read the article

  • A good data model for finding a user's favorite stories

    - by wings
    Original Design Here's how I originally had my Models set up: class UserData(db.Model): user = db.UserProperty() favorites = db.ListProperty(db.Key) # list of story keys # ... class Story(db.Model): title = db.StringProperty() # ... On every page that displayed a story I would query UserData for the current user: user_data = UserData.all().filter('user =' users.get_current_user()).get() story_is_favorited = (story in user_data.favorites) New Design After watching this talk: Google I/O 2009 - Scalable, Complex Apps on App Engine, I wondered if I could set things up more efficiently. class FavoriteIndex(db.Model): favorited_by = db.StringListProperty() The Story Model is the same, but I got rid of the UserData Model. Each instance of the new FavoriteIndex Model has a Story instance as a parent. And each FavoriteIndex stores a list of user id's in it's favorited_by property. If I want to find all of the stories that have been favorited by a certain user: index_keys = FavoriteIndex.all(keys_only=True).filter('favorited_by =', users.get_current_user().user_id()) story_keys = [k.parent() for k in index_keys] stories = db.get(story_keys) This approach avoids the serialization/deserialization that's otherwise associated with the ListProperty. Efficiency vs Simplicity I'm not sure how efficient the new design is, especially after a user decides to favorite 300 stories, but here's why I like it: A favorited story is associated with a user, not with her user data On a page where I display a story, it's pretty easy to ask the story if it's been favorited (without calling up a separate entity filled with user data). fav_index = FavoriteIndex.all().ancestor(story).get() fav_of_current_user = users.get_current_user().user_id() in fav_index.favorited_by It's also easy to get a list of all the users who have favorited a story (using the method in #2) Is there an easier way? Please help. How is this kind of thing normally done?

    Read the article

  • Is there a good NumPy clone for Jython?

    - by jbrogdon
    I'm a relatively new convert to Python. I've written some code to grab/graph data from various sources to automate some weekly reports and forecasts. I've been intrigued by the Jython concept, and would like to port some Python code that I've written to Jython. In order to do this quickly, I need a NumPy clone for Jython (or Java). Is there anything like this out there?

    Read the article

  • Good open source analytics/stats software in PHP?

    - by makeee
    The url shortening service I'm building needs to display some basic click stats to users: # of clicks, conversions, referring domains, and country (filterable by a date range). I'll possibly want more advanced stats in the future. Is there existing open source software that will allow me to pass events to it and then easily display a bar or line graph of that event (for example, a line graph of "conversions" between two specified dates). It seems like something like this should exist and would be much easier then building the whole thing from scratch. I know there are graphing scripts, but that still requires me to format the data (usually as an xml file) and then pass it to the graph. I'm looking for something a bit more complete, which I can just feed the events and then it does everything else.

    Read the article

  • Prevent PHP sesison hijack, are these good ideas?

    - by matthew Rhodes
    I'm doing a simple shopping cart for a small site. I plan to store cart items as well as logged in user_id in session variables. to make things a little more secure, I thought I'd do this: sha1() the user_id before storing it in the session. Also sha1() and store the http_user_agent var with some salt, and check this along with the user_id. I know there is more one can do, but I thought this at least helps quite a bit right? and is easy for me to implement.

    Read the article

  • Is there a good Open Source xml ide?

    - by Paul Butcher
    I've looked around, and I'm surprised that I can't find an Open Source equivalent to Oxygen or XMLSpy. i.e. A rich XML editor with support for diverse types of validation, XSLT debugging and profiling, and all the other extra bits that make it more than just a text editor with syntax highlighting. I've seen a few (like Jaxe), that that offer different ways to edit xml documents, but nothing that rolls it all up into an IDE-like application. I'm sure this means I've missed some very worthy project. Can anyone point me towards such a thing?

    Read the article

  • Example from: "Javascript - The Good Parts"

    - by Matrym
    What "ugliness" does the following solve? There's something I'm not getting, and I'd appreciate help understanding what it is. For example, by augmenting Function.prototype, we can make a method available to all functions: Function.prototype.method = function (name, func) { this.prototype[name] = func; return this; }; By augmenting Function.prototype with a method method, we no longer have to type the name of the prototype property. That bit of ugliness can now be hidden.

    Read the article

  • Is Google Mock a good mocking framework ?

    - by des4maisons
    I am pioneering unit testing efforts at my company, and need need to choose a mocking framework to use. I have never used a mocking framework before. We have already chosen Google Test, so using Google Mock would be nice. However, my initial impressions after looking at Google Mock's tutorial are: The need for re-declaring each method in the mocking class with a MOCK_METHODn macro seems unnecessary and seems to go against the DRY principle. Their matchers (eg, the '_' in EXPECT_CALL(turtle, Forward(_));) and the order of matching seem almost too powerful. Like, it would be easy to say something you don't mean, and miss bugs that way. I have high confidence in google's developers, and low confidence in my own ability to judge mocking frameworks, never having used them before. So my question is: Are these valid concerns? Or is there no better way to define a mock object, and are the matchers intuitive to use in practice? I would appreciate answers from anyone who has used Google Mock before, and comparisons to other C++ frameworks would be helpful.

    Read the article

  • Could anyone suggest a good RSS feeder?

    - by Noor
    Well I'm making a site that will function sort of like iGoogle does and I wanted to be able to let the users enter RSS-feeds. What i'm looking for is an RSS-feeder that is as customisable as possible (when it comes to looks) and it should be free since this is just a hobbyproject for now.. :)! Thanks guys

    Read the article

  • Good IM/Chat solution for pasting code

    - by Matt Miller
    We've got several distributed developers working together on a couple of projects. We've been using Skype to host chats with all the developers, and it works okay except for one thing: It REALLY mangles any code we copy and paste into the chats -- especially the whitespace in Python. This question has tons of opinions about chat clients & servers, but no one has much to say about pasting in code. (http://stackoverflow.com/questions/36415/best-chat-im-tool-for-developers) Is anybody out there using a chat or im client that handles source code really well?

    Read the article

  • Convincing why testing is good

    - by FireAphis
    Hello, In my team of real-time-embedded C/C++ developers, most people don't have any culture of testing their code beyond the casual manual sanity checks. I personally strongly believe in advantages of autonomous automatic tests, but when I try to convince I get some reappearing arguments like: We will spend more time on writing the tests than writing the code. It takes a lot of effort to maintain the tests. Our code is spaghetti; no way we can unit-test it. Our requirement are not sealed – we’ll have to rewrite all the tests every time the requirements are changed. Now, I'd gladly hear any convincing tips and advises, but what I am really looking for are references to researches, articles, books or serious surveys that show (preferably in numbers) how testing is worth the effort. Something like "We in IBM/Microsoft/Google, surveying 3475 active projects, found out that putting 50% more development time into testing decreased by 75% the time spent on fixing bugs" or "after half a year, the time needed to write code with test was only marginally longer than what used to take without tests". Any ideas? P.S.: I'm adding C++ tag too in case someone has a specific experience with convincing this, usually elitist, type of developers :-)

    Read the article

  • What is a good approach to preloading data?

    - by Bob Horn
    Are there best practices out there for loading data into a database, to be used with a new installation of an application? For example, for application foo to run, it needs some basic data before it can even be started. I've used a couple options in the past: TSQL for every row that needs to be preloaded: IF NOT EXISTS (SELECT * FROM Master.Site WHERE Name = @SiteName) INSERT INTO [Master].[Site] ([EnterpriseID], [Name], [LastModifiedTime], [LastModifiedUser]) VALUES (@EnterpriseId, @SiteName, GETDATE(), @LastModifiedUser) Another option is a spreadsheet. Each tab represents a table, and data is entered into the spreadsheet as we realize we need it. Then, a program can read this spreadsheet and populate the DB. There are complicating factors, including the relationships between tables. So, it's not as simple as loading tables by themselves. For example, if we create Security.Member rows, then we want to add those members to Security.Role, we need a way of maintaining that relationship. Another factor is that not all databases will be missing this data. Some locations will already have most of the data, and others (that may be new locations around the world), will start from scratch. Any ideas are appreciated.

    Read the article

  • Looking for good SIP Book

    - by Dave
    Hey guys I am looking for a SIP book similar to this one on XMPP - Professional XMPP Programming with Javascript and Jquery (http://www.amazon.com/Professional-Programming-JavaScript-jQuery-Programmer/dp/0470540710) I am new to the area and any resources would be appreciated, thanks

    Read the article

  • Recommend me a good book/source for learning for Web Design

    - by Idlecool
    Hi, While web development/design, I found coding it self is not enough to develop an attractive website so i have urge to learn photoshop.. i want to know what can be the best way to learn photoshop (preferably Photoshop CS4 Extended) mainly for website design. I experienced web tutorials are not enough for effectively learning computer languages, but not sure about photoshop coz it is a different job.. please recommend me a book / web tutorial for learning Photoshop.

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >