20.04 – Why do I see different result using files vs sudo nautilus?

When you run nautilus as a normal user, it shows the user’s Home directory that is /home/$USER.

When you run it with sudo is shows the home directory of root user that is /root.

Never run nautilus with sudo. It creates temporary files owned by root that can cause some trouble in the future.

You can use terminal commands to do file operations that require sudo, or install Midnight Commander mc for that purpose that can be run with sudo.

c++ – Naming a variable that store a result of a function with the same meaning

I know it sound silly, but I wonder how other people are solving this.

Say I have a function isOnMoon() and I want to store the result in a variable to use it multiple time in, let’s say, C++ code.

If I’ll do

bool isOnMoon = isOnMoon();

It will not work, with the failure Error: Only a function may be called.

And then I resort to isOnMoonVal or onMoon – so I just wonder what how are you naming this?

time series – What could I be doing wrong to get this result from Azure AutoML timeseries forecasting?

I’m experimenting with Azure AutoML for timeseries forecasting. I have a simple two column training dataset with two years of data at hourly intervals. Column 1 is Date/Time Column 2 is the variable I want to predict. I’ve done several runs of Azure AutoML and it seems to complete successfully. However, when I do a forecast and graph it something is obviously wrong. It looks like the forecast is being quantised somehow. The graph below is for the 7 days after the training set. Blue is actual and red is the forecast. This is obviously not right.

enter image description here

Here is my configuration for the training (python):

lags = (1,24,168)
forecast_horizon = 7 * 24 # 7 days of hourly data
forecasting_parameters = ForecastingParameters(
    time_column_name="DateTime",
    forecast_horizon=forecast_horizon,
    target_lags=lags,
    country_or_region_for_holidays='NZ',
    freq='H',
    use_stl='season',
    seasonality='auto'
)
automl_config = AutoMLConfig(task='forecasting',
                             debug_log='automl_forecasting_function.log',
                             primary_metric='normalized_root_mean_squared_error',
                             experiment_timeout_hours=1,
                             experiment_exit_score=0.05, 
                             enable_early_stopping=True,
                             training_data=train_df,
                             compute_target=compute,
                             n_cross_validations=10,
                             verbosity = logging.INFO,
                             max_concurrent_iterations=19,
                             max_cores_per_iteration=19,
                             label_column_name="Output",
                             forecasting_parameters=forecasting_parameters,
                             featurization="auto",
                             enable_dnn=False)

The best model from the run is a VotingEnsemble:

ForecastingPipelineWrapper(pipeline=Pipeline(
  memory=None,
  steps=(('timeseriestransformer',
  TimeSeriesTransformer(
    featurization_config=None,
    pipeline_type=<TimeSeriesPipelineType.FULL: 1>)),
  ('prefittedsoftvotingregressor',
  PreFittedSoftVotingRegressor(estimators=(('7',
  Pipeline(memory=None,
  steps=(('minmaxscaler',
  MinMaxScaler(copy=True,
  feature_range=(0,
  1))...
  DecisionTreeRegressor(ccp_alpha=0.0,
  criterion='mse',
  max_depth=None,
  max_features=0.5,
  max_leaf_nodes=None,
  min_impurity_decrease=0.0,
  min_impurity_split=None,
  min_samples_leaf=0.00218714609400816,
  min_samples_split=0.00630957344480193,
  min_weight_fraction_leaf=0.0,
  presort='deprecated',
  random_state=None,
  splitter='best'))),
  verbose=False))),
  weights=(0.5,
  0.5)))),
  verbose=False),
  stddev=None)

Check the result of a math expression in mysql

Let’s say I have a table, which has four columns (a, b, oper and c) and some primary key column. oper means arithmetic operation (+ - * /) here.

a  b  oper  c
-------------
2  3  +     5
4  2  /     3
6  1  *     9
8  5  -     3

As, we can see in some cases, a <oper> b != c. So, my question is how to filter out such cases?

I’ve heard of execute, which is used for executing statements, but I don’t know how to use it inside where clause.

Also, I’m not generalizing the oper to any arithmetic operation, but it would be nice to know, if any function exists.

unity – Why does switching from local to global rotation change the result of code?

I had this IK script I made a while ago from a tutorial, and I had a problem where the script would cause glitchy movement.

I was able to figure out the problem, which was that the target of the bone was a child object. So when I rotated the target, the bone with the IK script, which was the parent of the target, would rotate, which would cause the target to move as well, since it is a child object, which would cause the parent to move, and so on.

I was looking for a solution and discovered that if I switched the button above the hierarchy that says “local” to “global”, the problem would go away.

I understand global and local spaces and such, but why does this fix the problem?

The IK script I have is this:

