Search Results

Search found 2102 results on 85 pages for 'tom bell'.

Page 66/85 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • In what package should a "Settings" class be placed?

    - by Tom
    I'm in the middle of building an application but found myself too easily creating new packages without keeping the project's structure in mind. Now, I'm trying to redo the whole project structure on paper first. I am using a Settings class with public properties, accessed as settings for several other classes around the project. Now, since this Settings class applies for the whole project, I am unsure if it should be packaged and if so, in what kind of package should it exist? Or should it be in the root (the default package) with the main application class? I've been thinking about putting it in my utils package, then again I don't think it really is an utlity. Any strategies on how to decide on such package structure for example for a Settings class?

    Read the article

  • Visual Studio swapping code between projects?!?!?!?!??!

    - by Tom
    Are there any known issues with visual studio and code being swapped between projects? I had a project running in VS2008 and when i went back to it, the code from another project had been swapped in the Program.cs class. I havent made any mistakes, im not talking about some code- i mean the whole project had been swapped out. Its as if the .proj files or .soln files had been swapped from their project folders??? EDIT Ive restarted laptop, opened the code again and its still showing the wrong code BUT when i execute it, its the right code?!?!?!

    Read the article

  • Pattern matching against Scala Map type

    - by Tom Morris
    Imagine I have a Map[String, String] in Scala. I want to match against the full set of key–value pairings in the map. Something like this ought to be possible val record = Map("amenity" -> "restaurant", "cuisine" -> "chinese", "name" -> "Golden Palace") record match { case Map("amenity" -> "restaurant", "cuisine" -> "chinese") => "a Chinese restaurant" case Map("amenity" -> "restaurant", "cuisine" -> "italian") => "an Italian restaurant" case Map("amenity" -> "restaurant") => "some other restaurant" case _ => "something else entirely" } The compiler complains thulsy: error: value Map is not a case class constructor, nor does it have an unapply/unapplySeq method What currently is the best way to pattern match for key–value combinations in a Map?

    Read the article

  • Rotating an image in all browsers (canvas in IE?)

    - by Tom
    I finally got to work with canvas only to find out that it is not implemented in IE. I tried explore canvas from google to use it in Internet Explorer, but it's not working for my code (http://uptowar.com/test.php - little bug though that it is not removing the old image when rotating). So, is there an other way to smoothly rotate an image around it's bottom center angle? Maybe javascript? Or is there a way to do it with IE and canvas anyway? Edit: Google Chrome also seems to add an ugly border to the canvas example.. there must be an other smooth way? Edit2: tried a hacky javascript way: it causes mayor lags and corrupts the image (http://uptowar.com/test2.php), anyone knows of a working method?

    Read the article

  • Methods for breaking up content client-side into multiple "pages"

    - by Tom Genoni
    I have a long HTML text-only article formatted with paragraph tags. What I'd like to do is break this content into N number of divs so that I can create individual pages. So, for instance, on an iPad/iPhone, instead of reading one long page the user could swipe right/left to navigate to pages. My initial javascript attempts have been somewhat convoluted: creating an array of the text, measuring line-heights, device window heights, adding closing/opening paragraph tags and the end/beginning of pages. Thoughts on a good way to approach this? I will not have access to server-side processing, this has to be a client-side solution.

    Read the article

  • What Are Collections Implemented As In VB6?

    - by Tom Tresansky
    So a collection in VB6 keeps track of a key for each object, and you can look up the object by its key. Does that mean collections are implemented as some sort of hashtable under the hood? I realize you can have multiple items with the same key in a collection, hence the SOME SORT. Anybody know what type data structure a VB6 collection is supposed to represent?

    Read the article

  • MySQL: How to do a conditional update?

    - by Tom
    Hi, I'm trying to a create an update statement along the following lines: TABLE car: id | owner_id | type | status An owner can have multiple cars. UPDATE car c SET c.type = 1 WHERE c.owner_id IN ($ids) AND c.status = [1 IF IT EXISTS, ELSE 0] $ids is reasonably small (under 50 values). It seems simple but I can't seem to get my head around it because I can't use a SELECT subquery with an UPDATE to the same table. Anyone? Thanks

    Read the article

  • Recursion: using values passed in parameters

    - by Tom Lilletveit
    I got this line of code that pops a int of the array saves it to int element then removes it from array. then in the return statement return CountCriticalVotes(rest, blockIndex + element); it ads it to the blockIndex variable and if it reaches 10 before the array is empty it returns 1. But my problem is this, I do not want it to add up all the values in the array in the parameter, but only add one then revert the parameter value back to it´s original state, then add a new, revert etc... How would i do this? int NumCriticalVotes :: CountCriticalVotes(Vector<int> & blocks, int blockIndex) { if (blockIndex >= 10) { return 1; } if (blocks.isEmpty()) { return 0; } else { int element = blocks.get(0); Vector<int> rest = blocks; rest.remove(0); return CountCriticalVotes(rest, blockIndex + element);

    Read the article

  • What is the most widely used IDE for PHP?

    - by Tom
    Note I am not asking for which is the "best" IDE for PHP or anything subjective like that. I want to know which is the most widely used backed by some sort of statistic (something like the W3's stats for browser usage) but for IDE usage amongst PHP developers.

    Read the article

  • Eclipse - limiting a command's visibility to a specific perspective

    - by Tom
    How do I limit the visibility of an Eclipse command in menus and the toolbar to just one perspective? It is currently showing up in all perspectives, but it only makes sense to have it around when working in this particular perspective. It seems like this could be done with "contexts", but I was wondering if there was something simpler.

    Read the article

  • Rewriting URL's in ASP.net (Simple question)

    - by Tom Gullen
    On my master page I have: <link rel="stylesheet" href="css/default.css" /> I also have a page "blog.aspx" in the root directory. I have the rule: <rewrite url="~/blog/blog.aspx" to="~/blog.aspx" /> My questions are: Am I meant to make all my links in my site point to blog/blog.aspx now instead of just blog.aspx where it is physically located How is best to cope with the paths of the stylesheets etc now being messed up because they are one dir up?

    Read the article

  • MySQL UPDATE WHERE IN for each listed value separately?

    - by Tom
    Hi, I've got the following type of SQL: UPDATE photo AS f LEFT JOIN car AS c ON f.car_id=c.car_id SET f.photo_status=1 , c.photo_count=c.photo_count+1 WHERE f.photo_id IN ($ids) Basically, two tables (car & photo) are related. The list in $ids contains unique photo ids, such as (34, 87, 98, 12). With the query, I'm setting the status of each photo in that list to "1" in the photo table and simultaneously incrementing the photo count in the car table for the car at hand. It works but there's one snag: Because the list can contain multiple photo ids that relate to the same car, the photo count only ever gets incremented once. If the list had 10 photos associated with the same car, photo_count would become 1 .... whereas I'd like to increment it to 10. Is there a way to make the incrementation occur for each photo individually through the join, as opposed to MySQL overthinking it for me? I hope the above makes sense. Thanks.

    Read the article

  • C# How can i remove newline characters from binary?

    - by Tom
    Basically i have binary data, i dont mind if it's unreadable but im writing it to a file which is parsed and so it's importance newline characters are taken out. I thought i had done the right thing when i converted to string.... byte[] b = (byte[])SubKey.GetValue(v[i]); s = System.Text.ASCIIEncoding.ASCII.GetString(b); and then removed the newlines String t = s.replace("\n","") but its not working ?

    Read the article

  • C# log base 10 and rounding up to nearest power of 10?

    - by Tom
    Hi, if i have a number between 100 and 1000 i want to get the value 3 because 10^3 = 1000. Likewise, if i had a number between 10 and 100 i would want to get the value 2, because 10^2 is 100. Incase you're wondering, its to do with calculating a probability and i always need to divide through by 10^value, to keep the probability between 0 and 1. For example if i calculate 9256, i need to divide through by 10^4, so that i get a probability of 0.92 I'm not sure how to do the rounding up and how to do the base 10, could someone please help?

    Read the article

  • Initializing an object to all zeroes

    - by dash-tom-bang
    Oftentimes data structures' valid initialization is to set all members to zero. Even when programming in C++, one may need to interface with an external API for which this is the case. Is there any practical difference between: some_struct s; memset(s, 0, sizeof(s)); and simply some_struct s = { 0 }; Do folks find themselves using both, with a method for choosing which is more appropriate for a given application? For myself, as mostly a C++ programmer who doesn't use memset much, I'm never certain of the function signature so I find the second example is just easier to use in addition to being less typing, more compact, and maybe even more obvious since it says "this object is initialized to zero" right in the declaration rather than waiting for the next line of code and seeing, "oh, this object is zero initialized." When creating classes and structs in C++ I tend to use initialization lists; I'm curious about folks thoughts on the two "C style" initializations above rather than a comparison against what is available in C++ since I suspect many of us interface with C libraries even if we code mostly in C++ ourselves.

    Read the article

  • Canvas draw calls are rendering out of sequence

    - by Tom Murray
    I have the following code for writing draw calls to a "back buffer" canvas, then placing those in a main canvas using drawImage. This is for optimization purposes and to ensure all images get placed in sequence. Before placing the buffer canvas on top of the main one, I'm using fillRect to create a dark-blue background on the main canvas. However, the blue background is rendering after the sprites. This is unexpected, as I am making its fillRect call first. Here is my code: render: function() { this.buffer.clearRect(0,0,this.w,this.h); this.context.fillStyle = "#000044"; this.context.fillRect(0,0,this.w,this.h); for (var i in this.renderQueue) { for (var ii = 0; ii < this.renderQueue[i].length; ii++) { sprite = this.renderQueue[i][ii]; // Draw it! this.buffer.fillStyle = "green"; this.buffer.fillRect(sprite.x, sprite.y, sprite.w, sprite.h); } } this.context.drawImage(this.bufferCanvas,0,0); } This also happens when I use fillRect on the buffer canvas, instead of the main one. Changing the globalCompositeOperation between 'source-over' and 'destination-over' (for both contexts) does nothing to change this. Paradoxically, if I instead place the blue fillRect inside the nested for loops with the other draw calls, it works as expected... Thanks in advance!

    Read the article

  • How do (or can I) hack a gem temporarily while looking for a bug?

    - by Tom Andersen
    I have a gem installed in my home directory on a laptop (eg not THE server). I have installed ruby 1.9.1 and also some other gems, notably right_aws - which allows access to s3, etc with ruby. All works, except there is a bug when I do a query on SimpleDB, and the returned list of items includes an item with any two byte utf-8 character in its itemName(). So I look through the sources of the right_aws gem installed on my machine, and I can see some places where I would like to test a fix. If I edit the file, save changes, (needing a password), then restart the server (script/server), it ignores my changes. I am quite new at ruby - do you have to 'compile' or other similar move to get the source code changes made take effect? I can see the edited file is changed by viewing it in terminal, etc.

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >