Search Results

Search found 609 results on 25 pages for 'bs c3'.

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

  • Templates - Exercises

    - by atch
    Hi, As I mentioned in my yesterday's post, I'm trying to teach myself templates from the book: Templates: The Complete Guide. And although I'm finding this book very nicely presented and material there is explained really well there are no exercises attached after each chapter to test your knowlege, like it is in The C++ Language by B.S for example and had done all exercises from "The C++" I really feel benefit from doing them. So what I'm asking today is: Does anyone know where can I get excersises with templates. Thank you.

    Read the article

  • Column layout in HTML(5)/CSS

    - by Josh P.
    Is there a way in HTML5/CSS to have the columns layed out as shown below, and still have the text flow correctly? ###### ###### # C1 # # C2 # # # # # ###### ###### ###### ###### # C3 # # C4 # # # # # ###### ###### ###### ###### # C5 # # C6 # # # # # ###### ######

    Read the article

  • Convert List of one type to Array of another type using Dozer

    - by aheu
    I'm wondering how to convert a List of one type to an array of another type in Java using Dozer. The two types have all the same property names/types. For example, consider these two classes. public class A{ private String test = null; public String getTest(){ return this.test } public void setTest(String test){ this.test = test; } } public class B{ private String test = null; public String getTest(){ return this.test } public void setTest(String test){ this.test = test; } } I've tried this with no luck. List<A> listOfA = getListofAObjects(); Mapper mapper = DozerBeanMapperSingletonWrapper.getInstance(); B[] bs = mapper.map(listOfA, B[].class); I've also tried using the CollectionUtils class. CollectionUtils.convertListToArray(listOfA, B.class) Neither are working for me, can anyone tell me what I am doing wrong? The mapper.map function works fine if I create two wrapper classes, one containing a List and the other a b[]. See below: public class C{ private List<A> items = null; public List<A> getItems(){ return this.items; } public void setItems(List<A> items){ this.items = items; } } public class D{ private B[] items = null; public B[] getItems(){ return this.items; } public void setItems(B[] items){ this.items = items; } } This works oddly enough... List<A> listOfA = getListofAObjects(); C c = new C(); c.setItems(listOfA); Mapper mapper = DozerBeanMapperSingletonWrapper.getInstance(); D d = mapper.map(listOfA, D.class); B[] bs = d.getItems(); How do I do what I want to do without using the wrapper classes (C & D)? There has got to be an easier way... Thanks!

    Read the article

  • Serious Memory Clash: Variables clashing in C

    - by Soham
    int main(int argc, char*argv[]) { Message* newMessage; Asset* Check; //manipulation and initialization of Check, so that it holds proper values. newMessage = parser("N,2376,01/02/2011 09:15:01.342,JPASSOCIAT FUTSTK 24FEB2011,B,84.05,2000,0,0",newMessage); // MessageProcess(newMessage,AssetMap); printf("LAST TRADE ADDRESS %p LAST TRADE TIME %s\n",Check->TradeBook,Check->Time); } Message* parser(char *message,Message* new_Message) { char a[9][256]; char* tmp =message; bool inQuote=0; int counter=0; int counter2=0; new_Message = (Message*)malloc(sizeof(Message)); while(*tmp!='\0') { switch(*tmp) { case ',': if(!inQuote) { a[counter][counter2]='\0'; counter++; counter2=0; } break; case '"': inQuote=!inQuote; break; default: a[counter][counter2]=*tmp; counter2++; break; } tmp++; } a[counter][counter2]='\0'; new_Message->type = *a[0]; new_Message->Time = &a[2][11]; new_Message->asset = a[3]; if(*a[4]=='S') new_Message->BS = 0; else new_Message->BS = 1; new_Message->price1=atof(a[5]); new_Message->shares1=atol(a[6]); new_Message->price2=atof(a[7]); new_Message->shares2=atol(a[8]); new_Message->idNum = atoi(a[1]); return(new_Message); } Here there is a serious memory clash, in two variables of different scope. I have investigated using gdb and it seems the address of new_Message->Time is equalling to the address of Check->Time. They both are structures of different types I am trying to resolve this issue, because, when parser changes the value of new_Message->Time it manipulates the contents of Check-Time Please do suggest how to solve this problem. I have lost(spent) around 10 hours and counting to resolve this issue, and tons of hair. Soham

    Read the article

  • bash script variable inside variable

    - by user316100
    x=1 c1=string1 c2=string2 c3=string3 echo $c1 string1 I'd like to have the output be string1 by using something like: echo $(c($x)) So later in the script I can increment the value of x and have it output string1, then string2 and string3. Can anyone point me in the right direction?

    Read the article

  • shuffling array javascript

    - by Dennis Callanan
    <!doctype html> <html lang="en"> <head> <meta charset="utf=8" /> <title>Blackjack</title> <link rel="stylesheet" href="blackjack.css" /> <script type="text/javascript"> var H2 = 2; var S2 = 2; var D2 = 2; var C2 = 2; var H3 = 3; var S3 = 3; var D3 = 3; var C3 = 3; var deck = new Array(H2, S2, D2, C2, H3, S3, D3, C3); var new_deck = new Array(); var r; document.write("deck = ") for (r =0; r<deck.length; r++){ document.write(deck[r]); } document.write("</br>") document.write("new deck = ") for (r=0; r<new_deck.length; r++){ document.write(new_deck[r]); } document.write("</br>") for (r=0;r<deck.length;r++){ var randomindex = Math.floor(Math.random()*deck.length); new_deck.push(randomindex) deck.pop(randomindex) } document.write("deck = ") for (r =0; r<deck.length; r++){ document.write(deck[r]); } document.write("</br>") document.write("new deck = ") for (r=0; r<new_deck.length; r++){ document.write(new_deck[r]); } document.write("</br>") </script> </head> <body> </body> </html> Obviously this isn't the full Blackjack game here. It's just a test to see if shuffling the array works by printing the contents of both decks (arrays) before and after the shuffle. I'm only using 8 cards at the moment, 4 2's and 4 3's. What I am getting from this is: deck = 22223333 new deck = deck = 2222 new deck = 7502 What I'm hoping to get is: deck = 22223333 new deck = deck = new deck = 23232323 (or any of the 8 numbers, generated randomly) So it should be shuffling those 8 cards, what am I doing wrong? I'm only new to javascript but I've used some python before. I've done something similar in python and worked perfectly, but I'm not sure what's wrong here. Thanks for any answers in advance!!

    Read the article

  • Path Problem in ASP.net

    - by Hany
    Hi I am trying to do the following I am building asp.net website with c# language I want to read a text file from my project(the file is inside the project) I tried to get the file Path by this way : string path=Request.PhysicalApplicationPath+"filename.txt"; but I can't use The "Request" object from separated C# file ?? note: separated C3 file,I mean it's not related with aspx file can you help me with my way or do you have another way ?? thx

    Read the article

  • What is the best way to create related types at runtime?

    - by SniperSmiley
    How do I determine the type of a class that is related to another class at runtime? I have figured out a solution, the only problem is that I ended up having to use a define that has to be used in all of the derived classes. Is there a simpler way to do this that doesn't need the define or a copy paste? Things to note: both the class and the related class will always have their respective base class, the different classes can share a related class, and as in the example I would like the control class to own the view. #include <iostream> #include <string> class model; class view { public: view( model *m ) {} virtual std::string display() { return "view"; } }; #define RELATED_CLASS(RELATED)\ typedef RELATED relatedType;\ virtual relatedType*createRelated(){\ return new relatedType(this);} class model { public: RELATED_CLASS(view) model() {} }; class otherView : public view { public: otherView( model *m ) : view(m) {} std::string display() { return "otherView"; } }; class otherModel : public model { public: RELATED_CLASS(otherView) otherModel() {} }; class control { public: control( model *m ) : m_(m), v_( m->createRelated() ) {} ~control() { delete v_; } std::string display() { return v_->display(); } model *m_; view *v_; }; int main( void ) { model m; otherModel om; model *pm = &om; control c1( &m ); control c2( &om ); control c3( pm ); std::cout << c1.display() << std::endl; std::cout << c2.display() << std::endl; std::cout << c3.display() << std::endl; }

    Read the article

  • Oracle query to select rows with unique code

    - by Jasim
    I have a table like this C1 C2 C3 Code 1 2 3 33 1 2 3 34 2 4 1 14 1 2 3 14 i want to select only those record whose code is appearing only in single row. ie, in this case rows with code 33 and 34.. as they appear only once in this table. How can i write a query for that

    Read the article

  • Binding a collection in silverlight

    - by Titan
    For example, I have a collection of integers 1 - 10. I want to dynamically display 4 (can be 5, 6, 7) columns in the datagrid in silverlight. How can I bind the collection to the datagrid to achieve the following? C1 C2 C3 C4 R1 1 2 3 4 R2 5 6 7 8 R3 9 10 Cheers

    Read the article

  • How to get datarow array refering to datatable 's field value with linq

    - by Michael
    I want to use linq to get datarow array from a datatable which its string type ColumnA is not null or depending on its length 0 , so I can get the row index with Indexof() method to deal with something else. ColumnA ColumnB ColumnC A0 B0 C0 Null B1 C1 A2 B2 C2 Null B3 C3 My Linq Statment: DataRow[] rows = myDataTable.Select("ColumnA is not null").Where(row=>row.Field<string>("ColumnA").Length>0); somebody who can help?

    Read the article

  • Post bacc CS certificate of Java Certification?

    - by gwozdz
    I have a BS in biology, MS in Environmental Science, but I've been writing software in C++ and Java throughout grad school and a bit in my current job. I'd love to transition to a programming career. I've thought about getting what's called a "Post baccalaureate Certificate" or Java certification in lieu of another degree in CS. Which is more useful in terms of getting a job?

    Read the article

  • Oracle select query

    - by Jasim
    I have a table like this C1 C2 C3 Code 1 2 3 33 1 2 3 34 2 4 1 14 1 2 3 14 i want to select only those record whose code is appearing only in single row. ie, in this case rows with code 33 and 34.. as they appear only once in this table. How can i write a query for that

    Read the article

  • How many indexes will actually get used?

    - by Ender
    I'm writing a page that does very simple search queries, resulting in something like: SELECT * FROM my_table WHERE A in (a1, a2, a3) AND B in (b1, b2) AND C in (c1, c2, c3, c4) AND And so on for a variable number of columns, usually ~5. If I create a separate index for each column (one for A, one for B, one for C, not (A,B,C)), will all of them be used in the above query?

    Read the article

  • Good Software development courses?

    - by user296970
    I'm a software developer with a BS in Computer Science. I've been working in the field for 5 years, and I'm looking to develop my project leadership skills (I'm currently not a lead). Does anyone have any suggestions as to which schools / programs I can do? A masters is probably out of the question, due to the time required (and my not so good verbal score on my GRE). A shorter course would be preferable.

    Read the article

  • Iterating multple lists consecutively (C++)

    - by Graham Rogers
    I have 3 classes, 2 inheriting from the other like so: class A { public: virtual void foo() {cout << "I am A!" << endl;} }; class B : public A { public: void foo() {cout << "B pretending to be A." << endl} void onlyBFoo() {cout << "I am B!" << endl} }; class C : public A { public: void foo() {cout << "C pretending to be A." << endl} void onlyCFoo() {cout << "I am C!" << endl} }; What I want to do is something like this: list<A> list_of_A; list<B> list_of_B; list<C> list_of_C; //put three of each class in their respective list for (list<B>::iterator it = list_of_B.begin(); it != list_of_B.end(); ++it) { (*it).onlyBFoo(); } for (list<C>::iterator it = list_of_C.begin(); it != list_of_C.end(); ++it) { (*it).foo(); } //This part I am not sure about for (list<A>::iterator it = list_of_all.begin(); it != list_of_all.end(); ++it) { (*it).foo(); } To output: I am B! I am B! I am B! I am C! I am C! I am C! I am A! I am A! I am A! B pretending to be A. B pretending to be A. B pretending to be A. C pretending to be A. C pretending to be A. C pretending to be A. Basically, sometimes I want to only loop the Bs and Cs so that I can use their methods, but sometimes I want to loop all of them so that I can use the same method from each i.e. iterate the As, then the Bs, then the Cs all in one loop. I thought of creating a separate list (like the code above) containing everything, but it would create lots of unnecessary maintenance, as I will be adding and removing every object from 2 lists instead of one.

    Read the article

  • How to effectively measure difference in a run-time.

    - by Knowing me knowing you
    Guys, in one of the excersises in TC++PL B.S. asks to: "Write a function that either returns a value or that throws that value based on an argument. Measure the difference in run-time between the two ways." Great pity he never explaines how to measure such things. I'm not sure if I'm suppose to write simple "time start, time end" counter or maybe there are more effective and practical ways to do it? Thanks in advance.

    Read the article

  • Meshing different systems of keys together in XML Schema

    - by Tom W
    Hello SO, I'd like to ask people's thoughts on an XSD problem I've been pondering. The system I am trying to model is thus: I have a general type that represents some item in a hypothetical model. The type is abstract and will be inherited by all manner of different model objects, so the model is heterogeneous. Furthermore, some types exist only as children of other types. Objects are to be given an identifier, but the scope of uniqueness of this identifier varies. Some objects - we will call them P (for Parent) objects - must have a globally unique identifier. This is straightforward and can use the xs:key schema element. Other objects (we can call them C objects, for Child) are children of a P object and must have an identifier that is unique only in the scope of that parent. For example, object P1 has two children, object C1 and C2, and object P2 has one child, object C3. In this system, the identifiers given could be as follows: P1: 1 (1st P object globally) P2: 2 (2nd P object globally) C1: 1 (1st C object of P1) C2: 2 (2nd C object of P1) C3: 1 (1st C object of P2) I want the identity syntax of every model object to be identical if possible, therefore my first pass at implementing is to define a single type: <xs:complexType name="ModelElement"> <xs:attribute name="IDMode" type="IdentityMode"/> <xs:attribute name="Identifier" type="xs:string"/> </xs:complexType> where the IdentityMode is an enumerated value: <xs:simpleType name="IdentityMode"> <xs:restriction base="xs:string"> <xs:enumeration value="Identified"/> <xs:enumeration value="Indexed"/> <xs:enumeration value="None"/> </xs:restriction> </xs:simpleType> Here "Identified" signifies a global identifier, and "Indexed" indicates an identifier local only to the parent. My question is, how do I enforce these uniqueness conditions using unique, key or other schema elements based on the IdentityMode property of the given subtype of ModelElement?

    Read the article

  • MySQL server has gone away

    - by user491992
    Hello Friends, I executed this query on my MySql Server and it is giving me "MySQL server has gone away" Error.In following query my both table have more then 1000000 rows. SELECT a_tab_11_10.url as url,a_tab_11_10.c5 as 't1',a_tab_12_10.c3 as 't2' FROM a_tab_11_10 join a_tab_12_10 on (a_tab_11_10.url)=(a_tab_12_10.url) order by (a_tab_11_10.c5-a_tab_12_10.c3) desc limit 10 here is my log file but i am not getting it. Thank you @Faisal for answer and i check my log file but i am not getting it.. 110111 10:19:50 [Note] Plugin 'FEDERATED' is disabled. 110111 10:19:51 InnoDB: Started; log sequence number 0 945537221 110111 10:19:51 [Note] Event Scheduler: Loaded 0 events 110111 10:19:51 [Note] wampmysqld: ready for connections. Version: '5.1.36-community-log' socket: '' port: 3306 MySQL Community Server (GPL) 110111 12:35:42 [Note] wampmysqld: Normal shutdown 110111 12:35:43 [Note] Event Scheduler: Purging the queue. 0 events 110111 12:35:43 InnoDB: Starting shutdown... 110111 12:35:45 InnoDB: Shutdown completed; log sequence number 0 945538624 110111 12:35:45 [Warning] Forcing shutdown of 1 plugins 110111 12:35:45 [Note] wampmysqld: Shutdown complete 110111 12:36:39 [Note] Plugin 'FEDERATED' is disabled. 110111 12:36:40 InnoDB: Started; log sequence number 0 945538624 110111 12:36:40 [Note] Event Scheduler: Loaded 0 events 110111 12:36:40 [Note] wampmysqld: ready for connections. Version: '5.1.36-community-log' socket: '' port: 3306 MySQL Community Server (GPL) 110111 12:36:40 [Note] wampmysqld: Normal shutdown 110111 12:36:40 [Note] Event Scheduler: Purging the queue. 0 events 110111 12:36:40 InnoDB: Starting shutdown... 110111 12:36:42 InnoDB: Shutdown completed; log sequence number 0 945538634 110111 12:36:42 [Warning] Forcing shutdown of 1 plugins 110111 12:36:42 [Note] wampmysqld: Shutdown complete 110111 12:36:52 [Note] Plugin 'FEDERATED' is disabled. 110111 12:36:52 InnoDB: Started; log sequence number 0 945538634 110111 12:36:52 [Note] Event Scheduler: Loaded 0 events 110111 12:36:52 [Note] wampmysqld: ready for connections. Version: '5.1.36-community-log' socket: '' port: 3306 MySQL Community Server (GPL) 110111 12:37:42 [Note] wampmysqld: Normal shutdown 110111 12:37:42 [Note] Event Scheduler: Purging the queue. 0 events 110111 12:37:42 InnoDB: Starting shutdown... 110111 12:37:43 InnoDB: Shutdown completed; log sequence number 0 945538634 110111 12:37:43 [Warning] Forcing shutdown of 1 plugins 110111 12:37:43 [Note] wampmysqld: Shutdown complete 110111 12:37:46 [Note] Plugin 'FEDERATED' is disabled. 110111 12:37:46 InnoDB: Started; log sequence number 0 945538634 110111 12:37:46 [Note] Event Scheduler: Loaded 0 events 110111 12:37:46 [Note] wampmysqld: ready for connections. Version: '5.1.36-community-log' socket: '' port: 3306 MySQL Community Server (GPL)

    Read the article

  • When an active_record is saved, is it saved before or after its associated object(s)?

    - by SeeBees
    In rails, when saving an active_record object, its associated objects will be saved as well. But has_one and has_many association have different order in saving objects. I have three simplified models: class Team < ActiveRecord::Base has_many :players has_one :coach end class Player < ActiveRecord::Base belongs_to :team validates_presence_of :team_id end class Coach < ActiveRecord::Base belongs_to :team validates_presence_of :team_id end I use the following code to test these models: t = Team.new team.coach = Coach.new team.save! team.save! returns true. But in another test: t = Team.new team.players << Player.new team.save! team.save! gives the following error: > ActiveRecord::RecordInvalid: > Validation failed: Players is invalid I figured out that when team.save! is called, it first calls player.save!. player needs to validate the presence of the id of the associated team. But at the time player.save! is called, team hasn't been saved yet, and therefore, team_id doesn't yet exist for player. This fails the player's validation, so the error occurs. But on the other hand, team is saved before coach.save!, otherwise the first example will get the same error as the second one. So I've concluded that when a has_many bs, a.save! will save bs prior to a. When a has_one b, a.save! will save a prior to b. If I am right, why is this the case? It doesn't seem logical to me. Why do has_one and has_many association have different order in saving? Any ideas? And is there any way I can change the order? Say I want to have the same saving order for both has_one and has_many. Thanks.

    Read the article

  • Table row height in Internet Explorer

    - by Fritz H
    I have the following table: <table> <tr> <td style="height: 7px; width: 7px"> A1 </td> <td style="height: 7px"> B1 </td> <td style="height: 7px; width: 7px"> C1 </td> </tr> <tr> <td style="width: 7px"> A2 </td> <td> B2 </td> <td style="width: 7px"> C2 </td> </tr> <tr> <td style="height: 7px; width: 7px"> A3 </td> <td style="height: 7px"> B3 </td> <td style="height: 7px; width: 7px"> C3 </td> </tr> </table> The basic idea is that the first row must be 7 pixels high. The left- and rightmost cells (A1 and C1) must be 7px wide, and the middle cell (B1) must scale according to the width of the table. The same goes for the bottom row (A3, B3, C3). The middle row, however, needs to scale in height - in other words, it needs to be (tableheight - 14px). The left- and rightmost cells (A2, C2) need to be 7 pixels wide. An example: 7px x 7px |------|-------------------------|------| --- +------+-------------------------+------+ | | | | | | 7px | | | | | | | | | --- +------+-------------------------+------+ | | | | | | | | | | | | | | | | | | | | | y | | | | | | | | | | | | | | | | | | | | | | | | --- +------+-------------------------+------+ | | | | | | 7px | | | | | | | | | --- +------+-------------------------+------+ HOWEVER: In Internet Explorer, the widths work fine (columns A and C are 7px, column B scales dynamically) - but the heights don't. Rows 1, 2 and 3 turn out to be exactly 33% of the height of the table, no matter what I do. Unfortunately I have to use this table, so replacing it with a set of DIVs is not an option. I have the following DOCTYPE: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> I need to keep this, as some other elements on the page rely on some complex CSS-based layouts. Can anyone point me in the right direction to whip this into shape for IE? EDIT: Should have mentioned earlier - this table is resized on the fly using javascript.

    Read the article

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