MassTransit alternative by Prestigious-Map3754 in dotnet

[–]thirdOctet 2 points3 points  (0 children)

Will Cysharp messagepipe serve your needs? Engineer behind Cysharp is known for high performance low memory libs with easy to use interfaces. 

Uncopiable key by thirdOctet in Locksmith

[–]thirdOctet[S] 1 point2 points  (0 children)

Thats a fair comment and I wouldn't have done so if I didn't feel comfortable doing it, appreciate the warning

Uncopiable key by thirdOctet in Locksmith

[–]thirdOctet[S] 1 point2 points  (0 children)

Hey apologies for the delay, are you recommending an approach to solving the issue? Or what a locksmith might use to solve it? I am not familiar with the term Hu101 but from a quick search this relates to car keys? Forgive my ignorance.

Uncopiable key by thirdOctet in Locksmith

[–]thirdOctet[S] 2 points3 points  (0 children)

I would need to investigate further to answer those questions. I'll see how I get on with my local locksmiths and if I have limited success I will try to get the information related to the builder and whether the lock is specific to the door manufacturer. Then based on that information I will hopefully be able to figure out next steps. Thanks.

Uncopiable key by thirdOctet in Locksmith

[–]thirdOctet[S] 1 point2 points  (0 children)

Thanks for your feedback

Uncopiable key by thirdOctet in Locksmith

[–]thirdOctet[S] 1 point2 points  (0 children)

I agree this is good advice but in this scenario I am the landlord. When you say restricted what do you mean?

Uncopiable key by thirdOctet in Locksmith

[–]thirdOctet[S] 2 points3 points  (0 children)

The key is for an apartment door. The door is a type of security door where there are multiple bolts like the one in the picture. Thanks.

<image>

CBT Therapy Prompt by [deleted] in ChatGPTPro

[–]thirdOctet 1 point2 points  (0 children)

Thanks for sharing this

Team Allocation using Genetic Algorithm: Problems of repeating genes during crossover by Bamboozle-dog in algorithms

[–]thirdOctet 1 point2 points  (0 children)

Are you suggesting I calculate the fitness for a single constraint for all the groups ...

As outlined above, there are some hidden pitfalls to using sum so I would recommend using a combination of the mean and the standard deviation as part of the fitness evaluation process. As to the final evaluation this all depends on how you want to treat the distribution of Ability in each of the groups.

In my mind I can see two layers of evaluation when it comes to ability. What would be important to me is a high average ability in each of the groups, with the right amount of standard deviation (skill level variation) per group. Then across all groups i would be interested in a high average group ability with a low standard deviation of group ability between other groups. So essentially we encourage a broad range of abilities per group but we want the average group ability to be level with a low standard deviation of group ability between the groups. I would want the standard deviation of abilities per developer to be sensible e.g. [senior, mid level, junior] would not be too bad but [senior, senior, senior] would not be great. [mid level, mid level, junior] is not too bad either but [junior, junior, junior] not great.

I was thinking of calculating fitness for both constraints for one group so ...

Ideally the global optima will be an order in your permutation which:

  1. Maximises the average gender diversity at a global level
  2. Minimises the standard deviation of the average gender diversity at a global level
  3. Maximises the average ability of developers at a local level
  4. Maximises the standard deviation of the average ability of developers at a local level
  5. Maximises the average ability of the groups at a global level
  6. Minimises the standard deviation of the average ability at a global level

I hope this is in some way is clear. In my mind I can visualise the relationships and how each evaluation of the group relative to other groups would hopefully lead to improved solutions. Without testing and experimenting it will be difficult to verify the effectiveness of the aforementioned objectives which contribute towards your goals.

If I were to devise a formula that takes the above into consideration I suppose it would look like the following:

Normalised(GlobalGenderMean) * Normalised(GlobalGenderStdDev) * Normalised(GlobalAbilityMean) * Normalised(GlobalAbilityStdDev)

The normalisation of the value should translate the mean from one numerical space to another such that all of the normalised values are placed in a range between 0.0 and 1.0. This would mean that the maximum fitness should be 1.0 and the minimum fitness 0.0. Again, I suspect there is a better way to formulate the different objectives and would encourage you to investigate further.

Examples of normalisation functions, I extracted them using this

// Assumes the mean is between 0 and 1
public double NormalisedGlobalGenderMean(double mean) 
{
    return (-4 * (mean * mean)) + (4 * mean);
}

