tuse 22 Junior Poster

*problem*
How to exit this program when the user assigned k to 1 ?

Use exit() function

http://www.cprogramming.com/fod/exit.html

tuse 22 Junior Poster

did you try debugging using gdb?

tuse 22 Junior Poster

That is just the reverse of the aforementioned algorithm.

Explanation- Scan the input string from left to right. Whenever you see an operand, just push it onto a stack. When you encounter an operator, pop two elements and concatenate the operator between the two operands and push it back to the stack. Perform this till the input string is fully parsed. The only element left in the stack (if the postfix expression is valid) will be the required infix expression.

eg- AB+

1. push A to stack
2. push B to stack
3. Next element is '+'. pop two elements, B and A apply the operator (A+B) and push it back to stack
4. Since you have fully examined the input string, the element left in the stack is the required expression.

This is just a very basic explanation, google for a more precise technique

ps- the thread name says 'postfix' but in your post, you have given a prefix string (+AB). In such a case just parse the input dtring from R->L in the algorithm.

Hope this helps

jephthah commented: good answer: accurate, but without solving it for them. +12
tuse 22 Junior Poster

Sample question:- Wat will the expression ABC AB AC will become after postfix operation??

The expression contains only operands. Where are the operators?

If you have a string in infix, ie. in form A+B, and you wish to have it in the form AB+, you can use the Shunting Yard Algorithm

tuse 22 Junior Poster

umm.. what prasu says is correct.

Its just that sometimes you may have to do a lot of comparisons.

tuse 22 Junior Poster

Try this-

Just generate 16 x 40 numbers random numbers using the code. If you want it in the range as said, find the remainder of the generated random numbers on division by 10. Then split this one dimensional array into the matrix you need.
------
Hopefully you will get as you need.

But by no means is this the best way to go. There might (must) be a better way.

------
Are you using this for an online test application?

jamello commented: nice one tuse. thanks +2
tuse 22 Junior Poster

Can you tell me the range in which you need these integers?

I have something in mind which depends upon this.

tuse 22 Junior Poster

tuse,
thanks for your reply. Yes that is a good idea, but if i fill the first line with 16 integers (aided by an array) I would want the next group of 16 to be unique as a group. So if I generate 1000 of such group of 16 integers no group would apear twice. I hope the challenge is clearer.

Thanks

Do you mean the uniqueness of the numbers should be restricted to a group of 16 or do you want 16 x 40 unique numbers

--------------------

Yeah I got what you are trying to say.

tuse 22 Junior Poster

Use the Random Class.

Dim arbit As New Random
            Randomize()

X:          For i = 0 To a.GetUpperBound(0)
                t = arbit.Next(1, 10)

            ' Generate between the numbers 1 and 10

                If Array.IndexOf(a, t) = -1 Then
                    a(i) = t

                Else
                    GoTo X
                End If

            Next

Here I am filling an array with random numbers. Note that I have used the goto statement so ensure that unique numbers are inserted into the array. (Avoiding Duplicates)

tuse 22 Junior Poster

I guess in any web application you design, or for that matter any software you design, you must make sure that you have coded for all possible cases that may arise during its implementation.

You must not think from the point of view of a software vendor but from that of a software user.

tuse 22 Junior Poster

colors.getSelectedItem() will give you the selected item in the list. Hold it in a String and print it out on the console using System.out.println()

But you have a GUI here and why do you wish to print the selected item to the console?

tuse 22 Junior Poster

You can try online examination project.

Have done one here- http://dontnet.tekyt.info

tuse 22 Junior Poster

You can try creating your own Control and define the events and properties as you want them to be.

I guess that will help you as you seem to need multiple 'blinking' buttons.

tuse 22 Junior Poster

This is how I did it-

Public Class Form4

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim cn As New Odbc.OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=mydb; User=root;Password=xxxxx;")
        Dim cmd As New Odbc.OdbcCommand("Select * from mytable", cn)
        cn.Open()
        Dim dr As Odbc.OdbcDataReader
        dr = cmd.ExecuteReader
        While dr.Read
            Me.ComboBox1.Items.Add(dr(0))
            ' dr(i) where i is the column cardinal
            ' if the 2nd field is needed it should be dr(1)

        End While
        dr.Close()
    End Sub
End Class
tuse 22 Junior Poster

