-
Notifications
You must be signed in to change notification settings - Fork 4
Pseudocode #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Keerthana-Jayakumaran
wants to merge
26
commits into
hvram1:master
Choose a base branch
from
Keerthana-Jayakumaran:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Pseudocode #2
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
256e9f1
Json data to server
ke389954 c3b3a33
'pseudocode'
ke389954 3f5ddb2
'pseudocode'
ke389954 80b7cf7
'pseudocode'
ke389954 0404f10
'pseudocode'
ke389954 6ecda59
'pseudocode'
ke389954 c0d8a15
'pseudocode'
ke389954 b220431
'pseudocode'
ke389954 265eaba
'pseudocode'
ke389954 95d675e
for general filter variables
ke389954 6920cf1
filtering with any number of variables
ke389954 f3a87f6
'Pseudocode'
ke389954 1d88d0a
'pseudocodev2'
ke389954 4a346f7
'Pseudocodev2'
ke389954 f003a66
'first_version'
ke389954 9be3ff4
'first_version'
ke389954 a31663c
'version-1'
ke389954 03a9cce
'version-1'
ke389954 6caa653
'version-1.1'
ke389954 2c669b9
'version-1.2'
ke389954 6b5e5b9
'version-1.3'
ke389954 04f0850
'version-1.4'
ke389954 b9e7caf
'Update_feature'
ke389954 2b72663
'Update_Feature'
ke389954 b8067a8
'Update_Feature'
ke389954 f81f7e1
'Merkle_tree'
ke389954 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| var http = require('http'); | ||
|
|
||
| var data = JSON.stringify( { "ProgramName":"p1" , | ||
| "UserName":"U1" , | ||
| "IPaddress":" 10.200.208.44" , | ||
| "TimeStamp":"7:77" , | ||
| "PayLoad":"hello" } | ||
| ) ; | ||
|
|
||
|
|
||
| var options = { | ||
| host: '10.200.208.44', | ||
| port: 8080, | ||
| path: '/eventslogs', | ||
| method: 'POST', | ||
| headers: | ||
| { | ||
| // 'Content-Type': 'application/jsondata', | ||
| 'Content-Type': 'text/plain', | ||
| 'Content-Length': Buffer.byteLength(data) | ||
|
|
||
| } | ||
| }; | ||
|
|
||
| var req = http.request(options, function(res) | ||
| { | ||
| res.setEncoding('utf8'); | ||
| res.on('data', function (chunk) { | ||
| console.log('got response from server ' + ' \n body: ' + chunk); | ||
| }); | ||
|
|
||
| res.on('error', function (err){ | ||
| console.log(err); | ||
| }); | ||
|
|
||
| }); | ||
| //writing json data on the specified end points | ||
| req.write(data); | ||
| //request ends | ||
| req.end(); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # ************************************************* | ||
| # SERVER SIDE - Filter the data when it arrives | ||
| # ************************************************* | ||
| ## Assume the below details are available at server | ||
| #### main object contains the entire event data till the current time | ||
| #### Client_Obj = [CUID1,CUID2,CUID3,..] - Client_Obj is an array to store the client ids. | ||
| #### Client_UIDs = { CUID1 : [P1,IP1], CUID2 : [P1,IP1], CUID3 : [P1,IP1],..} | ||
|
|
||
| #### Time complexity of the program is O(n) , if Client_Obj.length is n. | ||
|
|
||
| GET Event_data; | ||
| DO | ||
| IF (Client not Present) | ||
|
|
||
| STORE Event_data in Main_Obj; | ||
|
|
||
| END IF | ||
|
|
||
| ELSE | ||
|
|
||
| FOR(EACH Obj in Client_Obj) | ||
|
|
||
| FETCH filter variables(assume two values [P1(program_name),IP1(IP address)]); | ||
| STORE the filter variable values in local variables(pgmname,ipadd); | ||
| COMPARE pgmname with Event_data.programname; | ||
|
|
||
| IF(TRUE) | ||
|
|
||
| IF(COMPARE pgmname with Event_data.ipaddress) | ||
| SEND Event_data to Obj (it's Client id); | ||
| END IF | ||
| END IF | ||
|
|
||
| END FOR | ||
| STORE Event_data in Main_Obj; | ||
| END ELSE | ||
| END DO | ||
|
|
||
|
|
||
|
|
||
| # ...................................................... | ||
|
|
||
| # ****************************************************** | ||
| # SERVER SIDE - Storing the Event_data in Main_obj and then filtering the data | ||
| # ****************************************************** | ||
|
|
||
| ## Assume the below details are available at sever | ||
| #### main object contains the entire event data till the current time | ||
| #### Client_Obj = [CUID1,CUID2,CUID3,..] - Client_Obj is an array to store the client ids and CUID - Client UID | ||
| #### LEI - Last Event Index , LEI = 0 , if client is created first. | ||
| #### Client_UIDs = { CUID1 : [ P1, IP1, LEI1], CUID2 : [ P1, IP1, LEI2], CUID3 : [ P1, IP1, LEI3 ],..} | ||
| #### programname_Object ={ p1 : [ EUID1, EUID2, EUID3] , p2 : [ EUID1, EUID2, EUID3] , p3 : [ EUID1, EUID2, EUID3] } and EUID - event UID | ||
| #### EUID refers the Main_Obj | ||
| #### Main_Obj structure - { EUID1:{ProgramName: p1, IPaddress : IP1, UserName :U1, TimeStamp : "7.77", Payload :"text" }, | ||
| #### EUID2:{ProgramName: p3 IPaddress : IP2, UserName :U2, TimeStamp : "5.87", Payload :"happy" },..} | ||
|
|
||
| #### Time complexity of the program is O(n*lei) , if Client_Obj.length is n and programname_Object.length is lei. | ||
|
|
||
|
|
||
| GET Event_data | ||
| DO | ||
| STORE it in Main_Obj; | ||
|
|
||
| IF (Client Present) | ||
|
|
||
| FOR(EACH obj in Client_Obj) | ||
| FETCH filter variables and LEI of that particular client (assume two values for filter and | ||
| last one - LEI { P1 (program_name), IP1 (IP address), LEI (Last Event Index) } ); | ||
| STORE the filter variable values in local variables( pgmname, ipadd, LEI); | ||
| 'lei' variable to store the last event index of that client. | ||
| CHECK the ' Key-Value Pair ' exist in programname_Object , according to the value of pgmname | ||
| THEN DO | ||
| FOR ( i = LEI ; i <= programname_Object.length) | ||
| FETCH EID and CHECK for IP address (another filter variable) is same | ||
|
|
||
| IF(TRUE) | ||
|
|
||
| SEND Event_data to that obj ( CUID in Client_Obj) | ||
|
|
||
| END IF | ||
|
|
||
| END FOR | ||
| lei = programname_Object.length; | ||
| WRITE the lei to that CUID.LEI--> lei | ||
| END DO | ||
| END FOR | ||
| END IF | ||
|
|
||
| END DO | ||
| # .......................................................... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # ************************************************* | ||
| # SERVER SIDE - Filter the data when it arrives | ||
| # ************************************************* | ||
| ## Assume the below details are available at server | ||
| #### main object contains the entire event data till the current time | ||
| #### Client_Obj = [CUID1,CUID2,CUID3,..] - Client_Obj is an array to store the client ids. | ||
| #### Client_UIDs = { CUID1 : { PropertyName:P1, IPaddress:IP1,etc}, | ||
| #### CUID2 : [IPaddress:IP1,PropertyName:P1,etc], | ||
| #### CUID3 : [UserName: U1, IPaddress:IP1],..} | ||
|
|
||
| #### Time complexity of the program is O(n) , if Client_Obj.length is n. | ||
|
|
||
| GET Event_data; | ||
| DO | ||
| IF (Client not Present) | ||
|
|
||
| STORE Event_data in Main_Obj; | ||
|
|
||
| END IF | ||
|
|
||
| ELSE | ||
|
|
||
| FOR EACH Obj in Client_Obj | ||
|
|
||
| FOR EACH key in Obj | ||
|
|
||
|
|
||
| IF ( CHECK key in Event_data ) | ||
| COMPARE obj.key with Event_data.key | ||
| CONTINUE; | ||
| END IF | ||
| ELSE | ||
| SET FLAG = 0; | ||
| BREAK; // coming out of the property checking since it failed in comparison | ||
|
|
||
| END ELSE | ||
| END FOR | ||
|
|
||
| IF (FLAG) | ||
| SEND Event_data to Obj (it's Client id); | ||
| END | ||
|
|
||
| END FOR | ||
|
|
||
| STORE Event_data in Main_Obj; | ||
|
|
||
| END ELSE | ||
|
|
||
| END DO | ||
|
|
||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you attempting to do with only 2 variables ? Please generalize