Array in an array
#71
Check this out, I was googling for any examples of using split & join to implement nested arrays and even nested JavaScript objects in a procedural langauge like QB, and ran across this. Do any of the old timers recall what OO features Galleon was considering adding to QB64 (without as they say, mutilating the language)? 

https://www.tapatalk.com/groups/qbasic/o...36905.html
Reply
#72
I mean, I wouldnt say PE is mutilating the language..?
Reply
#73
Poor NasaCow. I think this thread is going in a direction of hijacking. He wants to manage a student gradebook database (which is why I mentioned SQL) and now we're talking about JSON objects, REST API, and posts from 2012.

P.S. If a program will be used by a client/company and your code is full of all handwritten ways of dealing with their stuff, anyone who has to pick up where you left off later will be very confused. Such is the issue with many companies that do "in-house EDI", for instance. They write up all these solutions for handling EDI documents that take a crazy amount of lines and is not flexible at all, requiring a different set of code for each EDI partner. If they use an EDI parser library written in standard .NET with all the proper practices, anyone who shows up to replace the programmer can continue where they left off without having to step line by line through the code trying to figure out what the heck was going on. I have had to do this. Three times now. It's not fun. Writing up all these new ways of handling this stuff might be a "fun challenge" to the original programmer but is a giant pain in the ass for anyone else.
Ask me about Windows API and maybe some Linux stuff
Reply
#74
(02-17-2023, 05:43 PM)Balderdash Wrote: Obligatory MySQL/SQLite suggestion.

That is a good tool well olied and ready to start.
In this case I think that the will of NasaCow is in reinventing the wheel at his customized needs...
just like to say I have an optimun library for database but I want handwrite something with thousand of lines by myself.

BUT array in array is not need to manage so kind of database (Gradebook).
Reply
#75
(02-28-2023, 06:24 PM)madscijr Wrote:
(02-28-2023, 03:33 PM)Kernelpanic Wrote: There is a small error in the first code on the page. Thats how it works:
Code: (Select All)
'Assosziatives Array: https://jeff.win/qbhash/
'28. Feb. 2023

Type element
  tag As String * 10
  value As String * 10
End Type
Dim Shared aa(10) As element
Dim Shared aalast ' Last occupied AA() element

setvalue "foo", "bar"
Print getvalue$("foo") ' prints bar

End

Function getvalue$ (tag As String)
  tag = LTrim$(RTrim$(tag))
  tag = tag + String$(10 - Len(tag), " ")
  For i = 0 To aalast
    If (tag = aa(i).tag) Then
      getvalue$ = aa(i).value
      Exit Function
    End If
  Next
End Function

Sub setvalue (tag As String, value As String)
  aa(aalast).tag = tag
  aa(aalast).value = value
  aalast = aalast + 1
End Sub

One advantage of associative arrays didn't in moment become clear to me. Similar to a two-dimensional random access array. . . That's how I understood it.

Yes that can be quite useful in a lot of cases. 
I haven't had a chance to test that code sample - is it broken? 
Were you able to fix it? 
I can give it a look later, and provide better examples that I did run and were working (at least they were a year or two ago, LoL!)

Althought the demo is interesting, it is so poor in aspects that is very far away from a dictionary while the hash setting is quiet good.


As you can see playing with the function/subroutines of hash array, the dictionary has been projected to have no duplicating of hash value, and to have one value for each hash value, this is very far from a dictionary where you can have a list of values associated with the hash value. (look at Bplus implementation of dictionary that is on the past forum and on Rosetta Code under the voice QB64 dictionary or associative arrays).

So to get a real dictionary from this first skeleton demo the function SetValue must have the managment of adding new value in tail (or ordered by value/character ) , so  the same for removing (cancel) from the set of values associated to the hash value.

Indeed now this demo add the same hash key in a following cell of array, but this last is really unreached because the GetValue function returns only the first match with the hash value researched.
But with some modifications it is possible to get back a real dictionary with functions of storing, changing and cancelling the values associated to the hash value.
... but I think that is better the dictionary made by Bplus.
Reply
#76
I should be the one complaining. But I don't. Because I'm making another post which is off-topic here.

While QB64 was up to Galleon to improve, it must have started with allowing a subprogram written by an user to omit a parameter "in the middle" or at the end. Something that required an "IsMissing()" that I discovered in OpenOffice.org BASIC, or which required that "va_list" junk from C library. I'm going with what I read somewhere in the Wiki in the past.

What I said about the hash tables was something I discovered in the BASIC portion of the QB64 source code. But that's ready and waiting to be used for whoever could sort out that mess.
Reply
#77
(02-18-2023, 09:25 PM)TempodiBasic Wrote: @NasaCow
Is this your final goal?
PowerSchool Gradebook

In what measure do you want duplicate this program?

the picture that you showed at #1 is very simple  in respect to this second program.

That's the full blown version, I am going more for the gradebook local client than the web version. I was more worried about setting up all the files and info before I went to programming the actual gradebook. But I am doing a code rewrite to cleanup a lot of my mess (I program without a plan, just an idea so sometimes I need to stop and rewrite sections, like I teach my little writers!)

This is more what I am heading towards: different assignmet types, different point totals, color coding. I have a lot to do still but I will finish it *someday*

[Image: image.png]

upload picture url

 

(03-01-2023, 04:00 PM)bplus Wrote: You folks have sure wandered far from the main subject problem of OP.

Sure has but it has been an amazing read with a lot of different ideas and suggestions and discussions. I am sad I haven't been around for a few months. Things are finally starting to settle down so I hope to get back to one of my joys, programming and sharing  Big Grin
Reply
#78
Hi NasaCow
that image has no good focus!
but now I have got it!  It is at this link PowerBook Teacher Gradebook  Tabs
Reply
#79
(02-18-2023, 09:25 PM)TempodiBasic Wrote: @NasaCow
Is this your final goal?
PowerSchool Gradebook

In what measure do you want duplicate this program?

the picture that you showed at #1 is very simple  in respect to this second program.

(04-02-2023, 10:14 PM)TempodiBasic Wrote: Hi NasaCow
that image has no good focus!
but now I have got it!  It is at this link PowerBook Teacher Gradebook  Tabs

Sorry about that, I thought I capture a high-res picutre but I may have been mistaken.

I have been busy coding, did a ground up rewrite of many subs (at least the functions were still useful). It is more flexible, I am hoping to release something sooner than later. I am just trying to get back to where I was before I share though!
Reply
#80
(04-06-2023, 02:37 AM)NasaCow Wrote:
(02-18-2023, 09:25 PM)TempodiBasic Wrote: @NasaCow
Is this your final goal?
PowerSchool Gradebook

In what measure do you want duplicate this program?

the picture that you showed at #1 is very simple  in respect to this second program.

(04-02-2023, 10:14 PM)TempodiBasic Wrote: Hi NasaCow
that image has no good focus!
but now I have got it!  It is at this link PowerBook Teacher Gradebook  Tabs

Sorry about that, I thought I capture a high-res picutre but I may have been mistaken.

I have been busy coding, did a ground up rewrite of many subs (at least the functions were still useful). It is more flexible, I am hoping to release something sooner than later. I am just trying to get back to where I was before I share though!

Waiting your application, I am going to develope a demonstration application very close to PowerTeacher GradeBook structure of data and with an all in one file of data .
Good Luck on reinventing the report language for getting back the reports with data.
Reply




Users browsing this thread: 25 Guest(s)