|
I think you should put on your flame-retardant suit.
|
|
|
|
|
A Linked list, by its very nature, is dynamic; you can't use a stack for it.
Unless I'm making a huge mistake (and I've made plenty in the past ), you are going to be stuck with arrays*.
* You _could_ also use fixed-size stacks and queues and dequeues, but they're just sexed up arrays.
Cheers,
Vikram.
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
|
Vikram A Punathambekar wrote: A Linked list, by its very nature, is dynamic; you can't use a stack for it.
A linked list by it's very nature is in fact a stack without push and pop functions.
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
Out! Out! Out! Out damned spot! You have soiled our lounge enough!
For this kind of dirty talk you post in the forums! Hence the massive CLICK HERE! tagged with a pretty and upright exclamation point so that you may look at it and eject and stutter your verbal wonder and awe that such technology exists as may transfer you to another page where you could post your response with little fear that black hooded executioners such as many developers you will find crawling through this swamp known as the lounge that happens to be the incorrect location to post programming questions because it is where we lounge[^] and not discuss direct programming questions because those questions are to be posted in the proper location the access of which begins with the blue hyperlink that legibly reads click here.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
"Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
modified on Friday, December 14, 2007 1:11:59 AM
|
|
|
|
|
james_dixon_2008 wrote: Just a quick question. I am writing a stack application in which there is one requirement that data structure must make use of a block of memory allocated when the stack is constructed. Now which data stucture is most appropriate for this. Is it sensible to use linked list or not.
Your best bet would be to ask this over at the Mathematics and Algorithms[^] forum.
(if it were me, I'd just allocate an array and keep an index to the top of the stack. since you're dealing with a fixed size predetermined from the start, that's how I'd do it.)
|
|
|
|
|
Hello, I am using VB.Net for a database application. From VB.net form I call second application (VB or VB.net based) and as soon as second application finish process I have to refresh my current form with some updated data. Can anyone please help me how to do it.
Many Thanks
|
|
|
|
|
Just grab the return value of Process.Start, then wait for that process to end.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Many thanks for your reply. Let me be more specific to my problem.
- I am calling an 'Outlook 2000 New Message window' from VB.Net from.
- On Email ItemSend event I am updating the database by using a VBA macro
and closing Message window.
- When I get focus back to my VB.Net application, I want to refresh my current form with recently updated data.
I am using the following code to create a new mail.
Public Sub NewEmail(ByVal txtEmail As String, ByVal intContId As Long)
Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Dim objItem As Outlook.MailItem
Dim objProp As Outlook.UserProperty
objOutlook = New Outlook.Application()
objNamespace = objOutlook.GetNamespace(Type:="MAPI")
Try
'creating a process but it's not working
Dim Proc As New Process
Dim ProcInfo As New ProcessStartInfo
ProcInfo.CreateNoWindow = True
ProcInfo.FileName = ""
ProcInfo.UseShellExecute = False
Proc.StartInfo = ProcInfo
Proc.EnableRaisingEvents = True
AddHandler Proc.Exited, AddressOf ProcessExited
Proc.Start()
objMAPIFolder = objNamespace.GetDefaultFolder & _
(Outlook.OlDefaultFolders.olFolderInbox)
objItem = objOutlook.CreateItem(Outlook.OlItemType.olMailItem)
objItem.To = txtEmail
objProp = objItem.UserProperties.Add("ContactId", & _
Outlook.OlUserPropertyType.olNumber, False, False)
objProp.Value = intContId
objItem.Display()
objOutlook = Nothing
objNamespace = Nothing
objMAPIFolder = Nothing
objItem = Nothing
objProp = Nothing
Catch ex As Exception
msgbox err.message
End Try
End Sub
I would appreciate if you kindly guide me how to include a process object in this function. If you think there is a better way to solve this problem, kindly let me know.
Thanks again
Nas
|
|
|
|
|
manisghouri wrote: Dim Proc As New Process
You already have one; apply Christian's advice on that process.
|
|
|
|
|
Does any one know what is the fastest method of fetching data from database servers?
DataAdapter.Fill()?
DataTable.Load()?
DataReader?
|
|
|
|
|
DataReader is the quickest, but it has limited use. It gives you a read-only, forward-only cursor on the recordset that is returned.
DataAdapter (and DataTable) is the most flexible of the built-in controls, but is also slower. It gives you a completely navigable and editable copy of the recordset returned from the database.
|
|
|
|
|
The problem I am having is I need to enter values in a text box on a form
and transfer them to an Excel sheet. I need to be able to input up to 25
"scores" For example I submit 77 then click submit it runs the following code
For i = 1 To 25
'count = count + 1
'score = txtscore.Text
'Sheet5.Cells(i, "a").Value = score
'Next i
The problem is it enters score for all values A1:A25 I need the score to be entered in A1 then input another number into txtscore which is my text box. Then after I click the submit button I need that value to be placed in A2 and so on and so forth. Any suggestions?
Thanks
I can only open the door... I can't walk you through it.
|
|
|
|
|
I don't know VBA, but
J-c-K wrote: 'Sheet5.Cells(i, "a").Value = score
it seems clear to me that when i is 1, it will go into A1, when it's 2, it will go in to A2, etc.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks. It does go into A2 and so. However, I need the value in the text box to go into A1. Then I need the value/variable cleared then once another value is entered in the text box I want that value in A2 then cleared then A3 etc.
Private Sub CommandButton1_Click()
'txtscore.Text = ""
For i = 1 To 25
' hours = Cells(i, "b").Value
' rate = Cells(i, "c").Value
count = count + 1
score = txtscore.Text
Sheet5.Cells(i, "a").Value = score
txtcount = Sheet5.Range("B2")
txtmean = Sheet5.Range("B3")
txtstand = Sheet5.Range("B4")
Next i
End Sub
I can only open the door... I can't walk you through it.
|
|
|
|
|
You're not going to use any kind of For/Next loop at all in this. You simply keep track of the row you're in in a simple integer variable. Every time you click Submit, or whatever you're calling your button, you put the textbox values in the cells, then increment the variable to point it at the next row. Check the variable to see if it's gone too far and adjust as you see fit. Then, you do nothing... The whole process starts over again on the next button click.
|
|
|
|
|
I have a question:
How can I create a search textbox that would find a certain person in my phonebook. I have created an acces database with a table phonebook. I imported it into my project and then created a form on which I dragged this textboxes which are connected to different fields ( firstname, lastname, adress, number, etc. ) via lets say phonebookBindingSource. I am describing this so in case you write a code, you could write it specificaly for my case. Any comments are very welcome othervwise it's like useless
help tutorials which are made for those who already know all that not for those who want to learn. Anyway I have tried quite a lot including building queries in access and then using that in VB and it doesn't work.
I should write the lastname in a textbox and then clik search button. So I suppose I shuld writte in a Button1_Click Subroutine what?...
But the primary key is on ID not on Lastname or name. There can be different persons with the same lastname so with each click it goes to the next and when at the end of table the procedure should go round again. The easiest way and comments pretty please.
|
|
|
|
|
I wanted to add that the name of the imported database is phonebook.mdb. I found some examples on the internet and they don't work.
as I have read I think I should make a database object and recordset. can I do this with a query like I put some kind of a statement in the criteria box which means whatever is written in the box of this querie field it filters out the records with matched lastnames...
|
|
|
|
|
BOREC wrote: I found some examples on the internet and they don't work.
I'm afraid they almost certainly do. You should take one example and work with it until you can make it work locally, asking specific help questions there or here.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
select top 1 * from tblPhoneBook where firstlame like '%firstName%' and lastname like '%lastname'
is something like the query that would do this, and yes, you do need to write a button click handler for your button to do something.
dragging buttons, and binding sources, is not programming. It sounds to me like you need to buy a good book and work through it, you need a foundation to be able to make the most of online resources.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Somebody got up on the wrong leg I suppose...
I want to implement a simple search engine for a simple phonebook, not creating Windows 3000. I tried some examples and so I got it to work but this is a bit heavier. I didn't find any suitible example I turned here. I didn't find anything promissing so I ...
And I do thing VB is abaut dragging controls to forms and adding functions to it otherwise you would still use assembler language.
|
|
|
|
|
BOREC wrote: And I do thing VB is abaut dragging controls to forms and adding functions to it otherwise you would still use assembler language.
It people like you who give VB a bad name. Christian is correct. Programming, in ANY language, is NOT just dragging controls onto a form and sprinkling it with code.
You MUST understand how and why the controls work and precisely what they are used for. In that understanding you will also learn the limitations or those controls and also learn who to expand on their capabilities.
After reading your original post, you have an interface design problem. Normally, lists like that are shown AS LISTS, not each record individually. It can be done though. But your interface choice makes it more difficult to do and can NOT be done by just dragging and dropping controls. You'll have to write quite a bit of code and completely understand how data binding works and how to set it up manually in your own code, because that's exactly how it needs to be done.
Can I supply a code sample and write you're stuff for you? Nope. There's too much to write in a forum post and you wouldn't learn anything in the process.
Basically, your form has to be able to switch between two datatables. The first one you already have. The second one, you have to make entirely in code, this is the result of your "filter search", and setup the control bindings to point to it - manually.
When you click another button to clear the search results, you reset the control bindings to your original datatable.
|
|
|
|
|
BOREC wrote: I want to implement a simple search engine for a simple phonebook, not creating Windows 3000.
That's why I suggest you read a book. If you wanted to do something complex, I'd have said to forget it.
BOREC wrote: And I do thing VB is abaut dragging controls to forms and adding functions to it otherwise you would still use assembler language.
As Dave said, this is why VB has a bad name. You can create something that does something without ever writing code, but
a - that's not programming and
b - you'll hit the limits of that approach pretty fast.
I wasn't trying to be rude, I was trying to give good advise. I stand by it, if you want to be a programmer, you have to write code. If you find code on the web, you need to do some research to understand what it is you're adding, otherwise you're at the mercy of whatever google throws at you, and you'll never make the bits you paste in talk to each other nicely. Either way, you should always read a book as the first step to learning a new language, then you can have a basis from which to learn via code snippets and forums.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Niether I wanted to be rude. Never said I was a top class programer otherwise I wouldnt be here. Never had any complaints abaut VB or other programs nor wanted to upset you especially if you participated in development in this kind of software. I read for me interested sections in VB for dummies, VB from novice to pro, MS VB step by step and some web pages. I know I have a lack in object oriented programing cause I am now learning for abaut a week and although I don't know all the modules, proceedures, events, ... I shouldn't be able to writte some programs which could be very helpfull. I am not trying to sell them or anything. Don't want to molest you too. Just seeking for little help. Examples are mostly without proper comments. Like a reciepe with ingredients and no how to sentences.
Examples which are given are to easy like read text from textbox1 and write it to another one, some calculators, etc. I haven't had the opportunity to se the code behind move next button in databasebinding navigator or save or add, with some minimum explanation. Thats how you learn programming. By good examples with comments. I was very stunned when practically no good examples of a search engine was not found on the web, because this is one of the most common objects you use in a database. I have seen some good examples abaut graphics and creating a simple paintbrush or a simple web browser, so. Don't want to bore you but I admire your work but you should be a little more tolerant and plastic or open minded. Sorry for spending your time, but I thought you should abaut my situation, cause...
|
|
|
|
|
This is the code I found...
Public Class Form2
Dim dbMyDB As Database
Dim rsMyRS As RecordSet
' this part is supposed to create a recordset of phonebook table in phonebook.mdb
Private Sub Form_Load()
Set dbMyDB = OpenDatabase("Phonebook.mdb")
Set rsMyRS = dbMyDB.OpenRecordSet("phonebook", dbOpenDynaset)
If Not rsMyRS.EOF Then rsMyRS.MoveFirst
Do While Not rsMyRS.EOF
lstRecords.AddItem rsMyRS!Name
lstRecords.ItemData(lstRecords.NewIndex) = rsMyRS!ID
rsMyRS.MoveNext
Loop
End Sub
Private Sub Button1_Click()
rsMyRS.FindFirst "ID=" & Str(lstRecords.ItemData(lstRecords.ListIndex))
txtPhone.Text = rsMyRS!Phone
End Sub
End Class
|
|
|
|