WolfPack 491 Posting Virtuoso Team Colleague

If you read further it says that if it is a control it copies the text of the control.

WolfPack 491 Posting Virtuoso Team Colleague

Use GetWindowText to copy the text in the edit box, and call DeleteFile for that text.

WolfPack 491 Posting Virtuoso Team Colleague

Yes. We understand what you mean. But where do you have the problem?

WolfPack 491 Posting Virtuoso Team Colleague

Dave is the only person who wants or cares about color. Of 100,000 members, he's the only person who seems to have realized color went away.

No I want colours as well. I thought it was a bug in the new BB update, and since I felt that I have been asking too much I kept quiet until someone else put it forward. Have been sleeping for the whole day ofSaturday (went for a karoake until Satruday morning), so I saw this thread only now.

PS:
My head still hurts.

WolfPack 491 Posting Virtuoso Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague

Yes. I saw and did that.

WolfPack 491 Posting Virtuoso Team Colleague

I tried it in my cygwin bash shell. Maybe it is something unexpected in cygwin, but all the matches were stored in opts[0]. So ultimately I could do this without using arrays. :eek:

page_size=$(awk 'BEGIN {FS="="} { if($0~ /paper_size/) { print $2}}' $optfile)
for paper_size in $page_size; do
    echo $paper_size
done

But thanks a lot really. Your reply pointed me in the correct direction.

WolfPack 491 Posting Virtuoso Team Colleague

If you are using Windows, try ShellExecute.

WolfPack 491 Posting Virtuoso Team Colleague

I have an options file of the following format

option1 = value1
option2 = value2
   ..... ; variable number of options
   .....
page_size= pagesize1 ;Note there is no space between page_size and =
page_size= pagesize2
page_size= pagesize3

During a regression test I want to extract the values for these options. Since the keywords "option1", option2, ... are different from each other, I can use awk to extract the values of value1, value2 as follows.

value1=$(awk '/option1/ {print $3}' $optfile)
value2=$(awk '/option2/ {print $3}' $optfile)

Now the problem is with the values for page_size. Although there can be multiple values for page_size, the following statement of awk

pagesize1=$(awk '/ page_size=/ {print $2}' $optfile)

gives me only the corresponding value for the first match of page_size.

So do any of you know of a way to get all three page sizes using awk?
Thanks.

WolfPack 491 Posting Virtuoso Team Colleague

Oh. I should have looked more closely myself.

WolfPack 491 Posting Virtuoso Team Colleague

hmmm. Looks like there is a problem with your last snippet. When I select it with a newline, I get a completely different character. Mind you that I am working in Japanese, so maybe the fact that unicode characters have 2 bytes comes into play here. So running the above code with the selected text as 障害NL leaves me with a character like (but not exact) this . I don't even know what character it is. First time i saw something like that. The replace function works fine. :eek:

Edit.

Checked again. It is the second character in the search string. It was difficult to recognise in the debugger. One of the lines was missing because of the apparent low resolution in the debugger so I thought it was a new character.. Japanese can be subtle sometimes.

WolfPack 491 Posting Virtuoso Team Colleague

What are u exactly trying to prove Mr. Lerner. First you say there is no straightforward way to do it and ask the OP to use an external library. And when the solution is posted you say that even a ten year old kid could do it ???

I think you missed a hint of sarcasm in Lerner's reply. :)

WolfPack 491 Posting Virtuoso Team Colleague

Well I like the tool tips. But when I click over the link, a rather odd outline of a square shows up. It is a bit disturbing.

WolfPack 491 Posting Virtuoso Team Colleague

Yeah. You have real guts. Sounds like you are going through a phase our own Davey went through some years back. We sure will give any help you need in your C++ studies. Welcome.

WolfPack 491 Posting Virtuoso Team Colleague

Hey. What is this?

WolfPack 491 Posting Virtuoso Team Colleague

Become a Mod Dragon. I delete my posts all the time because they are wrong.

WolfPack 491 Posting Virtuoso Team Colleague

Wow. That was some interesting points you made there. Used the vbNullString, as you adviced. And about the second point, yes I want to remove the trailing newspace. But the thing is this is for a Office Macro. I want to remove the newline from the double clicked text the user selected. Depending on the situation, the double clicked text may or may not have a newline. So I can't always be sure that the last character is a newline. So I will have to stick with the Replace function. Keep any additional advice coming. Much appreciated.

WolfPack 491 Posting Virtuoso Team Colleague

OKay. I managed to, or at least I think I did, to do it with this.

SearchString = Replace(SearchString, Chr(13), "")

If anyone has a better solution, or it doesnt do what I want, please correct me. Thanks.

WolfPack 491 Posting Virtuoso Team Colleague

