Search Results

Search found 457 results on 19 pages for 'bobby williams'.

Page 15/19 | < Previous Page | 11 12 13 14 15 16 17 18 19  | Next Page >

  • Reusing a vector in C++

    - by Bobby
    I have a vector declared as a global variable that I need to be able to reuse. For example, I am reading multiple files of data, parsing the data to create objects that are then stored in a vector. vector<Object> objVector(100); void main() { while(THERE_ARE_MORE_FILES_TO_READ) { // Pseudocode ReadFile(); ParseFileIntoVector(); ProcessObjectsInVector(); /* Here I want to 'reset' the vector to 100 empty objects again */ } } Can I reset the vector to be "vector objVector(100)" since it was initially allocated on the stack? If I do "objVector.clear()", it removes all 100 objects and I would have a vector with a size of 0. I need it to be a size of 100 at the start of every loop.

    Read the article

  • Should I delete the string members of a C++ class?

    - by Bobby
    If I have the following declaration: #include <iostream> #include <string> class DEMData { private: int bitFldPos; int bytFldPos; std::string byteOrder; std::string desS; std::string engUnit; std::string oTag; std::string valType; int idx; public: DEMData(); DEMData(const DEMData &d); void SetIndex(int idx); int GetIndex() const; void SetValType(const char* valType); const char* GetValType() const; void SetOTag(const char* oTag); const char* GetOTag() const; void SetEngUnit(const char* engUnit); const char* GetEngUnit() const; void SetDesS(const char* desS); const char* GetDesS() const; void SetByteOrder(const char* byteOrder); const char* GetByteOrder() const; void SetBytFldPos(int bytFldPos); int GetBytFldPos() const; void SetBitFldPos(int bitFldPos); int GetBitFldPos() const; friend std::ostream &operator<<(std::ostream &stream, DEMData d); bool operator==(const DEMData &d) const; ~DEMData(); }; what code should be in the destructor? Should I "delete" the std::string fields?

    Read the article

  • Log4net 1.2.10 running on .NET 1.1 and 2.0 not compatible

    - by Daniel Williams
    I have old code that uses log4net version 1.2.10 targeted for the .NET 1.1 platform. My current code uses lognet version 1.2.10 targeted for the .NET 2.0 platform When I mix the old and new code all hell breaks loose. Code written today on .NET 4.0 and VS2010 can use the 2.0 log4net dll just fine. but if I put in the 1.1 version, it breaks. Conversely, the old dlls will break if I use the 2.0 log4net dll. I do not want to force my old dlls onto 2.0. Is there a good solution? I guess what bugs me most is that the log4net has the same version number, but I cannot fool my code and dlls into working with a single version.

    Read the article

  • jQuery selector after dynamically created element

    - by Bryan Williams
    I am trying to get an dynamically created element using a jQuery selector but it is returning an empty array. The first thing I am doing is grabbing an empty div: var packDiv = document.getElementById('templates'); packDiv.innerHTML = ""; then adding items to it in a loop: packDiv.innerHTML = packDiv.innerHTML + "<img id='" + thumbName + "' src='thumbs/" + thumbName + "'/>"; after the loop finishes I try to select an item using: console.log($("#"+thumbName)); and it returns the empty array. All the things I search on show to use .on but all the examples show that is to set event handlers. My question is how do I format a selector for dynamically created elements?

    Read the article

  • Multiple choice test GUI with serialization of Q&A

    - by Bobby
    I'm working on a project for school in Java programming. I need to design a GUI that will take in questions and answers and store them in a file. It should be able to contain an unlimited number of questions. We have covered binary I/O. How do I write the input they give to a file? How would I go about having them add multiple questions from this GUI? package multiplechoice; import java.awt.*; import javax.swing.*; public class MultipleChoice extends JFrame { public MultipleChoice() { /* * Setting Layout */ setLayout(new GridLayout(10,10)); /* * First Question */ add(new JLabel("What is the category of the question?: ")); JTextField category = new JTextField(); add(category); add(new JLabel("Please enter the question you wish to ask: ")); JTextField question = new JTextField(); add(question); add(new JLabel("Please enter the correct answer: ")); JTextField correctAnswer = new JTextField(); add(correctAnswer); add(new JLabel("Please enter a reccomended answer to display: ")); JTextField reccomendedAnswer = new JTextField(); add(reccomendedAnswer); add(new JLabel("Please enter a choice for multiple choice option " + "A")); JTextField A = new JTextField(); add(A); add(new JLabel("Please enter a choice for multiple choice option " + "B")); JTextField B = new JTextField(); add(B); add(new JLabel("Please enter a choice for multiple choice option " + "C")); JTextField C = new JTextField(); add(C); add(new JLabel("Please enter a choice for multiple choice option " + "D")); JTextField D = new JTextField(); add(D); add(new JButton("Compile Questions")); add(new JButton("Next Question")); } public static void main(String[] args) { /* * Creating JFrame to contain questions */ FinalProject frame = new FinalProject(); // FileOutputStream output = new FileOutputStream("Questions.dat"); JPanel panel = new JPanel(); // button.setLayout(); // frame.add(panel); panel.setSize(100,100); // button.setPreferredSize(new Dimension(100,100)); frame.setTitle("FinalProject"); frame.setSize(600, 400); frame.setLocationRelativeTo(null); // Center the frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }

    Read the article

  • Vertical line on HxW canvas of pixels

    - by bobby williams
    I searched and found nothing. I'm trying to draw lines (simple y=mx+b ones) on a canvas of black pixels. It works fine, but no line occurs when it is vertical. I'm not sure why. My first if statement checks if the denominator is zero, therefore m is undefined and no need for a line equation. My second and third if statement check how steep it is and based on that, calculate the points in between. I don't think there is a need for other classes, since I think there is a bug in my code or I'm just not translating the mathematics into code properly. If more is needed, I'll be happy to post more. /** * Returns an collection of points that connects p1 and p2 */ public ArrayList getPoints() { ArrayList points = new ArrayList(); // checks to see if denominator in m is zero. if zero, undefined. if ((p2.getX() - p1.getX()) == 0) { for (int y = p1.getY(); y<p2.getY(); y++) { points.add(new Point(p1.getX(), y, getColor())); } } double m = (double)(p2.getY()-p1.getY())/(double)(p2.getX()-p1.getX()); int b = (int)(p1.getY() - (m * p1.getX())); // checks to see if slope is steep. if (m > -1 || m < 1) { for (int x = p1.getX(); x<p2.getX(); x++) { int y = (int) ((m*x)+b); points.add(new Point(x, y, getColor())); } } // checks to see if slope is not steep. if (m <= -1 || m >= 1) { for (int y = p1.getY(); y<p2.getY(); y++) { int x = (int) ((y-b)/m); points.add(new Point(x, y, getColor())); } } return points; }

    Read the article

  • Getting Type mismatch for my function

    - by Sandy Williams
    I am getting an error message i.e. Type mismatch: 'EMXWEB_IE_LAUNCH' Line (1): "' ==============================================================================". the function is Option Explicit Public Function EMXWEB_IE_LAUNCH (dicArguments, sErrMsg) Dim strVersion Dim strExeVersion Dim WshShell Dim strEMXWebBrowserTitleBarText Dim ie Const strFunctionName = "EMXWEB_IE_LAUNCH" Set ie = CreateObject( "InternetExplorer.Application" ) ie.Navigate "www.google.com" ie.Visible=True End Function Could any one let me know where i am wrong and why i am getting this issue

    Read the article

  • Perl launched from Java takes forever

    - by Wade Williams
    I know this is an absolute shot in the dark, but we're absolutely perplexed. A perl (5.8.6) script run by Java (1.5) is taking more than an hour to complete. The same script, when run manually from the command line takes 12 minutes to complete. This is on a Linux host. Logging is the same in both cases and the script is run with the same parameters in both cases. The script does some complex stuff like Oracle DB access, some scp's, etc, but again, it does the exact same actions in both cases. We're stumped. Has anyone ever run into a similar situation? If not and if you were faced with the same situation, how would you consider debugging it?

    Read the article

  • Rails creating users, roles, and projects

    - by Bobby
    I am still fairly new to rails and activerecord, so please excuse any oversights. I have 3 models that I'm trying to tie together (and a 4th to actually do the tying) to create a permission scheme using user-defined roles. class User < ActiveRecord::Base has_many :user_projects has_many :projects, :through => :user_projects has_many :project_roles, :through => :user_projects end class Project < ActiveRecord::Base has_many :user_projects has_many :users, :through => :user_projects has_many :project_roles end class ProjectRole < ActiveRecord::Base belongs_to :projects belongs_to :user_projects end class UserProject < ActiveRecord::Base belongs_to :user belongs_to :project has_one :project_role attr_accessible :project_role_id end The project_roles model contains a user-defined role name, and booleans that define whether the given role has permissions for a specific task. I'm looking for an elegant solution to reference that from anywhere within the project piece of my application easily. I do already have a role system implemented for the entire application. What I'm really looking for though is that the users will be able to manage their own roles on a per-project basis. Every project gets setup with an immutable default admin role, and the project creator gets added upon project creation. Since the users are creating the roles, I would like to be able to pull a list of role names from the project and user models through association (for display purposes), but for testing access, I would like to simply reference them by what they have access to without having reference them by name. Perhaps something like this? def has_perm?(permission, user) # The permission that I'm testing user.current_project.project_roles.each do |role| if role.send(permission) # Not sure that's right... do_stuff end end end I think I'm in over my head on this one because I keep running in circles on how I can best implement this.

    Read the article

  • Declaring a data type dynamically in C++

    - by Bobby
    I want to be able to do the following: I have an array of strings that contain data types: string DataTypeValues[20] = {"char", "unsigned char", "short", "int"}; Then later, I would like to create a variable of one of the data types at runtime. I won't know at compile time what the correct data type should be. So for example, if at runtime I determined a variable x needed to be of type int: DataTypeValues[3] x = 100; Obviously this won't work, so how could I do something like this?

    Read the article

  • Reading a stream in C++

    - by Bobby
    I have the following code: ifstream initFile; initFile.open("D:\\InitTLM.csv"); if(initFile.is_open()) { // Process file } The file is not opening. The file does exist on the D: drive. Is there a way to find out exactly why this file cannot be found? Like an "errno"?

    Read the article

  • C++ shifting bits

    - by Bobby
    I am new to shifting bits, but I am trying to debug the following snippet: if (!(strcmp(arr[i].GetValType(), "f64"))) { dem_content_buff[BytFldPos] = tmp_data; dem_content_buff[BytFldPos + 1] = tmp_data >> 8; dem_content_buff[BytFldPos + 2] = tmp_data >> 16; dem_content_buff[BytFldPos + 3] = tmp_data >> 24; dem_content_buff[BytFldPos + 4] = tmp_data >> 32; dem_content_buff[BytFldPos + 5] = tmp_data >> 40; dem_content_buff[BytFldPos + 6] = tmp_data >> 48; dem_content_buff[BytFldPos + 7] = tmp_data >> 56; } I am getting a warning saying the lines with "32" to "56" have a shift count that is too large. The "f64" in the predicate just means that the data should be 64bit data. How should this be done?

    Read the article

  • Quick-sort doesn't work with middle pivot element

    - by Bobby
    I am trying to sort an array of elements using quick-sort algorithm.But I am not sure where am I going wrong.I choose the middle element as pivot every time and then I am checking the conditions.Here is my code below. void quicksort(int *temp,int p,int r) { if(r>p+1) { int mid=(p+r)/2; int piv=temp[mid]; int left=p+1; int right=r; while(left < right) { if(temp[left]<=piv) left++; else swap(&temp[left],&temp[--right]); } swap(&temp[--left],&temp[p]); quicksort(temp,p,left); quicksort(temp,right,r); } }

    Read the article

  • Accessing 'data' argument of with() function?

    - by Ken Williams
    Is it possible, in the expr expression of the with() function, to access the data argument directly? Here's what I mean conceptually: > print(df) result qid f1 f2 f3 -1 1 0.0000 0.1253 0.0000 -1 1 0.0098 0.0000 0.0000 1 1 0.0000 0.0000 0.1941 -1 2 0.0000 0.2863 0.0948 1 2 0.0000 0.0000 0.0000 1 2 0.0000 0.7282 0.9087 > with(df, subset(.data, select=f1:f3)) # Doesn't work Of course the above example is kind of silly, but it would be handy for things like this: with(subset(df, f2>0), foo(qid, vars=subset(.data, select=f1:f3))) I tried to poke around with environment() and parent.frame() etc., but didn't come up with anything that worked. Maybe this is really a question about eval(), since that's how with.default() is implemented.

    Read the article

  • Pointers in For loops

    - by Bobby
    Quick question: I am a C# guy debugging a C++ app so I am not used to memory management. In the following code: for(int i = 0; i < TlmMsgDB.CMTGetTelemMsgDBCount(); i++) { CMTTelemetryMsgCls* telm = TlmMsgDB.CMTGetTelemetryMsg(i); CMT_SINT32_Tdef id = telm->CMTGetPackingMapID(); ManualScheduleTables.SetManualMsg(i,id); ManualScheduleTables.SetManExec(i,false); } Am I leaking memory every iteration b/c of CMTTelemetryMsgCls* telm = TlmMsgDB.CMTGetTelemetryMsg(i);? The "CMTGetTelemetryMsg(int)" method returns a pointer. Do I have to "delete telm;" at the end of each iteration?

    Read the article

  • Where Should Using Statements Be Located [closed]

    - by Bobby Ortiz - DotNetBob
    Possible Duplicate: What is the difference between these two declarations? I recently started working on a project with using statement located inside the NameSpace block. namespace MyApp.Web { using System; using System.Web.Security; using System.Web; public class MyClass { I usually put my using statements above the namespace block. using System; using System.Web.Security; using System.Web; namespace MyApp.Web { public class MyClass { I don't think it matters, but I am currious if someone else had a recommendation and could they explain why one way is better than another. Note: I always have one class per file.

    Read the article

  • get next available integer using LINQ

    - by Daniel Williams
    Say I have a list of integers: List<int> myInts = new List<int>() {1,2,3,5,8,13,21}; I would like to get the next available integer, ordered by increasing integer. Not the last or highest one, but in this case the next integer that is not in this list. In this case the number is 4. Is there a LINQ statement that would give me this? As in: var nextAvailable = myInts.SomeCoolLinqMethod(); Edit: Crap. I said the answer should be 2 but I meant 4. I apologize for that! For example: Imagine that you are responsible for handing out process IDs. You want to get the list of current process IDs, and issue a next one, but the next one should not just be the highest value plus one. Rather, it should be the next one available from an ordered list of process IDs. You could get the next available starting with the highest, it does not really matter.

    Read the article

  • Can I create a two-column layout that fluidly adapts to narrow windows?

    - by Brant Bobby
    I'm trying to design a page that has two columns of content, div#left and div#right. (I know these aren't proper semantic identifiers, but it makes explaining easier) The widths of both columns are fixed. Desired result - Wide viewport When the viewport is too narrow to display both side-by-side, I want #right to be stacked on top of #left, like this: Desired result - narrow viewport My first thought was simply to apply float: left to #left and float: right to #right, but that makes #right attach itself to the right side of the window (which is the proper behavior for float, after all), leaving an empty space. This also leaves a big gap between the columns when the browser window is really wide. Wrong - div#right is not flush with the left side of the viewport Wrong - div#right is not on top of div#left Applying float: left to both divs would result in the wrong one moving to the bottom when the window was too small. I could probably do this with media queries, but IE doesn't support those until version 9. The source order is unimportant, but I need something that works in IE7 minimum. Is this possible to do without resorting to Javascript?

    Read the article

  • [picker dismissModalViewControllerAnimated:YES]; not working

    - by shishir.bobby
    I am using - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { } for imagepicker and using [picker dismissModalViewControllerAnimated:YES]; in iPad to dismiss the picker. also i tried using - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;{ [picker dismissModalViewControllerAnimated:YES]; } to dismiss the picker once it done the work. BUt its not dimissing it. when i tap anywhere in the screen, than only it gets dismiss. What i am doing wrong to dismiss the imagepicker? Many thnkas

    Read the article

  • When should I implement IDisposeable?

    - by Bobby
    What is the best practice for when to implement IDisposeable? Is the best rule of thumb to implement it if you have one managed object in the class, or does it depend if the object was created in the class or just passed in? Should I also do it for classes with no managed objects at all?

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19  | Next Page >