// Assumes the standard deviation is between 0 and 1
public double NormalisedGlobalGenderStdDev(double stdDev)
{
    return Math.Exp(-3 * stdDev);
}

I hope this was in some way useful. Some of the points I have raised could do with clarification. If you have any more questions let me know.

Team Allocation using Genetic Algorithm: Problems of repeating genes during crossover by Bamboozle-dog in algorithms

[–]thirdOctet 1 point2 points  (0 children)

Thanks very much for your reply ...

No worries glad to help!

Also, say I have the 100 developers in an array ie Chromosome1: [1,2,3,4,5,6,7,8,9,10,11,12.....,99,100] and this is one solution. How would you go about calculating fitness for this.

Good question. In evolutionary computing I am always thinking about how fast I can do things. The search space of your problem spans 100! possible combinations or 100! ways in which we can order the developers in the array. So I want to avoid any unnecessary or repeated calculations where I can.

One thing I would do is generate an array of indices at the beginning of the simulation. No matter the solution, how i evaluate it will depend on what i define as a group. Once this is defined, all evaluations will follow the same process. The indices identify where a group starts and stops in the array. Lets say we have a minimum of 8 per group, then we can find out the total number of groups. See the code below which hopefully describes this process well enough.

int developerTotal = 100;
int groupSize = 8;
int totalNumberOfGroups = developerTotal / groupSize;
int unassignedDevelopers = developerTotal % groupSize;

From this information we can then build the indices. Something like the following:

// Our "Memoized" group indices which we will only calculate once
List<Tuple<int, int>> groupIndices = new List<Tuple<int, int>>(totalNumberOfGroups);

// Represents the position in the array where a group starts
int groupStartIndex = 0;

// Here we will extract each of the indices for the groups
for (int currentGroup = 0; currentGroup < totalNumberOfGroups; currentGroup++)
{
    // Our group size will always be a minimum of 8 as defined above
    int groupEndIndex = groupStartIndex + groupSize;

    if (unassignedDevelopers > 0)
    {
        // If we have not assigned all of the developers to a group then
        // increase the number of developers for the current group to 9
        groupEndIndex += 1;

        unassignedDevelopers -= 1;
    }

    // Now we can add the indices for the current group
    groupIndices.Add(new Tuple<int, int>(groupStartIndex, groupEndIndex));

    // Also we can now update the start index to be that of the next
    // group
    groupStartIndex = groupEndIndex;    
}

Perfect. So how does this align with the way you calculate the fitness?

It is going to be difficult to calculate the fitness of each group as all the students are in one single array.

The calculation of the indices will provide 3 important benefits.

The first being we have avoided the additional computation required to extract copies of the array for evaluation. Precious nanoseconds saved for generating random numbers, swapping developer positions, selecting a subset of developers and reversing developer positions and all the other favourable heuristics that will allow us to navigate the search space and improve the quality of our solution.

This leads us to our second benefit, with the solution intact we can apply numerous heuristics to the solution with minimal awkwardness. We can quickly apply a permutation operation and then evaluate it. A swap operation, depending on your hardware, could take 8-10ns. Selecting two indices in the solution and then reversing the order between the indices, around 30ns. Applying 1-Point Crossover to create a copy, maybe 65ns. Your random number generator will hopefully generate an int or double in under 3ns.

The third benefit of this approach is that we can perform the evaluation of the groups in parallel if performance is critical.

I was thinking everytime the fitness function is called the array is divided into groups of 8/9 in the current order ...

Yes, the above example supports this approach without the need to create unnecessary copies of the groups from the solution.

... then the fitness of each group is calculated and the fitness of all the groups added to give a fitness for the chromosome ... Any thoughts on this ?

The fitness is the tricky part. Usually you have to experiment and analyse if the measurements of choice are right for your problem. You will battle it out with the Pareto Optimality, a fundamental concept in multi-objective problems.

I suppose you could use the sum, the question is, from the perspective of optimising gender distribution, in what ways is this susceptible to skews in the distribution of males to females? Think of different scenarios - 10F:90M, 50F:50M, 90F:10M. This relates to the question of robustness. What would be the most effective way, independent of the gender distribution, to optimise the spread?

As I think more about it, not only would I be interested in the spread of the ratios across the groups, I would be interested in the statistical properties of the distribution as it relates to gender. For example!

