Append array() to GlobalArray() without clearing global

I am trying to accumulate the values of an array into a global array for use later. The array is recycled in a for loop, but I want to add each (edit: read "all") values of it to a "historical" array of sorts.

I have tried Array Set which obviously only keeps the last set of values because it clears the global array each loop.

I have tried Array Push which sort of works, but I end up with an array of arrays. I want an array of array values appending.

Am I missing something obvious and easy here?

Edit: Attempting to give example:

Loop 1

    %local_array() = blue,orange,yellow
    
    %local_array() -> %Global_array
    
    %Global_array() = blue,orange,yellow
    
Loop 2

    %local_array() = red,green,purple,pink
    
    %local_array() -> %Global_array
    
    %Global_array() = blue,orange,yellow,red,green,purple,pink
    
Loop 3

    etc...

So basically I want to append all values in the local array to the Global array with each loop.

Not appending 1 value at a time, but rather the entire local array on each loop.

The local array is coming in whole from a webpage (x15) with all values preset. Just want to capture all of them in a Global for later use.

Hope this makes more sense.

Anyway, the codes I posted both work.

Thanks

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/palmuse
πŸ“…︎ Jan 13 2022
🚨︎ report
In C Plus Plus, Do All Arrays Have To Be Global?

Coming from a Java background. I understand that in this language, functions cannot return arrays.....they can only return pointers to arrays. Which brings many questions to mind.

Does this mean that the array has to be initialized globally before the function that alters it is called? Also if the function is modifying a global array, why does it even have to return the pointer to it? Can't you just keep track of the pointer at all times and then just refer to it after the function is called? Or is it because after modifying the array, the address to it changes and that's why its returning the pointer?

This sounds like a pretty radical change from Java. Would I have to completely restructure the way I make programs because of this or are there some tricks that I could use so that I can still continue structuring programs in the same way as I did in Java?

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/PeppermintDock
πŸ“…︎ Dec 27 2021
🚨︎ report
Skyhub: For approx $5 million, a civilian-owned global sensor array could be setup, consisting of 2500 UAP trackers and enclosures.

What is Skyhub?

Mission statement: Connect a network of civilian-owned sensor arrays, use machine learning to catalogue anomalous events, and share this data with researchers.

How It Works:

  1. At the edge of the Sky Hub network sit individual Sensor Arrays. These incorporate video feeds, magnetometers, RF spectrum monitors and other tools, in a weather-ready enclosure.
  2. Inside each enclosure is the artificial intelligence brains of the system, the Tracker. It monitors sensor data, and compares it with local background information to determine when anomalies occur.
  3. Recorded anomalies are next sent to the Sky Hub Cloud, where they are stored and made open to the public for research purposes. Additional machine learning is applied to Cloud data to discover aggregate trends.

My Proposal for interested multi Millionaire or billionaire:

Purchase and distribute 2500 tacker units of Option 3 (approx. $1400), and 2500 enclosures (hoping approx $600) = 2500 x ($1400+$600) = $5,000,000.

Considerations:

  1. To increase array efficiency and operational time, distribute sensor array assets to individuals with demonstrated interest and technical aptitude, in photography, videography, astronomy, and astrophotography, etc.
  2. Identify locations best suited to setup a global observation network, and thus distribute to individuals within these areas.
  3. Create a schedule for observations, so that individuals within certain location can setup their trackers and enclosures for data collection within those times.
πŸ‘︎ 178
πŸ’¬︎
πŸ‘€︎ u/madethistosaythat
πŸ“…︎ Aug 12 2021
🚨︎ report
How can I put my RaycastHit into a global array?

I have the raycast successfully storing the hit object, as it should. But when I go to put that local variable into my global array the code breaks down.

Here is *essentially* what I have:

GameObject[] adjacentCellList;

public void ExecuteButton() //< this is called by a UI button
{
    CheckNorth()
    
}