{
public int chainLength = 2;

public Transform target;
public Transform pole;

public int iterations = 10;

public float marginOfError = 0.001f;

(Range(0, 1))
public float snapBackStrength = 1f;

protected float() bonesLength;
protected float completeLength;
protected Transform() bones;
protected Vector3() positions;
protected Vector3() startDirection;
protected Quaternion() startRotationBone;
protected Quaternion startRotationTarget;
protected Quaternion startRotationRoot;

public bool ikActive = false;

// Start is called before the first frame update
void Start()
{
    if (ikActive)
    {
        Init();
    }
}

// Update is called once per frame
void Update()
{
    
}

void LateUpdate()
{
    if (ikActive)
    {
        ResolveIK();
    }
}

void Init()
{
    bones = new Transform(chainLength + 1);
    positions = new Vector3(chainLength + 1);
    bonesLength = new float(chainLength);
    startDirection = new Vector3(chainLength + 1);
    startRotationBone = new Quaternion(chainLength + 1);

    startRotationTarget = target.rotation;
    completeLength = 0;

    var current = transform;
    for(var i = bones.Length - 1; i>= 0; i--)
    {
        bones(i) = current;
        startRotationBone(i) = current.rotation;

        if (i == bones.Length - 1)
        {
            startDirection(i) = target.position - current.position;
        }

        else
        {
            startDirection(i) = bones(i + 1).position - current.position;
            bonesLength(i) = (bones(i + 1).position - current.position).magnitude;
            completeLength += bonesLength(1);
        }

        current = current.parent;
    }
}

void ResolveIK()
{
    if (target == null)
    {
        return;
    }

    if (bonesLength.Length != chainLength)
    {
        Init();
    }

    for (int i = 0; i < bones.Length; i++)
    {
        positions(i) = bones(i).position;
    }

    var rootRotation = (bones(0).parent != null) ? bones(0).parent.rotation : Quaternion.identity;
    var rootRotationDifference = rootRotation * Quaternion.Inverse(startRotationRoot);
   
    if ((target.position - bones(0).position).magnitude >= completeLength)
    {
        var direction = (target.position - bones(0).position).normalized;

        for (int i = 1; i < positions.Length; i++)
        {
            positions(i) = positions(i - 1) + direction * bonesLength(i - 1);
        }
    }
      
    else
    {
        for (int i = 0; i < positions.Length - 1; i++)
        {
            positions(i + 1) = Vector3.Lerp(positions(i + 1), positions(i) + rootRotationDifference * startDirection(i), snapBackStrength);
        }

        for (int iteration = 0; iteration < iterations; iteration++)
        {
            for (int i = positions.Length - 1; i > 0; i--)
            {
                if (i == positions.Length - 1)
                {
                    positions(i) = target.position;
                }

                else
                {
                    positions(i) = positions(i + 1) + (positions(i) - positions(i + 1)).normalized * bonesLength(i);
                }
            }

            for (int i = 1; i < positions.Length; i++)
            {
                positions(i) = positions(i - 1) + (positions(i) - positions(i - 1)).normalized * bonesLength(i - 1);
            }

            if ((positions(positions.Length - 1)).magnitude < marginOfError)
            {
                break;
            }
        }
    }

    if (pole != null)
    {
        for(int i = 1; i < positions.Length - 1; i++)
        {
            var plane = new Plane(positions(i + 1) - positions(i - 1), positions(i - 1));
            var projectedPole = plane.ClosestPointOnPlane(pole.position);
            var projectedBone = plane.ClosestPointOnPlane(positions(i));
            var angle = Vector3.SignedAngle(projectedBone - positions(i - 1), projectedPole - positions(i -1), plane.normal);
            positions(i) = Quaternion.AngleAxis(angle, plane.normal) * (positions(i) - positions(i - 1) + positions(i - 1));
        }
    }

    for (int i = 0; i < positions.Length; i++)
    {
        if (i == positions.Length - 1)
        {
            bones(i).rotation = target.rotation * Quaternion.Inverse(startRotationTarget) * startRotationBone(i);
        }

        else
        {
            bones(i).rotation = Quaternion.FromToRotation(startDirection(i), positions(i + 1) - positions(i)) * startRotationBone(i);
        }

        bones(i).position = positions(i);
    }
}

}

Also, does switching to global have any side effects/unintended consequences?

java – Will this time duration measurement in two threads give correct result?

A program I’m developing has two threads running similar but different task:

thread1:

timer1.start()
writeToExternalDB1(consumedData)
timer1.end()

thread2:

timer2.start()
writeToExternalDB2(consumedData)
timer2.end()

I want to compare the writing performance of the two external database. I have timers around the write operation so that I can collect some metrics. Those two threads are running concurrently.