Hi,
How do you delete a newline character that is inside a VB string? Apparently Trim removes only spaces.

Thanks in Advance.

WolfPack 491 Posting Virtuoso Team Colleague

Can you do something like this in the WM_SIZE event and tell me what happens?

case WM_SIZE:
        {
            RECT rectTreeView, rectStatus, rectTool;
            UINT uToolHeight, uStatusHeight, uClientAlreaHeight;

            SendMessage(hwndToolBar, TB_AUTOSIZE, 0, 0);
            SendMessage(hwndStatusBar, WM_SIZE, 0, 0);

            GetClientRect(hWnd, &rectTreeView);
            GetWindowRect(hwndStatusBar, &rectStatus);
            GetWindowRect(hwndToolBar, &rectTool);

            uToolHeight = rectTool.bottom - rectTool.top;
            uStatusHeight = rectStatus.bottom - rectStatus.top;
            uClientAlreaHeight = rectTreeView.bottom;

            SetWindowPos(hwndTreeView, HWND_TOP, 0, uToolHeight, rectTreeView.right, uClientAlreaHeight - uStatusHeight - uToolHeight, FALSE);
            return 0;
        }
WolfPack 491 Posting Virtuoso Team Colleague

Are you using C or C++? If you can use C++ there is the standard template library which has a doubly linked list. You can use that without a problem. If it is in C, then post the project with the work you have done up to now. I will post a link (no pun intended) for the doubly linked list in C.

WolfPack 491 Posting Virtuoso Team Colleague

post your program first. We don't just hand over source code for students expecting a quick solution and get a good grade. Or you can google yourself for source code.

WolfPack 491 Posting Virtuoso Team Colleague
aObj = "string2";

This line is wrong. The arguments of that assignment operator statement is a const char*. But you haven't defined a =operator that takes a constant char* as it's argument.

Declare something like this and it should be okay.

class aClass
{
    public:
        aClass()
        {
            this->aString = new char [1];
            this->aString[0] = '\0';
            this->length = 0;
        }
        ~aClass()
        {
            cout << "Destructor" << endl;
            delete [] this->aString;
        }
        aClass(const char *);
        const aClass& aClass::operator=(aClass &);
[B]        const aClass& aClass::operator=(const char *);
[/B]    private:
        int length;
        char * aString;
};

const aClass & aClass::operator=(const char* str)
{
    cout << "In Overloaded = operator for const char*" << endl;

    if ( this->aString )
        delete [] this->aString;
    length = strlen(str);
    this->aString = new char[ length + 1];
    strcpy(this->aString, str);
    return *this;
}
WolfPack 491 Posting Virtuoso Team Colleague

Yes. I agree with Anonymusius. We only help you correct the problem. For that you must.
1. Properly format the code. If you look at the code you posted. It is the ugliest code that I have ever seen. The least you can do is properly post it by changing parts like

cout<<"
              Enter Name      :            ";gets(name);

to

cout<<"Enter Name      :            ";
      gets(name);

2. You may have found by now that only certain part of the code gives the error (localized the problem). So try to post that part only. Otherwise we have to go through what you did to localize it, and wastes our time.

Post it again after making the corrections. The guide for properly formatted code is "If it looks pleasing to you, then it is properly formatted"

WolfPack 491 Posting Virtuoso Team Colleague

Thanks for the help! :)
But it still doesn't work properly.. It complains that the variable 'counter' is a private variable.. And it doesn't work if I cange it into a public one.
Any clues why?

The answer to this is in the web link I gave you in my reply. Something about the static variable being initialized globally. See if you can find it.

EDIT: I've also got another question if someone knows the answer..
I'm working on an assignment where you have to take an object of a class and have it as an membervariable of another class. How do I do this?

class A
{
public:
      int a;
};

class B
{
public:
      A member_var_of_instance_A;
}
WolfPack 491 Posting Virtuoso Team Colleague

davey he has already got a thread in the tech forum. I am following it up. but he didn't a reply since yesterday. don't know if it worked.

WolfPack 491 Posting Virtuoso Team Colleague

Create a local variable called a. Otherwise your global variables won't be hidden inside main.

#include "stdafx.h"
#include <iostream>
using namespace std;
int a=10;
void main()
{
 int a=20;
 cout<<a<<endl;
 cout<<::a<<endl;
}
WolfPack 491 Posting Virtuoso Team Colleague

In firefox go to
Tools-->Options--->Privacy--->Saved Forms or
Tools-->Options--->Privacy--->Passwords and see if those options are enabled.
But enabling that options is a bit risky if you ask me.

WolfPack 491 Posting Virtuoso Team Colleague

what is the internet browser you are using?