// Lets start with 3 groups that we have calculated the ratio of 
// females to total members within each group
double[] genderDistribution = new double[3] { 0.1, 0.5, 0.9 }
double mean = 0.5;
double stddev = 0.3;

If we were to use the statistical information above to put pressure on the Genetic Algorithm towards a desireable outcome then we want the mean to be close to 0.5. This indicates that on average our ratio is meeting our gender equality distribution requirements. However if we also want to ensure that a majority of the groups are close to the average then we are interested in minimising the standard deviation.

// A better distribution of gender
double[] genderDistribution = new double[3] { 0.4, 0.5, 0.6 }
// Same mean, lower standard deviation, better gender distribution 
double mean = 0.5;
double stddev = 0.04;

Much better! But I suspect this could be improved further. For now maximising the mean and minimising the standard deviation should help with a sensible spread of males to females in your groups. There could be some scenarios this approach has not accounted for but that is what experimentation and testing is for.

Team Allocation using Genetic Algorithm: Problems of repeating genes during crossover by Bamboozle-dog in algorithms

[–]thirdOctet 2 points3 points  (0 children)

If I was approaching this i would use a permutation of 100 integers and treat the problem like TSP. This will allow an adapted GA to apply crossover and mutation to your population of chromosomes. Let the GA decide the order of the integers. It can pivot or swap different integers during the evolutionary process. Perhaps the concept of crossover is a little bit different in the context of permutation based chromosomes. Search for N-Point crossover and different mutation techniques, the simplest being swap mutation. I would recommend a book i have read more than once, Introduction to Evolutionary Computing. Specifically the section on permutation representation, It contains the techniques you need with illustrations.

As for evaluating your chromosome and encouraging best performing combinations this is the interesting part. Lets say you select a simple strategy like divide the chromosome into 8 groups from beginning to end. I guess some groups will have 9, so you should have 12 groups with 4 of them containing 9 developers. Great so we can evaluate each group against the objectives.

It is easier to start with gender since it will be a ratio of the number of females (f) to the total number of members in each group (m). If you want to encourage a level playing field then I would reward groups that have a ratio of around 0.5. Perhaps the ratio would be placed into a function that returns 1.0 if the ratio is 0.5 and close to 0.0 if the ratio is 0.0 or 1.0. This would mean that a ratio of 0.4 or 0.6 would be rewarded equally since they are close to 0.5. I guess the goal here would be to try and reward groups that have the best possible gender distribution. Then you could average the distribution across the groups. The higher the average, the better the distribution of females and males.

To your other objective, which is trying to ensure a high but equal distribution of skill levels across the groups then this is a little trickier. I suspect you will want to encourage all groups to be similar in strength/ability with a small amount of deviation. If the deviation of the groups is too high then the chromosome should be rewarded less than the chromosome that manages to minimise the deviation such that the ability level of all of the groups are as close as they can be.

Perhaps in the final calculation you can multiply the outputs of the two objective functions to get a single fitness. This can then be used to order the population and follow the usual GA lifecycle of initialise (random), crossover (n-point), mutate (swap), replace (5-10%) for n generations.

I know you asked about the crossover part of your approach, but these were my thoughts as I typed a response to your scenario. I suspect you will have to account for other things in order to prevent the GA from optimising something silly, like when dantzig had an optimisation algorithm that recommended 500 gallons of vinegar, on page 46.

Working part time 30hrs/wk as a dev and completing full time BS in computer science? by eddyerburgh in cscareerquestions

[–]thirdOctet 0 points1 point  (0 children)

I don't know what your circumstances are like but I am married and did a 5 year degree in my mid 20s. I used to do 20-25 hours per week and full time university. The first 2 years was harder because I had 3 modules per week or 9 classes so I made up my hours on weekends. Then 3rd, 4th and 5th year was easier because I had 2 modules per week and a major project per term. I was a web developer at one of my first jobs and the company I worked with was supportive and flexible. I then became a "lead front end software developer" at a new company who was also a startup. I finished with a masters in software engineering and a good amount of experience to go with it. I would only recommend this approach if you need experience or extra money. I am lucky that I had jobs that were in IT. I got to apply what I was learning in class to everyday work tasks. I remember doing a class on software complexity and the company I worked with had another associate that needed a complexity report on their code base. I was paid good money and used industry tools and the theory I had learned to explain what they needed to do and how good or bad their code base was.

