## Generating number sequence

I am very new to mathematica. I am trying to generate list of number sequence. I want to make 6 sequences. 1 – 10, 10 – 100, 100 – 1 000, 1 000 – 10 000, 10 000 – 100 000. All reversed. Is there any elegant to way how to approach that? I am trying to figure it out using documentation, but I can’t. Thanks

## Generating And / Or Conditions Automatically from a List

I have the following list:

l1 = {x y, s t, a b}

From this list, I am trying to essentially generate a new list that looks like this:

    l1 = {x==1 && y==1 && s == 0 && t == 0 && a == 0 && b == 0 || x == 0 && y == 0 && s == 1 && t == 1 && a == 0 && b == 0 || x == 0 && y == 0 && s == 0 && t == 0 && a == 1 && b == 1} 

I.e., only one pair at a time can take on the value of 1 in each OR statement.

Posted on Categories cheapest proxies

## What is a good algorithm for generating a linear regression of positions in 3D space? (for getting the direction of a thrown object in VR)

I’m trying to get throwing to feel right in my VR game. I don’t plan on actually using physics to do this; my idea is to accurately determine the lateral direction of the throw, then move the object in the intended direction (with a doctored Y value) at a speed dependent on other factors.

The language of the code doesn’t matter too much, but I’m using Godot, so something that wouldn’t require me to import a bunch of different math libraries (by converting them to Godot’s Python-style GDScript) would be ideal. It doesn’t need to be robust.

To give you an idea of what I was thinking, my original plan was to save the position of the grabbing controller every frame while an object is being held, removing old positions if the controller is moving backwards, then averaging out the movement deltas over the last 10 or 15 frames or so before letting go (it should be consistent since Godot has a fixed-timestep “update” function available) and normalizing the vector to get the direction the object should travel in.

However, this blog post got me thinking that spending the time learning how to do the linear regression in a more robust way, then applying that to 3D/VR, might be worthwhile. I just wonder if, since I don’t need the actual linear or angular velocity, it might be overkill in terms of time spent on the feature.

Posted on Categories Free Proxy

## I cant get access into the target device by generating payload in metasploit

i am a beginner in Kali Linux, after i generate a payload there is this command (an interface may be specified) after the listen address. why is it happening

Posted on Categories proxies

## generating all pairs

suppose I have 6$$\{0,1,2,3,4,5\}$$ numbers.I should generate following 4 pairings of numbers where there will be 3 pairs in each pairing s.t

• each number should be in one pair and also every number should be paired

• a pair(like 0-1) should be present in only one of the pairing. and also every possible pair should be present somewhere

i) 0-1 , 2-3 ,4-5

ii) 0-4 , 1-2 ,3-5

iii) 0-3 , 1-4 ,2-5

iv) 0-2 , 1-5 ,3-4

v) 0-5 , 1-3 ,2-4

similarly if I have N numbers. I need $$(N-1)$$ pairing of numbers s.t in each pairing there are $$N/2$$ pairs.

essentially this is grouping $$\binom{n}{2}$$ combinations into $$n-1$$ groups s.t each number is present exactly once in each group

## sudo update-grub:Sourcing file /etc/default/grub’ Generating grub configuration file … error: invalid volume

I have re-Installed the Ubuntu after accidentally deleting the Ubuntu partition from windows without proper procedure & configuration of Ubuntu, so in result I couldn’t able to run Ubuntu and cant use the freed space. I have installed the Ubuntu in same partition which I was deleted improperly to overcome this problem, now I can use the Ubuntu but there are some issue.