WolfPack 491 Posting Virtuoso Team Colleague

Please post your question outside code tags. I corrected your first two posts, do this one yourself, or I will delete this thread. Since it has been only 2 minutes since your post, you can edit it now.

WolfPack 491 Posting Virtuoso Team Colleague

This is not a problem of the laptop manufacturer.
What is the Operating System?
What are the applications for which you are trying to save usernames and passwords?

WolfPack 491 Posting Virtuoso Team Colleague

There is a spelling mistake in the constructor.
Change this

Person::Person(string first_name, string last_name)
{
Person::inctCount ( );
cout << "Overloaded Constructor!" << endl; 
}

to this.

Person::Person(string first_name, string last_name)
{
Person::incrCount ( );
cout << "Overloaded Constructor!" << endl; 
}

Change these also

static void incrCount ( )
{ 
  Person::counter ++ ;
}

static int getCount ( )
{
 return Person::counter ;
}
WolfPack 491 Posting Virtuoso Team Colleague

Enter Desired grade: B
Enter minimum average required: 79.5
Enter current average in course: 74.6
Enter how much the final counts as a percentage of the course grade: 25

You need a score of 94.20 on the final to get a B.
[79.5 - 75(.746)] * 4

Here is a much more smaller program that gives you the required output. No check is done for Desired grade checking. You do that.

#include <stdio.h>

int main (void)
{
  char desiredgrade;
  double min_average;
  double currentaverage;
  double weight;
  double score;
  printf("Please enter your desired grade: \n");
  scanf("%c", &desiredgrade);
  printf("Please enter your minimum average required:  \n");
  scanf("%lf", &min_average);
  printf("Please enter your current average in course:  \n");
  scanf("%lf", &currentaverage);
  printf("Please enter how much the final counts as a percentage of the course grade:  \n");
  scanf("%lf", &weight);
  score=(min_average-((100-weight)*(currentaverage/100)))*(100/weight);
  printf("You need a score of %.2f on the final to get %c\n",score, desiredgrade);
  
  return 0;
}

My output

Please enter your desired grade:
B
Please enter your minimum average required:
79.5
Please enter your current average in course:
74.6
Please enter how much the final counts as a percentage of the course grade:
25
You need a score of 94.20 on the final to get B
WolfPack 491 Posting Virtuoso Team Colleague

If that doesnt correct your problem write me the Correct Formula mathematically. Use +,-,*,/ only. Don't use any implicit operators.

WolfPack 491 Posting Virtuoso Team Colleague

If you are sure that the string is in double conversible format like 1.2e-2, grunt's method is the eaisest. But if you want to check the input string if it can be converted as double, e.g 123abc will be converted as 123 in grunt's method. For easier error checking better use strtod. Just checking the value of end to be null will be enough.

#include <sstream>
#include <cstdlib>
int main ()
{
    std::istringstream stm;
    char* end = 0 ;
    
    double d;
    
     stm.str("123abc");// Invalid input string
    stm >>d;  
     std::cout << d << std::endl; // Returns 123
     
    stm.str("123e-2");
    stm >>d;  
    std::cout << d << std::endl;  

     d = strtod( "123abc", &end ); // Invalid input string
     if ( *end == 0 )
        std::cout << d << std::endl;
    else
         std::cout << "Error Converting\n"; // Reports error
         
    d = strtod( "123e-2", &end );
    if ( *end == 0 )
        std::cout << d << std::endl;
    else
        std::cout << "Error Converting\n";
        
    return 0;
}

PS:
To get the characters from num , use num.c_str()

WolfPack 491 Posting Virtuoso Team Colleague

You need some kind of operator between these brackets. Probably the multiplication operator. (a)(b) doesnt mean a * b like in algebra.

score=(min_average-(100-weight)(currentaverage/100)+(100/weight));
WolfPack 491 Posting Virtuoso Team Colleague

Because if you are allowed to do so, creating one variable of that type will go on creating nested variables inside it and eat all available memory.

WolfPack 491 Posting Virtuoso Team Colleague

So you want C only to draw this?

a---*-->b

WolfPack 491 Posting Virtuoso Team Colleague

So how do you draw this diagram in paper if a, b and * is given? Give me the steps.

WolfPack 491 Posting Virtuoso Team Colleague

Okay. Thread Moved to the Assembly Section.

WolfPack 491 Posting Virtuoso Team Colleague

I am not too sure if this is the correct forum either. The most appropriate IMHO is the Assembly Forum or the support forum of the manufacturer (if any). If you want this thread moved to the Assembly forum, reply in the affirmative in this thread, and a moderator will do it for you.

WolfPack 491 Posting Virtuoso Team Colleague

Read the part called static members.