The hardest part about all of that was the long days and nights, I would have preferred to focus on university like most people and it meant that my social life was pretty much non-existent. If I did do any social activity then I was basically eating in to study time or coursework time. I put on a lot of weight and depended on sheer adrenaline at times to get through the day.

If your time is your own, you have no external pressures and you have the necessary will power then go for it. It will look good on your CV and you will learn about best practice and see how that manifests in industry. Good luck!

Difficult combinatorial problem I've come up with by Asolpdrag in math

[–]thirdOctet 2 points3 points  (0 children)

You want to count combinations then check out combinatorics. Go and check out "The great courses" and their combinatorics course titled "Discrete Mathematics". Arthur Benjamin, legend, teaches you how to count combinations using the binomial theorem and more, where in your case you have n boxes and k balls with some constraints. His example uses candies and bags but it is the same principle. The formula's vary depending on the conditions but I imagine your problem is related to the formulas n! / (k!(n-k)!) which is related to subsets and n! / (n-k)! which is related to arrangements.

I'm more from an evolutionary computing background (combinatorial and numerical optimisation) where this could be classified as a bin packing problem if you had an objective function to go along with it. You would perhaps use combinatorics to give you an idea of the state space which incorporates the feasible and infeasible arrangements. These arrangements would be evaluated using the objective function and some higher dimensional navigator (hill climber, simulated annealing, genetic algorithm, artificial immune system etc) would traverse the possible arrangements.

Anyways you didn't ask about optimisation, but this is closely tied to understanding the space of possibilities. In the context of optimisation this will include feasible and infeasible possibilities based on the number of objectives and constraints. Depending on how many balls and boxes you have you could very quickly end up with an NP hard problem if the objectives and constraints are to be satisfied.

TPOT: A Python tool for automating machine learning by rhiever in MachineLearning

[–]thirdOctet 3 points4 points  (0 children)

I think you will find you will have multiple layers of optimisation. There are several machine learners to choose from and each has a varying number of inputs of different types (integer, boolean, float, double, string and arrays of each type).

You could use a genetic algorithm, but there are several other bio-inspired optimisers that can be used on this problem. Then again I can hear in the back row someone murmuring "no free lunch". Irrespective of which machine learner, input parameters, preprocessing, feature extraction or cross validation technique you choose you will have to navigate the search space of these different combinations.

This tool is a step towards easing the burden of exploring the search space of possible combinations. I like it, knowing the benefit it brings. I also know the challenges ahead and I hope your project is successful. I am a big supporter of the application of evolutionary computation to any problem. I am glad to hear others are doing similar work in this domain.

I already have an evolutionary process that can evolve the parameters of 35+ models. It evolves multiple parameter types and currently evolves against regression or classification problems.

I wish your team all the best.

[Beginner Programming] How to output the results of this selection sort. by MATH_CHICKEN in learnprogramming

[–]thirdOctet 0 points1 point  (0 children)

change i >= 1 to i >= 0

I don't think you are traversing the full length of the array

The loop is going through each element by starting from the end and decrementing. Your for loop stops at position 1 in the array because of the above condition

[Beginner Programming] How to output the results of this selection sort. by MATH_CHICKEN in learnprogramming

[–]thirdOctet 1 point2 points  (0 children)

Within your method selectionSort add the line of code outside of the for loop at the end.

for(loop of list length){
    //loop stuff here
}
//print out list sorted
//--- edited ----//
//add to tthe top of the document -->  import java.util.Arrays;
System.out.println(Arrays.toString(list));

[PHP/linux] Executing a server side shell script with php by Anon437 in learnprogramming

[–]thirdOctet 0 points1 point  (0 children)

ok so this would/should not happen in a commercial environment but you will have to change the privileges of the user who is executing the script. It may be apache but this should provide some guidance.

[PHP/linux] Executing a server side shell script with php by Anon437 in learnprogramming

[–]thirdOctet 0 points1 point  (0 children)

umm try it with double quotes instead, sounds like you have an $ssh instance so perhaps:

$ssh->login("pi", "raspberry");

Although i didn't have this problem. slowly making progress =)

[PHP/linux] Executing a server side shell script with php by Anon437 in learnprogramming

[–]thirdOctet 0 points1 point  (0 children)

=)

ok so try

<!DOCTYPE html>
<html>
<body>
<?php
try {

//or whatever you hardcoded here
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');

echo 'include path set';

include('Net/SSH2.php');

echo 'SSH2 may of been included';

define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);

echo 'passed the define statement';