public void CheckNorth()
    {
        if (Physics.Raycast(NorthDetect.transform.position, NorthDetect.transform.TransformDirection(Vector3.forward), out RaycastHit northHit, 5))
        {
            Debug.DrawRay(NorthDetect.transform.position, NorthDetect.transform.TransformDirection(Vector3.forward) * northHit.distance, Color.green);
            adjacentCellList[0] = northHit.transform.gameObject;
        }
        else
        {
            Debug.DrawRay(NorthDetect.transform.position, NorthDetect.transform.TransformDirection(Vector3.forward) * 10, Color.red);
        }
    }

This doesn't work and Im not sure why. I have also tried to use the ref key word to pass it through the function, but that is sloppy and I still couldn't get that to work.Any help is appreciated thank you so much!

Solved, check comments.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/NoSmallTask
πŸ“…︎ Nov 19 2021
🚨︎ report
Is it possible to create a global array larger than ~2GB?

Running this code:

#include <stdio.h>
char arr[1024L1024L1024L*2L] = { [0] = 'a' };
int main() { return 0; }

I get this error:

gcc -m64 -mcmodel=large -Wall -Werror -std=gnu11  -o test-a3 test-a3.c
/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o: in function `deregister_tm_clones':
crtstuff.c:(.text+0x3): relocation truncated to fit: R_X86_64_PC32 against `.tm_clone_table'
crtstuff.c:(.text+0xa): relocation truncated to fit: R_X86_64_PC32 against symbol `__TMC_END__' defined in .data section in test-a3
/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o: in function `register_tm_clones':
crtstuff.c:(.text+0x33): relocation truncated to fit: R_X86_64_PC32 against `.tm_clone_table'
crtstuff.c:(.text+0x3a): relocation truncated to fit: R_X86_64_PC32 against symbol `__TMC_END__' defined in .data section in test-a3
/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o: in function `__do_global_dtors_aux':
crtstuff.c:(.text+0x76): relocation truncated to fit: R_X86_64_PC32 against `.bss'
crtstuff.c:(.text+0x9e): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: error: ld returned 1 exit status
make: *** [Makefile:4: build-test] Error 1