My question is will this design give correct measurement result regarding to the time spent by each write operation?
My understanding is probably not because the processing time given by CPU to each thread may be different. Let’s say for thread1, after timer1 started, cpu will not move forward to the followed write operation, but switch to processing thread2 instead. This may introduce some gaps between timer1.start() and writeToExternalDB1(consumedData). However, in that case, should we regard this gap as negligible if we are processing a lot of data? What should I do to give the correct measurement result?

Magento2 query displaying perfect result in database but wrong in collection while sorting by created_at

Magento2 query displaying perfect result in database but wrong in collection while sorting by created_at

Query

SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, IFNULL(review_summary.reviews_count, 0) AS `reviews_count`, IFNULL(review_summary.rating_summary, 0) AS `rating_summary` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index_store1` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=8 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1' LEFT JOIN `review_entity_summary` AS `review_summary` ON e.entity_id = review_summary.entity_pk_value AND review_summary.store_id = 1 AND review_summary.entity_type = (SELECT `review_entity`.`entity_id` FROM `review_entity` WHERE (entity_code = 'product')) ORDER BY `e`.`created_at` DESC

For sorting

$this->_collection
      ->getSelect()
        ->order('e.created_at');

creat 100 manullay 20 EDU/GOV Safe SEO High Pr9 Backlinks 2020 Best Result for $1

creat 100 manullay 20 EDU/GOV Safe SEO High Pr9 Backlinks 2020 Best Result

creat 100% manullay 20 EDU/GOV Safe SEO High Pr9 Backlinks 2020 Best Results
If you need you can order me without any kinds of hesitation. I will try my best to give you a better service.
We all know how important links are to everyone’s website and Google loves back links from authority sites.

EDU/GOV: create 100% manullay 20 EDU/GOV backlinks using some Biggest PR9-2 Authority Domains.(High Pagerank is on root domain, not page) anchored, and non-anchored, some with about me text, some without, which is the most natural, search engine friendly technique to use as it doesn’t look spammy?

EDU/GOV BACKLINKS FROM:
FUDAN.EDU.CN

Mit.edu

Academia.edu

Berkeley.edu

REMEMBER it’s not about throwing a ton of low quality urls to your site, that just doesn’t work, a handful good high quality links from trusted domains like these will do more good for you SEO efforts.
I will do this service honestly.If you are not satisfied then I will give I always money back guaranteed but I hope you are not unsatisfied.

I always hardly work as per your need.



.(tagsToTranslate)100(t)manully(t)Edu(t)gov(t)backlinks(t)highPr

postgresql – SELECT using JOIN where result counts per join are less than n?

This is MSSQL syntax, but I believe the equivalent in postgresql is LEFT JOIN LATERAL. Hope it helps. Didn’t realize it was postgresql until I already wrote it all out :-p

DECLARE @TableA TABLE
(
    columnA  VARCHAR(50)
    ,columnB VARCHAR(50)
);

DECLARE @TableB TABLE
(
    columnA  VARCHAR(50)
    ,columnB VARCHAR(50)
);

INSERT INTO @TableA
(
    columnA
    ,columnB
)
SELECT 'item1' , 'focaccia'
UNION ALL
SELECT 'item2' , 'spinach'
UNION ALL
SELECT 'item3' , 'goat cheese'
UNION ALL
SELECT 'item4' , 'beets';

INSERT INTO @TableB
(
    columnA
    ,columnB
)
SELECT 'blah1','focaccia'
UNION ALL SELECT 'blah2','focaccia'
UNION ALL SELECT 'blah3','focaccia'
UNION ALL SELECT 'blah4','spinach'
UNION ALL SELECT 'blah5','goat cheese'
UNION ALL SELECT 'blah6','goat cheese'
UNION ALL SELECT 'blah7','goat cheese'
UNION ALL SELECT 'blah8','goat cheese'
UNION ALL SELECT 'blah9','goat cheese'
UNION ALL SELECT 'blah10','goat cheese'
UNION ALL SELECT 'blah11','beets'
UNION ALL SELECT 'blah12','beets'
UNION ALL SELECT 'blah13','beets'
UNION ALL SELECT 'blah14','beets'
UNION ALL SELECT 'blah15','beets'
UNION ALL SELECT 'blah16','beets'
UNION ALL SELECT 'blah17','beets'

SELECT  ta.columnA
        ,ta.columnB
        ,r.HitCount
FROM    @TableA AS ta
        CROSS APPLY (
                        SELECT  COUNT(1) AS HitCount
                        FROM    @TableB AS tb
                        WHERE   ta.columnB = tb.columnB
                    ) AS r
WHERE   r.HitCount < 4;