Category: News
Optimisation for Resource Allocation
Hello!
I’m currently trying to process data in Excel, and looking at how I might optimise my distribution of resources.
Effectively, I have a number of students who have provided up to 3 preferences for a staff member to talk to for guidance, and I’m looking if there’s a way to optimise my spread for the most equal distribution of students per staff member.
Some staff members have been requested more than others, which is unavoidably going to lead to them having larger loads, but trying to distribute as evenly as possible. Is there a solution I’m not thinking of right now? I have the ability to process this data in either 365 or the desktop app.
Hello!I’m currently trying to process data in Excel, and looking at how I might optimise my distribution of resources.Effectively, I have a number of students who have provided up to 3 preferences for a staff member to talk to for guidance, and I’m looking if there’s a way to optimise my spread for the most equal distribution of students per staff member. Some staff members have been requested more than others, which is unavoidably going to lead to them having larger loads, but trying to distribute as evenly as possible. Is there a solution I’m not thinking of right now? I have the ability to process this data in either 365 or the desktop app. Read More
How to onboard Sentinel in GCCHigh
Is there any good documentation for how to onboard Sentinel in GCCHigh?
Is there any good documentation for how to onboard Sentinel in GCCHigh? Read More
How to create a custom profile in matlab plots
Hello Everyone,
I am trying to create a profile based on user defined inputs. The profile consists of different modes each having a certain duration and order as defined by the user.
I have uploaded a picture which shows how i want the profile to look like.
Additionally i have coded to some extent, but i am struggling to get it right.
Also i would like to break the number of cycles for dynamic elements and use ‘…’ to show continuity. However, on th etime axis i would like to have the actual value instead of shortened periods by discontinuity.
I kindly request for support and i thank you in advance.
Vconst.val = [1, 0.85, 0.6, 0.4];
Vconst.txt = {‘OCV’, ‘Idle’, ‘Mid Load’, ‘High Load’};
Vdyn.val = [0.8, 0.7, 0.8, 0.5, 1.5, 1];
Vdyn.txt = {‘Dynamic Low’, ‘Dyn low trough’, ‘Dynamic High’, ‘Dyn high trough’, ‘SUSD’, ‘SUSD trough’};
% Define the order of phases and durations
order = {‘OCV’, ‘SUSD’, ‘OCV’, ‘Mid Load’, ‘High Load’, ‘Mid Load’, ‘Dynamic Low’, ‘Mid Load’, ‘Dynamic High’, ‘OCV’}; % duration in s for Vconst elements, nr. of cycles for Vdyn elements
durations = [100, 10, 200, 100, 50, 50, 4, 50, 4, 100]; % Corresponding durations in seconds or cycles
% Initialize time and voltage vectors
time = [];
voltage = [];
current_time = 0;
% Generate time and voltage vectors
for i = 1:length(order)
phase = order{i};
duration = durations(i);
t = current_time + (0:0.1:duration);
if ismember(phase, {‘OCV’, ‘Idle’, ‘Mid Load’, ‘High Load’})
% Constant phases
t = current_time + (0:0.1:duration);
V_idx = find(strcmp(Vconst.txt, phase));
v = Vconst.val(V_idx) * ones(size(t));
time_act(i) = t(end);
else
% Dynamic phases
n_cycles = duration; % Number of dynamic cycles
t_dynamic_full = [];
v_dynamic_full = [];
Vdyn_idx = find(strcmp(Vdyn.txt, phase));
peak_height = Vdyn.val(Vdyn_idx);
trough_height = Vdyn.val(Vdyn_idx + 1);
nr_pts = 50;
for j = 1:n_cycles
t_cycle = current_time + (0:1:nr_pts);
tri_wave = sawtooth(2 * pi * (1/nr_pts) * (t_cycle – current_time), 0.5);
tri_wave = (peak_height – trough_height) * tri_wave / 2 + (peak_height + trough_height) / 2;
tri_wave(tri_wave > peak_height) = peak_height;
tri_wave(tri_wave < trough_height) = trough_height;
t_dynamic_full = [t_dynamic_full, t_cycle];
v_dynamic_full = [v_dynamic_full, tri_wave];
current_time = t_cycle(end);
end
time_act(i) = t_dynamic_full(end);
if n_cycles > 3
t_dynamic_1 = t_dynamic_full(1:nr_pts*2+2);
v_dynamic_1 = v_dynamic_full(1:nr_pts*2+2);
t_dynamic_2 = t_dynamic_full(nr_pts*3+3:nr_pts*4+4);
v_dynamic_2 = v_dynamic_full(nr_pts*3+3:nr_pts*4+4);
t_continuity = t_dynamic_full(nr_pts*2+4:nr_pts*3+2);
v_continuity = NaN * ones(size(t_continuity));
t = [t_dynamic_1, t_continuity, t_dynamic_2];
v = [v_dynamic_1, v_continuity, v_dynamic_2];
else
t = t_dynamic_full;
v = v_dynamic_full;
end
end
time = [time, t];
voltage = [voltage, v];
current_time = t(end);
if i>1
time_act(i) = time_act(i)+time_act(i-1);
else
end
end
% Plot the voltage over time
figure;
plot(time, voltage, ‘LineWidth’, 1.5);
xlabel(‘Time (s)’);
ylabel(‘Voltage (V)’);
title(‘User Defined Plot with Flexible Phase Order and Durations’);
grid on;
ylim([0 2])
yticklabels([])Hello Everyone,
I am trying to create a profile based on user defined inputs. The profile consists of different modes each having a certain duration and order as defined by the user.
I have uploaded a picture which shows how i want the profile to look like.
Additionally i have coded to some extent, but i am struggling to get it right.
Also i would like to break the number of cycles for dynamic elements and use ‘…’ to show continuity. However, on th etime axis i would like to have the actual value instead of shortened periods by discontinuity.
I kindly request for support and i thank you in advance.
Vconst.val = [1, 0.85, 0.6, 0.4];
Vconst.txt = {‘OCV’, ‘Idle’, ‘Mid Load’, ‘High Load’};
Vdyn.val = [0.8, 0.7, 0.8, 0.5, 1.5, 1];
Vdyn.txt = {‘Dynamic Low’, ‘Dyn low trough’, ‘Dynamic High’, ‘Dyn high trough’, ‘SUSD’, ‘SUSD trough’};
% Define the order of phases and durations
order = {‘OCV’, ‘SUSD’, ‘OCV’, ‘Mid Load’, ‘High Load’, ‘Mid Load’, ‘Dynamic Low’, ‘Mid Load’, ‘Dynamic High’, ‘OCV’}; % duration in s for Vconst elements, nr. of cycles for Vdyn elements
durations = [100, 10, 200, 100, 50, 50, 4, 50, 4, 100]; % Corresponding durations in seconds or cycles
% Initialize time and voltage vectors
time = [];
voltage = [];
current_time = 0;
% Generate time and voltage vectors
for i = 1:length(order)
phase = order{i};
duration = durations(i);
t = current_time + (0:0.1:duration);
if ismember(phase, {‘OCV’, ‘Idle’, ‘Mid Load’, ‘High Load’})
% Constant phases
t = current_time + (0:0.1:duration);
V_idx = find(strcmp(Vconst.txt, phase));
v = Vconst.val(V_idx) * ones(size(t));
time_act(i) = t(end);
else
% Dynamic phases
n_cycles = duration; % Number of dynamic cycles
t_dynamic_full = [];
v_dynamic_full = [];
Vdyn_idx = find(strcmp(Vdyn.txt, phase));
peak_height = Vdyn.val(Vdyn_idx);
trough_height = Vdyn.val(Vdyn_idx + 1);
nr_pts = 50;
for j = 1:n_cycles
t_cycle = current_time + (0:1:nr_pts);
tri_wave = sawtooth(2 * pi * (1/nr_pts) * (t_cycle – current_time), 0.5);
tri_wave = (peak_height – trough_height) * tri_wave / 2 + (peak_height + trough_height) / 2;
tri_wave(tri_wave > peak_height) = peak_height;
tri_wave(tri_wave < trough_height) = trough_height;
t_dynamic_full = [t_dynamic_full, t_cycle];
v_dynamic_full = [v_dynamic_full, tri_wave];
current_time = t_cycle(end);
end
time_act(i) = t_dynamic_full(end);
if n_cycles > 3
t_dynamic_1 = t_dynamic_full(1:nr_pts*2+2);
v_dynamic_1 = v_dynamic_full(1:nr_pts*2+2);
t_dynamic_2 = t_dynamic_full(nr_pts*3+3:nr_pts*4+4);
v_dynamic_2 = v_dynamic_full(nr_pts*3+3:nr_pts*4+4);
t_continuity = t_dynamic_full(nr_pts*2+4:nr_pts*3+2);
v_continuity = NaN * ones(size(t_continuity));
t = [t_dynamic_1, t_continuity, t_dynamic_2];
v = [v_dynamic_1, v_continuity, v_dynamic_2];
else
t = t_dynamic_full;
v = v_dynamic_full;
end
end
time = [time, t];
voltage = [voltage, v];
current_time = t(end);
if i>1
time_act(i) = time_act(i)+time_act(i-1);
else
end
end
% Plot the voltage over time
figure;
plot(time, voltage, ‘LineWidth’, 1.5);
xlabel(‘Time (s)’);
ylabel(‘Voltage (V)’);
title(‘User Defined Plot with Flexible Phase Order and Durations’);
grid on;
ylim([0 2])
yticklabels([]) Hello Everyone,
I am trying to create a profile based on user defined inputs. The profile consists of different modes each having a certain duration and order as defined by the user.
I have uploaded a picture which shows how i want the profile to look like.
Additionally i have coded to some extent, but i am struggling to get it right.
Also i would like to break the number of cycles for dynamic elements and use ‘…’ to show continuity. However, on th etime axis i would like to have the actual value instead of shortened periods by discontinuity.
I kindly request for support and i thank you in advance.
Vconst.val = [1, 0.85, 0.6, 0.4];
Vconst.txt = {‘OCV’, ‘Idle’, ‘Mid Load’, ‘High Load’};
Vdyn.val = [0.8, 0.7, 0.8, 0.5, 1.5, 1];
Vdyn.txt = {‘Dynamic Low’, ‘Dyn low trough’, ‘Dynamic High’, ‘Dyn high trough’, ‘SUSD’, ‘SUSD trough’};
% Define the order of phases and durations
order = {‘OCV’, ‘SUSD’, ‘OCV’, ‘Mid Load’, ‘High Load’, ‘Mid Load’, ‘Dynamic Low’, ‘Mid Load’, ‘Dynamic High’, ‘OCV’}; % duration in s for Vconst elements, nr. of cycles for Vdyn elements
durations = [100, 10, 200, 100, 50, 50, 4, 50, 4, 100]; % Corresponding durations in seconds or cycles
% Initialize time and voltage vectors
time = [];
voltage = [];
current_time = 0;
% Generate time and voltage vectors
for i = 1:length(order)
phase = order{i};
duration = durations(i);
t = current_time + (0:0.1:duration);
if ismember(phase, {‘OCV’, ‘Idle’, ‘Mid Load’, ‘High Load’})
% Constant phases
t = current_time + (0:0.1:duration);
V_idx = find(strcmp(Vconst.txt, phase));
v = Vconst.val(V_idx) * ones(size(t));
time_act(i) = t(end);
else
% Dynamic phases
n_cycles = duration; % Number of dynamic cycles
t_dynamic_full = [];
v_dynamic_full = [];
Vdyn_idx = find(strcmp(Vdyn.txt, phase));
peak_height = Vdyn.val(Vdyn_idx);
trough_height = Vdyn.val(Vdyn_idx + 1);
nr_pts = 50;
for j = 1:n_cycles
t_cycle = current_time + (0:1:nr_pts);
tri_wave = sawtooth(2 * pi * (1/nr_pts) * (t_cycle – current_time), 0.5);
tri_wave = (peak_height – trough_height) * tri_wave / 2 + (peak_height + trough_height) / 2;
tri_wave(tri_wave > peak_height) = peak_height;
tri_wave(tri_wave < trough_height) = trough_height;
t_dynamic_full = [t_dynamic_full, t_cycle];
v_dynamic_full = [v_dynamic_full, tri_wave];
current_time = t_cycle(end);
end
time_act(i) = t_dynamic_full(end);
if n_cycles > 3
t_dynamic_1 = t_dynamic_full(1:nr_pts*2+2);
v_dynamic_1 = v_dynamic_full(1:nr_pts*2+2);
t_dynamic_2 = t_dynamic_full(nr_pts*3+3:nr_pts*4+4);
v_dynamic_2 = v_dynamic_full(nr_pts*3+3:nr_pts*4+4);
t_continuity = t_dynamic_full(nr_pts*2+4:nr_pts*3+2);
v_continuity = NaN * ones(size(t_continuity));
t = [t_dynamic_1, t_continuity, t_dynamic_2];
v = [v_dynamic_1, v_continuity, v_dynamic_2];
else
t = t_dynamic_full;
v = v_dynamic_full;
end
end
time = [time, t];
voltage = [voltage, v];
current_time = t(end);
if i>1
time_act(i) = time_act(i)+time_act(i-1);
else
end
end
% Plot the voltage over time
figure;
plot(time, voltage, ‘LineWidth’, 1.5);
xlabel(‘Time (s)’);
ylabel(‘Voltage (V)’);
title(‘User Defined Plot with Flexible Phase Order and Durations’);
grid on;
ylim([0 2])
yticklabels([]) plot, profile creation, data handling MATLAB Answers — New Questions
polar plot
Hi everyone!
I want to plot a function like that:
<http://i44.tinypic.com/hu3v2q.jpg>
the plot is in fig. 138 (c) and its expression in Ms.
What’s the code?
because, I think, there is a scale factor, I use this code:
ts=linspace(0,2*pi,500);
Ms = 1-ts.*sin(ts)-0.5*cos(ts);
polar(ts,Ms)
but this generates a wrong plot.
How can I do this?
Thanks a lot for your answer!
PincoHi everyone!
I want to plot a function like that:
<http://i44.tinypic.com/hu3v2q.jpg>
the plot is in fig. 138 (c) and its expression in Ms.
What’s the code?
because, I think, there is a scale factor, I use this code:
ts=linspace(0,2*pi,500);
Ms = 1-ts.*sin(ts)-0.5*cos(ts);
polar(ts,Ms)
but this generates a wrong plot.
How can I do this?
Thanks a lot for your answer!
Pinco Hi everyone!
I want to plot a function like that:
<http://i44.tinypic.com/hu3v2q.jpg>
the plot is in fig. 138 (c) and its expression in Ms.
What’s the code?
because, I think, there is a scale factor, I use this code:
ts=linspace(0,2*pi,500);
Ms = 1-ts.*sin(ts)-0.5*cos(ts);
polar(ts,Ms)
but this generates a wrong plot.
How can I do this?
Thanks a lot for your answer!
Pinco polar, plot MATLAB Answers — New Questions
Application of multistage decimator filter to signal
Dear all
We had a piece of code to decimate data (decimation ratio (dec_factor) > 13) that read:
Hfd=fdesign.decimator(dec_factor,’Nyquist’);
Hm=design(Hfd,’multistage’);
signal_output=filter(Hm,signal_input);
Matlad is warning that
Warning: Multistage design using fdesign.decimator will be removed. Use designMultistageDecimator instead.
So we are replacing the codewith:
Astop = 80;
TW = 0.03*fs_sampling/2;
Hm=designMultistageDecimator(dec_factor,fs_sampling,TW,Astop,’CostMethod’,’design’);
We don´t know what to do with Hm in order to apply the filter to get signal_input.
Any ideas?
Thanks in advanceDear all
We had a piece of code to decimate data (decimation ratio (dec_factor) > 13) that read:
Hfd=fdesign.decimator(dec_factor,’Nyquist’);
Hm=design(Hfd,’multistage’);
signal_output=filter(Hm,signal_input);
Matlad is warning that
Warning: Multistage design using fdesign.decimator will be removed. Use designMultistageDecimator instead.
So we are replacing the codewith:
Astop = 80;
TW = 0.03*fs_sampling/2;
Hm=designMultistageDecimator(dec_factor,fs_sampling,TW,Astop,’CostMethod’,’design’);
We don´t know what to do with Hm in order to apply the filter to get signal_input.
Any ideas?
Thanks in advance Dear all
We had a piece of code to decimate data (decimation ratio (dec_factor) > 13) that read:
Hfd=fdesign.decimator(dec_factor,’Nyquist’);
Hm=design(Hfd,’multistage’);
signal_output=filter(Hm,signal_input);
Matlad is warning that
Warning: Multistage design using fdesign.decimator will be removed. Use designMultistageDecimator instead.
So we are replacing the codewith:
Astop = 80;
TW = 0.03*fs_sampling/2;
Hm=designMultistageDecimator(dec_factor,fs_sampling,TW,Astop,’CostMethod’,’design’);
We don´t know what to do with Hm in order to apply the filter to get signal_input.
Any ideas?
Thanks in advance filtering, multistage filtering MATLAB Answers — New Questions
issue with fmincon function.
I want to maximize rate using fmincon function. the problem is I have an error as "Arrays have incompatible sizes for this operation." and "Caused by: Failure in initial objective function evaluation. FMINCON cannot continue.". I provide a part of my code and the objective function here. I guess the problem is in the reshape part and it might be wrong. I would really appreciate it if someone could help me to write the objective function correctly.
when . I should mention that is a vector and is a matrix for .
here is my code.
%initial guess for P2 and W2
P2_0 = ones(Ns,1) * (tilde_P2 / Ns) / 2; % initial guess for P2
W2_0 = ones(Ms,Ns); %initial guess for W2
%combine initial guess in a single vector
x0 = [P2_0 ; W2_0(:)];
% Define the linear constraint (C2)
A = zeros(Np, Ns + Ms * Ns);
for l = 1:Np
A(l, 1:Ns) = xi’; % Place xi’ in the first Ns columns of each row
end
% Define the bounds(C1)
lb = [zeros(Ns, 1); -Inf(Ms * Ns, 1)]; % Lower bound (P2 >= 0, no lower bound for W2)
ub = [repmat(tilde_P2 / Ns, Ns, 1); Inf(Ms * Ns, 1)]; % Upper bound (P2 <= tilde_P2_max / Ns, no upper bound for W2)
%%%objective function
obj_fun = @(x) -((Nup – Nt) / Nup * sum(log(1 + x(1:Ns) ./ (sigma2 * reshape(x(Ns+1:end), Ms, Ns).^2))));
% Set options for fmincon
options = optimoptions(‘fmincon’, ‘Display’, ‘iter’, ‘Algorithm’, ‘interior-point’);
% Run the optimization
[x_opt, fval] = fmincon(obj_fun, x0, A, hat_zeta1, [], [], lb, ub, [], options);
% Extract optimized values for P2 and W2
P2_opt = x_opt(1:Ns);
W2_opt = reshape(x_opt(Ns+1:end), Ms, Ns);I want to maximize rate using fmincon function. the problem is I have an error as "Arrays have incompatible sizes for this operation." and "Caused by: Failure in initial objective function evaluation. FMINCON cannot continue.". I provide a part of my code and the objective function here. I guess the problem is in the reshape part and it might be wrong. I would really appreciate it if someone could help me to write the objective function correctly.
when . I should mention that is a vector and is a matrix for .
here is my code.
%initial guess for P2 and W2
P2_0 = ones(Ns,1) * (tilde_P2 / Ns) / 2; % initial guess for P2
W2_0 = ones(Ms,Ns); %initial guess for W2
%combine initial guess in a single vector
x0 = [P2_0 ; W2_0(:)];
% Define the linear constraint (C2)
A = zeros(Np, Ns + Ms * Ns);
for l = 1:Np
A(l, 1:Ns) = xi’; % Place xi’ in the first Ns columns of each row
end
% Define the bounds(C1)
lb = [zeros(Ns, 1); -Inf(Ms * Ns, 1)]; % Lower bound (P2 >= 0, no lower bound for W2)
ub = [repmat(tilde_P2 / Ns, Ns, 1); Inf(Ms * Ns, 1)]; % Upper bound (P2 <= tilde_P2_max / Ns, no upper bound for W2)
%%%objective function
obj_fun = @(x) -((Nup – Nt) / Nup * sum(log(1 + x(1:Ns) ./ (sigma2 * reshape(x(Ns+1:end), Ms, Ns).^2))));
% Set options for fmincon
options = optimoptions(‘fmincon’, ‘Display’, ‘iter’, ‘Algorithm’, ‘interior-point’);
% Run the optimization
[x_opt, fval] = fmincon(obj_fun, x0, A, hat_zeta1, [], [], lb, ub, [], options);
% Extract optimized values for P2 and W2
P2_opt = x_opt(1:Ns);
W2_opt = reshape(x_opt(Ns+1:end), Ms, Ns); I want to maximize rate using fmincon function. the problem is I have an error as "Arrays have incompatible sizes for this operation." and "Caused by: Failure in initial objective function evaluation. FMINCON cannot continue.". I provide a part of my code and the objective function here. I guess the problem is in the reshape part and it might be wrong. I would really appreciate it if someone could help me to write the objective function correctly.
when . I should mention that is a vector and is a matrix for .
here is my code.
%initial guess for P2 and W2
P2_0 = ones(Ns,1) * (tilde_P2 / Ns) / 2; % initial guess for P2
W2_0 = ones(Ms,Ns); %initial guess for W2
%combine initial guess in a single vector
x0 = [P2_0 ; W2_0(:)];
% Define the linear constraint (C2)
A = zeros(Np, Ns + Ms * Ns);
for l = 1:Np
A(l, 1:Ns) = xi’; % Place xi’ in the first Ns columns of each row
end
% Define the bounds(C1)
lb = [zeros(Ns, 1); -Inf(Ms * Ns, 1)]; % Lower bound (P2 >= 0, no lower bound for W2)
ub = [repmat(tilde_P2 / Ns, Ns, 1); Inf(Ms * Ns, 1)]; % Upper bound (P2 <= tilde_P2_max / Ns, no upper bound for W2)
%%%objective function
obj_fun = @(x) -((Nup – Nt) / Nup * sum(log(1 + x(1:Ns) ./ (sigma2 * reshape(x(Ns+1:end), Ms, Ns).^2))));
% Set options for fmincon
options = optimoptions(‘fmincon’, ‘Display’, ‘iter’, ‘Algorithm’, ‘interior-point’);
% Run the optimization
[x_opt, fval] = fmincon(obj_fun, x0, A, hat_zeta1, [], [], lb, ub, [], options);
% Extract optimized values for P2 and W2
P2_opt = x_opt(1:Ns);
W2_opt = reshape(x_opt(Ns+1:end), Ms, Ns); fmincon, error MATLAB Answers — New Questions
How to COUNTIFS with mixed criteria
I am having some issues with using the COUNTIFS function. My spreadsheet has all the readers enrolled in my reading challenges for June, sorted by age. I need to be able to quickly calculate how many readers in each of my age groups logged reading during the month, but the Ages are messing me up. I used the following functions to successfully determine:
How many Avid readers aged 0-11 logged reading: =COUNTIFS(AVID!$A$2:$A$500,”<12″,AVID!I2:$I$500,”>0″)
How many Avid readers aged 12-18 logged reading:
=COUNTIFS(AVID!$A$2:$A$500,”>11.5″,AVID!$A$2:$A$500,”<19″,AVID!$I$2:$I$500,”>0″)
How many Casual readers aged 0 – 11 logged reading:
=COUNTIFS(CASUAL!$A$2:$A$500,”<12″,CASUAL!$I$2:$I$500,”>0″)
How many Casual readers aged 12-18 logged reading:
=COUNTIFS(CASUAL!$A$2:$A$500,”>11.5″,CASUAL!$A$2:$A$500,”<19″,CASUAL!$I$2:$I$500,”>0″)
note: I have not imported RTM reader data yet . . .
What is messing me up are the ages of my Adult readers. We collect readers ages up to age 20, but all other adult readers are listed as “21+”. How do I amend the COUNTIFS formula to scrape “19,” “20,” and “21+” from my Age column? A link to my sample is below.
Sample Reader Participation Report.xlsx
I am having some issues with using the COUNTIFS function. My spreadsheet has all the readers enrolled in my reading challenges for June, sorted by age. I need to be able to quickly calculate how many readers in each of my age groups logged reading during the month, but the Ages are messing me up. I used the following functions to successfully determine: How many Avid readers aged 0-11 logged reading: =COUNTIFS(AVID!$A$2:$A$500,”<12″,AVID!I2:$I$500,”>0″)How many Avid readers aged 12-18 logged reading: =COUNTIFS(AVID!$A$2:$A$500,”>11.5″,AVID!$A$2:$A$500,”<19″,AVID!$I$2:$I$500,”>0″)How many Casual readers aged 0 – 11 logged reading: =COUNTIFS(CASUAL!$A$2:$A$500,”<12″,CASUAL!$I$2:$I$500,”>0″)How many Casual readers aged 12-18 logged reading: =COUNTIFS(CASUAL!$A$2:$A$500,”>11.5″,CASUAL!$A$2:$A$500,”<19″,CASUAL!$I$2:$I$500,”>0″)note: I have not imported RTM reader data yet . . . What is messing me up are the ages of my Adult readers. We collect readers ages up to age 20, but all other adult readers are listed as “21+”. How do I amend the COUNTIFS formula to scrape “19,” “20,” and “21+” from my Age column? A link to my sample is below. Sample Reader Participation Report.xlsx Read More
Newly added staff not being sent activation email
Having an issue where staff are being added to an existing booking page, but they aren’t receiving the activation email to confirm being added to the Booking page. As a result, they remain ‘not bookable’ – we have a need to add some staff as Administrators, but can’t confirm their access because they don’t receive the email when they are initially added (even though the Bookings dialogue suggests that one has been sent) and when I try to re-send the activation email, nothing changes – the time and date doesn’t update, and no email is received by the user, so it seems like the system hasn’t even tried to send an email out to the user:
It’s interesting to note, that users with existing access can have an email re-sent to them – is there a permissioning issue at play here? All our users should already have the required access (as existing users were added with no issue earlier this year), so I’m not sure what to look at first.
Any helps is greatly appreciated.
Kind regards,
Peter
Having an issue where staff are being added to an existing booking page, but they aren’t receiving the activation email to confirm being added to the Booking page. As a result, they remain ‘not bookable’ – we have a need to add some staff as Administrators, but can’t confirm their access because they don’t receive the email when they are initially added (even though the Bookings dialogue suggests that one has been sent) and when I try to re-send the activation email, nothing changes – the time and date doesn’t update, and no email is received by the user, so it seems like the system hasn’t even tried to send an email out to the user: It’s interesting to note, that users with existing access can have an email re-sent to them – is there a permissioning issue at play here? All our users should already have the required access (as existing users were added with no issue earlier this year), so I’m not sure what to look at first. Any helps is greatly appreciated. Kind regards,Peter Read More
How to set legend marker size
How do I change the marker size on the legend ? I can change the font size but not marker.
l = legend(‘Orientation’, ‘Horizontal’, ‘RNN (Ours)’, ‘SLIC’, ‘SEEDS’, ‘LSC’, ‘ERS’, ‘FH’);
l.FontSize = 20;
%l.MarkerSize = 20; does not work
%l.markersize = 20; does not work
set(l,’Position’, [0.4 0 0.2 0.2], ‘Units’, ‘normalized’);
%set(l,’MarkerSize’, 20); does not workHow do I change the marker size on the legend ? I can change the font size but not marker.
l = legend(‘Orientation’, ‘Horizontal’, ‘RNN (Ours)’, ‘SLIC’, ‘SEEDS’, ‘LSC’, ‘ERS’, ‘FH’);
l.FontSize = 20;
%l.MarkerSize = 20; does not work
%l.markersize = 20; does not work
set(l,’Position’, [0.4 0 0.2 0.2], ‘Units’, ‘normalized’);
%set(l,’MarkerSize’, 20); does not work How do I change the marker size on the legend ? I can change the font size but not marker.
l = legend(‘Orientation’, ‘Horizontal’, ‘RNN (Ours)’, ‘SLIC’, ‘SEEDS’, ‘LSC’, ‘ERS’, ‘FH’);
l.FontSize = 20;
%l.MarkerSize = 20; does not work
%l.markersize = 20; does not work
set(l,’Position’, [0.4 0 0.2 0.2], ‘Units’, ‘normalized’);
%set(l,’MarkerSize’, 20); does not work plot, legend, markersize MATLAB Answers — New Questions
NVIDIA Jetson setup issue: coder.checkGpuInstall can’t find nvcc
I am trying to use the GPU coder to send converted code to my Jetson Orin Nano. However, when I use the coder.checkGpuInstall command, it says that it can’t find nvcc.
I followed the setup instructions with the variables here:
Documentation
and referenced the following questions before posting this one:
https://www.mathworks.com/matlabcentral/answers/506483-ncc-problem-in-jetson-nano
https://www.mathworks.com/matlabcentral/answers/2068206-checking-for-cuda-availability-on-the-target-checking-for-nvcc-in-the-target-system-path-war
This is a cropped version of my script:
if (boardName == "jetson")
if isempty(deviceAddress)
hwobj = jetson();
else
hwobj = jetson(deviceAddress,userName,password);
end
else
if isempty(deviceAddress)
hwobj = drive();
else
hwobj = drive(deviceAddress,userName,password);
end
end
if (boardName == "jetson")
envCfg = coder.gpuEnvConfig(‘jetson’);
else
envCfg = coder.gpuEnvConfig(‘drive’);
end
envCfg.BasicCodegen = 1;
envCfg.HardwareObject = hwobj;
coder.checkGpuInstall(envCfg);
and the output:
Checking for CUDA availability on the Target…
Checking for ‘nvcc’ in the target system path…
Checking for cuDNN library availability on the Target…
Checking for TensorRT library availability on the Target…
Checking for prerequisite libraries is complete.
Gathering hardware details…
Checking for third-party library availability on the Target…
Warning: Unable to find the SDL 1.2 library on the target.
> In nvidiaio.internal.checkForSdlLibs (line 14)
In nvidiaboard/checkAndGetHardwareConfig
In jetson
In gpu_jetson_setup (line 10)
Warning: Unable to find one of the packages "sox", "libsox-fmt-all" or "libsox-dev". Make sure to have installed these
packages on the target hardware using "apt-get". These are required for successful deployment of Audio File Read block
in Simulink.
> In nvidiaio.internal.checkSoXVersion (line 17)
In nvidiaboard/checkAndGetHardwareConfig
In jetson
In gpu_jetson_setup (line 10)
Warning: Unable to fetch information about GPU devices.
> In nvidiaio.internal.getGpuInfo (line 77)
In nvidiaboard/getGpuInfo
In nvidiaboard/checkAndGetHardwareConfig
In jetson
In gpu_jetson_setup (line 10)
Gathering hardware details is complete.
Board name : NVIDIA Jetson Orin Nano Developer Kit
CUDA Version : 12.2
cuDNN Version : 8.9
TensorRT Version : 8.6
GStreamer Version : 1.20.3
V4L2 Version : 1.22.1-2build1
SDL Version :
OpenCV Version : 4.8.0
Available Webcams :
Available GPUs :
Available Digital Pins : 7 11 12 13 15 16 18 19 21 22 23 24 26 29 31 32 33 35 36 37 38 40
Compatible GPU : FAILED (Unable to find GPU information. This is due to the missing of ‘nvcc’ on the system path. Update the ‘.bashrc’ script on the target to set up the required environment variables.)
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
Basic Code Generation : PASSED
In accordance with the setup guide, I updated both the .bashrc file (and /etc/environment file for good measure) on the jetson, I have pasted them below:
.bashrc excerpt:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don’t do anything
case $- in
*i*) ;;
*)
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export ARM_COMPUTELIB=$ARM_COMPUTELIB:/usr/local/arm_compute
return;;
esac
# don’t put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
/etc/environment:
PATH="/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
LANG="en_US.UTF-8"
LD_LIBRARY_PATH="/usr/local/cuda/lib64"
And to confirm, the jetson does show nvcc is installed correctly:
$ nvcc –version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:08:11_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0
Matlab version info:
MATLAB Version: 24.1.0.2628055 (R2024a) Update 4
Operating System: Linux 5.15.0-116-generic #126~20.04.1-Ubuntu SMP Mon Jul 1 15:40:07 UTC 2024 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Any help on this topic would be much appreciated. Thank you!I am trying to use the GPU coder to send converted code to my Jetson Orin Nano. However, when I use the coder.checkGpuInstall command, it says that it can’t find nvcc.
I followed the setup instructions with the variables here:
Documentation
and referenced the following questions before posting this one:
https://www.mathworks.com/matlabcentral/answers/506483-ncc-problem-in-jetson-nano
https://www.mathworks.com/matlabcentral/answers/2068206-checking-for-cuda-availability-on-the-target-checking-for-nvcc-in-the-target-system-path-war
This is a cropped version of my script:
if (boardName == "jetson")
if isempty(deviceAddress)
hwobj = jetson();
else
hwobj = jetson(deviceAddress,userName,password);
end
else
if isempty(deviceAddress)
hwobj = drive();
else
hwobj = drive(deviceAddress,userName,password);
end
end
if (boardName == "jetson")
envCfg = coder.gpuEnvConfig(‘jetson’);
else
envCfg = coder.gpuEnvConfig(‘drive’);
end
envCfg.BasicCodegen = 1;
envCfg.HardwareObject = hwobj;
coder.checkGpuInstall(envCfg);
and the output:
Checking for CUDA availability on the Target…
Checking for ‘nvcc’ in the target system path…
Checking for cuDNN library availability on the Target…
Checking for TensorRT library availability on the Target…
Checking for prerequisite libraries is complete.
Gathering hardware details…
Checking for third-party library availability on the Target…
Warning: Unable to find the SDL 1.2 library on the target.
> In nvidiaio.internal.checkForSdlLibs (line 14)
In nvidiaboard/checkAndGetHardwareConfig
In jetson
In gpu_jetson_setup (line 10)
Warning: Unable to find one of the packages "sox", "libsox-fmt-all" or "libsox-dev". Make sure to have installed these
packages on the target hardware using "apt-get". These are required for successful deployment of Audio File Read block
in Simulink.
> In nvidiaio.internal.checkSoXVersion (line 17)
In nvidiaboard/checkAndGetHardwareConfig
In jetson
In gpu_jetson_setup (line 10)
Warning: Unable to fetch information about GPU devices.
> In nvidiaio.internal.getGpuInfo (line 77)
In nvidiaboard/getGpuInfo
In nvidiaboard/checkAndGetHardwareConfig
In jetson
In gpu_jetson_setup (line 10)
Gathering hardware details is complete.
Board name : NVIDIA Jetson Orin Nano Developer Kit
CUDA Version : 12.2
cuDNN Version : 8.9
TensorRT Version : 8.6
GStreamer Version : 1.20.3
V4L2 Version : 1.22.1-2build1
SDL Version :
OpenCV Version : 4.8.0
Available Webcams :
Available GPUs :
Available Digital Pins : 7 11 12 13 15 16 18 19 21 22 23 24 26 29 31 32 33 35 36 37 38 40
Compatible GPU : FAILED (Unable to find GPU information. This is due to the missing of ‘nvcc’ on the system path. Update the ‘.bashrc’ script on the target to set up the required environment variables.)
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
Basic Code Generation : PASSED
In accordance with the setup guide, I updated both the .bashrc file (and /etc/environment file for good measure) on the jetson, I have pasted them below:
.bashrc excerpt:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don’t do anything
case $- in
*i*) ;;
*)
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export ARM_COMPUTELIB=$ARM_COMPUTELIB:/usr/local/arm_compute
return;;
esac
# don’t put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
/etc/environment:
PATH="/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
LANG="en_US.UTF-8"
LD_LIBRARY_PATH="/usr/local/cuda/lib64"
And to confirm, the jetson does show nvcc is installed correctly:
$ nvcc –version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:08:11_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0
Matlab version info:
MATLAB Version: 24.1.0.2628055 (R2024a) Update 4
Operating System: Linux 5.15.0-116-generic #126~20.04.1-Ubuntu SMP Mon Jul 1 15:40:07 UTC 2024 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Any help on this topic would be much appreciated. Thank you! I am trying to use the GPU coder to send converted code to my Jetson Orin Nano. However, when I use the coder.checkGpuInstall command, it says that it can’t find nvcc.
I followed the setup instructions with the variables here:
Documentation
and referenced the following questions before posting this one:
https://www.mathworks.com/matlabcentral/answers/506483-ncc-problem-in-jetson-nano
https://www.mathworks.com/matlabcentral/answers/2068206-checking-for-cuda-availability-on-the-target-checking-for-nvcc-in-the-target-system-path-war
This is a cropped version of my script:
if (boardName == "jetson")
if isempty(deviceAddress)
hwobj = jetson();
else
hwobj = jetson(deviceAddress,userName,password);
end
else
if isempty(deviceAddress)
hwobj = drive();
else
hwobj = drive(deviceAddress,userName,password);
end
end
if (boardName == "jetson")
envCfg = coder.gpuEnvConfig(‘jetson’);
else
envCfg = coder.gpuEnvConfig(‘drive’);
end
envCfg.BasicCodegen = 1;
envCfg.HardwareObject = hwobj;
coder.checkGpuInstall(envCfg);
and the output:
Checking for CUDA availability on the Target…
Checking for ‘nvcc’ in the target system path…
Checking for cuDNN library availability on the Target…
Checking for TensorRT library availability on the Target…
Checking for prerequisite libraries is complete.
Gathering hardware details…
Checking for third-party library availability on the Target…
Warning: Unable to find the SDL 1.2 library on the target.
> In nvidiaio.internal.checkForSdlLibs (line 14)
In nvidiaboard/checkAndGetHardwareConfig
In jetson
In gpu_jetson_setup (line 10)
Warning: Unable to find one of the packages "sox", "libsox-fmt-all" or "libsox-dev". Make sure to have installed these
packages on the target hardware using "apt-get". These are required for successful deployment of Audio File Read block
in Simulink.
> In nvidiaio.internal.checkSoXVersion (line 17)
In nvidiaboard/checkAndGetHardwareConfig
In jetson
In gpu_jetson_setup (line 10)
Warning: Unable to fetch information about GPU devices.
> In nvidiaio.internal.getGpuInfo (line 77)
In nvidiaboard/getGpuInfo
In nvidiaboard/checkAndGetHardwareConfig
In jetson
In gpu_jetson_setup (line 10)
Gathering hardware details is complete.
Board name : NVIDIA Jetson Orin Nano Developer Kit
CUDA Version : 12.2
cuDNN Version : 8.9
TensorRT Version : 8.6
GStreamer Version : 1.20.3
V4L2 Version : 1.22.1-2build1
SDL Version :
OpenCV Version : 4.8.0
Available Webcams :
Available GPUs :
Available Digital Pins : 7 11 12 13 15 16 18 19 21 22 23 24 26 29 31 32 33 35 36 37 38 40
Compatible GPU : FAILED (Unable to find GPU information. This is due to the missing of ‘nvcc’ on the system path. Update the ‘.bashrc’ script on the target to set up the required environment variables.)
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
Basic Code Generation : PASSED
In accordance with the setup guide, I updated both the .bashrc file (and /etc/environment file for good measure) on the jetson, I have pasted them below:
.bashrc excerpt:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don’t do anything
case $- in
*i*) ;;
*)
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export ARM_COMPUTELIB=$ARM_COMPUTELIB:/usr/local/arm_compute
return;;
esac
# don’t put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
/etc/environment:
PATH="/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
LANG="en_US.UTF-8"
LD_LIBRARY_PATH="/usr/local/cuda/lib64"
And to confirm, the jetson does show nvcc is installed correctly:
$ nvcc –version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:08:11_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0
Matlab version info:
MATLAB Version: 24.1.0.2628055 (R2024a) Update 4
Operating System: Linux 5.15.0-116-generic #126~20.04.1-Ubuntu SMP Mon Jul 1 15:40:07 UTC 2024 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Any help on this topic would be much appreciated. Thank you! gpu, nvidia, jetson, nvcc, cuda, error, env, matlab coder, embedded coder, hardware, gpu coder MATLAB Answers — New Questions
How to create an attention layer for deep learning networks?
Hello,
Can you please let me know how to create an attention layer for deep learning classification networks? I have a simple 1D convolutional neural network and I want to create a layer that focuses on special parts of a signal as an attention mechanism.
I have been working on the wav2vec MATLAB code recently, but the best I found is the multi-head attention manual calculation. Can we make it as a layer to be included for the trainNetwork function?
For example, this is my current network, which is from this example:
numFilters = 128;
filterSize = 5;
dropoutFactor = 0.005;
numBlocks = 4;
layer = sequenceInputLayer(numFeatures,Normalization="zerocenter",Name="input");
lgraph = layerGraph(layer);
outputName = layer.Name;
for i = 1:numBlocks
dilationFactor = 2^(i-1);
layers = [
convolution1dLayer(filterSize,numFilters,DilationFactor=dilationFactor,Padding="causal",Name="conv1_"+i)
layerNormalizationLayer
spatialDropoutLayer(dropoutFactor)
convolution1dLayer(filterSize,numFilters,DilationFactor=dilationFactor,Padding="causal")
layerNormalizationLayer
reluLayer
spatialDropoutLayer(dropoutFactor)
additionLayer(2,Name="add_"+i)];
% Add and connect layers.
lgraph = addLayers(lgraph,layers);
lgraph = connectLayers(lgraph,outputName,"conv1_"+i);
% Skip connection.
if i == 1
% Include convolution in first skip connection.
layer = convolution1dLayer(1,numFilters,Name="convSkip");
lgraph = addLayers(lgraph,layer);
lgraph = connectLayers(lgraph,outputName,"convSkip");
lgraph = connectLayers(lgraph,"convSkip","add_" + i + "/in2");
else
lgraph = connectLayers(lgraph,outputName,"add_" + i + "/in2");
end
% Update layer output name.
outputName = "add_" + i;
end
layers = [
globalMaxPooling1dLayer("Name",’gapl’)
fullyConnectedLayer(numClasses,Name="fc")
softmaxLayer
classificationLayer(‘Classes’,unique(Y_train),’ClassWeights’,weights)];
lgraph = addLayers(lgraph,layers);
lgraph = connectLayers(lgraph,outputName,"gapl");
I appreciate your help!
regards,
MohanadHello,
Can you please let me know how to create an attention layer for deep learning classification networks? I have a simple 1D convolutional neural network and I want to create a layer that focuses on special parts of a signal as an attention mechanism.
I have been working on the wav2vec MATLAB code recently, but the best I found is the multi-head attention manual calculation. Can we make it as a layer to be included for the trainNetwork function?
For example, this is my current network, which is from this example:
numFilters = 128;
filterSize = 5;
dropoutFactor = 0.005;
numBlocks = 4;
layer = sequenceInputLayer(numFeatures,Normalization="zerocenter",Name="input");
lgraph = layerGraph(layer);
outputName = layer.Name;
for i = 1:numBlocks
dilationFactor = 2^(i-1);
layers = [
convolution1dLayer(filterSize,numFilters,DilationFactor=dilationFactor,Padding="causal",Name="conv1_"+i)
layerNormalizationLayer
spatialDropoutLayer(dropoutFactor)
convolution1dLayer(filterSize,numFilters,DilationFactor=dilationFactor,Padding="causal")
layerNormalizationLayer
reluLayer
spatialDropoutLayer(dropoutFactor)
additionLayer(2,Name="add_"+i)];
% Add and connect layers.
lgraph = addLayers(lgraph,layers);
lgraph = connectLayers(lgraph,outputName,"conv1_"+i);
% Skip connection.
if i == 1
% Include convolution in first skip connection.
layer = convolution1dLayer(1,numFilters,Name="convSkip");
lgraph = addLayers(lgraph,layer);
lgraph = connectLayers(lgraph,outputName,"convSkip");
lgraph = connectLayers(lgraph,"convSkip","add_" + i + "/in2");
else
lgraph = connectLayers(lgraph,outputName,"add_" + i + "/in2");
end
% Update layer output name.
outputName = "add_" + i;
end
layers = [
globalMaxPooling1dLayer("Name",’gapl’)
fullyConnectedLayer(numClasses,Name="fc")
softmaxLayer
classificationLayer(‘Classes’,unique(Y_train),’ClassWeights’,weights)];
lgraph = addLayers(lgraph,layers);
lgraph = connectLayers(lgraph,outputName,"gapl");
I appreciate your help!
regards,
Mohanad Hello,
Can you please let me know how to create an attention layer for deep learning classification networks? I have a simple 1D convolutional neural network and I want to create a layer that focuses on special parts of a signal as an attention mechanism.
I have been working on the wav2vec MATLAB code recently, but the best I found is the multi-head attention manual calculation. Can we make it as a layer to be included for the trainNetwork function?
For example, this is my current network, which is from this example:
numFilters = 128;
filterSize = 5;
dropoutFactor = 0.005;
numBlocks = 4;
layer = sequenceInputLayer(numFeatures,Normalization="zerocenter",Name="input");
lgraph = layerGraph(layer);
outputName = layer.Name;
for i = 1:numBlocks
dilationFactor = 2^(i-1);
layers = [
convolution1dLayer(filterSize,numFilters,DilationFactor=dilationFactor,Padding="causal",Name="conv1_"+i)
layerNormalizationLayer
spatialDropoutLayer(dropoutFactor)
convolution1dLayer(filterSize,numFilters,DilationFactor=dilationFactor,Padding="causal")
layerNormalizationLayer
reluLayer
spatialDropoutLayer(dropoutFactor)
additionLayer(2,Name="add_"+i)];
% Add and connect layers.
lgraph = addLayers(lgraph,layers);
lgraph = connectLayers(lgraph,outputName,"conv1_"+i);
% Skip connection.
if i == 1
% Include convolution in first skip connection.
layer = convolution1dLayer(1,numFilters,Name="convSkip");
lgraph = addLayers(lgraph,layer);
lgraph = connectLayers(lgraph,outputName,"convSkip");
lgraph = connectLayers(lgraph,"convSkip","add_" + i + "/in2");
else
lgraph = connectLayers(lgraph,outputName,"add_" + i + "/in2");
end
% Update layer output name.
outputName = "add_" + i;
end
layers = [
globalMaxPooling1dLayer("Name",’gapl’)
fullyConnectedLayer(numClasses,Name="fc")
softmaxLayer
classificationLayer(‘Classes’,unique(Y_train),’ClassWeights’,weights)];
lgraph = addLayers(lgraph,layers);
lgraph = connectLayers(lgraph,outputName,"gapl");
I appreciate your help!
regards,
Mohanad deep learning, attention, cnn MATLAB Answers — New Questions
Dev Channel update to 128.0.2730.0 is live.
Hello Insiders! We released 128.0.2730.0 to the Dev channel! This includes numerous fixes. For more details on the changes, check out the highlights below.
Added Features:
Included an icon in the footer elements for autofill suggestions.
Improved Reliability:
Resolved an issue when signing into an AAD account would cause a crash on Android.
Resolved an issue where the browser crashes when playing YouTube videos after a restart.
Changed Behavior:
Resolved an issue where the UI overlapped during AAD login and after a successful sync under favorites.
Resolved an issue where the search button icon lacked sufficient contrast in high contrast mode.
Resolved an issue where, upon opening the same group in browser, all tabs initially load, but a few tabs subsequently disappear.
Fixed an issue where the buttons overlapped on screens with smaller resolutions, even when the browser was maximized.
Mac: Resolved an issue where the FRE page was skipped, and the browser was unresponsive on Mac and Mac Arm platforms upon launch.
Android:
Resolved an issue where the Sign-In page’s layout and color scheme were not consistent with other pages on android.
Resolved an issue where the Immersive Translate panel was displayed in the middle of the screen on android.
iOS:
Fixed an issue where the ‘Continue’ button was displayed in a lower position on the implicit sign-in page on iOS.
Fixed an issue where users were unable to rearrange or drag items using single-point mode on the All-menu page in iOS.
Resolved an issue where clicking ‘sync settings’ on the implicit sign-in page caused the account information to appear blank.
See an issue that you think might be a bug? Remember to send that directly through the in-app feedback by heading to the … menu > Help and feedback > Send feedback and include diagnostics so the team can investigate.
Thanks again for sending us feedback and helping us improve our Insider builds.
~Gouri
Hello Insiders! We released 128.0.2730.0 to the Dev channel! This includes numerous fixes. For more details on the changes, check out the highlights below.
Added Features:
Included an icon in the footer elements for autofill suggestions.
Improved Reliability:
Resolved an issue when signing into an AAD account would cause a crash on Android.
Resolved an issue where the browser crashes when playing YouTube videos after a restart.
Changed Behavior:
Resolved an issue where the UI overlapped during AAD login and after a successful sync under favorites.
Resolved an issue where the search button icon lacked sufficient contrast in high contrast mode.
Resolved an issue where, upon opening the same group in browser, all tabs initially load, but a few tabs subsequently disappear.
Fixed an issue where the buttons overlapped on screens with smaller resolutions, even when the browser was maximized.
Mac: Resolved an issue where the FRE page was skipped, and the browser was unresponsive on Mac and Mac Arm platforms upon launch.
Android:
Resolved an issue where the Sign-In page’s layout and color scheme were not consistent with other pages on android.
Resolved an issue where the Immersive Translate panel was displayed in the middle of the screen on android.
iOS:
Fixed an issue where the ‘Continue’ button was displayed in a lower position on the implicit sign-in page on iOS.
Fixed an issue where users were unable to rearrange or drag items using single-point mode on the All-menu page in iOS.
Resolved an issue where clicking ‘sync settings’ on the implicit sign-in page caused the account information to appear blank.
See an issue that you think might be a bug? Remember to send that directly through the in-app feedback by heading to the … menu > Help and feedback > Send feedback and include diagnostics so the team can investigate.
Thanks again for sending us feedback and helping us improve our Insider builds.
~Gouri Read More
Help with Powershell scripts to backup and restore printers
Hello all.
I’m rather new to PowerShell. I hope I’m not causing any grief here. I whipped together a proof of concept because I need to protect certain computers’ printing abilities as they are crucial to our business. I know I can use Print Migration to export and import the set of printers. I don’t know how to start Printer Migration giving it a destination of the UNC to the server, the current computer’s name. It does not seem to restore all the printers either.
I really would appreciate the ability to clone an existing printer to a new name and new IP address.
I wanted to see how far Perplexity.AI could take this. It made a start but then started forgetting requirements, re-writing whole scripts, and losing functionality already obtained.
My premise is that copying is backup, change, and restore. So I made Backup-SinglePrinter, Restore-SinglePrinter, and Copy-ExistingPrinter. A settings file is included. I expect that once backup-singleprinter and restore-singleprinter work, I could make a BackupPrinters and RestorePrinters to handle all existing printers.
One final thing is I would like to have the scripts locate each other by using the single settings file or by knowing the starting location of the first script.
Mike
Copy-ExistingPrinter.ps1
<#
.SYNOPSIS
Copies an existing printer to a new printer with a different name and a new IP address.
.DESCRIPTION
This script copies an existing printer by backing it up, modifying the backup,
and then restoring it with a new name and a new IP address.
.PARAMETER ExistingPrinterName
The name of the existing printer to copy from.
.PARAMETER NewPrinterName
The name of the new printer to create.
.EXAMPLE
.Copy-ExistingPrinter.ps1 -ExistingPrinterName “Printer1” -NewPrinterName “Printer2”
#>
param (
[Parameter(Mandatory=$true)]
[string]$ExistingPrinterName,
[Parameter(Mandatory=$true)]
[string]$NewPrinterName
)
# Import settings
$settingsPath = Join-Path $PSScriptRoot “settings.ps1”
if (Test-Path $settingsPath) {
. $settingsPath
} else {
Write-Error “Settings file not found at $settingsPath”
exit 1
}
# Verify that $BaseFolder is set in settings.ps1
if (-not $BaseFolder) {
Write-Error “BaseFolder is not set in settings.ps1”
exit 1
}
# Manually import required modules
$modulesToImport = @(
“Backup-SinglePrinter.psm1”,
“Restore-SinglePrinter.psm1”,
“Find-AvailableIPPort.psm1”,
“Get-PrinterExtendedConfig.psm1”
)
foreach ($module in $modulesToImport) {
$modulePath = Join-Path $BaseFolder $module
if (Test-Path $modulePath) {
Import-Module $modulePath -Force
Write-Host “Imported module: $module” -ForegroundColor Green
} else {
Write-Error “Module $module not found at $modulePath”
exit 1
}
}
# Verify that the functions are available
$requiredFunctions = @(“Backup-SinglePrinter”, “Restore-SinglePrinter”, “Find-AvailableIPPort”, “Get-PrinterExtendedConfig”)
foreach ($func in $requiredFunctions) {
if (-not (Get-Command -Name $func -ErrorAction SilentlyContinue)) {
Write-Error “Required function $func is not available.”
exit 1
} else {
Write-Host “Function $func is available.” -ForegroundColor Green
}
}
try {
# Create backup folder structure
$backupsFolder = Join-Path $BaseFolder “Backups”
$computerName = $env:COMPUTERNAME
$computerBackupFolder = Join-Path $backupsFolder $computerName
$driversFolder = Join-Path $computerBackupFolder “Drivers”
if (-not (Test-Path $computerBackupFolder)) {
New-Item -ItemType Directory -Path $computerBackupFolder -Force | Out-Null
}
if (-not (Test-Path $driversFolder)) {
New-Item -ItemType Directory -Path $driversFolder -Force | Out-Null
}
# Backup the existing printer
Write-Host “Backing up existing printer: $ExistingPrinterName” -ForegroundColor Cyan
$backupFileName = “$ExistingPrinterName.xml”
$backupFile = Join-Path $computerBackupFolder $backupFileName
$backupResult = Backup-SinglePrinter -PrinterName $ExistingPrinterName -BackupFile $backupFile
if (-not $backupResult) {
throw “Failed to backup the existing printer.”
}
# Get the IP address of the existing printer
$existingPrinter = Get-Printer -Name $ExistingPrinterName
$existingPort = Get-PrinterPort -Name $existingPrinter.PortName
$BaseIP = $existingPort.PrinterHostAddress
if ([string]::IsNullOrEmpty($BaseIP)) {
Write-Error “Unable to retrieve IP address for existing printer $ExistingPrinterName”
exit 1
}
Write-Host “Existing printer IP address: $BaseIP” -ForegroundColor Cyan
# Find an available IP port for the new printer
Write-Host “Finding an available IP port for the new printer” -ForegroundColor Cyan
$NewIPAddress = Find-AvailableIPPort -BaseIP $BaseIP
if ($NewIPAddress) {
Write-Host “Available IP port found: $NewIPAddress” -ForegroundColor Green
} else {
throw “No available IP address found.”
}
# Create a new port with the new IP address
$NewPortName = $NewIPAddress
Add-PrinterPort -Name $NewPortName -PrinterHostAddress $NewIPAddress
# Restore the modified backup as a new printer
Write-Host “Restoring modified backup as new printer: $NewPrinterName” -ForegroundColor Cyan
$restoreResult = Restore-SinglePrinter -BackupFile $backupFile -NewPrinterName $NewPrinterName -NewPortName $NewPortName
if ($restoreResult) {
Write-Host “Printer ‘$ExistingPrinterName’ successfully copied to ‘$NewPrinterName’ with IP $NewIPAddress.” -ForegroundColor Green
# Create a backup summary
$summaryFile = Join-Path $computerBackupFolder “BackupSummary.txt”
$summaryContent = @”
Backup performed on: $(Get-Date)
Original Printer: $ExistingPrinterName
New Printer: $NewPrinterName
New IP Address: $NewIPAddress
“@
Add-Content -Path $summaryFile -Value $summaryContent
} else {
throw “Failed to restore the new printer.”
}
}
catch {
Write-Error “An error occurred during the printer copying process: $_”
# Clean up the new printer if it was created
if (Get-Printer -Name $NewPrinterName -ErrorAction SilentlyContinue) {
Remove-Printer -Name $NewPrinterName -ErrorAction SilentlyContinue
}
# Clean up the new port if it was created
if ($NewPortName -and (Get-PrinterPort -Name $NewPortName -ErrorAction SilentlyContinue)) {
Remove-PrinterPort -Name $NewPortName -ErrorAction SilentlyContinue
}
}
# Script Version: 3.9
Backup-SinglePrinter.psm1
function Backup-SinglePrinter {
param (
[Parameter(Mandatory=$true)]
[string]$PrinterName,
[Parameter(Mandatory=$true)]
[string]$BackupFile
)
# Import settings
$settingsPath = Join-Path $PSScriptRoot “settings.ps1”
if (Test-Path $settingsPath) {
. $settingsPath
} else {
Write-Error “Settings file not found at $settingsPath”
return $false
}
# Import printer properties
$propertiesModulePath = Join-Path $BaseFolder “Get-PrinterExtendedConfig.psm1”
if (Test-Path $propertiesModulePath) {
Import-Module $propertiesModulePath -Force
} else {
Write-Error “Get-PrinterExtendedConfig module not found at $propertiesModulePath”
return $false
}
$computerName = $env:COMPUTERNAME
$computerBackupFolder = Join-Path $BackupsFolder $computerName
$driversFolder = Join-Path $computerBackupFolder “Drivers”
if (-not (Test-Path $computerBackupFolder)) {
New-Item -ItemType Directory -Path $computerBackupFolder -Force | Out-Null
}
if (-not (Test-Path $driversFolder)) {
New-Item -ItemType Directory -Path $driversFolder -Force | Out-Null
}
try {
$printer = Get-Printer -Name $PrinterName -Full
$printerConfig = Get-PrintConfiguration -PrinterName $PrinterName
$printerProperties = Get-PrinterProperty -PrinterName $PrinterName
$backupObject = @{
Printer = $printer
Configuration = $printerConfig
Properties = $printerProperties
IsShared = $printer.Shared
ShareName = $printer.ShareName
}
$backupObject | Export-Clixml -Path $BackupFile -Depth 10
# Backup driver files
$driverName = $printer.DriverName
$driverInfo = Get-PrinterDriver -Name $driverName
$driverPath = $driverInfo.InfPath
if ($driverPath) {
Copy-Item -Path $driverPath -Destination $driversFolder -Force
}
Write-Host “Printer ‘$PrinterName’ backed up successfully to $BackupFile”
return $true
}
catch {
Write-Error “Printer backup process failed: $_”
return $false
}
}
Export-ModuleMember -Function Backup-SinglePrinter
Restore-SinglePrinter.psm1
function Restore-SinglePrinter {
param (
[Parameter(Mandatory=$true)]
[string]$BackupFile,
[Parameter(Mandatory=$true)]
[string]$NewPrinterName,
[Parameter(Mandatory=$false)]
[string]$NewPortName
)
try {
$backupObject = Import-Clixml -Path $BackupFile
$printer = $backupObject.Printer
$printerConfig = $backupObject.Configuration
$printerProperties = $backupObject.Properties
# Import printer properties module
$propertiesModulePath = Join-Path $PSScriptRoot “Get-PrinterExtendedConfig.psm1”
if (Test-Path $propertiesModulePath) {
Import-Module $propertiesModulePath -Force
} else {
Write-Error “Get-PrinterExtendedConfig module not found at $propertiesModulePath”
return $false
}
$printerExtendedConfig = Get-PrinterExtendedConfig
# If NewPortName is not provided, use the original port
if (-not $NewPortName) {
$NewPortName = $printer.PortName
}
# Create or update the printer
if (Get-Printer -Name $NewPrinterName -ErrorAction SilentlyContinue) {
Set-Printer -Name $NewPrinterName -DriverName $printer.DriverName -PortName $NewPortName
} else {
Add-Printer -Name $NewPrinterName -DriverName $printer.DriverName -PortName $NewPortName
}
# Restore printer settings
$validPrinterParams = $printerExtendedConfig.PrinterProperties
$printerParams = @{}
foreach ($param in $validPrinterParams) {
if ($null -ne $printer.$param) {
$printerParams[$param] = $printer.$param
}
}
if ($printerParams.Count -gt 0) {
Set-Printer -Name $NewPrinterName @printerParams
}
# Restore configuration
$validConfigParams = $printerExtendedConfig.PrinterConfiguration
$configParams = @{}
foreach ($param in $validConfigParams) {
if ($null -ne $printerConfig.$param -and $printerConfig.$param -isnot [System.Management.Automation.PSMethod]) {
$configParams[$param] = $printerConfig.$param
}
}
if ($configParams.Count -gt 0) {
Set-PrintConfiguration -PrinterName $NewPrinterName @configParams
}
# Restore properties
foreach ($prop in $printerProperties) {
if (-not [string]::IsNullOrWhiteSpace($prop.Name) -and $null -ne $prop.Value) {
try {
Set-PrinterProperty -PrinterName $NewPrinterName -PropertyName $prop.Name -Value $prop.Value -ErrorAction Stop
} catch {
Write-Warning “Unable to set printer property $($prop.Name): $_”
}
}
}
# Restore sharing settings
if ($printer.Shared) {
Set-Printer -Name $NewPrinterName -Shared $true -ShareName $NewPrinterName
}
Write-Host “Printer ‘$NewPrinterName’ restored successfully from $BackupFile”
return $true
}
catch {
Write-Error “Printer restoration process failed: $_”
return $false
}
}
Export-ModuleMember -Function Restore-SinglePrinter
Settings.ps1
# settings.ps1
$BaseFolder = “\testserverdeveloperprinterBackup”
$BackupsFolder = Join-Path $BaseFolder “Backups”
Get-PrinterExtendedConfig.psm1 I hoped would be a single place to list all settings to capture. Maybe that is not needed.
function Get-PrinterExtendedConfig {
return @{
PrinterProperties = @(
‘Comment’,
‘Location’,
‘Shared’,
‘Published’
)
PrinterConfiguration = @(
‘Collate’,
‘Color’,
‘DuplexingMode’,
‘PaperSize’,
‘Orientation’
)
}
}
Export-ModuleMember -Function Get-PrinterExtendedConfig
Find-AvailablePort.psm1
# Find-AvailableIPPort.psm1
function Find-AvailableIPPort {
param (
[string]$BaseIP
)
$existingPorts = Get-PrinterPort | Where-Object { $_.Name -like “$BaseIP*” } | Select-Object -ExpandProperty Name
# If the base IP is not in use, return it
if ($BaseIP -notin $existingPorts) {
return $BaseIP
}
# Check for available ports with suffixes
for ($i = 1; $i -lt 100; $i++) {
$newIP = “${BaseIP}_$i”
if ($newIP -notin $existingPorts) {
return $newIP
}
}
# If no available port found, create a new one with the next available suffix
$maxSuffix = $existingPorts |
Where-Object { $_ -match “${BaseIP}_(d+)” } |
ForEach-Object { [int]($Matches[1]) } |
Measure-Object -Maximum |
Select-Object -ExpandProperty Maximum
return “${BaseIP}_$($maxSuffix + 1)”
}
Export-ModuleMember -Function Find-AvailableIPPort
Hello all. I’m rather new to PowerShell. I hope I’m not causing any grief here. I whipped together a proof of concept because I need to protect certain computers’ printing abilities as they are crucial to our business. I know I can use Print Migration to export and import the set of printers. I don’t know how to start Printer Migration giving it a destination of the UNC to the server, the current computer’s name. It does not seem to restore all the printers either. I really would appreciate the ability to clone an existing printer to a new name and new IP address. I wanted to see how far Perplexity.AI could take this. It made a start but then started forgetting requirements, re-writing whole scripts, and losing functionality already obtained. My premise is that copying is backup, change, and restore. So I made Backup-SinglePrinter, Restore-SinglePrinter, and Copy-ExistingPrinter. A settings file is included. I expect that once backup-singleprinter and restore-singleprinter work, I could make a BackupPrinters and RestorePrinters to handle all existing printers. One final thing is I would like to have the scripts locate each other by using the single settings file or by knowing the starting location of the first script. Mike Copy-ExistingPrinter.ps1 <#
.SYNOPSIS
Copies an existing printer to a new printer with a different name and a new IP address.
.DESCRIPTION
This script copies an existing printer by backing it up, modifying the backup,
and then restoring it with a new name and a new IP address.
.PARAMETER ExistingPrinterName
The name of the existing printer to copy from.
.PARAMETER NewPrinterName
The name of the new printer to create.
.EXAMPLE
.Copy-ExistingPrinter.ps1 -ExistingPrinterName “Printer1” -NewPrinterName “Printer2”
#>
param (
[Parameter(Mandatory=$true)]
[string]$ExistingPrinterName,
[Parameter(Mandatory=$true)]
[string]$NewPrinterName
)
# Import settings
$settingsPath = Join-Path $PSScriptRoot “settings.ps1”
if (Test-Path $settingsPath) {
. $settingsPath
} else {
Write-Error “Settings file not found at $settingsPath”
exit 1
}
# Verify that $BaseFolder is set in settings.ps1
if (-not $BaseFolder) {
Write-Error “BaseFolder is not set in settings.ps1”
exit 1
}
# Manually import required modules
$modulesToImport = @(
“Backup-SinglePrinter.psm1”,
“Restore-SinglePrinter.psm1”,
“Find-AvailableIPPort.psm1”,
“Get-PrinterExtendedConfig.psm1”
)
foreach ($module in $modulesToImport) {
$modulePath = Join-Path $BaseFolder $module
if (Test-Path $modulePath) {
Import-Module $modulePath -Force
Write-Host “Imported module: $module” -ForegroundColor Green
} else {
Write-Error “Module $module not found at $modulePath”
exit 1
}
}
# Verify that the functions are available
$requiredFunctions = @(“Backup-SinglePrinter”, “Restore-SinglePrinter”, “Find-AvailableIPPort”, “Get-PrinterExtendedConfig”)
foreach ($func in $requiredFunctions) {
if (-not (Get-Command -Name $func -ErrorAction SilentlyContinue)) {
Write-Error “Required function $func is not available.”
exit 1
} else {
Write-Host “Function $func is available.” -ForegroundColor Green
}
}
try {
# Create backup folder structure
$backupsFolder = Join-Path $BaseFolder “Backups”
$computerName = $env:COMPUTERNAME
$computerBackupFolder = Join-Path $backupsFolder $computerName
$driversFolder = Join-Path $computerBackupFolder “Drivers”
if (-not (Test-Path $computerBackupFolder)) {
New-Item -ItemType Directory -Path $computerBackupFolder -Force | Out-Null
}
if (-not (Test-Path $driversFolder)) {
New-Item -ItemType Directory -Path $driversFolder -Force | Out-Null
}
# Backup the existing printer
Write-Host “Backing up existing printer: $ExistingPrinterName” -ForegroundColor Cyan
$backupFileName = “$ExistingPrinterName.xml”
$backupFile = Join-Path $computerBackupFolder $backupFileName
$backupResult = Backup-SinglePrinter -PrinterName $ExistingPrinterName -BackupFile $backupFile
if (-not $backupResult) {
throw “Failed to backup the existing printer.”
}
# Get the IP address of the existing printer
$existingPrinter = Get-Printer -Name $ExistingPrinterName
$existingPort = Get-PrinterPort -Name $existingPrinter.PortName
$BaseIP = $existingPort.PrinterHostAddress
if ([string]::IsNullOrEmpty($BaseIP)) {
Write-Error “Unable to retrieve IP address for existing printer $ExistingPrinterName”
exit 1
}
Write-Host “Existing printer IP address: $BaseIP” -ForegroundColor Cyan
# Find an available IP port for the new printer
Write-Host “Finding an available IP port for the new printer” -ForegroundColor Cyan
$NewIPAddress = Find-AvailableIPPort -BaseIP $BaseIP
if ($NewIPAddress) {
Write-Host “Available IP port found: $NewIPAddress” -ForegroundColor Green
} else {
throw “No available IP address found.”
}
# Create a new port with the new IP address
$NewPortName = $NewIPAddress
Add-PrinterPort -Name $NewPortName -PrinterHostAddress $NewIPAddress
# Restore the modified backup as a new printer
Write-Host “Restoring modified backup as new printer: $NewPrinterName” -ForegroundColor Cyan
$restoreResult = Restore-SinglePrinter -BackupFile $backupFile -NewPrinterName $NewPrinterName -NewPortName $NewPortName
if ($restoreResult) {
Write-Host “Printer ‘$ExistingPrinterName’ successfully copied to ‘$NewPrinterName’ with IP $NewIPAddress.” -ForegroundColor Green
# Create a backup summary
$summaryFile = Join-Path $computerBackupFolder “BackupSummary.txt”
$summaryContent = @”
Backup performed on: $(Get-Date)
Original Printer: $ExistingPrinterName
New Printer: $NewPrinterName
New IP Address: $NewIPAddress
“@
Add-Content -Path $summaryFile -Value $summaryContent
} else {
throw “Failed to restore the new printer.”
}
}
catch {
Write-Error “An error occurred during the printer copying process: $_”
# Clean up the new printer if it was created
if (Get-Printer -Name $NewPrinterName -ErrorAction SilentlyContinue) {
Remove-Printer -Name $NewPrinterName -ErrorAction SilentlyContinue
}
# Clean up the new port if it was created
if ($NewPortName -and (Get-PrinterPort -Name $NewPortName -ErrorAction SilentlyContinue)) {
Remove-PrinterPort -Name $NewPortName -ErrorAction SilentlyContinue
}
}
# Script Version: 3.9 Backup-SinglePrinter.psm1 function Backup-SinglePrinter {
param (
[Parameter(Mandatory=$true)]
[string]$PrinterName,
[Parameter(Mandatory=$true)]
[string]$BackupFile
)
# Import settings
$settingsPath = Join-Path $PSScriptRoot “settings.ps1”
if (Test-Path $settingsPath) {
. $settingsPath
} else {
Write-Error “Settings file not found at $settingsPath”
return $false
}
# Import printer properties
$propertiesModulePath = Join-Path $BaseFolder “Get-PrinterExtendedConfig.psm1”
if (Test-Path $propertiesModulePath) {
Import-Module $propertiesModulePath -Force
} else {
Write-Error “Get-PrinterExtendedConfig module not found at $propertiesModulePath”
return $false
}
$computerName = $env:COMPUTERNAME
$computerBackupFolder = Join-Path $BackupsFolder $computerName
$driversFolder = Join-Path $computerBackupFolder “Drivers”
if (-not (Test-Path $computerBackupFolder)) {
New-Item -ItemType Directory -Path $computerBackupFolder -Force | Out-Null
}
if (-not (Test-Path $driversFolder)) {
New-Item -ItemType Directory -Path $driversFolder -Force | Out-Null
}
try {
$printer = Get-Printer -Name $PrinterName -Full
$printerConfig = Get-PrintConfiguration -PrinterName $PrinterName
$printerProperties = Get-PrinterProperty -PrinterName $PrinterName
$backupObject = @{
Printer = $printer
Configuration = $printerConfig
Properties = $printerProperties
IsShared = $printer.Shared
ShareName = $printer.ShareName
}
$backupObject | Export-Clixml -Path $BackupFile -Depth 10
# Backup driver files
$driverName = $printer.DriverName
$driverInfo = Get-PrinterDriver -Name $driverName
$driverPath = $driverInfo.InfPath
if ($driverPath) {
Copy-Item -Path $driverPath -Destination $driversFolder -Force
}
Write-Host “Printer ‘$PrinterName’ backed up successfully to $BackupFile”
return $true
}
catch {
Write-Error “Printer backup process failed: $_”
return $false
}
}
Export-ModuleMember -Function Backup-SinglePrinter Restore-SinglePrinter.psm1 function Restore-SinglePrinter {
param (
[Parameter(Mandatory=$true)]
[string]$BackupFile,
[Parameter(Mandatory=$true)]
[string]$NewPrinterName,
[Parameter(Mandatory=$false)]
[string]$NewPortName
)
try {
$backupObject = Import-Clixml -Path $BackupFile
$printer = $backupObject.Printer
$printerConfig = $backupObject.Configuration
$printerProperties = $backupObject.Properties
# Import printer properties module
$propertiesModulePath = Join-Path $PSScriptRoot “Get-PrinterExtendedConfig.psm1”
if (Test-Path $propertiesModulePath) {
Import-Module $propertiesModulePath -Force
} else {
Write-Error “Get-PrinterExtendedConfig module not found at $propertiesModulePath”
return $false
}
$printerExtendedConfig = Get-PrinterExtendedConfig
# If NewPortName is not provided, use the original port
if (-not $NewPortName) {
$NewPortName = $printer.PortName
}
# Create or update the printer
if (Get-Printer -Name $NewPrinterName -ErrorAction SilentlyContinue) {
Set-Printer -Name $NewPrinterName -DriverName $printer.DriverName -PortName $NewPortName
} else {
Add-Printer -Name $NewPrinterName -DriverName $printer.DriverName -PortName $NewPortName
}
# Restore printer settings
$validPrinterParams = $printerExtendedConfig.PrinterProperties
$printerParams = @{}
foreach ($param in $validPrinterParams) {
if ($null -ne $printer.$param) {
$printerParams[$param] = $printer.$param
}
}
if ($printerParams.Count -gt 0) {
Set-Printer -Name $NewPrinterName @printerParams
}
# Restore configuration
$validConfigParams = $printerExtendedConfig.PrinterConfiguration
$configParams = @{}
foreach ($param in $validConfigParams) {
if ($null -ne $printerConfig.$param -and $printerConfig.$param -isnot [System.Management.Automation.PSMethod]) {
$configParams[$param] = $printerConfig.$param
}
}
if ($configParams.Count -gt 0) {
Set-PrintConfiguration -PrinterName $NewPrinterName @configParams
}
# Restore properties
foreach ($prop in $printerProperties) {
if (-not [string]::IsNullOrWhiteSpace($prop.Name) -and $null -ne $prop.Value) {
try {
Set-PrinterProperty -PrinterName $NewPrinterName -PropertyName $prop.Name -Value $prop.Value -ErrorAction Stop
} catch {
Write-Warning “Unable to set printer property $($prop.Name): $_”
}
}
}
# Restore sharing settings
if ($printer.Shared) {
Set-Printer -Name $NewPrinterName -Shared $true -ShareName $NewPrinterName
}
Write-Host “Printer ‘$NewPrinterName’ restored successfully from $BackupFile”
return $true
}
catch {
Write-Error “Printer restoration process failed: $_”
return $false
}
}
Export-ModuleMember -Function Restore-SinglePrinter Settings.ps1 # settings.ps1
$BaseFolder = “\testserverdeveloperprinterBackup”
$BackupsFolder = Join-Path $BaseFolder “Backups” Get-PrinterExtendedConfig.psm1 I hoped would be a single place to list all settings to capture. Maybe that is not needed. function Get-PrinterExtendedConfig {
return @{
PrinterProperties = @(
‘Comment’,
‘Location’,
‘Shared’,
‘Published’
)
PrinterConfiguration = @(
‘Collate’,
‘Color’,
‘DuplexingMode’,
‘PaperSize’,
‘Orientation’
)
}
}
Export-ModuleMember -Function Get-PrinterExtendedConfig Find-AvailablePort.psm1 # Find-AvailableIPPort.psm1
function Find-AvailableIPPort {
param (
[string]$BaseIP
)
$existingPorts = Get-PrinterPort | Where-Object { $_.Name -like “$BaseIP*” } | Select-Object -ExpandProperty Name
# If the base IP is not in use, return it
if ($BaseIP -notin $existingPorts) {
return $BaseIP
}
# Check for available ports with suffixes
for ($i = 1; $i -lt 100; $i++) {
$newIP = “${BaseIP}_$i”
if ($newIP -notin $existingPorts) {
return $newIP
}
}
# If no available port found, create a new one with the next available suffix
$maxSuffix = $existingPorts |
Where-Object { $_ -match “${BaseIP}_(d+)” } |
ForEach-Object { [int]($Matches[1]) } |
Measure-Object -Maximum |
Select-Object -ExpandProperty Maximum
return “${BaseIP}_$($maxSuffix + 1)”
}
Export-ModuleMember -Function Find-AvailableIPPort Read More
New Blog | Now available: Modernize your SAP environment with Microsoft Entra ID
Building on our joint announcement with SAP earlier this year, we have now released guidance to help customers modernize their SAP environment and move their identity management scenarios from SAP Identity Management (SAP IDM) to Entra ID. With this documentation, SAP IDM customers can migrate seamlessly to the cloud-based IAM and identify the right partners that can assist.
In February, SAP announced that the on-premises tool for managing identity would reach end-of-maintenance by 2030. We are honored that SAP has recommended Microsoft Entra ID, our cloud-based identity and access management solution, to facilitate a seamless migration and ongoing enterprise-wide identity and access management.
Read the full post here: Now available: Modernize your SAP environment with Microsoft Entra ID
By Melanie Maynes
Building on our joint announcement with SAP earlier this year, we have now released guidance to help customers modernize their SAP environment and move their identity management scenarios from SAP Identity Management (SAP IDM) to Entra ID. With this documentation, SAP IDM customers can migrate seamlessly to the cloud-based IAM and identify the right partners that can assist.
In February, SAP announced that the on-premises tool for managing identity would reach end-of-maintenance by 2030. We are honored that SAP has recommended Microsoft Entra ID, our cloud-based identity and access management solution, to facilitate a seamless migration and ongoing enterprise-wide identity and access management.
Read the full post here: Now available: Modernize your SAP environment with Microsoft Entra ID Read More
What part of this training and testing steps need(s) to be modified to get the correct missing rate?
I got missing rate = 1 with this attached code, but my class’s auto grading system says it’s incorrect.
What part of this training and testing steps need(s) to be modified to get the correct missing rate?
[Current Code]
load("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 4WoodKnotsGroundTruth.mat");
testPath = overwriteGTruthLocations(gTruthTrain);
imageLabeler(gTruthTrain)
imageLabeler(testPath)
load("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 4WoodKnotsGroundTruthTest2.mat");
imdsTest = imageDatastore(testPath);
gTruth.LabelDefinitions
gTruth.DataSource
gTruth.LabelData
objectTrainingData = objectDetectorTrainingData(gTruthTrain)
acfDetector = trainACFObjectDetector(objectTrainingData)
imdsTest = imageDatastore(testPath)
bboxes = detect(acfDetector,imdsTest)
evaluateDetectionMissRate(bboxes,gTruthTest.LabelData)I got missing rate = 1 with this attached code, but my class’s auto grading system says it’s incorrect.
What part of this training and testing steps need(s) to be modified to get the correct missing rate?
[Current Code]
load("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 4WoodKnotsGroundTruth.mat");
testPath = overwriteGTruthLocations(gTruthTrain);
imageLabeler(gTruthTrain)
imageLabeler(testPath)
load("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 4WoodKnotsGroundTruthTest2.mat");
imdsTest = imageDatastore(testPath);
gTruth.LabelDefinitions
gTruth.DataSource
gTruth.LabelData
objectTrainingData = objectDetectorTrainingData(gTruthTrain)
acfDetector = trainACFObjectDetector(objectTrainingData)
imdsTest = imageDatastore(testPath)
bboxes = detect(acfDetector,imdsTest)
evaluateDetectionMissRate(bboxes,gTruthTest.LabelData) I got missing rate = 1 with this attached code, but my class’s auto grading system says it’s incorrect.
What part of this training and testing steps need(s) to be modified to get the correct missing rate?
[Current Code]
load("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 4WoodKnotsGroundTruth.mat");
testPath = overwriteGTruthLocations(gTruthTrain);
imageLabeler(gTruthTrain)
imageLabeler(testPath)
load("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 4WoodKnotsGroundTruthTest2.mat");
imdsTest = imageDatastore(testPath);
gTruth.LabelDefinitions
gTruth.DataSource
gTruth.LabelData
objectTrainingData = objectDetectorTrainingData(gTruthTrain)
acfDetector = trainACFObjectDetector(objectTrainingData)
imdsTest = imageDatastore(testPath)
bboxes = detect(acfDetector,imdsTest)
evaluateDetectionMissRate(bboxes,gTruthTest.LabelData) matlab, machine learning, testing, training, image labeling MATLAB Answers — New Questions
What is QuickBookꜱ Error 15106 and How to Fix it?
Upon accessing the client’s system remotely, I noted that the error 15106 was indeed preventing QuickBookꜱ from updating to the latest version. The error message indicated a problem with the update program, suggesting that the update couldn’t be initialized due to either a permissions issue or an interference from a third-party application
Upon accessing the client’s system remotely, I noted that the error 15106 was indeed preventing QuickBookꜱ from updating to the latest version. The error message indicated a problem with the update program, suggesting that the update couldn’t be initialized due to either a permissions issue or an interference from a third-party application Read More
Quad Buffer support for RDP
Hello,
Would it be possible to get a change made to RDP that would allow more than 1 buffer from a GPU to be sent the remote desktop client?
Currently it is not possible to use Server with GPU (with quad-buffer ON) via RDP. This would have broad commercial appeal for mapping, gnome research, chemical engineering, CAD, Automotive and other industries.
Hello, Would it be possible to get a change made to RDP that would allow more than 1 buffer from a GPU to be sent the remote desktop client?Currently it is not possible to use Server with GPU (with quad-buffer ON) via RDP. This would have broad commercial appeal for mapping, gnome research, chemical engineering, CAD, Automotive and other industries. Read More
Houston Chapter Meeting Aug 22nd – Join online or in person!
You’re invited to join us in-person or virtually on August 22!
IAMCP‘s TOLA Chapter (Texas, Oklahoma, Louisiana, Arkansas) rotates monthly and hosts chapter meetings in Austin, Houston and Dallas. All meetings are hybrid and anyone is welcome to attend, no matter where you are!
We’ll be talking about the FY25 updates, announcements and partner program changes. Come ask your partner questions as you navigate FY25 as a Microsoft partner!
Join us online or in-person (lunch included) in Houston at the Microsoft office –
750 Town and Country Blvd., Ste. 1000
Houston, Texas 77024
11:30am-1:00pm CST
You’re invited to join us in-person or virtually on August 22! IAMCP’s TOLA Chapter (Texas, Oklahoma, Louisiana, Arkansas) rotates monthly and hosts chapter meetings in Austin, Houston and Dallas. All meetings are hybrid and anyone is welcome to attend, no matter where you are! We’ll be talking about the FY25 updates, announcements and partner program changes. Come ask your partner questions as you navigate FY25 as a Microsoft partner! Join us online or in-person (lunch included) in Houston at the Microsoft office – 750 Town and Country Blvd., Ste. 1000Houston, Texas 7702411:30am-1:00pm CST Register Here > Read More
Talking about FY25 changes in Houston and online, August 22
You’re invited to join us in-person or virtually on August 22!
IAMCP‘s TOLA Chapter (Texas, Oklahoma, Louisiana, Arkansas) rotates monthly and hosts chapter meetings in Austin, Houston and Dallas. All meetings are hybrid and anyone is welcome to attend, no matter where you are!
We’ll be talking about the FY25 updates, announcements and partner program changes. Come ask your partner questions as you navigate FY25 as a Microsoft partner! I know many of us are excited about the new additions to the partner benefits, including over 20 new SKUs that were teased in July.
Join us online or in-person (lunch included) in Houston at the Microsoft office –
750 Town and Country Blvd., Ste. 1000
Houston, Texas 77024
11:30am-1:00pm CST
Not a member of IAMCP? You can attend for $30 or, as a new member, join for $1 for your first 90 days!
I myself have been a member of IAMCP for about 2+ years and I’m the Secretary of the Houston chapter. There are plenty of other virtual meetings every month covering all topics concerning partners. It’s a great way to understand the ecosystem, how to gain designations and credentials, and find partner to partner opportunities.
You’re invited to join us in-person or virtually on August 22! IAMCP’s TOLA Chapter (Texas, Oklahoma, Louisiana, Arkansas) rotates monthly and hosts chapter meetings in Austin, Houston and Dallas. All meetings are hybrid and anyone is welcome to attend, no matter where you are! We’ll be talking about the FY25 updates, announcements and partner program changes. Come ask your partner questions as you navigate FY25 as a Microsoft partner! I know many of us are excited about the new additions to the partner benefits, including over 20 new SKUs that were teased in July. Join us online or in-person (lunch included) in Houston at the Microsoft office – 750 Town and Country Blvd., Ste. 1000Houston, Texas 7702411:30am-1:00pm CST Register Here > Not a member of IAMCP? You can attend for $30 or, as a new member, join for $1 for your first 90 days! I myself have been a member of IAMCP for about 2+ years and I’m the Secretary of the Houston chapter. There are plenty of other virtual meetings every month covering all topics concerning partners. It’s a great way to understand the ecosystem, how to gain designations and credentials, and find partner to partner opportunities. Read More
Ready for FY25? Join us in Houston or online August 22nd for the next IAMCP TOLA meeting
IAMCP‘s TOLA Chapter (Texas, Oklahoma, Louisiana, Arkansas) rotates monthly and hosts chapter meetings in Austin, Houston and Dallas. All meetings are hybrid and anyone is welcome to attend, no matter where you are!
We’ll be talking about the FY25 updates, announcements and partner program changes. Come ask your partner questions as you navigate FY25 as a Microsoft partner! I know many of us are excited about the new additions to the partner benefits, including over 20 new SKUs that were teased in July.
Join us online or in-person (lunch included) in Houston at the Microsoft office –
750 Town and Country Blvd., Ste. 1000
Houston, Texas 77024
11:30am-1:00pm CST
Not a member of IAMCP? You can attend for $30 or, as a new member, join for $1 for your first 90 days!
I myself have been a member of IAMCP for about 2+ years and I’m the Secretary of the Houston chapter. There are plenty of other virtual meetings every month covering all topics concerning partners. It’s a great way to understand the ecosystem, how to gain designations and credentials, and find partner to partner opportunities.
You’re invited to join us in-person or virtually on August 22! IAMCP’s TOLA Chapter (Texas, Oklahoma, Louisiana, Arkansas) rotates monthly and hosts chapter meetings in Austin, Houston and Dallas. All meetings are hybrid and anyone is welcome to attend, no matter where you are! We’ll be talking about the FY25 updates, announcements and partner program changes. Come ask your partner questions as you navigate FY25 as a Microsoft partner! I know many of us are excited about the new additions to the partner benefits, including over 20 new SKUs that were teased in July. Join us online or in-person (lunch included) in Houston at the Microsoft office – 750 Town and Country Blvd., Ste. 1000Houston, Texas 7702411:30am-1:00pm CST Register Here > Not a member of IAMCP? You can attend for $30 or, as a new member, join for $1 for your first 90 days! I myself have been a member of IAMCP for about 2+ years and I’m the Secretary of the Houston chapter. There are plenty of other virtual meetings every month covering all topics concerning partners. It’s a great way to understand the ecosystem, how to gain designations and credentials, and find partner to partner opportunities. Read More