Now I understand that this will allocate space in the data section of the binary essentially making the binary bigger for 2GB(even though it doesn't work here, 1.9GB works fine). Now, is there any way to make this allow arbitrarily large numbers like 32GB?

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/edvin123212
πŸ“…︎ Oct 15 2021
🚨︎ report
Batch processing, restarting macro, keeping array, global array/global table

Hello!

I am batch processing a huge number of files. My macro structure is the following:

I start the batch macro, it opens one image after another and runs two separate macros on each of these.

For each image, different parameters are stored in arrays, exported as csv etc.

Now I would like to create one array that is populated with parameters from EACH image by the macro that is run on each each image by the batch macro.

How can I create and populate global arrays in imageJ?

Thank you!

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/papalagirauscher
πŸ“…︎ Nov 23 2021
🚨︎ report
[DEV] Tasker 5.12.5-beta - Parse/Format DateTime, Arrays Merge, Sleeping event, Global structured variables and more!

Another New beta! Some stuff that should really already have been in Tasker is now finally native! πŸ˜…

Sign up for the beta here.

If you don't want to wait for the Google Play update, get it right away here.

If you want you can also check any previous releases here.

You can also get the updated app factory here.

Parse/Format DateTime

Demo: https://youtu.be/UR5Qf7KpDXQ

Import the sunset/sunrise task here: https://taskernet.com/shares/?user=AS35m8ne7oO4s%2BaDx%2FwlzjdFTfVMWstg1ay5AkpiNdrLoSXEZdFfw1IpXiyJCVLNW0yn&id=Task%3AGet+Sunset+Sunrise

I see a lot of people asking how to format the current date into a specific format, or change the format of an existing date. Well, fear no more, the Parse/Format DateTime action will take care of all of that!

This action follows the principle of being very simple to use but, if you really want to, you can do some pretty crazy combinations of configurations. Easy to use, but powerful if you need it!

  • If you don't configure anything, the action will simply output a bunch of variables (day, month, year, etc) regarding the current date
  • You can specify an Output Format to, additionally, output another variable with the format you specify
  • You can specify multiple Output Formats if you want to simultaneously output into different formats. For example, you could want the date and time in different variables, and this allows you to do that easily
  • You can change the Formatted Variable Names so that you can for example specify 2 output formats and give them relevant names directly in this action.
  • If you change the Input Type from Now to something else, you can format/get variables regarding a date that's not the current one
  • You can use %TIMEMS (Milliseconds Since Epoch), %TIMES (Seconds since Epoch), ISO 8601 (a widely used format) or any other custom format you want with the Custom Input Type
  • If you use the Custom Input Type you can input one or multiple input dates each with its own Input Format if you want (you can use
... keep reading on reddit ➑

πŸ‘︎ 84
πŸ’¬︎
πŸ‘€︎ u/joaomgcd
πŸ“…︎ Mar 09 2021
🚨︎ report
Bitcoin and Beyond Global Summit 2021 is fast approaching! Organized by #AAX in collaboration with @Forkast_News, industry insights will be provided for a wide array of crypto-related topics by speakers @t_xiaoduo_zhang, @BenCaselin and more. Stay tuned for more updates!
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/dancingfrankie
πŸ“…︎ Oct 13 2021
🚨︎ report
Should my global state object have nested objects or nested arrays?

My current state object structure (with nested arrays) is as follows:

state = {
  pages: [
    {
      notes: [
        {
          ...
        },
        ...
      ]
    },
    ...
  ]
}

So, to edit a note, I have to go through the pages to find the right page (i.e. pages.findIndex(page => page.id === pageIdArgument)), go through the notes to find the right note, and then edit the note.

I'm thinking of switching to a structure (with nested objects) like the following:

state = {
  pages: {
    pageId: {
      notes: {
        noteId: {
          ...
        },
        ...
      }
    },
    ...
  }
}

To edit a note with the nested object structure, I would be able to find the right page by id (without needing to iterate through a pages array) and find the right note to edit by id (without needing to iterate through a notes array).

So, my original question of whether to use nested arrays or nested objects can be broken down into the following questions:

  • Is my reasoning correct that it would be more performant to have nested objects instead of nested arrays?
  • Assuming that one note get edited frequently (e.g. multiple edits per second) and that there are a lot of notes (e.g. >10,000 notes), would there be a noticeable performance difference between having nested arrays and having nested objects (or does it not matter which one I use)?
πŸ‘︎ 5
πŸ’¬︎
πŸ“…︎ Aug 10 2021
🚨︎ report
Array not changing global variable

I have an array that in menu should change a global variable but its not changing it in my spawn object.

menu object Step:

case 0:
global.P1 = 0; break;

case 1:
global.P1 = 1; break;

case 2:
global.P1 = 2; break;

spawn object Create:

global.P1 = 1;

if global.P1 = 0

{

instance_change(oByte, true,)

}

else if global.P1 = 1

{

instance_change(oSmile, true)

}

else if global.P1 = 2

{

instance_change(oFrown, true)
}

How do I successfully change the global number?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/TranSedMind
πŸ“…︎ Jun 07 2021
🚨︎ report
A modular hierarchical array camera. Note:Notably, in 3D panoramic videography, intermodule collaboration works to estimate rough global depth information, which is further refined by the complimentary high-resolution local semantic information . nature.com/articles/s4137…
πŸ‘︎ 9
πŸ’¬︎
πŸ“…︎ Aug 02 2021
🚨︎ report
Global var array not modified by function on Epiphany (webkit) browser

Hi, all.

This is (the essential part of) my code:

<body>
	<input type="text">
	<button type="button">Click!</button><br>
	<p id="out" style="background-color: lightgray">In array: </p>
</body>

<script>
	const button = document.querySelector('button');
	button.onclick = pushit; 
	var globArray = [],
		inpt = document.querySelector('input'),
		out = document.getElementById('out');
	function pushit() {
		array.push(inpt.value);
		console.log(array);
		out.innerText += ' ' + inpt.value;
	}
</script>

Now, upon entering anything into the text input and clicking the button, the text on the paragraph is modified. However, I do need the array globArray to be modified so as it contains everything I input in the text bar (this is the bare essential part of another project, too long to paste here). When I type into Epiphany's console globArray, or console.log(globArray), I don't even get "[]"; however, this only happens on the Epiphany browser; in Firefox and Edge (beta for Linux), querying for globArray in the console does return what is expected. I really need to know how to solve this, or at least why it happens only in this browser. I have no way yet of installing Safari on my distro, so I cannot say whether this is a general Webkit issue. Thanks!

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/AdbekunkusMX
πŸ“…︎ Jul 22 2021
🚨︎ report
My newly built secondary power storage array at Oil Island. It adds 18 batteries to the grid, allowing for a global storage capacity of 4.9 GW. I can also isolate it from the rest of the grid and run the island from the fuel generators and battery capacity should the need ever arise.
πŸ‘︎ 30
πŸ’¬︎
πŸ‘€︎ u/Kubrick_Fan
πŸ“…︎ Apr 18 2021
🚨︎ report
Intuition for global and local inversions in an array

Hi everyone,

Recently I’ve been doing the leetcode questions of the day as a fun way to do some algorithmic puzzles. The question today was:

β€œYou have an array A that has N elements. The elements are a permutation of the numbers [0, 1, 2 ... N-1].

The number of (global) inversions is the number of i < j with 0 <= i < j < N and A[i] > A[j].

The number of local inversions is the number of i with <= i < N and A[i] >A[i+1].

We want to return true if and only if the number of global inversions is equal to the number of local inversions.”

SPOILER: The solution to the problem is to >!just check to see if any abs(A[i] - i) is less than or equal to 1 β€” effectively meaning that any number is more than 1 away from its sorted location.!<

When I was first solving the problem, basically my first solution to the problem ended up being correct. However, I don’t really that I convinced myself that it was correct. It was kinda a lucky guess that I made, and I feel like that because I knew it was correct (after submitting to see whether my code worked), I kinda convinced myself that I knew how it worked.

After thinking after it further though, I feel like I’ve missed out on the intuition/problem solving strategy on this problem. If you’ve given the problem a try and ended up finding the solution, I’m curious to hear your thought process and how you came up with the answer!

πŸ‘︎ 9
πŸ’¬︎
πŸ‘€︎ u/lilplop
πŸ“…︎ Apr 05 2021
🚨︎ report
Facebook, Twitter dismantle global array of disinformation networks reuters.com/article/us-cy…
πŸ‘︎ 165
πŸ’¬︎
πŸ‘€︎ u/foxisfaux
πŸ“…︎ Oct 08 2020
🚨︎ report
Array Technologies, the No. 2 global solar tracker maker, IPO launches at any moment now. Why is nobody talking about this?
πŸ‘︎ 62
πŸ’¬︎
πŸ‘€︎ u/TheLastRedditAcct
πŸ“…︎ Oct 15 2020
🚨︎ report
The onset of the COVID-19 pandemic last year led to a devastating loss of jobs and income across the global south, threatening hundreds of millions of people with hunger and lost savings and raising an array of risks for children, according to new research news.berkeley.edu/2021/02…
πŸ‘︎ 26
πŸ’¬︎
πŸ‘€︎ u/Wagamaga
πŸ“…︎ Feb 06 2021
🚨︎ report
Facebook, Twitter dismantle global array of disinformation networks vancouversun.com/technolo…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/rtbot2
πŸ“…︎ Jun 11 2021
🚨︎ report
Setting a global pointer to an array declared in a function ?

Looking at the following code...

char *pointer

int main(){

    function1();
    function2();
}

void function1(){
    char array[10];
    pointer = array;
}

void function2(){
    //This is where i want to increment my pointer, however 
    //I kept on getting syntax error's

}

My goal is to set the pointer to the array in one function, and because the pointer is global, I should be able to loop over the array in another function?

The part im stuck on is the syntax, so would the pointer loop look something like this ?

for {pointer; *pointer[i] != '\0'; pointer++} ?
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/xErratic
πŸ“…︎ Mar 04 2021
🚨︎ report
How can i make an array accessible global

I want to make an array in my functions.c file to be accessible for all functions and the array also should have all the information which where made in the other functions.

What do i have to do to achieve this?

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/xaetlas
πŸ“…︎ Jan 23 2021
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.