You may try to make an MDI and then create instances for your individual forms.

tuse 22 Junior Poster

If you want to deploy asp.net pages on your Linux Server, you might want to take a look at this -

http://www.dotheweb.net/lama/

tuse 22 Junior Poster

Ok. You need an Apache Module to do this.

Download it here- http://sourceforge.net/project/showfiles.php?group_id=175077&package_id=223778&release_id=490544


Since your Apache came from Wamp, the default installation path for the module will need to be changed to - C:\wamp\bin\apache\apache2.2.8 (or wherever your Apache is installed)

Next, you need to modify your httpd.conf file. To do so, Left Click once on your WampServer speedometer, goto Apache and there you can see the httpd.conf option. Add the following code

#asp.net
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"

AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb 

vbproj vsdisco webinfo

<IfModule mod_aspdotnet.cpp> 
  # Mount the ASP.NET /asp application
  AspNetMount /SampleASP "C:/wamp/www/SampleASP"
  #/SampleASP is the alias name for asp.net to execute
  #"c:/SampleASP" is the actual execution of files/folders  in that location

  # Map all requests for /asp to the application files
  Alias /SampleASP "C:/wamp/www/SampleASP"
  #maps /SampleASP request to "c:/SampleASP"
  #now to get to the /SampleASP type [url]http://localhost/SampleASP[/url]
  #It'll redirect [url]http://localhost/SampleASP[/url] to "c:/SampleASP"

  # Allow asp.net scripts to be executed in the /SampleASP example
  <Directory "C:/wamp/www/SampleASP">
    Options FollowSymlinks ExecCGI
    Order allow,deny
    Allow from all
    DirectoryIndex index.htm index.aspx
   #default the index page to .htm and .aspx
  </Directory>

  # For all virtual ASP.NET webs, we need the aspnet_client files
  # to serve the client-side helper scripts.
  AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) 

"C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
  <Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
    Options FollowSymlinks
    Order allow,deny
    Allow from all
  </Directory>
</IfModule>
#asp.net

Next, in your www folder, create a folder named SampleASP and put your aspx pages there. …

tuse 22 Junior Poster

I suggest you use the same Command Object (cmd) , the same Adapter (adp) and the same Dataset (ds) in the code for event Form3_VisibleChanged.

Try it and let me know if it worked.

tuse 22 Junior Poster

Are you getting any error messages?

Could you post them and the line numbers?

tuse 22 Junior Poster

sed 's/string1/string2/' replaces string1 with string2. the 's' signifies the substitution.

you are grouping the letters 'abc' i.e. (abc) using \(abc\) using the \ to escape the literal interpretation of the parenthesis.

The asterisk is used to signify one or more occurences of the group 'abc'.

It is the reason you are getting a single 'xyz' as the output.

type the same without the asterisk to see the change in output.

Hope it helps!

tuse 22 Junior Poster

Well the number of rows really do not matter.

In the code that I have posted below, I hold the number of rows in a variable named total.

I have chosen to extract the contents of the first column, if you want to do so for the column number x, substitute 0 by x-1 in the statement below in the code-

a(i) = ds.Tables("trial1").Rows(i).Item(0)

I am adding the contents retrieved to a ListBox, just as a check.

Public Class Form1

    Dim a() As String
    Dim total As Integer

    Dim cn As New Odbc.OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=shreyas; User=root;Password=;")
    Dim cmd As Odbc.OdbcCommand
    Dim adp As Odbc.OdbcDataAdapter
    Dim ds As New DataSet


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cn.Open()
        cmd = New Odbc.OdbcCommand("Select * from trial1", cn)
        adp = New Odbc.OdbcDataAdapter(cmd)
        adp.Fill(ds, "trial1")
        'Count the number of rows
       total = ds.Tables("trial1").Rows.Count - 1

        Dim i As Integer

        ReDim a(0 To total)
        For i = 0 To total
            a(i) = ds.Tables("trial1").Rows(i).Item(0)
        Next


        Dim j As Integer

        For j = 0 To total
            Me.ListBox1.Items.Add(a(j))
        Next




    End Sub
End Class
tuse 22 Junior Poster

let us say you have a login button on the registration form which gets enabled on validation of registration details.

code for login button- form2.showdialog()

in the form_load for the 2nd form, do form1.hide()

and in the form closing event for the 2nd form, remember to do form1.close()