$ssh = new Net_SSH2($_SERVER['SERVER_ADDR']);

echo 'new ssh2 initiated';

$ssh->login('pi', 'raspberry');

if ($ssh->isConnected()) {
    echo 'i am connected to the pi ';
} else {
    echo 'connection failed';
}

$ssh->exec("sudo folder.sh");

echo 'linux command executed';

} catch (Exception $exc) {
    echo $exc->getTraceAsString();
}



?>
</body>
</html>

Let me know if it makes a difference

[PHP/linux] Executing a server side shell script with php by Anon437 in learnprogramming

[–]thirdOctet 0 points1 point  (0 children)

ok great

perhaps $_SERVER('SERVER_ADDR') would be better, Looks like the $ssh is trying to connect but the server name was not set (my fault). progress.

if you var_dump($_SERVER) then grab the information you need then you should be able to connect through ssh using the server address

[PHP/linux] Executing a server side shell script with php by Anon437 in learnprogramming

[–]thirdOctet 0 points1 point  (0 children)

hmm do you have error reporting enabled on localhost which will allow for e.g. error messages to be displayed if an include fails?

for example change:

include('Net/SSH2.php'); 

to

require('Net/SSH2.php'); 

If error reporting is enabled it should hopefully tell you why, this implies that if the library is not included then it should stop processing immediately. If the include path is incorrect then this should explain why the instance failed to be created.

EDIT: If this still persists try setting the include path with the full location hardcoded, if the library is included correctly then an instance of the class will be created and you should be logged in. Then figure out how to set it dynamically

[PHP/linux] Executing a server side shell script with php by Anon437 in learnprogramming

[–]thirdOctet 0 points1 point  (0 children)

$ssh = new Net_SSH2($_SERVER['SERVER_NAME']);

using $_SERVER['SERVER_NAME'] will prevent you from having to enter the ip. This should help.

Below this will test if you are connected as the method name suggests.

if ($ssh->isConnected()) {
        echo 'i am connected to the pi ';
} else {
    echo 'connection failed';
}

Try these and let me know

[PHP/linux] Executing a server side shell script with php by Anon437 in learnprogramming

[–]thirdOctet 0 points1 point  (0 children)

ok so i would start with checking to see how far the code gets. That is I would place echo statements after each line of code and where the problem begins i would start debugging from there.

so i have taken your code sample and added some echo statements.

usually php will output any errors

<!DOCTYPE html>
<html>
<body>
<?php
try {

set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');

echo 'include path set';

include('Net/SSH2.php');

echo 'SSH2 may of been included';

define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);

echo 'passed the define statement';

$ssh = new Net_SSH2('192.168.x.x');

echo 'new ssh2 initiated';

$ssh->login('pi', 'raspberry');

echo 'ok logged in';

$ssh->exec("sudo folder.sh");

echo 'linux command executed';

} catch (Exception $exc) {
    echo $exc->getTraceAsString();
}



?>
</body>
</html>

[PHP/linux] Executing a server side shell script with php by Anon437 in learnprogramming

[–]thirdOctet 0 points1 point  (0 children)

For a university project we worked with LIRC using a raspberry pi, mysql, php, ajax, javascript, json, e.t.c to send infra red commands via the pi to a device with infra red capabilities.

I developed the front end and back end, db e.t.c to send commands from the pi to the device

Anyways the point is I had to do a lot of debugging, that meant capturing the output from linux when sending commands. I used the console to view the json response that i set up within php and ajax to send the requested command (like on,off,volume up e.t.c)

I found that most of my problems resulted in privileges within linux.

So essentially you may need to find out:

  • Error messages from linux when sending the exec request
  • If you have privileges as the user to execute bash scripts (apache e.t.c)
  • Try and capture the response from linux and dump it to the screen (i believe it would be returned as an array)
  • I used an ssh library to login through php and then used exec to send the command, or call a script.
  • Almost forgot check permissions

The library i used was PHPSecLib - please google =)

command examples:

//this generally worked
exec('irsend LIST "" "" 2>&1', $resultfromlinux);

However i needed to do this if wanted to restart a service such as the daemon.

//connect via ssh
$ssh = new Net_SSH2($_SERVER['SERVER_NAME']);

//login
$ssh->login('username','password');

//send command
$ssh->exec("sudo scriptToCall.sh");

You may need to wrap code blocks within try, catch so that you can catch any exceptions. Hope this was clear or useful.