Search Results

Search found 33736 results on 1350 pages for 'project structure'.

Page 202/1350 | < Previous Page | 198 199 200 201 202 203 204 205 206 207 208 209  | Next Page >

  • Which is faster: Appropriate data input or appropriate data structure?

    - by Anon
    I have a dataset whose columns look like this: Consumer ID | Product ID | Time Period | Product Score 1 | 1 | 1 | 2 2 | 1 | 2 | 3 and so on. As part of a program (written in C) I need to process the product scores given by all consumers for a particular product and time period combination for all possible combinations. Suppose that there are 3 products and 2 time periods. Then I need to process the product scores for all possible combinations as shown below: Product ID | Time Period 1 | 1 1 | 2 2 | 1 2 | 2 3 | 1 3 | 2 I will need to process the data along the above lines lots of times ( 10k) and the dataset is fairly large (e.g., 48k consumers, 100 products, 24 time periods etc). So speed is an issue. I came up with two ways to process the data and am wondering which is the faster approach or perhaps it does not matter much? (speed matters but not at the cost of undue maintenance/readability): Sort the data on product id and time period and then loop through the data to extract data for all possible combinations. Store the consumer ids of all consumers who provided product scores for a particular combination of product id and time period and process the data accordingly. Any thoughts? Any other way to speed up the processing? Thanks

    Read the article

  • Python class structure ... prep() method?

    - by Adam Nelson
    We have a metaclass, a class, and a child class for an alert system: class AlertMeta(type): """ Metaclass for all alerts Reads attrs and organizes AlertMessageType data """ def __new__(cls, base, name, attrs): new_class = super(AlertMeta, cls).__new__(cls, base, name, attrs) # do stuff to new_class return new_class class BaseAlert(object): """ BaseAlert objects should be instantiated in order to create new AlertItems. Alert objects have classmethods for dequeue (to batch AlertItems) and register (for associated a user to an AlertType and AlertMessageType) If the __init__ function recieves 'dequeue=True' as a kwarg, then all other arguments will be ignored and the Alert will check for messages to send """ __metaclass__ = AlertMeta def __init__(self, **kwargs): dequeue = kwargs.pop('dequeue',None) if kwargs: raise ValueError('Unexpected keyword arguments: %s' % kwargs) if dequeue: self.dequeue() else: # Do Normal init stuff def dequeue(self): """ Pop batched AlertItems """ # Dequeue from a custom queue class CustomAlert(BaseAlert): def __init__(self,**kwargs): # prepare custom init data super(BaseAlert, self).__init__(**kwargs) We would like to be able to make child classes of BaseAlert (CustomAlert) that allow us to run dequeue and to be able to run their own __init__ code. We think there are three ways to do this: Add a prep() method that returns True in the BaseAlert and is called by __init__. Child classes could define their own prep() methods. Make dequeue() a class method - however, alot of what dequeue() does requires non-class methods - so we'd have to make those class methods as well. Create a new class for dealing with the queue. Would this class extend BaseAlert? Is there a standard way of handling this type of situation?

    Read the article

  • What are all the concurrent things [data structure, algorithm, locking mechanism] missing in .Net 3.

    - by user49767
    First time I am bit disappointed in StackOverflow cause my http://stackoverflow.com/questions/2571727/c-concurrency-vs-java-concurrency-which-is-neatly-designed-which-is-better question was closed. My intension was just trying to gather knowledge from programming guru's who worked in both the programming technologies. Rather closing this question, please help me by discussing what is good, bad, and ugly in multi-threading part in both the platforms. It is also welcome, if someone would like to compare with .Net 4.0 with JDK 6 (or JDK 7)

    Read the article

  • Need a design approach or suggestion for a simple structure using Servlet.

    - by akshay
    Hi I have to design such that whenever user pass a query I process it using servlet and then call the js page to draw the chart 1 user writes a query on a page 2 the page call the servelt class public class MyServlet extends Httpservlet implements DataSourceServlet {..... return data The user see a beautiful string like this.. google.visualization.Query.setResponse......... /Tiger'},{v:80.0}, {v:false}]}]}}); 3 when the user hits on different html page myhtml.js it draws the chart. I want the Myservlet class itself call the myhtml.js page and draw the chart directly. and want to eliminate the beautiful string google.visualization.Query.setResponse......... /Tiger'},{v:80.0}, {v:false}]}]}}); from coming on user's browser What should i do? I tried using functions to call another page like request dispatcher(), redirect() calling myhtml.js page directly after myservlet process the query results. But i get the result like this google.visualization.Query.setResponse......... /Tiger'},{v:80.0}, {v:false}]}]}}); and the entire myhtml.js code page below it on the browsers that to without the chart been draw. Is there anyway to element the beautiful string from coming on clients browser and only show them the chart been drawn ? :) This is the small tutorial i am following http://code.google.com/apis/visualization/documentation/dev/dsl_get_started.html

    Read the article

  • The standard map/associative-array structure to use in flash actionscript 3?

    - by tstyle
    I'm relatively new to flash, and is confused about what I should use to store and retrieve key value pairs. After some googling I've found various map-like things to choose from: 1) Use a Object: var map:Object = new Object(); map["key"] = "value"; The problem is that it seems to lack some very basic features. For example to even get the size of map I'd have to write a util method. 2) Use a Dictionary What does this standard library class provide over the simple object? It seems silly for it to exist if it's functionally identical to Object. 3) Go download some custom HashMap/HashTable implementation from the web. I've used a lot of modern languages, and this is the first time I haven't been able to find a library implementation of an associative array within 5 minutes. So I'd like to get some best-practice advice from an experienced flash developer. Thanks!

    Read the article

  • How to structure code with 2 methods, one after another, which throw the same two exceptions?

    - by dotnetdev
    Hi, I have two methods, one called straight after another, which both throw the exact same 2 exceptions (IF an erroneous condition occurs, not stating that I'm getting exceptions). For this, should I write seperate try and catch blocks with the one statement in each try block and catch both exceptions (Both of which I can handle as I checked MSDN class library reference and there is something I can do, eg, re-open SqlConnection or run a query and not a stored proc which does not exist). So code like this: try { obj.Open(); } catch (SqlException) { // Take action here. } catch (InvalidOperationException) { // Take action here. } And likewise for the other method I call straight after. This seems like a very messy way of coding. The other way is to code with the exception variable (that is ommited as I am using AOP to log the exception details, using a class-level attribute). Doing this, this could aid me in finding out which method caused an exception and then taking action accordingly. Is this the best approach or is there another best practise altogether? I also assume that, as only these two methods are thrown, I do not need to catch Exception as that would be for an exception I cannot handle (causes way out of my control). Thanks

    Read the article

  • how to remove all text nodes and only preserve structure information of a html page with nokogiri

    - by user58948
    I want to remove all text from html page that I load with nokogiri. For example, if a page has the following: <body><script>var x = 10;</script><div>Hello</div><div><h1>Hi</h1></div></body> I want to process it with Nokogiri and return html like the following after stripping the text like so: <body><script>var x = 10;</script><div></div><div><h1></h1></div></body> (THat is, remove the actual h1 text, text between divs, text in p elements etc, but keep the tags. also, dont remove text in the script tags.) How can I do that?

    Read the article

  • Setting the type of a field in a superclass from a subclass (Java)

    - by Ibolit
    Hi. I am writing a project on Google App Engine, within it I have a number of abstract classes that I hope I will be able to use in my future projects, and a number of concrete classes inheriting from them. Among other abstract classes I have an abstract servlet that does user management, and I hava an abstract user. The AbstractUser has all the necessary fields and methods for storing it in the datastore and telling whether the user is registered with my service or not. It does not implement any project specific functionality. The abstract servlet that manages users, refers only to the methods declared in the AbstractUser class, which allows it to generate links for logging in, logging out and registering (for unregistered users). In order to implement the project-specific user functionality I need to subclass the Abstract user. The servlets I use in my project are all indirect descendants from that abstract user management servlet, and the user is a protected field in it, so the descendant servlets can use it as their own field. However, whenever i want to access any project specific method of the concrete user, i need to cast it to that type. i.e. (abstract user managing servlet) ... AbstractUser user = getUser(); ... abstract protected AbstractUser getUser(); (project-specific abstract servlet) @Override protected AbstractUser getUser() { return MyUserFactory.getUser(); } any other project specific servlet: int a = ((ConcreteUser) user).getA(); Well, what i'd like to do is to somehow make the type of “user” in the superclass depend on something in the project-specific abstract class. Is it at all possible? And i don't want to move all the user-management stuff into a project-specific layer, for i would like to have it for my future projects already written :) Thank you for your help.

    Read the article

  • How to implement copy operator for such C++ structure?

    - by Kabumbus
    So having struct ResultStructure { ResultStructure(const ResultStructure& other) { // copy code in here ? using memcpy ? how??? } ResultStructure& operator=(const ResultStructure& other) { if (this != &other) { // copy code in here ? } return *this } int length; char* ptr; }; How to implement copy? (sorry - I am C++ nube)

    Read the article

  • Is a python dictionary the best data structure to solve this problem?

    - by mikip
    Hi I have a number of processes running which are controlled by remote clients. A tcp server controls access to these processes, only one client per process. The processes are given an id number in the range of 0 - n-1. Were 'n' is the number of processes. I use a dictionary to map this id to the client sockets file descriptor. On startup I populate the dictionary with the ids as keys and socket fd of 'None' for the values, i.e no clients and all pocesses are available When a client connects, I map the id to the sockets fd. When a client disconnects I set the value for this id to None, i.e. process is available. So everytime a client connects I have to check each entry in the dictionary for a process which has a socket fd entry of None. If there are then the client is allowed to connect. This solution does not seem very elegant, are there other data structures which would be more suitable for solving this? Thanks

    Read the article

  • How important is it that models be consistent across project components?

    - by RonLugge
    I have a project with two components, a server-side component and a client-side component. For various reasons, the client-side device doesn't carry a fully copy of the database around. How important is it that my models have a 1:1 correlation between the two sides? And, to extend the question to my bigger concern, are there any time-bombs I'm going to run into down the line if they don't? I'm not talking about having different information on each side, but rather the way the information is encapsulated will vary. (Obviously, storage mechanisms will also vary) The server side will store each user, each review, each 'item' with seperate tables, and create links between them to gather data as necessary. The client side shouldn't have a complete user database, however, so rather than link against the user for gathering things like 'name', I'd store that on the review. In other words... --- Server Side --- Item: +id //Store stuff about the item User: +id +Name -Password Review: +id +itemId +rating +text +userId --- Device Side --- Item: +id +AverageRating Review: +id +rating +text +userId +name User: +id +Name //Stuff The basic idea is that certain 'critical' information gets moved one level 'up'. A user gets the list of 'items' relevant to their query, with certain review-orientation moved up (i. e. average rating). If they want more info, they query the detail view for the item, and the actual reviews get queried and added to the dataset (and displayed). If they query the actual review, the review gets queried and they pick up some additional user info along the way (maybe; I'm not sure if the user would have any use for any of the additional user information). My basic concern is that I don't wan't to glut the user's bandwidth or local storage with a huge variety of information that they just don't need, even if proper database normalizations suggests that information REALLY should be stored at a 'lower' level. I've phrased this as a fairly low-level conceptual issue because that's the level I'm trying to think / worry over, but if it matters I'm creating a PHP / MySQL server that provides data for a iOS / CoreData client.

    Read the article

  • What are the benefits of a classical structure over a prototyple one?

    - by Rixius
    I have only recently started programming significantly, and being completely self-taught, I unfortunately don't have the benefits of a detailed Computer science course. I've been reading a lot about JavaScript lately, and I'm trying to find the benefit in classes over the prototype nature of JavaScript. The question seems to be drawn down the middle of which one is better, and I want to see the classical side of it. When I look at the prototype example: var inst_a = { "X": 123, "Y": 321, add: function () { return this.X+this.Y; } }; document.write(inst_a.add()); And then the classical version function A(x,y){ this.X = x; this.Y = y; this.add = function(){ return this.X+this.Y; }; }; var inst_a = new A(123,321); document.write(inst_a.add()); I begun thinking about this because I'm looking at the new ecmascript revision 5 and a lot of people seem up in arms that they didn't add a Class system.

    Read the article

  • database structure for threads that are editable by many users?

    - by fayer
    at the moment i have a column "user_id" in the "threads" table cause one thread belongs to an user. i want to make it like Stackoverflow that one thread can be editable by many users and you can see when they edited, what they edited, roll back changes and so on. im using symfony, is there a plugin for this? if no, are there any 3rd part libraries/plugins to download for this to integrate to existing database? cause i have no idea how to implement this. it sounds like mediawiki, something that already exists? thanks

    Read the article

  • How to Improve this if else structure in Javascript?

    - by basit74
    if(isIE()) if(termin != "") TargetElement.onclick = function() {merkzettelRemove(this, id, termin)}; else TargetElement.onclick = function() {merkzettelRemove(this, id)}; else if(termin != "") TargetElement.setAttribute("onclick","merkzettelRemove(this, " + id + ", '" + termin + "')"); else TargetElement.setAttribute("onclick","merkzettelRemove(this, " + id + ")");

    Read the article

  • How do I unpack bits from a structure's stream_data in c code?

    - by Chelp
    Ex. typedef struct { bool streamValid; dword dateTime; dword timeStamp; stream_data[800]; } RadioDataA; Ex. Where stream_data[800] contains: **Variable** **Length (in bits)** packetID 8 packetL 8 versionMajor 4 versionMinor 4 radioID 8 etc.. I need to write: void unpackData(radioDataA *streamData, MA_DataA *maData) { //unpack streamData (from above) & put some of the data into maData //How do I read in bits of data? I know it's by groups of 8 but I don't understand how. //MAData is also a struct. }

    Read the article

  • Cast A primitive type pointer to A structure pointer - Alignment and Padding?

    - by Seçkin Savasçi
    Just 20 minutes age when I answered a question, I come up with an interesting scenario that I'm not sure of the behavior: Let me have an integer array of size n, pointed by intPtr; int* intPtr; and let me also have a struct like this: typedef struct { int val1; int val2; //and less or more integer declarations goes on like this(not any other type) }intStruct; My question is if I do a cast intStruct* structPtr = (intStruct*) intPtr; Am I sure to get every element correctly if I traverse the elements of the struct? Is there any possibility of miss-alignment(possible because of padding) in any architecture/compiler?

    Read the article

  • How Would you Mimic an Arbitrary Directory Structure with Rails Routes?

    - by viatropos
    I want to be able to map Google Docs' folder system to urls in my application and am just wondering how I can say "route, I want you to match an arbitrary set of nodes, and the last one is the file (or possibly a directory, I can check in the controller)". So I could do things like: www.mysite.com/documents/folder1/childfolderA/document www.mysite.com/documents/root-level-doc Can the routes.rb file do something like this?

    Read the article

  • Looking for something to add some standard rules for my c++ project.

    - by rkb
    Hello all, My team is developing a C++ project on linux. We use vim as editor. I want to enforce some code standard rules in our team in such a way that if the code is not in accordance with it, some sort of warning or error will be thrown when it builds or compiles. Not necessarily it builds but at least I can run some plugin or tools on that code to make sure it meets the standard. So that before committing to svn everyone need to run the code through some sort of plugin or script and make sure it meets the requirement and then only he/she can commit. Not sure if we can add some rules to vim, if there are any let me know about it. For eg. In our code standards all the member variables and private functions should start with _ class A{ private: int _count; float _amount; void _increment_count(){ ++_count; } } So I want to throw some warning or error or some sort of messages for this class if the variables are declared as follows. class A{ private: int count; float amount; void increment_count(){ ++_count; } } Please note that warning and error are not from compiler becoz program is still valid. Its from the tool I want to use so that code goes to re-factoring but still works fine on the executable side. I am looking for some sort of plugin or pre parsers or scripts which will help me in achieving all this. Currently we use svn; just to anser the comment.

    Read the article

  • Please help me out in fetching the desired result from below given DB table structure of MySQL..

    - by OM The Eternity
    Hi All below are the table structures according to which I have to develop the desired output(given at the end) tbl_docatr docatr_id doc_id docatrtype_id docatr_float docatr_int docatr_date docatr_varchar docatr_blob 1 12 1 NULL NULL NULL testing [BLOB - NULL] 2 12 2 NULL NULL NULL Tesitng [BLOB - NULL] tbl_docatrtype docatrtype_id docatrtypegroup_id docatrtypetype_id docatrtype_name 1 1 4 Name 2 1 4 Company Name tbl_docatrtypetype docatrtypetype_id docatrtypetype_name 1 Float 2 Int 3 Date 4 String line Above are three tables from which I have to display the desired output as Name : testing Company Name : Tesitng such that at first step I have doc_id then I get docatrtype_id and then docatrtypetype_id acording to these values i have to fetch the result. Also the query must see the doactrtypetype_id from table tbl_docatrtypetype and fetch the result from tbl_docatr from respective column docatr_float, docatr_int, docatr_date, docatr_varchar, docatr_blob Please help!!!

    Read the article

  • What is the best way to structure those jquery call backs?

    - by user518138
    I am new to jquery and recently have been amazed how powerful those call backs are. But here I got some logic and I am not sure what the best way is. Basically, I got a bunch of tables in web sql database in chrome. I will need to go through say table A, table B and table C. I need to submit each row of the table to server. Each row represents a bunch of complicated logic and data url and they have to be submitted in the order of A - B - C. The regular java way would be: TableA.SubmitToServer() { query table A; foreach(row in tableA.rows) { int nRetID = submitToServer(row); do other updates.... } } Similar for tableB and table C. then just call: TableA.SubmitToServer(); TableB.SubmitToServer(); TableC.SubmitToServer(); //that is very clear and easy. But in JQuery, it probably will be: db.Transaction(function (tx){ var strQuery = "select * from TableA"; tx.executeSql(strQuery, [], function (tx, result){ for(i = 0 ; i < result.rows.length; i++) { submitTableARowToServer(tx, result.rows.getItem(i), function (tx, result) { //do some other related updates based on this row from tableA //also need to upload some related files to server... }); } }, function errorcallback....) }); As you can see, there are already enough nested callbacks. Now, where should I put the process for TableB and tableC? They all need to have similar logic and they can only be called after everything is done from TableA. So, What is the best way to do this in jquery? Thanks

    Read the article

  • Resolving TFS_SCHEMA_VERSION Errors In Team Foundation Server 2010 Collection Databases

    - by Jeff Ferguson
    I recently backed up a Team Foundation Server 2010 project collection database and restored it onto another server. All of that went well, until I tried to use the restored database on the new server. As it turns out, the old server was running the Release Candidate of TFS 2010 and the new server is running the RTM version of TFS 2010. I ended up with an error message shown on the new server's Team Web Access site about the project collection's TFS_SCHEMA_VERSION property not containing the appropriate value. As it turns out, TFS_SCHEMA_VERSION is an extended property on the project collection database. I ran the following SQL script against the project collection database restored onto the new server: EXEC [Tfs_DefaultCollection].sys.sp_dropextendedproperty @name=N'TFS_PRODUCT_VERSION' GO EXEC [Tfs_DefaultCollection].sys.sp_addextendedproperty @name=N'TFS_PRODUCT_VERSION', @value=N'10.0.30319.1' GO EXEC [Tfs_DefaultCollection].sys.sp_dropextendedproperty @name=N'TFS_SCHEMA_VERSION' GO EXEC [Tfs_DefaultCollection].sys.sp_addextendedproperty @name=N'TFS_SCHEMA_VERSION', @value=N'Microsoft Team Foundation Server 2010 (RTM)' GO Now, all is well. I can now navigate to http://newserver:8080/tfs/ and see the restored project collection and its contents.

    Read the article

< Previous Page | 198 199 200 201 202 203 204 205 206 207 208 209  | Next Page >