Member Avatar

I have Google'd and all i found was outdated, buggy or not working source samples. Here is what i tried but i have a bit of a problem: [CODE]void toDecimal(char bin[]){ int i, d = 0; int l = strlen(bin)-1; int x = 1; for(i = 0; i < l; i++){ int a = (bin[i] - '0'); x *= 2; d = d + a * x; //printf("%d",d); This will just print out 1222222 //printf("%d",x); This will just print out 1 2 4 8 16 .. } } int main(){ toDecimal("10000001"); }[/CODE]

Member Avatar
+0 forum 2
Member Avatar

Hi. I have a small dilema. I have 1 Picassa .ini file a contacts.xml file and a few images all in the same folder. On the images there are certian people, picassa.ini file holds the image name and id's of people included on that image in such format: [CODE][img_8538.jpg] faces=rect64(4ac022d1820c8624),d5a2d2f6f0d7ccbc backuphash=46512 [img_8551.jpg] faces=rect64(acb64583d1eb84cb),2623af3d8cb8e040;rect64(58bf441388df9592),d85d127e5c45cdc2 backuphash=8108[/CODE] and the contacts.xml holds names belonging to those id's in such format: [CODE]<contacts> <contact id="709c4b6f3d8d1920" name="Nikolaj Zimic" display="Nikolaj" modified_time="2010-11-11T15:05:52+01:00" sync_enabled="1"/> <contact id="8f757c1b974c6687" name="Joze Rugelj" display="Joze" modified_time="2010-11-11T15:05:21+01:00" sync_enabled="1"/> </contacts>[/CODE] Now what my program needs to do is first read the .ini file and take out face ID …

Member Avatar
+0 forum 3
Member Avatar

I find this like really really strange for quit a few reasons. For me the most productive time to program is after 21:00 hours. The weird part is this even if i sleep like a baby and i come to work i will be productive but not nearly as productive and INTO programming as i am after dark : P The weird thing is even if i come from work and school so tired i can barely keep my eye's open if i will sit down behind a screen i will suddenly change moods from tired to like freaky focused. …

Member Avatar
+0 forum 11
Member Avatar

Hi, I it possible to implement an ActionListener to a global or local variable so that if variable changes the Listener performed a certain function / method etc.. I am working on a GUI application i am guessing there has to be a better solution than wrapping my main code in a forever loop is there ?

Member Avatar
+0 forum 4
Member Avatar

Hi, I have 2 JTree components on my JForm. If a user clicks on a DefaultMutableTreeNode on JTree A i want app to add it to JTree B. [CODE] public void addModule(final JTree a, final JTree b){ a.addTreeSelectionListener(new TreeSelectionListener(){ @Override public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = new DefaultMutableTreeNode(a.getLastSelectedPathComponent()); b.add(node); } }); } [/CODE] I have been trying to implement this via MouseListener or TreeSelectionListener but just cant do it right problem occurs at this location ( b.add(node); );

Member Avatar
+0 forum 9
Member Avatar

I have been testing out the component JProgressBar, now from what i learned so far it's easy to handle but any way i try it i cannot get it to work. To explain: I want to have a JProgressBar component that will show the total and consumed amount of oil. | 5000 / 12943 | I am writing a simulator for oil distribution over a pre defined pipeline and this pipeline can handle 1000 total liters in flow. Now to the pipe line i can add choke points that control how much of oil can flow. Now if i add …

Member Avatar
+0 forum 1
Member Avatar

Hello, To get right to the point i would like to ask for some suggestions regarding writing Java GUI applications. I have so far only done small GUI or Console applications that consisted of max 2 classes aka. 2 files. But now while back i decided to take on a larger project. I find it difficult to separate Logic and GUI part of the application. I wish to keep my GUI and my Logic separate so i can have some sort of organization. Unless the application is really small in scale i don't like to keep my event listeners all …

Member Avatar
+0 forum 5
Member Avatar

Hello, First of all let me say i have very little idea about shell scripting and linux ( ubuntu ). I am trying to write a script where i would give it two arguments two dates in a 29/5 30/5 whitin the console and it would return a list or it out print out users that were logine'd within that time and for how long and how many times did they login.

Member Avatar
+0 forum 2
Member Avatar

Hi, I am using eclipse and Netbeans 7 whit Java JDK 1.6 i am wondering how do i add java extensions. I want to add Appache libary : org.commons.apache.2.4.jar to my java because their libary offers a lot of good extensions such as coutnMatches method.

Member Avatar
+0 forum 1
Member Avatar