WolfPack 491 Posting Virtuoso Team Colleague

even still, what a legend! he had so much passion for what he did, and his poor kids, one day his wife will have the hard task of explaining to them what happened, as he was filming at the time - someone somewhere must have it on tape, not that im some kind of sicko, it would end and awful lot of rumors about how and what happened.

darren

You are spot on.
http://news.bbc.co.uk/2/hi/asia-pacific/5314918.stm

But the manager had later rejected the fact that he said he saw Irwin pull out the spike out of his heart.

WolfPack 491 Posting Virtuoso Team Colleague

This belongs in the Web Design forum. I am moving it.

WolfPack 491 Posting Virtuoso Team Colleague

What is NFA and DFA?
By the way, here are some sample answers you may get.

WolfPack 491 Posting Virtuoso Team Colleague

What is a state transition diagram?

WolfPack 491 Posting Virtuoso Team Colleague

Heh. Wish I was. No I was just doing a random search in google when I stumbled upon these.

Killed on service:
------------------
One Sunday morning, the pastor noticed little Alex standing in the foyer of the church staring up at a large plaque. It was covered with names with small American flags mounted on either side of it.
The seven year old had been staring at the plaque for some time, so the Pastor walked up, stood beside the little boy, and said quietly, "Good morning, Alex."
"Good morning, Pastor," the boy replied, still focused on the plaque. Then he asked, "Pastor, what is this?"
The pastor said, "Well, son, it's a memorial to all the young men and women who died in the service."
Soberly they stood together, staring at the large plaque. Finally, little Alex's voice, barely audible and trembling with fear, asked:
"Which service: the 9:45 or the 11:15?"


Twin Confusion:
---------------
A very unattractive, mean actin' woman walks into Wal-Mart with her two kids. The Wal-Mart Greeter asks, "Are they twins?"
The ugly woman says, "No, the oldest one, he's 9 and the younger one, she's 7. Why? ... Do you think they really look alike?"
"No", replies the greeter, "I just couldn't believe you got laid twice!"


Microsoft Windows 98's secret:
------------------------------
Recently one of my friends, a computer wizard, paid me a visit. …

WolfPack 491 Posting Virtuoso Team Colleague

How can you say such a thing! Linux has far less viruses and spyware than Windows!

Yes. But With the AVAST antivirus in action, and no spyware catcher, my system has done well to keep them out. Considering the ratio of malware available for Windows, one would be expecting to see swarms in any windows machine. I think there was a time when that was true. There was a time, when if you installed your windows os with your machine plugged to the network, chances are that within seconds you will be infected with a virus. A friend of mine used to tell about how he left his system unattended while installing Windows 2000, and when he came back, the installation was over, but the system had been infected and was restarting itself again and again. My opinion is that most of the spyware comes because of the fault of the user. Go to crack or porn sites, and download illegal cracks or porn finders, who knows what you are downloading? I am not that conversant in OS security, but I have only been infected with a spyware once; A dialer got into my Win98 OS and made a couple of calls to cyprus. No virus attacks. And I still am to use the Hijack Logs (I took a look at the Malware forum and I can't make head out of tail of these things) to restore my system. So as you see, if I can keep my system secure …

WolfPack 491 Posting Virtuoso Team Colleague

1. I'm making a program with a default constructor and an overloaded constructor. They're both called by different rules and produces a testline of text when called. The assignment is to give the overloaded constructor default arguments to see what happens. I wonder, what is a default argument i an overloaded constructor?

Lets take class A such that

class A
{
         int i;
         int j;
}

A default constructor is a constructor that doesn't take any arguments.
e.g. A::A(); An overloaded constructor is a constructor that takes arguments.
e.g

A::A(int int_i, int int_j )
{
      i = int_i; 
      j = int_j;
};

you can use the values of int_i and int_j to assign values for class A's member variables i and j .
If you write the overloaded constructor like this,

A::A(int int_i, int int_j = 0)
{
      i = int_i; 
      j = int_j;
};

calling the constructor like A a(2) , will create an object a with a.i = 2 and a.j = 0; calling the constructor like A a(2,9) , will create an object a with a.i = 2 and a.j = 9; If you have a default constructor defined, don't make all the arguments of the overloaded constructor default arguments. That is because the compiler will not be able to tell the difference between the two constructors.

2. How do you instance an object from a class in different scope?

I think you are asking about something like this.

Grunt commented: Nice and detailed explantion-[Grunt] +1
WolfPack 491 Posting Virtuoso Team Colleague

Hello mbr2. Welcome to Daniweb. You were an early starter compared to me. I had my first computer lessons in late 2000. Programming is one of the easiest areas of technology where you can develop with relatively low cost. Make the most of daniweb. Good luck.