I am using the dell Inspiron model so i avoid the issue of the kernel checking the graphics driver which causing the boot problem I had to change the some of grub file (Reference Video: https://www.youtube.com/watch?v=Tg4fWsFPzSE). After following the video in last I had to run the sudo update-grub which causing this error. Error after running command

And also there is number other files folder are created because of improper removal of my previous and re installation of Ubuntu again As you can see here

Or should I removed the all Ubuntu now with all configuration and Ubuntu now, will this work?

Any help would be appreciated.

Note: Previous and re-installed version are both Ubuntu is 18.04.3 LTS

Posted on Categories Best Proxies

## Generating a Summary with echo

I have the next function, i want to ouput the echo in the same lines, so i want to output the echos, delete everything and restart the process as the variables are charged dinamically and are updated all the time.

YT-FINAL() { while [ -z $FINALVAR ] do speedCache=$  (cat $MSSLOGS/$  project-$intnumber/$  project-$intnumber-cache.log | grep -o -E "speed=[0-9]+.[0-9]+++[a-z]+|speed=[0-9]+.[0-9]++[a-z]+|speed=[0-9]+.[0-9]+[a-z]+|speed=[0-9]+[a-z]+" | tr -d 'speed=' | tail -n 1) filCache=$  (cat $MSSLOGS/$  project-$intnumber/$  project-$intnumber-cache.log | grep -o -E "$  project[0-9]+.ts|$project[0-9]++.ts|$  project[0-9]+++.ts" | tail -n 1) speedSdi=$(cat$  MSSLOGS/$project-$  intnumber/$project-$  intnumber-sdi.log | grep -o -E "speed=[0-9]+.[0-9]+++[a-z]+|speed=[0-9]+.[0-9]++[a-z]+|speed=[0-9]+.[0-9]+[a-z]+|speed=[0-9]+[a-z]+" | tr -d 'speed=' | tail -n 1) fileSdi=$(cat$  MSSLOGS/$project-$  intnumber/$project-$  intnumber-sdi.log | grep -o -E "$project[0-9]+.ts|$  project[0-9]++.ts|$project[0-9]+++.ts" | tail -n 1) speedSave=$  (cat $MSSLOGS/$  project-$intnumber/$  project-$intnumber-save.log | grep -o -E "speed=[0-9]+.[0-9]+++[a-z]+|speed=[0-9]+.[0-9]++[a-z]+|speed=[0-9]+.[0-9]+[a-z]+|speed=[0-9]+[a-z]+" | tr -d 'speed=' | tail -n 1) fileSave=$  (cat $MSSLOGS/$  project-$intnumber/$  project-$intnumber-save.log | grep -o -E "$  project[0-9]+.ts|$project[0-9]++.ts|$  project[0-9]+++.ts" | tail -n 1)  echo "Cache Creation" echo $fileCache -$  speedCache echo -------------------------- echo "Sdi Insertion" echo -ne $fileSdi -$  speedSdi echo -------------------------- echo "Netapp Save" echo $fileSave -$  speedSave  done } 

Expected

Cache Creation RT149 - 1.03x -------------------------- Sdi Insertion RT145 - 1.1x -------------------------- Netapp Save RT144 - 1x 

## Why free() is generating an error when I use __strtok_r() in C. Is there any alternatives to __strtok_r()?

I am using the dynamically allocated string named *buffer to store the contents of the string time_digital, in order to tokenize the string using __strtok_r() function defined in #include<string.h>.

I have written the following logic to tokenize the string time_digital which contains the time in hr:mm format.

The problem occurred is when I try to free the allocated memory to *buffer using free(), the following error is generated at run-time:

Enter the number of test cases 1 Enter the time 12:00 free(): invalid pointer Aborted (core dumped) 

The code for the logic is:

#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<inttypes.h> #include<assert.h>  #define STRING_LENGTH 6  double angle_between_hour_min_hand(char[]);  int main(void) {     uint8_t test;     printf("Enter the number of test cases\n");     scanf("%"SCNu8,&test);     assert(test>0);     while(test--) {         char time_digital[STRING_LENGTH];         printf("Enter the time\n");         scanf("%s",time_digital);         double angle_between_hands_deg = angle_between_hour_min_hand(time_digital);         abs(angle_between_hands_deg) < angle_between_hands_deg ? printf("%0.1f\n",angle_between_hands_deg) : printf("%d\n",abs(angle_between_hands_deg));     }     return 0; }  double angle_between_hour_min_hand(char time_digital[]) {     uint8_t hr,min;     double hr_angle_deg,min_angle_deg,angle_between_hands_deg;     char*buffer = calloc(sizeof(char),STRING_LENGTH);     if(buffer) {         snprintf(buffer,STRING_LENGTH,"%s",time_digital);         hr = atoi(__strtok_r(buffer,":",&buffer));         min = atoi(__strtok_r(NULL,":",&buffer));         free(buffer);         hr_angle_deg = (double)(30*hr) + (double) (0.5*min);         // printf("hr-angle: %f\n", hr_angle_deg);         min_angle_deg = 6*min;         // printf("min-angle: %f\n", min_angle_deg);         angle_between_hands_deg = (hr_angle_deg > min_angle_deg) ? hr_angle_deg - min_angle_deg : min_angle_deg - hr_angle_deg;         if(angle_between_hands_deg > 180) {             angle_between_hands_deg = 360 - angle_between_hands_deg;         }     }     else fprintf(stderr,"Memory not allocated to the buffer pointer!\n");     return angle_between_hands_deg; } 

Why free() is throwing an error, I have read the documentation of __strtok_r(), which basically says:

Syntax:

#define _XOPEN_SOURCE 500 #include <string.h>    char *strtok_r(char *s, const char *sep, char **lasts); 

The function strtok_r() considers the NULL-terminated string s as a sequence of zero or more text tokens separated by spans of one or more characters from the separator string sep. The argument lasts points to a user-provided pointer which points to stored information necessary for strtok_r() to continue scanning the same string.

In the first call to strtok_r(), s points to a NULL-terminated string, sep to a NULL-terminated string of separator characters and the value pointed to by lasts is ignored. The function strtok_r() returns a pointer to the first character of the first token, writes a NULL character into s immediately following the returned token, and updates the pointer to which lasts points.

In subsequent calls, s is a NULL pointer and lasts will be unchanged from the previous call so that subsequent calls will move through the string s, returning successive tokens until no tokens remain. The separator string sep may be different from call to call. When no token remains in s, a NULL pointer is returned.

So, in my case the function changes the address to which *buffer is pointing to i.e when __strtok_r() reaches the end of the string, the *buffer pointer will not be pointing to the base address of the allocated memory.

After understanding the __strtok_r() functionality, I came to realise that it actually changes the address to which the pointer is pointing to. So I changed the code in the following the way and used valgrind to check for memory leaks, and found no errors.

#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<inttypes.h> #include<assert.h>  #define STRING_LENGTH 6  double angle_between_hour_min_hand(char[]);  int main(void) {     uint8_t test;     printf("Enter the number of test cases\n");     scanf("%"SCNu8,&test);     assert(test>0);     while(test--) {         char time_digital[STRING_LENGTH];         printf("Enter the time\n");         scanf("%s",time_digital);         double angle_between_hands_deg = angle_between_hour_min_hand(time_digital);         abs(angle_between_hands_deg) < angle_between_hands_deg ? printf("%0.1f\n",angle_between_hands_deg) : printf("%d\n",abs(angle_between_hands_deg));     }     return 0; }  double angle_between_hour_min_hand(char time_digital[]) {     uint8_t hr,min;     double hr_angle_deg,min_angle_deg,angle_between_hands_deg;     char*buffer = calloc(sizeof(char),STRING_LENGTH);     if(buffer) {         snprintf(buffer,STRING_LENGTH,"%s",time_digital);         hr = atoi(__strtok_r(buffer,":",&buffer));         min = atoi(__strtok_r(NULL,":",&buffer));         buffer -= strlen(time_digital);         free(buffer);         hr_angle_deg = (double)(30*hr) + (double) (0.5*min);         // printf("hr-angle: %f\n", hr_angle_deg);         min_angle_deg = 6*min;         // printf("min-angle: %f\n", min_angle_deg);         angle_between_hands_deg = (hr_angle_deg > min_angle_deg) ? hr_angle_deg - min_angle_deg : min_angle_deg - hr_angle_deg;         if(angle_between_hands_deg > 180) {             angle_between_hands_deg = 360 - angle_between_hands_deg;         }     }     else fprintf(stderr,"Memory not allocated to the buffer pointer!\n");     return angle_between_hands_deg; } 

I used the idea that, at the end *buffer pointer will be pointing to the last-location, so if I subtract the size of the array multiplied by sizeof(datatype) which in this case is 1 as the datatype is char, will take the pointer to the base-address again, and then I can use free().
Another way I thought of is to store the base-address to a *temp pointer and then when string is tokenized, free(temp).

Is there any other way to achieve the task, and is there a function other than __strtok_r() to tokenize the strings in C programming.

Posted on Categories proxies

## Generating all possible permutations in the fox, goose and beans problem

I have learned graph theory, and am using it to solve the classic Fox, goose and bag of beans puzzle. If we consider that there are three locations for each of the fox (X), goose (G), farmer (F) and beans (B) (near side of river, in the boat, far side of the river), and there are four characters, there are hence 4^3 = 81 combinations. Two of these combinations would be

(Near)    (Boat)    (Far) F,G,B,X     -         -  (Near)    (Boat)    (Far)  B,X        F,G        - 

…for the starting state and the state when the farmer and the goose have entered the boat respectively.

I want to generate all of these states programatically (in C++, but that is beyond the point), but simply cannot get my head around how to do it. (I know that some of these 81 possible states will be invalid (e.g. that with all characters in the boat at once) but I can search for those and remove them afterwards.)

I am well aware of binary and how I get 81 combinations, and am aware using C++ I could generate all combinations of the characters F,G,X,B, but still cannot figure how to add the three “locations” into this.

EDIT:

OK, can the downvoter explain how “this question does not show any research effort; it is unclear or not useful”. Do you want me to list everything I’ve tried and every single search I’ve done??

(And yes, I have extensively searched for solutions before posting here.)

## Generating a set of divergence-free basis

I’m trying to derive an algorithm that would generate a set of divergence-free vectors, which shall be used as basis vectors later on. Using a simple example, a 2D second-order divergence-free basis would look like this:

$$\begin{bmatrix} 1 \ 0 \end{bmatrix}, \begin{bmatrix} 0 \ 1 \end{bmatrix}, \begin{bmatrix} x \ -y \end{bmatrix}, \begin{bmatrix} y \ 0 \end{bmatrix}, \begin{bmatrix} 0 \ x \end{bmatrix}, \begin{bmatrix} x^2 \ -2xy \end{bmatrix}, \begin{bmatrix} xy \ -\frac{1}{2} y^2 \end{bmatrix}, \begin{bmatrix} y^2 \ 0 \end{bmatrix}, \begin{bmatrix} 0 \ x^2 \end{bmatrix}.$$

So far, I have manually implemented these calculations, but it will be quite tedious to work it out for 3D cases and for higher order. As of now, my pseudocode for 2D case looks like this:

switch (order):   order=1:      // manually calculate vectors for first order   order=2:      // manually calculate vectors for second order   [...] `

I would imagine things to be nastier in 3D… As of now, I am trying both to derive the whole basis manually and to come up with an algorithm to do it. Any suggestions?

Posted on Categories proxies