Hi, i am still learning i want to make a simple shell script. I wish to make a function that will receive 2 arguments (two dates) and will return all users who logged in during that period, how many times and how long were they logged in. I wish to call my function this way: ./functionName 29/05 30/05 This would print out all users that were logged in during that period how many times did they login and how long were they logged in. Result would be maybe like: username 5x 0 days 12:43 How can i go about this, …

Member Avatar
+0 forum 1
Member Avatar

Hi, i know how to open a file and read data from it but i wanna print out the number of lines in that file ? How would i go about this ?

Member Avatar
+0 forum 1
Member Avatar

I wanna know how to print only part of a string. For instance: [CODE] public static void main(String[] args){ String a = "daniweb.com"; System.out.println(a); } [/CODE] I wanna say print only characters after the 4th one so the output would be: [CODE]> web.com[/CODE]

Member Avatar
+0 forum 4
Member Avatar

Hi, I am writing a simple script, basicly i have: [CODE] String s = "A quick fox jumps over a lazy dog"; [/CODE] Now i want to print it like this: (like 3 words per line) :: A quick fox jumps over a lazy dog Know i know i can move the string aka the line to a array and then looping over it whit a "for" or "while". But is there any way i can avoid using a array maybe do it whit just one for or while loop. Thanks in advance, n3red

Member Avatar
+0 forum 1
Member Avatar

Hello, Can someone please explain to me because i do not understand the tutorials on pointers. anyways i have a struct: [CODE] struct driver { int id; char name[30]; int runs; } //I am reading a file which goes in order ID NAME RUNS as: 1 Super Man 5 //I am reading it from a file like so: struct drive *read(char *file){ int x = 1; FILE* open; open = fopen(file,"r"); while(!feof(open)){ struct drive *drive1; drive1 = (struct drive*) malloc(sizeof(struct drive)); drive1->stevilka=x; fscanf(open, "%d", &drive1->id); fscanf(open,"%s", drive1->name); printf("%d", drive->id); printf("%s", drive->ime); } } [/CODE] What am i doing wrong here …

Member Avatar
+0 forum 2
Member Avatar

Ok in a simplex txt file i have some text written in all capital letters. Now i need to take that text convert it to lowercase and then ucfirst in this way. Ex: MY NAME IS MIKE AND I GO TO LIBRARY EVERY DAY. I ALSO LIKE PIE. Now i read files by lines so i first turn all those lowercase and then uppercase all first characters of each word. Now here i my problem i only need to uppercase the first character if it is a start of the new line like at the beginning of the text or …

Member Avatar
+0 forum 6
Member Avatar

Hi, I have a small problem after working on my program last night i found out that C does not have any function that uppercase first character in a word. So i have been trying to split each word in to characters and uppercase the first word but it keeps replacing the first character whit a whitespace It there any other way around this ?

Member Avatar
+0 forum 10
Member Avatar

So here is my code: The purpose of this code is to take all the plain text in all capital letters in the vitranc.txt file and turn them all in to lowercase characters. Now to my knowledge i can do this with "tolower" function but: when i add tolower in my "while" counter it does not compile but gives an error about some conversion from char to int. Now in addition i have also tried turning the "lists" to int whit "atoi" method before passing it on to "tolower" and it works but not as it should only few words …

Member Avatar
+0 forum 2
Member Avatar

Hi, I need two functions one that checks if the inputed number is a prime number and second one that splits the given number in to prafactors. I have the first function done but the second one is a bit annoying. The function has to take the given number and split it and save the results in a list. Needs to split the prime number on factors and append that to an empty list. Example: 252=2(on 2) * 3(on 2) * 7(on 1) - Because 2*2 * 3*3 * 7*1 = 256 And then i have to print this list …

Member Avatar
+0 forum 8
Member Avatar

Anyways i have a gourp that i created called Wholesale and anotherone called VIP. So when user registers as wholesale he gets to see prices of products and when he is moved by admin to vip customer group he gets to see special category i managed to do that as well. But here is the problem: When i move someone from wholesale customer group to vip i want them to be in vip group for exactly 30 days and tehn get moved out back to wholesale automaticaly.

+0 forum 0
Member Avatar

Hi iam trying to write a script, for a calculus competition (shrot) : I wil have two competitors, both will play the game / competition until one leads by 2 points then the game is over. Anyways it goes like this: In first round first competitor enters two factors / numbers say 5 and 2 in to a input field then the second competitor is prompted whit a input and needs to anwser whit the combined value of the two 5+2=7 if second competitor guesed the right value "7" he gets 1 point if not then he gets 0 points …

Member Avatar
+0 forum 6

The End.