|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On May 25 2011 09:23 mr_tolkien wrote:I need help :/ I have some troubles with data structures in Java, and there is something I don't get. Here is a piece of code from me : + Show Spoiler +HashMap<Position, PositionTree> sons = new HashMap<Position, PositionTree>();
Position a = new Position(0,0); sons.put(a, null); Position b = new Position(0,0); System.out.println(sons.keySet().contains(a)); System.out.println(b.equals(a)); System.out.println(sons.keySet().contains(b)); Position is just a standard class, PositionTree is my tree structure. When running this I get true true false. Meaning b.equals(a) is true, sons.keySet() contains a, but... sons.keySet() doesn't "contain" b ? When looking at the doc of contains ( http://download.oracle.com/javase/1.4.2/docs/api/java/util/Set.html#contains(java.lang.Object) ) it says «returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)). » It seems to me like it should return true... Does anybody have any clue on what I am doing wrong ?
I agree, the documentation suggests that it should return true.
I think a good start would be to override the default equals() implementation in the Position class with your own implementation and see if that works and if it even gets triggered. It looks to me as if it is not using the correct equals() method for some reason.
|
On May 25 2011 09:23 mr_tolkien wrote:I need help :/ I have some troubles with data structures in Java, and there is something I don't get. Here is a piece of code from me : + Show Spoiler +HashMap<Position, PositionTree> sons = new HashMap<Position, PositionTree>();
Position a = new Position(0,0); sons.put(a, null); Position b = new Position(0,0); System.out.println(sons.keySet().contains(a)); System.out.println(b.equals(a)); System.out.println(sons.keySet().contains(b)); Position is just a standard class, PositionTree is my tree structure. When running this I get true true false. Meaning b.equals(a) is true, sons.keySet() contains a, but... sons.keySet() doesn't "contain" b ? When looking at the doc of contains ( http://download.oracle.com/javase/1.4.2/docs/api/java/util/Set.html#contains(java.lang.Object) ) it says «returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)). » It seems to me like it should return true... Does anybody have any clue on what I am doing wrong ?
I think the problem is with your equals() method. Check to see if you have correctly overwritten the Object class's equals method:
public boolean equals(Object obj){}
Using another equals(Position o) method will not suffice since the contains method will most likely use the Object class's equals method. So try that and do the necessary casting and see if it works.
EDIT: sorry guy above me I didn't see your post in time. ;p
|
On May 25 2011 14:40 One Student wrote:Show nested quote +On May 25 2011 09:23 mr_tolkien wrote:I need help :/ I have some troubles with data structures in Java, and there is something I don't get. Here is a piece of code from me : + Show Spoiler +HashMap<Position, PositionTree> sons = new HashMap<Position, PositionTree>();
Position a = new Position(0,0); sons.put(a, null); Position b = new Position(0,0); System.out.println(sons.keySet().contains(a)); System.out.println(b.equals(a)); System.out.println(sons.keySet().contains(b)); Position is just a standard class, PositionTree is my tree structure. When running this I get true true false. Meaning b.equals(a) is true, sons.keySet() contains a, but... sons.keySet() doesn't "contain" b ? When looking at the doc of contains ( http://download.oracle.com/javase/1.4.2/docs/api/java/util/Set.html#contains(java.lang.Object) ) it says «returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)). » It seems to me like it should return true... Does anybody have any clue on what I am doing wrong ? I think the problem is with your equals() method. Check to see if you have correctly overwritten the Object class's equals method: public boolean equals(Object obj){} Using another equals(Position o) method will not suffice since the contains method will most likely use the Object class's equals method. So try that and do the necessary casting and see if it works. EDIT: sorry guy above me I didn't see your post in time. ;p
did you override the default equals/hashCode? You must...
it'd help if you post your Position class
also, instead of getting the keyset, you can call
sons.containsKey( a );
|
just curious but are any of you freelance web designers/developers? If so, what are your thoughts on the future demand of freelance web work? I've come across some really interesting articles (here's a good one for those who are interested) and the general consensus seems to be that more businesses/clients are going to realize that hiring freelancers is way cheaper so demand's going to increase. That's probably a really shallow prediction so I was curious as to what you guys thought.
|
Thank you for your answers, here is my equals function in Position : + Show Spoiler +public boolean equals(Object o){ if(((Position)o).getX()==this.x && ((Position)o).getY()==this.y) return true; return false; } Seems to me like it's well coded.
I know of containsKey() btw, but the documentation isn't as clear as contains() for a Set, so for testing purposes I'm doing it with keySet.contains(). I'll change it once I'll sort this out.
EDIT : just figured it out ! I needed to cast b as an Object in my third line... Seems weird because there is no equals(Position) anyway, I was figuring he used the good one.
|
On May 25 2011 14:45 EpiK wrote:just curious but are any of you freelance web designers/developers? If so, what are your thoughts on the future demand of freelance web work? I've come across some really interesting articles ( here's a good one for those who are interested) and the general consensus seems to be that more businesses/clients are going to realize that hiring freelancers is way cheaper so demand's going to increase. That's probably a really shallow prediction so I was curious as to what you guys thought.
I'd have to disagree. Freelance web development is great for small business, hobby sites & new start ups. However there is a limit to the size of these projects due to the nature of small teams so big business will still require established IT services or have their own in-house development teams.
|
I'm back again, it was a wrong test I did, it still doesn't work the slightest \o/
I even did this : sons.keySet().toArray()[0].equals(b) Which returns TRUE. And still, sons.containsKey(b) returns false.
I'm a bit in «WTFUUUUUUUUUUUUUUUUUUUUUUUUUUUU» mode right now, what I'm doing seems perfectly legit.
PS : I have a workaround working, but I'd like to know why it doesn't work in the first time.
|
I am guessin it's because you have overriden equals but not hashCode in your position class. This means that Object.hashCode is used which explains why the first test is OK, but not the last one.
Here is an example of equals and hashCode for the Position Class:
+ Show Spoiler + public class Main { public static void main(String[] args) {
final HashSet<Position> positions = new HashSet<Position>();
final Position a = new Position(0, 0); final Position b = new Position(0, 0); positions.add(a);
System.out.println(positions.contains(a)); System.out.println(positions.contains(b)); } }
class Position { private int x; private int y;
Position(int x, int y) { this.x = x; this.y = y; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false;
Position position = (Position) o;
if (x != position.x) return false; if (y != position.y) return false;
return true; }
@Override public int hashCode() { int result = x; result = 31 * result + y; return result; } }
|
On May 25 2011 18:02 ibutoss wrote:Show nested quote +On May 25 2011 14:45 EpiK wrote:just curious but are any of you freelance web designers/developers? If so, what are your thoughts on the future demand of freelance web work? I've come across some really interesting articles ( here's a good one for those who are interested) and the general consensus seems to be that more businesses/clients are going to realize that hiring freelancers is way cheaper so demand's going to increase. That's probably a really shallow prediction so I was curious as to what you guys thought. I'd have to disagree. Freelance web development is great for small business, hobby sites & new start ups. However there is a limit to the size of these projects due to the nature of small teams so big business will still require established IT services or have their own in-house development teams. I think it depends on the project. I work as a consultant to a very big swedish company on one of their web systems and there's no way a project like this would be done by freelancers since the system is huge and needs constant ongoing development, not only on the actual ASP.NET site but all the extra components, the databases and so on.
However, big companies generally have a lot of projects with very different scopes, I'm sure smaller ones could be done by freelancing smaller teams.
|
On May 25 2011 18:02 ibutoss wrote:Show nested quote +On May 25 2011 14:45 EpiK wrote:just curious but are any of you freelance web designers/developers? If so, what are your thoughts on the future demand of freelance web work? I've come across some really interesting articles ( here's a good one for those who are interested) and the general consensus seems to be that more businesses/clients are going to realize that hiring freelancers is way cheaper so demand's going to increase. That's probably a really shallow prediction so I was curious as to what you guys thought. I'd have to disagree. Freelance web development is great for small business, hobby sites & new start ups. However there is a limit to the size of these projects due to the nature of small teams so big business will still require established IT services or have their own in-house development teams.
I agree if we are talking of a country like America (I don't know how Australia is in this regard). However I would like to add that if we are talking of Europe or a country with a worker-friendly labor code the situation is more in favor of freelancers. I see you are in Korea and I'm not sure what the situation is there but I'm under impression that it's more similar to Europe than to America.
In Europe in general it's getting really expensive to hire somebody due to social security, indemnifications you have to pay fired employees, the fact that if an employee gets pregnant you have to pay her while she takes a leave, the amount of bureaucratic BS that comes with employing every person, etc. Now I'm not saying this is good or bad, but it is a fact that it makes hiring more expensive and riskier.
Because of this contracting freelancers is incredibly attractive at the moment. You just pay for the work and none of the overheads cited above and if they don't deliver in time the contract is void and you don't have to pay. If an employee doesn't deliver in time... you are screwed and he isn't gonna return his paychecks.
So yeah, if what I explained above is true of the country you are in, I would say don't be afraid to go freelancer.
|
Hey, does anyone in this thread have experience with Excel?
I'm currently working on a super-huge Excel program at work (roughly 50-60 sheets and 20 modules) and I'm having some trouble with buttons. In a new workbook I am able to make a button and right-click on it to view its properties (i.e. Visible, Name, Caption, Background Colour, etc.). In the program though when I right-click to view the button's properties, I can't see the properties of the button I've selected - the Properties window is just blank. If I make a new button in the program the same thing happens.
Any idea what setting may have disabled my ability to view these properties?
EDIT: It just worked. Don't ask me how but it did. I'll edit this again if it keeps giving me problems.
|
On May 25 2011 17:40 mr_tolkien wrote:Thank you for your answers, here is my equals function in Position : + Show Spoiler +public boolean equals(Object o){ if(((Position)o).getX()==this.x && ((Position)o).getY()==this.y) return true; return false; } Seems to me like it's well coded. I know of containsKey() btw, but the documentation isn't as clear as contains() for a Set, so for testing purposes I'm doing it with keySet.contains(). I'll change it once I'll sort this out. EDIT : just figured it out ! I needed to cast b as an Object in my third line... Seems weird because there is no equals(Position) anyway, I was figuring he used the good one.
what about hashcode
it's not enough to only override equals
From a very high level, how a hashmap works is that 1) converts key object to number (this is what hashCode does) 2) put the value object in an array, position determined by the number obtained in 1.
You do not need to perform a cast when you call .equals(...), all objects in Java has the Object base class, so you can pass in Position objects just fine.
Also, your equals method is badly coded, you should use the .equals(...) that comes with your IDE and make modifications as you see fit.
For example, you don't check for null explicitly, and your .equals will throw an NPE if a null is passed in.
|
Anyone here with GTK+ experience?
I've just started my adventure with it and I'm trying to figure out the basics but run into some problems already...
+ Show Spoiler [code] + #include <gtk/gtk.h> #include <stdlib.h>
#define STARTING_STAT 8; #define STARTING_POOL 25;
char StatBuffer[5];
struct StatsConfig { gint8 StatStr; gint8 StatDex; gint8 StatCon; gint8 StatInt; gint8 StatWis; gint8 StatCha; gint8 StatPool; };
struct StatsConfig* GetConfig(); int PoolIncrease(struct StatsConfig *config); int PoolDecrease(struct StatsConfig *config); int StrIncrease(struct StatsConfig *config); int StrDecrease(struct StatsConfig *config); void StrIncreaseButtonAction(GtkWidget *widget, gpointer strLabel, struct StatsConfig *config); void StrDecreaseButtonAction(GtkWidget *widget, gpointer strLabel, struct StatsConfig *config); void ReleaseMemory(struct StatsConfig *config);
int main(int argc, char** argv) { GtkWidget *window; GtkWidget *frame; GtkWidget *strPlusButton; GtkWidget *strMinusButton; GtkWidget *strLabel; GtkWidget *poolLabel; struct StatsConfig *config;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); frame = gtk_fixed_new(); strPlusButton = gtk_button_new_with_label("+"); strMinusButton = gtk_button_new_with_label("-"); strLabel = gtk_label_new("8"); poolLabel = gtk_label_new("25"); poolText = gtk_label_new("Stat point pool:"); strText = gtk_label_new("Str:"); config = GetConfig();
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(window), 300, 300); gtk_window_set_title(GTK_WINDOW(window), "test");
gtk_container_add(GTK_CONTAINER(window), frame);
gtk_widget_set_size_request(strPlusButton, 25, 15); gtk_fixed_put(GTK_FIXED(frame), strPlusButton, 5, 42);
gtk_widget_set_size_request(strMinusButton, 25, 15); gtk_fixed_put(GTK_FIXED(frame), strMinusButton, 85, 42);
gtk_fixed_put(GTK_FIXED(frame), strLabel, 70, 40); gtk_fixed_put(GTK_FIXED(frame), strText, 42, 40);
gtk_fixed_put(GTK_FIXED(frame), poolLabel, 200, 10); gtk_fixed_put(GTK_FIXED(frame), poolText, 92, 10);
gtk_widget_show_all(window);
g_signal_connect(strPlusButton, "clicked", G_CALLBACK(StrIncreaseButtonAction), strLabel);
g_signal_connect(strMinusButton, "clicked", G_CALLBACK(StrDecreaseButtonAction), strLabel); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_main();
ReleaseMemory(config);
return 0; }
struct StatsConfig* GetConfig() { gint8 statStr, statDex, statCon, statInt, statWis, statCha = STARTING_STAT; gint8 statPool = STARTING_POOL;
struct StatsConfig *config; config = malloc(sizeof(struct StatsConfig));
config->StatStr = statStr; config->StatDex = statDex; config->StatCon = statCon; config->StatInt = statInt; config->StatWis = statWis; config->StatCha = statCha; config->StatPool = statPool;
return config; }
int PoolIncrease(struct StatsConfig *config) { return config->StatPool +1; }
int PoolDecrease(struct StatsConfig *config) { gint8 statPool = config->StatPool;
if(statPool > 0) { return config->StatPool -1; }
return config->StatPool; }
int StrIncrease(struct StatsConfig *config) { gint8 statPool = config->StatPool; if(statPool > 0) { PoolDecrease(config); return config->StatStr +1; } return config->StatStr; }
int StrDecrease(struct StatsConfig *config) { gint8 statStr = config->StatStr;
if(statStr > 3) { PoolIncrease(config); return config->StatStr -1; }
return config->StatStr; }
void StrIncreaseButtonAction(GtkWidget *widget, gpointer strLabel, struct StatsConfig *config) { StrIncrease(config); sprintf(StatBuffer, "%d", config->StatStr); gtk_label_set_text(strLabel, StatBuffer);
// sprintf(StatBuffer, "%d", config->StatPool); // gtk_label_set_text(poolLabel, StatBuffer); }
void StrDecreaseButtonAction(GtkWidget *widget, gpointer strLabel, struct StatsConfig *config) { StrDecrease(config); sprintf(StatBuffer, "%d", config->StatStr); gtk_label_set_text(strLabel, StatBuffer); }
void ReleaseMemory(struct StatsConfig *config) { if (config != NULL) { free(config); config = NULL; } }
As you can see, I'm trying to create a simple window that will emulate the D20 system for RPG's. Right now it compiles and runs but pressing the button results in seg fault 
For now I've just created 2 buttons just to test things out. I have no idea how to make one button change two labels at the same time too, when I tried to pass more arguments to the action it didn't want to work 
Any tips?
P. S. Don't look at the atrocious button/label placement, I put it there randomly just to test things out.
|
On May 28 2011 19:32 Manit0u wrote:As you can see, I'm trying to create a simple window that will emulate the D20 system for RPG's. Right now it compiles and runs but pressing the button results in seg fault  Yes, I bet it does. In g_signal_connect you are passing a gtk_label as the data parameter for the signal handler, but in the handler itself you're trying to use the label as a struct StatsConfig*. Which obviously leads to problems. edit: Sorry read that wrong. It seems that the strlabel is used correctly in the signal handler. The problem is that the struct StatsConfig* probably contains garbage data as it isn't filled correctly.
For now I've just created 2 buttons just to test things out. I have no idea how to make one button change two labels at the same time too, when I tried to pass more arguments to the action it didn't want to work  You can only pass one 'own' parameter to the handler. So if you want to change two or more labels in the same handler, you have to put them in to a struct/linked list/table and pass a pointer to that to the signal handler.
P. S. Don't look at the atrocious button/label placement, I put it there randomly just to test things out.
You shouldn't use gtk_fixed for anything. Instead use the other containers, (e.g. vbox/hbox) which place themselves automatically and react correctly to theme/window size changes.
|
|
Hey guys I was wondering if anyone cold help me out with this question. I just graduated with my computer science degree the job I been at for a few months doesn't use my degree to much. I pretty much write SQL and do some database stuff. I wanna be able to stay fresh with other programming because I plan on either getting into the programming side of things with my company or move to another company that's more programming oriented. So, what would you guys suggest I do for some sort of recreational programming to help keep it fresh in my mind? Thanks!
|
On May 28 2011 21:52 razzloss wrote:Show nested quote +On May 28 2011 19:32 Manit0u wrote:As you can see, I'm trying to create a simple window that will emulate the D20 system for RPG's. Right now it compiles and runs but pressing the button results in seg fault  Yes, I bet it does. In g_signal_connect you are passing a gtk_label as the data parameter for the signal handler, but in the handler itself you're trying to use the label as a struct StatsConfig*. Which obviously leads to problems. edit: Sorry read that wrong. It seems that the strlabel is used correctly in the signal handler. The problem is that the struct StatsConfig* probably contains garbage data as it isn't filled correctly. Show nested quote +For now I've just created 2 buttons just to test things out. I have no idea how to make one button change two labels at the same time too, when I tried to pass more arguments to the action it didn't want to work  You can only pass one 'own' parameter to the handler. So if you want to change two or more labels in the same handler, you have to put them in to a struct/linked list/table and pass a pointer to that to the signal handler. Show nested quote + P. S. Don't look at the atrocious button/label placement, I put it there randomly just to test things out.
You shouldn't use gtk_fixed for anything. Instead use the other containers, (e.g. vbox/hbox) which place themselves automatically and react correctly to theme/window size changes.
Thanks for the info. I've decided to scrap this thing allogether and write it from scratch, which led me to a ton of new problems... I've decided to leave the buttons and operations on values for later and focused on getting my initial text to display in some more coherent way.
+ Show Spoiler [code] + #include <gtk/gtk.h> #include <stdlib.h> #include <string.h>
#define STARTING_STAT 8; #define STARTING_POOL 25;
struct StatsConfig { gint8 StatStr; gint8 StatDex; gint8 StatCon; gint8 StatInt; gint8 StatWis; gint8 StatCha; gint8 StatPool; };
char buffer[2]; struct StatsConfig* GetConfig(); char* ReturnStatPool(struct StatsConfig *config); char* ReturnStats(struct StatsConfig *config); char* ReturnStatNames(); void ReleaseMemory(struct StatsConfig *config);
int main(int argc, char** argv) { GtkWidget *window; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *frame; GtkWidget *label; char *currentStats; char *currentStatPool; char *statNames; struct StatsConfig *config;
config = GetConfig(); currentStatPool = ReturnStatPool(config); statNames = ReturnStatNames(); currentStats = ReturnStats(config);
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(window), 300, 300); gtk_window_set_title(GTK_WINDOW(window), "Star Wars character builder"); gtk_container_set_border_width(GTK_CONTAINER(window), 5);
hbox = gtk_hbox_new(FALSE, 1); vbox = gtk_vbox_new(FALSE, 1); gtk_container_add(GTK_CONTAINER(window), hbox); gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
frame = gtk_frame_new("Stat point pool:"); label = gtk_label_new(currentStatPool); gtk_container_add(GTK_CONTAINER(frame), label); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
hbox = gtk_hbox_new(FALSE, 1); vbox = gtk_vbox_new(FALSE, 1); gtk_container_add(GTK_CONTAINER(window), hbox); gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
frame = gtk_frame_new("Name:"); label = gtk_label_new(statNames); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_container_add(GTK_CONTAINER(frame), label); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new("Value:"); label = gtk_label_new(currentStats); gtk_container_add(GTK_CONTAINER(frame), label); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show_all(window);
gtk_main();
ReleaseMemory(config);
return 0; }
struct StatsConfig* GetConfig() { gint8 statStr, statDex, statCon, statInt, statWis, statCha = STARTING_STAT; gint8 statPool = STARTING_POOL;
struct StatsConfig *config; config = malloc(sizeof(struct StatsConfig));
config->StatStr = statStr; config->StatDex = statDex; config->StatCon = statCon; config->StatInt = statInt; config->StatWis = statWis; config->StatCha = statCha; config->StatPool = statPool;
return config; }
char* ReturnStatPool(struct StatsConfig *config) { int statPool = config->StatPool;
sprintf(buffer, "%d", statPool);
return buffer; }
char* ReturnStats(struct StatsConfig *config) { int statStr = config->StatStr; int statDex = config->StatDex; int statCon = config->StatCon; int statInt = config->StatInt; int statWis = config->StatWis; int statCha = config->StatCha;
char st1[50]; char st2[2]; char st3[2]; char st4[2]; char st5[2]; char st6[2]; char n = "\n"; sprintf(st1, "%d", statStr); sprintf(st2, "%d", statDex); sprintf(st3, "%d", statCon); sprintf(st4, "%d", statInt); sprintf(st5, "%d", statWis); sprintf(st6, "%d", statCha);
strcat(st1, st2); strcat(st1, n); strcat(st1, st3); strcat(st1, n); strcat(st1, st4); strcat(st1, n); strcat(st1, st5); strcat(st1, n); strcat(st1, st6);
char* stats = st1;
return stats; }
char* ReturnStatNames() { char* stats = "Strength\nDexterity\nConstitution\nIntelligence\nWisdom\nCharisma\n";
return stats; }
void ReleaseMemory(struct StatsConfig *config) { if (config != NULL) { free(config); config = NULL; } }
It was compiling and working fine up until I decided to add the stat values. The problem I'm facing (which is obvious from the code I believe) is that I have absolutely no idea how to make a concatenated string as a char array...
Here's an example of the problem I'm facing:
krs@chameleon:~/workspace/Gtk> gcc -std=c99 -o test test.c `pkg-config --libs --cflags gtk+-2.0` test.c: In function ‘ReturnStats’: test.c:132:11: warning: initialization makes integer from pointer without a cast test.c:142:2: warning: passing argument 2 of ‘strcat’ makes pointer from integer without a cast /usr/include/string.h:135:14: note: expected ‘const char * restrict’ but argument is of type ‘char’ test.c:144:2: warning: passing argument 2 of ‘strcat’ makes pointer from integer without a cast /usr/include/string.h:135:14: note: expected ‘const char * restrict’ but argument is of type ‘char’ test.c:146:2: warning: passing argument 2 of ‘strcat’ makes pointer from integer without a cast /usr/include/string.h:135:14: note: expected ‘const char * restrict’ but argument is of type ‘char’ test.c:148:2: warning: passing argument 2 of ‘strcat’ makes pointer from integer without a cast /usr/include/string.h:135:14: note: expected ‘const char * restrict’ but argument is of type ‘char’
Internet was no help to me so far
|
On May 29 2011 02:34 Manit0u wrote:It was compiling and working fine up until I decided to add the stat values. The problem I'm facing (which is obvious from the code I believe) is that I have absolutely no idea how to make a concatenated string as a char array...
You could try making the string and converting it to a char array like so:
string a = "asd";
char* b = a.c_str();
Not sure if that's what you're asking for though 
Good luck!
|
Hey guys, I love C++, but I can't ignore the handy stuff that C# gives.
Is there stuff like reflection c++? (maybe in the new version?)
Also, I've being working with Unity3D, and they use Coroutines using the yield command. Is this available in normal C# too ? (or even c++?)
|
On May 29 2011 00:11 thedeadhaji wrote:Couldn't really figure out how to properly set up the Google ap environment, so I decided to just set up a proper python environment and learn the language and get used to coding again before heading onto interface type stuff  Wish me luck!  
That for web development?
I'm currently trying to get into this: http://www.symfony-project.org/
If you look for Python then go with Django: https://www.djangoproject.com/
P. S.
Disregard my previous post. After looking around I've decided to screw the C/Gtk+ for creating stuff with GUI and opted to go with C++/Qt instead. Gtk widget tree is such a bitch...
|
|
|
|