text:
Q: Approach to get rid of controller GET-actions that just return view in ASP.NET MVC Most of actions in controllers of a project simply return corresponding view:
public ActionResult Index()
{
    return View();
}

I wonder is there any approach to get rid of such GET-actions and map url directly to view?
For example: '/home/index' renders view '~/Views/Home/Index.cshtml'
Sample code of solution suggested by Chaim Brykman (@haim770): https://github.com/artplastika/ViewWithoutControllerDemo

A: Create a ViewRenderer action in some Controller:
public ViewResult ViewRenderer(string viewPath)
{
    var extractedPath = viewPath.Split('/');

    this.ControllerContext.RouteData.Values["controller"] = extractedPath[0];
    this.ControllerContext.RouteData.Values["action"] = extractedPath[1];

    return View();
}

Then, in your RoutesConfig, add the following route before the default (last) route, changing the Controller name appropriately:
// Views Renderer
routes.MapRoute(
    name: "ViewsRenderer",
    url: "Static/{*viewPath}",
    defaults: new { controller = "Common", action = "ViewRenderer" }
);

The URL would be:
http://your_host_name/Static/Home/Index

(You can change 'Static' to whatever you like)
This is a very basic implementation and it does not take Areas into account (can be easily adjusted though). It also doesn't handle all the security implications that this change may introduce (depending on the nature of your application).

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to set up computer to boot from a network drive Not taking into account any specific computers.

*

*How do I set up a computer to boot from a network drive?

*How do I set up the network drive to allow itself to be booted from.

I am open to using either Windows Server or any Linux Server distro. Whichever is easier.
The images that I want to boot from on the network drive will be Windows images. The computer will basically become a thin client.
Update:
This is basically what I wanted to do, I just need to know how to do it.
Deploy an already created image of Windows 7 from Windows Server 2008 R2 over the network.
The Client will utilize the OS provided by the server, but all the resources will be used locally such as CPU and RAM.
If it is easier to deploy the image from Linux then Windows, then I will use that instead.

A: Network booting is different than booting off of a hard drive, and you can't really directly boot off of a Windows network share.
The computer you want to boot off the network must support PXE, which most do nowadays.  PXE kicks in when you turn the computer on and fetches an address from a DHCP server.  The DHCP server must also be configured with an option that tells it where to go to get a bootloader.  That bootloader is then fetched using tftp.  You must also be running a tftpd server which hosts that bootloader.
Tftpd32 is a nice Windows program that can act as both a DHCP and TFTP server if you want something to experiment with.
The bootloader is then responsible for loading and launching the OS.  That bootloader must have the capability of initializing a "network-drive" aware OS.  Linux supports running straight off of a mounted NFS drive, but Windows doesn't really support that as far as I know.  With Windows, you had Remote Installation Services (RIS) and now, Windows Deployment Services.  These are minimal environments that are designed to support remote imaging and reinstallation, so I don't know how it would go as far as just running an OS off of a network share.  (If I find additional information shortly I'll edit this).

A: If I understand this correctly, you want a system where a server sends a packaged OS to a local machine each time the system boots up. You don't want a thin client since all processing needs to happen on the local machine and not a server. You don't want a traditional OS since that will write files to the local hard drive.
What it should like you want is the windows equivalent of a network hosted Linux live CD. While there are solutions that perform this action, they are geared towards system administrators who want to fix problems. Each one is setup slightly differently so check out the products website for more info. (source)
As for a network environment of a windows 7 workstation, that does not exist yet. The only licensing models I know of are as follows:

*

*Windows Home / Pro / Enterprise - Local install

*Windows Thin Client - Remote terminals that connect to a server.

*Windows embedded - Special Kiosk installs that have the OS on local hardware.

This is all based off assumptions made when reading your question. I apologize in advance if this doesn't apply to your situation.
[EDIT]
My recommendation based on the comment that this is a home environment is to just use a traditional installation on local hard drives. There are a lot of tools to do automated deployments, maintenance, and management. Most software has silent installation methods that can allow you to bring back a dead system with only a few minutes of interaction and a few hours of processing time.
Treat the computers as if they were in a small business and you'll find a lot of tools out there to make supporting the environment easier.
[END EDIT]

A: The ability to do this used to exist under DOS/Win3.x
Supposedly it was possible under Win 95 as well. However, performance even with DOS was horrific. You would turn on the computer and go eat breakfast while you waited for your login prompt to appear. And that was across IPX/SPX which was faster than TCP/IP at the time.


text:
Q: How do I get rid of switching noise from these types of DCDC converters? I am using a lot of these types of isolated DCDC converters for measurement circuits.
The problem is they introduce so much switching noise. I try to put filters on the output and even put the recommended 220 µH and 0.22 µF filter on from that datasheet but the noise is always there!
How do I get rid of noise from this type of DCDC? It is really annoying. There is always this short period of ringing and oscillation happening at like 50 kHz or 100 kHz (presumably at the switching frequency of that particular DCDC) of up to 20mV sometimes and this destroys my measurements unless I take averages.
DCDCs like these ones are even more noise, 100mVp-p!
Noise looks like the yellow waveform here (not my image):

A: 1st one must follow the datasheet Test methods for proper noise measurement.
C1,C2 supplement the ripple rejection to meet specs under the conditions given.
C3 and R1 present a 500 Ohm load impedance with R2 (50 Ohm) to reduce the level 10:1.
T1 is a common-mode choke made of 3 turns of coax cable thru a ferrite torroid to raise the CM "Transfer Impedance" of coax where some types are better at shielding UHF better than others.

Then Output Ripple Reduction guidelines are also stated in the datasheet about ESR.
Note that "general purpose" electrolytic caps have an ESR *C time constant in the range of 200us which is far too high while low ESR caps are in the 1us range.
To reduce noise above this BW of 350kHz which is well above the regulator loop regulator bandwidth, one must use film or low ESR type ceramic SMD caps with rated ESR or S parameters and again not cheap no-spec any old ceramic caps.
Parameters of importance in traces, capacitors and inductive power leads are all derived from low ratios of path length to width ratio or L/W ratio. This is in order to reduce series inductance or ESL and raise path capacitance to ground.
The RLC Q factor that controls resonant gain from impulse loads is based on the ratio of X(f) /R = Qs and R/X(f)=Qp for series and parallel resonance respectively. Thus very high L/C switched loads require a computed series R to control the Q factor to minimize it without excessive R losses.
Decoupling step loads from the source to reduce ripple requires awareness this RLC equivalent circuit and the step response, the radiation loop area of interference, and load regulation effects on the supply.
The regulator can often only regulate noise up to 50kHz and relies on the brute force low ESR caps to absorb load transients above this frequency.
Final Reminder
Just remember the Test Engineer methods shown above are the best practice needed to ensure error capturing the DC + AC ripple power signals avoid false measurements.
When not readily available even a good 10:1 prove with no ground leads using only tip and ring may do for a start and wrap the coax into a coil with clamshell snap ferrite CM choke will improve accuracy of results with < 20ns rise times.


text:
Q: Same string, but var_dump shows weird data I have a variable $username that I substring from a url string, which I get from a file.
This is the output of var_dump($username):
"tring(18) "honorablevacuum87

if I set $username = "honorablevacuum87" and I var_dump it, I get:
string(17) "honorablevacuum87"

What is the problem. I am getting insane over this.

A: The problem is that you have opened the file in binary mode instead of text mode, which means that no end-of-line translation is happening.
$fp = fopen('foo.txt', 'rt');


text:
Q: Echo text based off of dynamic dropdown I am using Magento and using Custom Options. I have 5 custom options that allow the user to choose the condition of the item. I want some text below to show what the condition means when they select it.
Im sorry for the confusion. I want this to update live on the screen when the appropriate option is selected.
Here is my current code but it isn't displaying the text.
    <select name="options[1][]" id="select_1" class="multiselect required-entry product-custom-option" title=""  onchange="opConfig.reloadPrice()">
<option value="1"  price="0" >Perfect </option>
<option value="2"  price="-35" >Excellent </option>
<option value="3"  price="-105" >Good </option>
<option value="4"  price="-140" >Poor </option>
<option value="5"  price="-252" >Broken </option></select>

   <?php if( $_POST['select_1']=='1' ){
                echo "Perfect Condition Text";

                }elseif( $_POST['select_1']=='2' ){
                echo "Excellent Condition Text";

                }elseif( $_POST['select_1']=='3' ){
                echo "Good Condition Text";

                }elseif( $_POST['select_1']=='4' ){
                echo "Poor Condition Text";

                }elseif( $_POST['select_1']=='5' ){
                echo "Broken Condition Text";

                } ?>

A: Changing the <select> name to select_1 will solve your problem:
<select name="select_1" id="select_1" class="multiselect required-entry product-custom-option" title=""  onchange="opConfig.reloadPrice()">

If you can't change the names for some reason, change $_POST['select_1'] to $_POST['options'][1][0]

A: If you want to display the value of the <select> without refreshing the page then you could use javascript or jquery. Here is a sample of Javascript:

<form name="formName">
    <select name="options[1][]" id="select_1" class="multiselect required-entry product-custom-option" title=""  onchange="displayCondition()">
        <option value="0">Select Condition</option>
        <option value="1"  price="0" >Perfect</option>
        <option value="2"  price="-35" >Excellent</option>
        <option value="3"  price="-105" >Good</option>
        <option value="4"  price="-140" >Poor</option>
        <option value="5"  price="-252" >Broken</option>
    </select>

</form>

A: The array will not be available in PHP $_POST by select_1 index but PHP $_POST is going to have an options array $_POST['options']

A: The post array name is based on the name of the form element, not the id of the form element. Change the name property of your select element to "select_1" and you will get what you are looking for.


text:
Q: Connected components in a variety of 2 known polynomials I am trying to calculate the homology of an algebraic variety of 2 known polynomial functions $f(x_1,\dots,x_n)$ and $g(x_1,\dots,x_n)$, where $g()$ specifically is a linear function. But I cannot seem to find out how to, if this is at all possible.
The goal is to determine the homology of the intersection, either by finding the amount of connected components, or finding all the betti numbers.
I've seen a few papers that discuss upper bounds on the betti numbers, but I'm yet to find one that describe a way of finding the exact values.


text:
Q: How do I create this complicated table?
Having a hard time creating this table in latex, any help would be appreciated.  Thank you!

A: Welcome! This is not a complicated table.
\documentclass{article}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|*7{c|}}
\hline
\multicolumn{7}{|c|}{Compression failure} \\
\hline
& \multicolumn{3}{|c|}{Group 1} & \multicolumn{3}{|c|}{Afternoon}\\
\hline
Test & Load & Stress & Pattern & Load & Stress & Pattern \\
\hline
 & [lb]& [psi] & & [lb]& [psi] & \\
\hline
 1 & $123,567$ & $123,567$ & $123,567$ & $123,567$ & $123,567$ & $123,567$\\
\hline
 2 & $123,567$ & $123,567$ & $123,567$ & $123,567$ & $123,567$ & $123,567$\\
\hline
 3 & $123,567$ & $123,567$ & $123,567$ & $123,567$ & $123,567$ & $123,567$\\
\hline
 Avg & $123,567$ & $123,567$ & $123,567$ & $123,567$ & $123,567$ & $123,567$\\
\hline
\end{tabular}
\end{table}
\end{document}

Obviously I had not the patience to punch in your data from the screen shot.
Notice that nowadays there is a trend to use bookmarks and less lines, in particular no vertical lines, to use siunitx to align the numbers at the period or comma and so on and so forth. I guess these are the first steps in rethinking the need of such tables completely, in an age in which data gets usually accessed and processed electronically. That is, if you really need such a table consider using e.g. pgfplotstable and typeset it automatically from some data file while computing the average and so on for you. Also, please do not post screen shots because this forces the one writing an answer punching in stuff from a screen shot.

A: It's not that difficult, actually. I fixed the units: they should be in parentheses like (lb), not in brackets like [lb].
Just remember that headers in S columns should be braced.
\documentclass{article}
\usepackage{siunitx}% for the numbers

\sisetup{output-decimal-marker={,}}

\begin{document}

\begin{table}[htp]
\centering

\caption{Summary of compressive strength, 7-day results}\label{A}

\medskip

\begin{tabular}{
  |c|
  S[table-format=3.3]|
  S[table-format=1.3]|
  c|
  S[table-format=2.3]|
  S[table-format=1.3]|
  c|
}
\hline
\multicolumn{7}{|c|}{Compressive failure} \\
\hline
& \multicolumn{3}{c|}{Group 1} & \multicolumn{3}{c|}{Afternoon} \\
\hline
Test & {Load} & {Stress} & {Pattern} & {Load} & {Stress} & {Pattern} \\
\hline
& {(lb)} & {(psi)}  &           & {(lb)} & {(psi)}  &           \\
\hline
%
1   & 101,522 & 3,525 & 2 & 85,667 & 3,063 & 2 \\
\hline
2   &  95,365 & 3,334 & 5 & 84,003 & 3,012 & 2 \\
\hline
3   &  90,759 & 3,253 & 2 & 87,969 & 3,152 & 2 \\
\hline
Avg &  95,881 & 3,371 &   & 85,879 & 3,075 &   \\
\hline
\end{tabular}

\end{table}

\end{document}

And now, for something completely different.

Please, compare the two outputs and choose.
\documentclass{article}
\usepackage{siunitx}% for the numbers
\usepackage{booktabs}% for the better table

\sisetup{output-decimal-marker={,}}

\begin{document}

\begin{table}[htp]
\centering

\caption{Summary of compressive strength, 7-day results}\label{A}

\medskip

\begin{tabular}{
  @{}
  c
  S[table-format=3.3]
  S[table-format=1.3]
  c
  S[table-format=2.3]
  S[table-format=1.3]
  c
  @{}
}
\toprule
\multicolumn{7}{c}{Compressive failure} \\
\midrule
Test & \multicolumn{3}{c}{Group 1} & \multicolumn{3}{c}{Afternoon} \\
\cmidrule(r){1-1} \cmidrule(lr){2-4} \cmidrule(l){5-7}
& {Load (lb)} & {Stress (psi)} & {Pattern} & {Load (lb)} & {Stress (psi)} & {Pattern} \\
\midrule
%
1   & 101,522 & 3,525 & 2 & 85,667 & 3,063 & 2 \\
2   &  95,365 & 3,334 & 5 & 84,003 & 3,012 & 2 \\
3   &  90,759 & 3,253 & 2 & 87,969 & 3,152 & 2 \\
\midrule
Avg &  95,881 & 3,371 &   & 85,879 & 3,075 &   \\
\bottomrule
\end{tabular}

\end{table}

\end{document}


text:
Q: How to concatenate an nsstring url How can I concatenate an NSString URL? For example:
http://isomewebsite.com/username=[someuservariable]&password=[somevariable]

A: Try with below code.
NSString* myURLString = [NSString stringWithFormat:@"somewebsite.com/username=%@&password=%@", myUserName,myPassword];
NSURL *url = [NSURL URLWithString:myURLString];

Here is the blog tutorial will help you know more about Handling url authentication challenges accessing password protected servers

A: You can use the method stringWithFormat of NSString:
NSString *url = [NSString stringWithFormat:@"somewebsite.com/username=%@&password=%@", someuservariable, some variable];

A: Try this excellent post - URL encoding an NSString on iOS


text:
Q: Why cant I install brightness-controller I have been having problems with adjusting the brightness.....it is at max (when I look at it, it is at max in the settings. By the way, I cant control it at all with the keyboard combination.)
I have decided to install this app, but it just wont work.....
Can someone confirm if it works at all? Or if I should at all?
https://apps.ubuntu.com/cat/applications/brightness-controller/

A: Install Brightness Controller with the following commands:
sudo add-apt-repository ppa:apandada1/brightness-controller
sudo apt-get update
sudo apt-get install brightness-controller

You can control brightness using its slider.

(source: ubuntu.com)


text:
Q: DXL doors : finding why a module is still open I use this loop at end of my script to detect if I have still modules open :
for module_in_database in database do
{
    logResult = logResult "INFO: open modules at the end the script are " fullName(module_in_database) "\n"
}

Then at the end of my (quite complex script), I still have those module open :
INFO: open modules at the end the script are /spec_fpga/spec_fpga
INFO: open modules at the end the script are /spec produit/spec_produit
INFO: open modules at the end the script are /spec produit/spec_produit
INFO: open modules at the end the script are /spec_fpga/_conf/OBJ_satisfies_OBJ
INFO: open modules at the end the script are /spec_fpga/_conf/OBJ_satisfies_OBJ

What could I do to close those and even better to understand why there are still open (identify the name of variable that are linked to them ?)
Is it normal to have a link module open ? I don't open such link module. Are they open automatically with the downstream module ?
I don't even know if it is a module that is open or a baseline of a module.

A: I am unsure why spec_produit and OBJ_satisfies_OBJ appear twice, one of spec_produit (formal module?) might be separate baselines, but for link modules like OBJ_satisfies_OBj, it is rare to have baselines.
You might get to know when your modules are opened by starting "Tools→Manage open modules" and regarding the list while your script runs. Perhaps you want to use a DXL Debugger for this.
Generally, link modules are opened automatically when a formal module that contains out links is opened, but usually they are closed again automatically when the formal module closes. Formal modules can be opened when they contain in links and an out link to this module is opened. You might have one module with a (default) view that follows all its out links. Or there might be a trigger or DXL attribute in a module that does something similar.
You might want to check isBaseline moduleVersion module_in_database and versionString moduleVersion module_in_database to get more information.
To close them, just use close module_in_database.
on a side note: in DXL it is never a good idea to close something that you currently loop over, so you want to use a temporary skip list like this:
Skip closeMe = create
for module_in_database in database do {
    logResult = logResult "INFO: currently open: " (fullName module_in_database) ((isBaseline (moduleVersion module_in_database)) ? " Baseline " (versionString moduleVersion module_in_database) : " (current version)") "\n"
    put (closeMe, module_in_database, module_in_database)
}
Module m
for m in closeMe do {
    if open (module m) then {
        logResult = logResult "INFO: closing " fullName m "\n"
        close m
}   }
delete closeMe


text:
Q: Is there a way to debug mailer with sendgrid on heroku? Or to check if the mail get actually sent? I'm trying to implement a "contact us" form on my rails 3.0.10 project. Following the RailsGuides I created a mailer.
class QuestionMailer < ActionMailer::Base
  default :to => "%mail@mydomain" #gmail for domains

  def ask(message)
    @content = message.content

    unless message.name.nil? or message.name.empty?
      from = "#{message.name} <#{message.email}>"
    else
      from = message.email
    end

    mail(:subject => message.subject, :from => from)
  end
end

In my controller I have these lines:
if @question.valid?
  QuestionMailer.ask(@question).deliver
  redirect_to root_url, :notice => "Сообщение отправлено"
else

Production.rb:
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => '%mydomain%' }

ActionMailer::Base.smtp_settings = {
  :address        => "smtp.sendgrid.net",
  :port           => "25",
  :authentication => :plain,
  :user_name      => ENV['SENDGRID_USERNAME'],
  :password       => ENV['SENDGRID_PASSWORD'],
  :domain         => ENV['SENDGRID_DOMAIN']
}

I didn't have this config at first, but when I didn't receive the email, I added it.
The problem is, the Heroku log says, that the corresponding view has been rendered, but I don't receive the email. And because I use sendgrid, I cant test it locally.
upd
Note to self. After creating gmail for domain account, don't forget to your DNS settings. >_<

A: You can test locally still using sendgrid - from the command line do heroku config and you can grab the values that Heroku has set for sendgrid username, password and domain and then set them in your development.rb along with the actionmailer settings and it will route your message through sendgrid from your local development app.
I also find this heroku plugin https://github.com/hone/heroku-sendgrid-stats very useful for checking on my message sending numbers.


text:
Q: Array == String I am doing a "Rock,Paper,Scissors" game with Java and I have a question, is there any way to create and Array with answers and check if any of these values equal to another array? For example:
Here is the answerArray (also I want to have short cuts for answers):
String[] answersArray = {"Rock","R","Paper","P","Scissors","S"};

And here is a randomArray for computer:
String[] npcAnswer = {"Rock","Paper","Scissors"};
        int idx = new Random().nextInt(npcAnswer.length);
        String npcRandomAnswer = (npcAnswer[idx]);

So, I want to check through the scanner if my answer (answersArray) equal to npcRandomAnswer.
Sorry if I have grammar mistakes, I did my best to explain my point.
Thank you.

A: You can only compare apples with apples. Or actually you can compare apples with oranges, but then you don't really need to compare them, you know the answer will always be false.
It looks like you don't really know yet what will your algorithm be.
I suggest you to concentrate on the algorithm, write pseudo code, and when you have it, try to make java out of it. If you'll have problem with the java, we can easily help you if you post your algorithm (in a new question)


text:
Q: Questions about Stinespring's theorem for completely positive maps I have a question about Stinespring's Theorem:
Let $A$ be a $C^*$-algebra, $H$ be a complex Hilbert space and $L(H)$ the set of bounded linear operators on H. Let $\Phi: A\to L(H)$ be a completely positive map. Then there exists a complex Hilbert space $K$, a $*$-homomorphism $\pi:A\to L(K)$ and a bounded linear map $V:H\to K$ such that
$$\Phi(a)=V^*\pi(a)V,$$ for all $a\in A$.
Furthermore, we have $\|\Phi\|=\|V\|^2$.
If A is unital, $\phi$ is unital and if $\phi(e_A)=Id_{L(H)}$, V is isometric. In this case you can consider H as a sub-hilbertspace of K and it is $\phi(a)=P_H\pi(a)_{|H}$ for all $a\in A$. Here is $P_H$ the projection of K onto H.
My questions are:
Is $V^*V\le Id_{L(H)}$ true in general?
It is equivalent to prove that $\langle Id-V^*Vx,x\rangle \ge 0$ for all $x\in H$ and this means $\|x\|\ge \|Vx\|$ for all $x\in H$. But I don't think this is true in general for the V above in Stinespring's Theorem.
And why is "In this case ... it is $\phi(a)=P_H\pi(a)_{|H}$ for all $a\in A$" true? I only know if $V$ is an isometry, it is $V^*V=Id_{L(H)}$.
I appreciate your help. Regards

A: Of course it is not true in general. As you mentioned, $\|V\|^2=\|\Phi\|$, so if $V^*V\leq\text{Id}_{L(H)}$, this implies that $\|\Phi\|\leq1$.
The equality $\Phi(a)=P_H\,\pi(a)|_H$ is not really an equality; there is a unitary hanging around, but it is not worth writing. What happens is this: if $\Phi$ is unital, then $V$ is an isometry. So $H_0=VH$ is a subspace of $K$, isomorphic to $H$; and if we restrict the codomain of $V$ to $H_0$, then $V$ is bijective. Also, $VV^*\in L(K)$ is a projection, because $VV^*VV^*=VV^*$. For $\xi\in H_0$, we have $\eta=V^*\xi\in H$, and $VV^*\xi=\xi$. For  $\xi\in H_0^\perp$ and $\nu\in H_0$,
$$
\langle VV^*\xi,\nu\rangle=\langle\xi,VV^*\nu\rangle=\langle\xi,\nu\rangle=0.
$$
So $VV^*$ maps $H_0^\perp$ to zero, which shows that $VV^*=P_{H_0}$. Now, for $\xi\in H_0$ and $\eta=V^*\xi\in H$,
$$
P_{H_0}\pi(a)\xi=VV^*\pi(a)V\eta=V\Phi(a)\eta=V\Phi(a)V^*\xi.
$$
So, on $H_0$, $P_{H_0}\pi(a)=V\Phi(a)V^*$ where $V$ is a unitary $H\to H_0$. In other words, up to a unitary that implements the isomorphism between $H$ and $H_0$,
$$
P_{H_0}\pi(a)|_{H_0}=\Phi(a).
$$


text:
Q: Hash function for strings without respecting char's position The title of my question is self-descriptive.
I need to hash a structure of three 64bit variables (I'll convert them to a string of chars) each one contains a hand of cards - card game app, so swapping of some chars in these variables should produce the same hash.
One approach would be to sort resulting string. Is there any better solution?

A: If the representation of a hand is similar to a bit set, it is already unordered. For example, if you use a combination of bit masks to represent a combination of cards, say, like this
A♠ - 0x00000001
2♠ - 0x00000002
3♠ - 0x00000004
4♠ - 0x00000008
...
K♠ - 0x00001000
A♥ - 0x00002000
2♥ - 0x00004000
...

then you can represent hands using bit combinations, like this:
A♠ 4♠ 2♥ - 0x00004009

This representation is position-independent, i.e. hands 4♠ A♠ 2♥ and 2♥ 4♠ A♠ would have exactly the same representation as A♠ 4♠ 2♥. You can convert this representation to a string as necessary by iterating the individual bits, and adding a card to the string representation each time that you discover a bit that is set to 1.
A representation like this can be used to compute a 32-bit hash code by XOR-ing the upper 32 bits of the representation with the lower 32 bits:
uint64_t hand = ... // A representation of hand similar to what's described above
uint32_t hash = (uint32_t)(hand ^ (hand >> 32));

Currently my cards are presented as bytes, but bits in two cards can overlap: A♣ = 0x11; 10♣=0x12; K♣=0x13 ... and so on.

You can convert this representation to the one described above when computing the hash code, and avoid sorting that way:
// Each card is a number from 1 to 53, inclusive
uint8_t hand[HAND_SIZE] = ...; // The hand
uint64_t set = 0;
for (int i = 0 ; i != HAND_SIZE ; i++) {
    set |= (1LL << hand[i]);
}
uint32_t hash = (uint32_t)(set ^ (set >> 32));

A: The other way to do this is to count the number of occurrences of each character and then hash the resulting vector(a vector count, where count[c] is the number of occurrences of a character c). I would not say that it is better than sorting(the number of characters is fixed(and probably pretty low) so you can use radix sort)(but I cannot say that it is worse either). The time complexity of both: sorting using radix sort and counting the number of occurrences of each character is linear(moreover, radix sort and counting characters is pretty much the same thing), so there shouldn't be much difference between these two.


text:
Q: In Oment veins, how to get speed of a vehicle by providing vehicle ID which is not transmitting or receiving any message? I want to to get vehicle speed by defining a function like getSpeedById(Std::string vid) which will give me the current speed of that vehicle. it doesnot matter the vehicle is receiving/transmitting any message. I am using TraciDemo11p  example file. In that example, i know that I can get current speed only when the message is sent/ received. But I want to get speed of a particular vehicle all the simulation time which will not transmit any signal at all.

A: See answer https://stackoverflow.com/a/49973662/4707703 for how to iterate over all currently simulated vehicles in OMNeT++ and how to get a pointer to their mobility simulation module. From there, it should be as easy as calling getCurrentSpeed (instead of getCurrentPosition, which is done in the linked answer)


text:
Q: How to open HTTPS port in Google cloud? Hello today configured vps on Google Cloud and put Vesta control panel, but the problem is not open one https that is, and the ip server and the domain itself does not open on https. Set up Google Cloud firewall and opened ports 80,443 but https does not open the site itself is not the ip of the server. Checked through online services port 443 is closed but settings of the server and a firewall of Google and ip tables say that port 443 is opened (checked by several services port 443) and in the browser through ip of the server and the domain on https do not open. Please tell me how to open port 443?
Same with ports 8443,8080.

A: I am not able to comment but here are some steps that might help to isolate the issue:

*

*Check to see if the port is open or closed or filtered using nmap
nmap [ip_address]

*Firewall rules are defined at the network level and therefore make sure that you follow this document while creating the firewall rules to allow incoming traffic on TCP port 80 and 443 (same for other ports). In this document in step 11, choose " specified protocols and ports" and enter tcp: 80, tcp: 443.

*As you previously stated, you need to make sure there is no firewall running inside the VM blocking those connections.

*You also need to verify if the application running on your vps is listening on port 443. To check this, try with this command.
sudo netstat -ntlp | grep LISTEN
In the output, if you don't see the application beside port number, check if your vps is rightly configured to ports for your application.

A: I was having the same issue with NGinx. And Found the root cause finally to be the Firewall (GCP VM Firewall) having a lower priority for the rule. ie: I had 65534 (which is super low priority) for the "Ingress 443" rule. Which did block the traffic coming into the SSL. Instead when I set this rule to 1, traffic started flowing and issue sorted.
What finally helped me was https://cloud.google.com/vpc/docs/using-firewalls
Thanks @Md Zubayer for the tip.


text:
Q: Не работает функция console.log Нативная функция console.log ничего не выводит в firebug окне. При этом функция alert работает как должна. При подробном выводе получаю следующую ошибку:

тестировалось на вот таком коде:

<html>
<head>
</head>
<body>
<script>
console.log("tst");
alert("!");
</script>
</body>
</html>

PS
Это происходит на любой кодировке.
версия ff:

версия firebug:

A: Поскольку Firebug в современных версиях Firefox больше не существует, а в нативном отладчике все хорошо, полагаю вопрос больше неактуален.


text:
Q: Al intentar correr una query en Laravel, arroja un error 500 y consulta vacía [], en cambio en Postgres funciona sin errores Tengo problemas al realizar una consulta con join, comparando varias columnas en ambas tablas, para extraer un solo dato completo con todas las columnas.
$nomina = DB::connection('pgsql')->table('nomina')
        ->join('unidad','nomina.anocur','=','unidad.anocur')
        ->where('nomina.codper','=','00123456')
        ->where('unidad.oficina','=','nomina.oficina')
        ->where('unidad.lugar','=','nomina.lugar')
        ->where('unidad.deparamento','=','nomina.deparamento')
        ->where('unidad.sub_departamento','=','nomina.sub_departamento')
        ->where('unidad.codigo_nomina','=','nomina.codigo_nomina')
        ->where('unidad.organizacion','=','nomina.organizacion')
        ->select('*')->get()->first();

Al intentar correr el Query en laravel, arroja un error 500 y consulta vacía []... En cambio con la misma consulta estructurada en Postgres, funciona sin errores, extrayendo todas las columnas, con el siguiente Query
select * from nomina
inner join unidad
on nomina.anocur = unidad.anocur
where nomina.codper = '00123456'
and unidad.oficina = nomina.oficina
and unidad.lugar = nomina.lugar
and unidad.deparamento = nomina.deparamento
and unidad.sub_departamento = nomina.sub_departamento
and unidad.codigo_nomina = nomina.codigo_nomina
and unidad.organizacion = nomina.organizacion

¿De qué otra manera se puede realizar, para obtener los resultados de Postgres en Laravel?

A: De la manera como tienes planteado, el query builder por debajo manda la sentencia
SELECT
    *
FROM
    nomina
    INNER JOIN unidad ON nomina.anocur = unidad.anocur
WHERE
    nomina.codper = '00123456'
    AND unidad.oficina = 'nomina.oficina'
    AND unidad.lugar = 'nomina.lugar'
    AND unidad.deparamento = 'nomina.deparamento'
    AND unidad.sub_departamento = 'nomina.sub_departamento'
    AND unidad.codigo_nomina = 'nomina.codigo_nomina'
    AND unidad.organizacion = 'nomina.organizacion'

O sea, intenta hacer el where contra cadenas de texto y no contra campos de nomina.
Ignoro por qué te sale un error 500, Aunque está fuera del alcance de esta pregunta, debieras revisar en storage/logs para saber más.
Para lo que nos convoca: lo que quieres hacer (aunque no es la única manera) podría implementarse usando un join con una función como segundo parámetro.
$nomina = DB::connection('pgsql')->table('nomina')
    ->join('unidad',function($join) {
        $join->on('nomina.anocur','=','unidad.anocur')
             ->on('unidad.oficina','=','nomina.oficina')
             ->on('unidad.lugar','=','nomina.lugar')
             ->on('unidad.deparamento','=','nomina.deparamento')
             ->on('unidad.sub_departamento','=','nomina.sub_departamento')
             ->on('unidad.codigo_nomina','=','nomina.codigo_nomina')
             ->on('unidad.organizacion','=','nomina.organizacion');
    })
    ->where('nomina.codper','=','00123456')
    ->select('*')->get()->first();

Fíjate que el where contra el escalar '00123456' se mantiene tal cual, y no debe meterse dentro del join.


text:
Q: How to set own image for a cursor If I set the cursor for a Label in a css-file as shown below it works as expected. The cursor is a "wait-cursor" if it is moved over the Label
Label.mylabel:hover {
    cursor: wait;
}

As it is described in the RWT-Theming-Reference the following should also be possible
Label.mylabel:hover {
    cursor: url( resources/cursor.gif );
}

But I can not see my cursor.
How can I set an own image for a cursor?

A: Turns out that there is a bug in RAP that prevents custom cursors from being rendered. I'll provided a fix that will likely be included in the 3.0.1 release.
Update: the fix is merged and will be available in 3.1 M1 and 3.0.1.

A: Try this
label.mylabel:hover {
    cursor:url("resources/cursor.gif"), auto;
}

Make sure that your are providing correct url for image.


text:
Q: google captcha nocaptcha in html form I am trying to figure out how to add the new google recaptcha to my form. I have followed all the steps and documentation but the verification fails. Please help with adding the correct lines to my php file.
<?php

if(!$_POST) exit;

// Email address verification, do not edit.
function isEmail($email) {
return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email));
}

if (!defined("PHP_EOL")) define("PHP_EOL", "\r\n");

$name     = $_POST['name'];
$email    = $_POST['email'];
$comments = $_POST['comments'];

if(trim($name) == '') {
echo '
Attention! You must enter your name.
';
exit();
} else if(trim($email) == '') {
echo '
Attention! Please enter a valid email address.
';
exit();
} else if(!isEmail($email)) {
echo '
Attention! You have enter an invalid e-mail address, try again.
';
exit();
} else if(trim($comments) == '') {
echo '
Attention! Please enter your message.
';
exit();
}

if(get_magic_quotes_gpc()) {
$comments = stripslashes($comments);
}

// Configuration option.
// Enter the email address that you want to emails to be sent to.
// Example $address = "joe.doe@yourdomain.com";

//$address = "joe.doe@yourdomain.com";
$address = "joe.doe@yourdomain.com";

// Configuration option.
// i.e. The standard subject will appear as, "You've been contacted by John Doe."

// Example, $e_subject = '$name . ' has contacted you via Your Website.';

$e_subject = 'You\'ve been contacted by ' . $name . '.';

// Configuration option.
// You can change this if you feel that you need to.
// Developers, you may wish to add more fields to the form, in which case you must be sure to add them here.

$e_body = "You have been contacted by $name with regards to $subject, their additional message is as follows." . PHP_EOL . PHP_EOL;
$e_content = "\"$comments\"" . PHP_EOL . PHP_EOL;
$e_reply = "You can contact $name via email, $email or via phone $phone";

$msg = wordwrap( $e_body . $e_content . $e_reply, 70 );

$headers = "From: $email" . PHP_EOL;
$headers .= "Reply-To: $email" . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;

if(mail($address, $e_subject, $msg, $headers)) {

// Email has sent successfully, echo a success page.

echo "<fieldset>";
echo "
";
echo "
Email Sent Successfully.
";
echo "
Thank you $name, your message has been submitted to us.
";
echo "
";
echo "</fieldset>";

} else {

echo 'ERROR!';

}

A: Honestly, you should have just wrote an HTML file and put <?php ?> in it to write the necessary PHP code and everything else, in HTML. Google reCAPTCHA requires you to:

*

*Use the script tag inside the head tag to include their JS code.

*Use a form to put your reCAPTCHA in.

*Submit a POST request to https://www.google.com/recaptcha/api/siteverify with 2 parameters - secret and response
And all of them need HTML. I suggest you to rebuild your form in HTML and use PHP when necessary, like verifying the email and stuff, but you really do need HTML.


text:
Q: Why is String.Equals not working? My friend and I are working on a simple trivia console app to try to learn to code C#. We've got the random question generator working and we can take input. We're having an issue though where no matter what we input the code always says it was the wrong answer. We want it to say it was the correct answer or the wrong answer like normal trivia goes. To check if the answer is correct or incorrect we're using String.Equals to check if the answer matches up to an answer stored in an array. We're curious what we're doing wrong here and how to make it so the if statement works properly.
static void Main(string[] args)
    {
        //Random number generator
        Random rnd = new Random();
        int randInt = rnd.Next(0, 9);

        //Questions array Question/Answer
        string[,] array2D = new string[10, 2] {
            { "Mario Kart is a video game series publish by which company?", "Nintendo" },
            { "What was the first console video game that allowed the game to be saved?", "The Legend of Zelda" },
            { "The Connecticut Leather Company later became what toy company that was popular in the 1980s for its Cabbage Patch Kids and video game consoles?", "Coleco" },
            { "Nintendo is a consumer electronics and video game company founded in what country?", "Japan" },
            { "The first person shooter video game Doom was first released in what year?", "1993" },
            { "In what year did Nintendo release its first game console in North America?", "1985" },
            { "In the world of video games, what does NES stand for?", "Nintendo Entertainment System" },
            { "In what year was the Nintendo 64 officially released?", "1996" },
            { "What was the most popular video game in the year 1999?", "Doom" },
            { "If you have any kind of console known to mankind, what will your mother call it no matter what?", "A Nintendo" } };

        //printing the question
        System.Console.WriteLine(array2D[randInt, 0]);
        System.Console.ReadKey();

        //taking user input
        string Answer = Console.ReadLine();

        //checking to see if the answer is correct
        if (Answer.Equals(array2D[randInt, 1]))
        {
            //the console exclamation for the right answer given in any scenario.
            Console.WriteLine("Correct Answer! Good job!");
            Console.ReadKey();
        }
        else
        {
            //the console exlamation for the incorrect answer in any given scnario
            Console.WriteLine("Aw man! You got it wrong! Better luck next time :(");
            Console.WriteLine("The correct answer was {0}", array2D[randInt, 1]);
            Console.ReadKey();
        }

    }

A: Just Remove the  System.Console.ReadKey() from above;
//Random number generator
        Random rnd = new Random();
        int randInt = rnd.Next(0, 9);

        //Questions array Question/Answer
        string[,] array2D = new string[10, 2] {
        { "Mario Kart is a video game series publish by which company?", "Nintendo" },
        { "What was the first console video game that allowed the game to be saved?", "The Legend of Zelda" },
        { "The Connecticut Leather Company later became what toy company that was popular in the 1980s for its Cabbage Patch Kids and video game consoles?", "Coleco" },
        { "Nintendo is a consumer electronics and video game company founded in what country?", "Japan" },
        { "The first person shooter video game Doom was first released in what year?", "1993" },
        { "In what year did Nintendo release its first game console in North America?", "1985" },
        { "In the world of video games, what does NES stand for?", "Nintendo Entertainment System" },
        { "In what year was the Nintendo 64 officially released?", "1996" },
        { "What was the most popular video game in the year 1999?", "Doom" },
        { "If you have any kind of console known to mankind, what will your mother call it no matter what?", "A Nintendo" } };

        //printing the question
        System.Console.WriteLine(array2D[randInt, 0]);
        //System.Console.ReadKey(); Removed

        //taking user input
        string Answer = Console.ReadLine();

        //checking to see if the answer is correct
        if (Answer.Equals(array2D[randInt, 1]))
        {
            //the console exclamation for the right answer given in any scenario.
            Console.WriteLine("Correct Answer! Good job!");
            Console.ReadKey();
        }
        else
        {
            //the console exlamation for the incorrect answer in any given scnario
            Console.WriteLine("Aw man! You got it wrong! Better luck next time :(");
            Console.WriteLine("The correct answer was {0}", array2D[randInt, 1]);
            Console.ReadKey();
        }


text:
Q: React Native Image component with "{width: 100%, height: auto}" gets dislocated when using margin I have an Image component that has width from Dimensions.get('window').width,
and height that is calculated using this formula:
{ //not the real code, but it works exactly like this.
  width: Dimensions.get('window').width,
  height: actualImageHeight*(Dimensions.get('window').width/actualImageWidth)
}

It basically closely emulates how width: 100%, height: auto works in css.
and it works well until i added margins to it, which causes the image to get dislocated
like this:
Dislocated Bear
I have also tried to use PixelRatio.getPixelSizeForLayoutSize(margin*2) to try taking account the margin, which makes the new formula look like this:
{ //not the real code, but it works exactly like this.
  width: Dimensions.get('window').width-PixelRatio.getPixelSizeForLayoutSize(margin*2),
  height: actualImageHeight*((Dimensions.get('window').width-PixelRatio.getPixelSizeForLayoutSize(margin*2))/actualImageWidth)
}

and the result is almost, there, but still slightly dislocated: Slightly Dislocated Bear
Which makes me think that Dimensions isn't a good reference for width.
So how do I emulate width: 100%, height: auto that doesn't use Dimensions?
Is it possible to use width: 100% as a reference to use in the formula?

A: import React from 'react';
import {SafeAreaView,View,Dimensions,Image,} from 'react-native';

const {width, height} = Dimensions.get('window');
const actualImageHeight = 200;
const actualImageWidth = 300;

const Test = props => {
return (
<SafeAreaView style={{flex: 1}}>
  <View
    style={{
      width: width,
      height: actualImageHeight * (width / actualImageWidth),
      borderRadius: 6,
      borderWidth: 1,
      borderColor: '#f1f1f1',
      overflow: 'hidden',
      backgroundColor: 'red',
      padding: 12,
    }}>
    <Image
      style={{flex: 1, width: null, height: null}}
      source={{uri: 'https://picsum.photos/200/300'}}
    />
  </View>
</SafeAreaView>
 );
};

when you place calculated width and height to any view if you place margin in styles it will dislocated the view because while rendering the view margin also considered. Better to wrap image with view.

A: I still continued the idea of subtracting the width with the margins, and I managed to make it work. Simply by doing Dimensions.get('window').width-(margin*2) will make it work. So final code is:
{
  width: Dimensions.get('window').width-(margin*2),
  height: actualImageHeight*(Dimensions.get('window').width-(margin*2)/actualImageWidth)
}

The result: Bears
Full code of the component:
import React, { useState, useEffect } from "react";
import { Dimensions, Image } from "react-native";

interface AnotherCardProps {
  thumbnail: string;
  margin?: number;
  column?: number;
  maxHeight?: number;
  minHeight?: number;
}

const AnotherCard: React.FC<AnotherCardProps> = (props) => {
  const [imageSize, setImageSize] = useState({ width: 0, height: 0, ratio: 0 });
  const margin = props.margin || 0;
  const column = props.column || 1;
  const newWidth = Dimensions.get("window").width / column - margin * 2;
  const maxHeight = props.maxHeight || newWidth * 1.5;
  const minHeight = props.minHeight || newWidth;

  useEffect(() => {
    Image.getSize(props.thumbnail, (w, h) =>
      setImageSize({
        width: w,
        height: h,
        ratio: newWidth / w,
      })
    );
  });

  return (
    <Image
      style={{
        borderRadius: 20,
        margin: margin,
        flex: 1,
        width: newWidth,
        height:
          imageSize.height * imageSize.ratio < minHeight
            ? minHeight
            : imageSize.height * imageSize.ratio > maxHeight
            ? maxHeight
            : imageSize.height * imageSize.ratio,
        resizeMode: "cover",
      }}
      source={{
        uri: props.thumbnail,
      }}
    />
  );
};

export default AnotherCard;


text:
Q: Fade in background color using jQuery? I would like to take a div and have the background fade to white on mouseenter and fade back out to black on mouseout. Any ideas on how to do this in jQuery?

A: You need to use either jQuery UI libarary or jQuery Colors to enable animation of colors
$('div').hover(function () {
    $(this).stop(true, true).animate({
        backgroundColor: 'black'
    })
}, function () {
     $(this).stop(true, true).animate({
        backgroundColor: 'white'
    })
})

Demo: Fiddle

A: with JQuery .hover()
  $("div" ).hover(
  function() {
     $(this).animate({backgroundColor: "#fff"}, 'slow');
  }, function() {
    $(this).animate({backgroundColor:"#000"},'slow');
  });

with JQuery .mouseover()
$("div")
  .mouseover(function() {
    $(this).animate({backgroundColor: "#fff"}, 'slow');
  })
  .mouseout(function() {
    $(this).animate({backgroundColor:"#000"},'slow');
  });

Note you have to use jquery-color (for animating colors). https://github.com/jquery/jquery-color/

A: OP requested jQuery. For those trying to free-hand without jQuery:

hello world


text:
Q: Inline Content Block in Template For SFMC Email Studio, i have create a Template-Based Email, I have also create a Content Block which uses the placeholder %%firstname%% to return the text True if it is not empty and False if it is empty. The Email is called EmailA and the Content Block is called has_firstname
Within EmailA, i have added the following
My name is Mike and what i say is %%has_firstname%%, thank you for listening.
I'm not sure what this would be called in SFMC, but to me this is called inlining a content block. However this does not seem to work. The only thing i can seem to do is drag and drop content on top of each other.
Is there any way to call the Content Block as a variable or function? I do NOT want to have inline Placeholder logic or AMP Script within the template itself. I want that logic to be in a Content Block or something else which i can easily inline.
Thank you.

A: You reference external Content Blocks using the ContentBlockByKey, ContentBlockByName and ContentBlockByID functions.
For example:
My name is Mike and what I say is %%=ContentBlockByName("My Contents\has_firstname")=%%, thank you for listening
Also, following the #NoNakedPersonalizationStrings principle, your content block should reference first_name something like this:
%%[

var @first_name
set @first_name = AttributeValue("first_name")

if not empty(@first_name) then
  set @first_name = propercase(@first_name)
endif

]%%
%%=v(@first_name)=%%

A: The '%%text%%' is actually for 'Personalization Strings' and not any functions or calls.
That is not to say that your request is not possible, but it will require AMPscript in order to accomplish.
Basically you will want to utilize the ContentBlockByName, ContentBlockByID or ContentBlockByKey functions to call your block.
To note as well, if you want to utilize this content block inline, you NEED to make sure to set it up as a Code Snippet block. Any other block has html that is prepended and appended to the block prior to insertion into content.
I would highly recommend utilizing ContentBlockByID as the ID will never be changed for that Content Block, but the name and/or key can be changed and make the call invalid or require an update of the content block call to make it work.
Basically something like:
My name is Mike and what i say is %%=ContentBlockByID(12345)=%%, thank you for listening.

A: has_firstname would be a personalization string, which means it directly references either an attribute from the All Subscribers list or from the Data Extension being used to send the email. In order to check if the Firstname field was empty or not you would need to write some form of AMPScript to check this first and assign it to a variable. Or there are inline functions to help with this.
%%[
  SET @firstname = [firstname]
  SET @has_firstname = Empty(@firstname)
]%%

Then output inline using: %%=v(@has_firstname)=%%
Or using inline functions:
%%=IIF(EMPTY(firstname),'false', 'true')=%%


text:
Q: Is this proof of the irrationality of the square root of any prime number correct? i was trying to proof that $\sqrt{2}$ was irrational without looking the standard proof, and after hours of head banging i ended up with an argument for the irrationality of the square root of any prime, the argument goes like this:
[1/premise]for any prime number $P, \sqrt{P} = \frac{a}{b}$ were [2]$a,b$ are coprime
[3] every natural number can be described by a product of primes.
$x = p_0^{y_0}  p_1^{y_1}  p_0^{y_2} ... p_n^{y_n}$
[4]the exponents of all the prime factors of any perfect square are all even
$x^2 = x*x = (p_0^{y_0}  p_1^{y_1}  p_0^{y_2} ... p_n^{y_n}) * (p_0^{y_0}  p_1^{y_1}  p_0^{y_2} ... p_n^{y_n}) = p_0^{2y_0}  p_1^{2y_1}  p_0^{2y_2} ... p_n^{2y_n}$
by the premise $\sqrt{P} = \frac{a}{b}$ we can square both sides and multiply by $b^2$, then we get $a^2=P*b^2$, so $a^2$ is divisible by $P$, and by [2] we know that b is not.
therefore the prime factors of $a^2 = P^1 * (p_0^{2y_0}  p_1^{2y_1}  p_0^{2y_2} ... p_n^{2y_n})$, the exponent of $P$ is 1, entering in contraction with [4] so the premise is false.


text:
Q: Contrast between SO(n) and Spin(n) representation Earlier I asked this Comparison between SO(n) and Spin(n) representation theory which is closed. I think the question is certainly valid and a good one. But my comments are too many and too long, so someone did not like that or got bored. So let me focus on one thing ONLY this time.
We know that $Spin(n)/\mathbb{Z}_2=SO(n)$. The  $SO(n)$ and $Spin(n)$ have the same Lie algebra. When it comes to the representation of $SO(n)$ and $Spin(n)$, does it make any difference?
Since Spin group is a double cover of SO group, how does this global structure being reflected in the case of representation? (if their representations are the same? or differed also by a double cover? perhaps the parameters of Lie group are "doubled" in some way?) Am I correct to say that SO group has integer spin representations, while Spin group has both integer and half-integer spin representations? For example, the SO(3) group has a trivial representation, and other odd-rank dimensional matrix representation:
$$
1,3,5,7,\dots.
$$
In contrast, the Spin(3) group has a trivial representation, and other odd and even-rank dimensional matrix representation:
$$
1,2,3,4,5,6,7,\dots.
$$
The odd and even-rank dimensional matrix representation is related to what physicists call the integer and half-integer spin representations.
How about the more general cases for  $SO(n)$ and $Spin(n)$, other than $n=3$?

A: If $G$ is a (Lie) group and $H$ a (closed) normal subgroup, then for any given (say, complex) vector space $V$ there is a bijection
$$\text{(cont.) rep's of  }G \text{ on } V \text{ such that } \rho_{\vert H}=id \leftrightarrow \text{ (cont.) rep's of } G/H \text { on  }V$$
given by mapping a representation $\rho :G \rightarrow Aut(V)$ on the left to the induced  $\tilde \rho: G/H \rightarrow Aut(V)$ on the right, and in the other direction, given a representation $\rho: G/H \rightarrow Aut(V)$, pulling it back to $\hat\rho:G \twoheadrightarrow G/H \stackrel{\rho}\rightarrow Aut(V)$.
This bijection respects irreducibility.
Apply this to $G= Spin(n)$ and $H=\{\pm1\}$ where you know that $SO(n) \simeq G/H$.
You'll find that the representations of $SO(n)$ correspond exactly to those representations of $Spin(n)$ which are trivial on $-1$.
And now you need to know a little more theory to tell which representations of $Spin(n)$ that are. What do you know about the root lattice and the weight lattice of these groups?


text:
Q: Littelmann Path model and RSK e and f operators The Littelmann path model defines $e_i$ and $f_i$ operators which correspond in type A to the $e_i$ and $f_i$ operators on semistandard Young tableaux (i.e. since they both are different ways of looking at Type A crystal.)
In the context of semistandard Young tableaux, we can think of the $e_i$ and $f_i$ operators as being described by a paired parenthesis operation, and that operation commutes with RSK insertion thus the $e_i$ and $f_i$ operators are often thought of as acting on words, not just semistandard Young tableaux.
In the context of the Littelmann path model, there are many paths to the same point, all equally compatible with the same $e_i$ and $f_i$ operators.  Some of those paths, particularly those that are a sequence of various length one steps from the set $\{e_i-v\}_{i=1\cdots,n}$ (where $v=\frac{1}{n}(1,1,\cdots,1)$ so the vector sums to zero) might reasonably be considered an analogue of a word, with $e_i- v$ corresponding to i in the word (with the end of the word corresponding to the start of the path at the origin).  Call these path "special" paths for purposes of this post.
Since every highest weight path of the same weight generators the same crystal, there's a sense in which order doesn't matter to the $e_i$ and $f_i$ operators in the Littelmann path model.  In contrast, not every word of the same type RSK inserts to the same semistandard Young Tableaux, so special paths must not be fully compatible with RSK and the $e_i$ and $f_i$ paired parenthesis operators on words.  Is there a natural subset of special paths that is consistent on which the paired parenthesis $e_i$ and $f_i$ operators are consistent with the $e_i$ and $f_i$ operators of the Littelmann path model?  For example, on special paths which correspond to reading words of Semistandard Young tableaux, will the $e_i$ and $f_i$ operators in the Littelmann path model result in paths which are also the reading word of semistandard Young tableaux?
I suspect this is too much to ask for, although it seemed to work on a couple of very small examples.


text:
Q: Parsing arrays in logic apps I have a JSON schema that looks like this:
InputParameters": [
{
  "key": "Target",
  "value": {
    "__type": "Entity:http://schemas.microsoft.com/xrm/2011/Contracts",
    "Attributes": [
      {
        "key": "prioritycode",
        "value": {
          "__type": "OptionSetValue:http://schemas.microsoft.com/xrm/2011/Contracts",
          "Value": 1
        }
      },
      {
        "key": "completeinternalreview",
        "value": false
      },
      {
        "key": "stepname",
        "value": "1-Lead"
      }
    ]
  }
}
]

This is from a CRM message that gets read off a queue.
What is the best way to read the key value pairs? Seems like there is no way to do nested for loops if you have nested arrays.
Can I use function apps with JSON.NET to do some funky stuff instead?


text:
Q: Is there a more efficient way to partition my data for use in lme4? I'm currently using lme4 to fit the following model:
Model = lmer(CA ~ P + T + S + (1 | Study), Data)

P and T refer to pressure and temperature, and there is an a priori reason to expect a different relationship at low pressure and temperature compared to high pressure and temperature. So I've partitioned my data into two, one for supercritical CO2 conditions (P > 7.37 and T > 31.1) and one for everything else. Which means having two models...
ModelSub = lmer(CA ~ P + T + S + (1 | Study), DataSub)
ModelSuper = lmer(CA ~ P + T + S + (1 | Study), DataSuper)

I'm wondering, though, if there is a way to have a single model but include the 'phase' category somehow (Sub versus Supercritical) that doesn't introduce problems, and even if a single model would make it more difficult to interpret the results (at the model the results are easy to interpret because the estimates for T and S are very close across both models)?
Neither of these yielded what I expected...
ModelCombined = lmer(CA ~ P*Phase + T + S + (1|Study),Data)
ModelCombined = lmer(CA ~ P:Phase + T + S + (1|Study),Data)

In the second version (P:Phase) the T and S estimates were okay but the P:Phase estimates were the same for both categories whereas there is a marked difference when separate models are made...

A: Since you say :

P and T refer to pressure and temperature, and there is an a priori reason to expect a different relationship at low pressure and temperature compared to high pressure and temperature. So I've partitioned my data into two, one for supercritical CO2 conditions (P > 7.37 and T > 31.1) and one for everything else. Which means having two models...

No, I don't think it means that. Since you expect a different relationship at low pressure and temperature compared to high pressure and temperature, you can fit an interaction term to account for this:
ModelCombined = lmer(CA ~ P + T + P:T + S + (1|Study),Data)


text:
Q: Visual Studio install project doesn't perform InstallConditions I'm creating an installer for a C# application using Visual Studio Install Project. This application needs Python, so I added this as custom prerequisite.
This is the package manifest I wrote for the prerequisite:
<?xml version="1.0" encoding="utf-8"?>
<Package Name="DisplayName" Culture="Culture"    xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
  <PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="python-3.4.4.amd64.msi" HomeSite="https://www.python.org/ftp/python/3.4.4/python-3.4.4.amd64.msi"    PublicKey="3082010A0282010100AD1F1AA13C2A1F0A66721AC80D3356CC4DDB267CAA18E002B057D85E978FE5BF03AC7820A182AE3F7C785AAFFFC448FC5736B35D9E236F5E805EB60EA21276470C4DE40A7975B3DA98F90D50CE3702DEB5A7D44BAC8958F470CDE7C59220D23E2D902E0B6690EFA51F5D27843798CAB855823FE6F14F2A685EF5CF6F777BB45362DD6C55C12D2EA258B6E44B29342A8156F 3C7C9EFACAD23193E86ED44FCD8F2797DE9A2CCFE5A6DE60E57EC4F5DBDA878505B63B0AA41F129AC6F5CF1079C0649A9D0BAD01DC52989D71672E9D8EFE6A0B1A285232181E82D114D8871AAAEAF26BAC01D1FB787352B3785E22D3B9D6ABDC4D99A8D04ADD3596070F2B23A38F90203010001" />
</PackageFiles>
<InstallChecks>
<RegistryCheck Property="IsInstalled" Key="HKLM\Software\Python\"/>
<RegistryCheck Property="IsCurrentUserInstalled" Key="HKCU\Software\Python\"/>
</InstallChecks>
<Commands Reboot="Defer">
<Command PackageFile="python-3.4.4.amd64.msi">
  <InstallConditions>
    <BypassIf Property="IsInstalled" Compare="ValueExists" />
    <BypassIf Property="IsCurrentUserInstalled" Compare="ValueExists" />
  </InstallConditions>
  <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
    <DefaultExitCode Result="Fail" String="Anunexpectedexitcodewasr" FormatMessageFromSystem="true" />
   </ExitCodes>
 </Command>
</Commands>
<Strings>
<String Name="Culture">no</String>
<String Name="DisplayName">Python 3.4.4</String>
<String Name="Anunexpectedexitcodewasr">An unexpected exit code was returned from the installer. The installation failed.</String>
</Strings>
</Package>

The problem is that when I run the installer on a system which has Python, it keeps me asking to download and install it. The registry keys I look for are present on the system. What should I do?

A: It's not clear to me whether the bootstrapper check is looking in the native or WoW6432 location. If it's a 32-bit app it might be looking in the wrong (i.e. the 32-bit) registry. I don't know if there is a way to choose the WoW6432 registry or the native one.
Also, from looking in the Registry table in the Python MSI file, it does not appear to write anything containing "IsInstalled", and I'd expect the install to be the thing that created that entry.
There is however a Software\Python\PythonCore\3.4\InstallPath entry that contains the install location, so maybe that's something else to look for.


text:
Q: Java libraries in appication server classpath -Linux How to check the list of libraries (jar, properties,folders) that is in the classpath of the application which is running in the application server(webpshere 8.1)?
Does ps (process) command in linux gives all the details.
And also , How do we checking the port number(http,admin console,soap) of the application /application server domains?
Aside from WEB-INF/lib ,WEB-INF/classes. which are the folders that application server takes deafault into classpath.
My question is to find out the libraries that are used by server to run the application.

A: To know which jars are loaded into the JVM. In most conditions, 'lsof' can help you:
lsof -a -p < pid > |grep '\.jar'

A: You should use the Class viewer service to find out what jar files and libraries reside on the classpath.
For more information:
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Fttrb_classload_viewer.html

A: I am not aware of the existence of WAS 8.1. However, application classloader in WAS can output all libraries that were loaded. Simply call toString() on it from within any class of the application:
System.out.println(getClass().getClassLoader().toString())

A: I don't know how to specify java command line parameters for websphere, but for the standard JVM, if you want to see where the class files are loaded from, you can specify the -verbose:class parameter.  Assuming websphere is using a standard JVM at some point, that should help.


text:
Q: Full text search schedule throw an exception I try to create schedule for full text search, but when I choose Schedules menu I see this message:

I don't know how it can be affected with further error. The error happens when I press ok button on my schedule settings window.

How can I fix this error or can I add schedule by a TSQL script?

===================================

Object reference not set to an instance of an object. (SqlManagerUI)
------------------------------ Program Location:
at
  Microsoft.SqlServer.Management.SqlManagerUI.FullTextIndexPropertiesSchedule.btnNew_Click(Object
  sender, EventArgs e)    at
  System.Windows.Forms.Control.OnClick(EventArgs e)    at
  System.Windows.Forms.Button.OnClick(EventArgs e)    at
  System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)    at
  System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
  button, Int32 clicks)    at
  System.Windows.Forms.Control.WndProc(Message& m)    at
  System.Windows.Forms.ButtonBase.WndProc(Message& m)    at
  System.Windows.Forms.Button.WndProc(Message& m)    at
  System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
  m)    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
  hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    at
  System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  at
  System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr
  dwComponentID, Int32 reason, Int32 pvLoopData)    at
  System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
  reason, ApplicationContext context)    at
  System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
  reason, ApplicationContext context)    at
  System.Windows.Forms.Application.RunDialog(Form form)    at
  System.Windows.Forms.Form.ShowDialog(IWin32Window owner)    at
  System.Windows.Forms.Form.ShowDialog()    at
  Microsoft.SqlServer.Management.SqlMgmt.RunningFormsTable.RunningFormsTableImpl.ThreadStarter.StartThread()

A: If you are using SQL Server Express edition, then Agent Job is not included.
Please, try upgrade to other editions(Standard, Enterprise etc..).


text:
Q: SignatureException while parsing correctly signed JJWT token retrieved from X-AUTH-TOKEN header of client request in Jersey request filter I am trying to parse claims in a JJWT token that I retreive from X-AUTH-TOKEN header of a client request.
The matter is that the parsing throws SignatureException, though the token is correctly signed.
Here is my Jersey filter :
@Provider
public class ClientClaimsFilter implements ContainerRequestFilter {

    @Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        String token = requestContext.getHeaderString("X-AUTH-TOKEN");
        if ((token != null) && (!token.isEmpty())) {
            Claims claims = Jwts.parse().setSigningKey(key).parseClaimsJws(token).getBody();
        }
    }
}

Where key was generated like this String key = TextCodec.BASE64.encode(MacProvider.generateKey(SignatureAlgorithm.HS256).getEncoded());
I verified that the key stays the same while generating token and while parsing it. But there is still SignatureException with the parsing.


text:
Q: How to monkey-patch a class in Rails I'm trying to monkey-patch the class "Tumble" with the module "Tinder". But when I add methods to the class, they aren't inherited. Constants, however, are.
lib/tumble.rb:
class Tumble
  ...

lib/tumble/tinder.rb
module Tinder
  APP_ID = 1234567890

  # Without self
  def xyz
    puts 'bar'
  end

config/initializers/tumble.rb
Tumble.include Tinder

The app loads Tumble and Tinder and I can access APP_ID:
$ rails r 'puts Tumble::APP_ID'
1234567890

But Tumble didn't inherit the methods:
[~/tinder]$ rails r 'puts Tumble.foo'
Please specify a valid ruby command or the path of a script to run.
Run 'bin/rails runner -h' for help.

undefined method `foo' for Tumble:Class
[~/tinder]$ rails r 'puts Tumble.xyz'
Please specify a valid ruby command or the path of a script to run.
Run 'bin/rails runner -h' for help.

undefined method `xyz' for Tumble:Class

How do I patch Tumble to include these methods from Tinder?
Thanks :)

A: When you call Tumble.foo that's calling foo as if it were a class method.
Yet when you do Tumble.include Tinder that adds the module's instance methods as instance methods of Tumble.
So, your current code should work if you do Tumble.new.foo.
You can also make Tumble.foo work with Tumble.extend Tinder.

A: class Tinder
 def initialize
  # some code here
 end
end

Imagine that this above was the class that you wanted to monkey-patch. To monkey-patch it you only need to write (on any place that gets loaded) the class Tinder again with the code to be added like this:
class Tinder
 def some_more_code
  # does great stuff
 end
end

This is monkey-patch. Modules won't do monkey-patch. They extend functionality but in a different way.
Just be aware not to override any methods of the original class that you want to monkey-patch, unless, of course, if that is your goal.


text:
Q: SSRS Date Expression stopped working I hope someone can share their experience with me. I've used the following ssrs expression to default a SSRS report parameter to the last day of the current month for months without issue:
=DateAdd("d", -1, DateSerial(Year(Now()), Month(Now()), 1))

This morning instead of returnng 3/31/2016, the expression is stuck on 3/29/2016. Can anyone help me understand why this happened?

A: You are substracting one day to the first day of the current month.
You have to get the first day of the next month and substract one day.
=DateAdd("d", -1, DateSerial(2016, Month(Now.AddMonths(1)), 1))

It returns 3/31/2016
Let me know if this helps.

A: The expression you show will give the last day of the previous month, not the last day of this month.
You want to do date arithmetic rather than build dates from scratch. Think about what will happen in December if you are using the current year but adding a month to find the month you need.
The safest way to get the last day of the current month would be to calculate the first day of this month, add one month then subtract a day:
=DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, DateAdd(DateInterval.Day, 1-Day(Today), Today)))

If what you actually want is the last day of the previous month, then that is simple:
=DateAdd(DateInterval.Day, 0-Day(Today), Today)


text:
Q: Select MYSQL, listar linha não presente na tabela NULL Estou fazendo um hotsite com um quiz (perguntas e respostas), com mais de 3000 usuários. A dúvida está na listagem dos quizes para cada usuário, tenho duas tabelas (simplifiquei para focar na minha dúvida):
QUIZ: (que guarda todos os quizes criados pelo admin, o campo total é o total de perguntas de cada quiz)

QUIZ_GERAL (que é criado toda vez que um usuário inicia um quiz, campo respondido é quantas perguntas o usuário já respondeu nesse quiz)

Quando vou listar para o usuário os quizes que ele já finalizou, não tenho problemas:
SELECT quiz.id AS quizid, quiz.mes, quiz.ano, quiz.total, quiz_geral.respondido FROM quiz_geral
INNER JOIN quiz ON quiz_geral.idquiz = quiz.id
WHERE (quiz_geral.idconta = :idLogado AND quiz_geral.respondido = quiz.total)
ORDER BY quiz.ano ASC, quiz.mes ASC

O problema está na hora de listar os quizes NÃO terminados e NÃO começados, pois tenho que listar eles em uma única consulta, ordenado pelo mês/ano, até agora fiz assim:
SELECT quiz.id AS quizid, quiz.mes, quiz.ano, quiz.total, quiz_geral.respondido FROM quiz_geral
RIGHT JOIN quiz ON quiz_geral.idquiz = quiz.id
WHERE (quiz_geral.idconta = :idLogado AND quiz_geral.respondido <> quiz.total)
OR (quiz_geral.id IS NULL)
ORDER BY quiz.ano ASC, quiz.mes ASC

Até lista certo os quizes começados e não terminados, o problema está em listar os quizes não começados (que não estão ainda na tabela QUIZ_GERAL), na tabela exemplo que coloquei aqui, da forma que fiz, não seria listado para o usuário com idconta 100 o quiz com id 1, pois a linha OR (quiz_geral.id IS NULL) não entraria nesse caso, já que existe na tabela, mas com outro idconta.
Como fazer essa segunda consulta de forma correta?


text:
Q: Display popup alert after Ajax response I have a JSON request using post method using ajax within this code
$(document).ready(function() {
  $(document).on('submit', '#registration_check', function() {
    var data = $(this).serialize();
    $.ajax({
      type: 'POST',
      url: 'apidomain.com',
      data: data,
      success: function(data) {

        $("#registration_check").fadeOut(500).hide(function() {
          $(".result_1").fadeIn(500).show(function() {
            $(".result_1").html(data);
          });
        });
      }
    });
    return false;
  });
});

the response will return 3 fields like name, email, phone on this element:

it's working nice so far, but want I plan to do is I want to display the alert or popup message if the ajax response found some of return value null. For example:

*

*If JSON response return:
name: jhon, email: jhon@doe.com, phone: 123456789
user will redirect to the other page (done so far)

*But if JSON response return
name: jane, email: jane@doe.com, phone:
The popup or alert will appeared, within text phone number empty.

A: If your data is a JSON object then you can do:
success: function(data) {
  for (var i in data) {
    if (!data[i]) {
      alert(/* MESSAGE HERE */)
      return;
    }
  }

  // Your regular code here
}

A: You can make an associative array of your values in php file and echo it in the json format like
echo json_encode($array);

Then you will receive this in your ajax response like this
  var objs = JSON.parse(data);

Then you can parse the values by keys like name, email and phone as you defined in associative array in your php file
console.log(objs.name);
console.log(objs.email);
console.log(objs.phone);

This is how you can parse the values individually. You can also apply conditions by your own way

A: First thing that comes to my mind: Do you need the JSON response in the document element or is it, that you dont know how to work with jQuery Ajax?
Anyway, this solution should help you in both cases:
$(document).ready(function()
{
    $(document).on('submit', '#registration_check', function()
    {
        var data = $(this).serialize();
        $.ajax({
        type : 'POST',
        url  : 'apidomain.com',
        data : data,
        dataType: 'json', // tell jQuery, that the response data will be a JSON - it will be parsed automatically
        success :  function(data)
                   {
                        // now you have a parsed JSON object in the 'data' var

                        var show_alert = false;

                        if (data.phone === null || !data.phone.length) {
                            show_alert = true;
                        }

                        if (data.email === null || !data.email.length) {
                            show_alert = true;
                        }

                        if (show_alert) {
                            alert('here is the alert :)');
                        }

                        $("#registration_check").fadeOut(500).hide(function()
                        {
                            $(".result_1").fadeIn(500).show(function()
                            {
                                $(".result_1").html(JSON.stringify(data));
                            });
                        });

                   }
        });
        return false;
    });
});


text:
Q: Intersection of RotatedRect with Rect or RotatedRect OpenCV I know it's possible to intersect two Rects in OpenCV in order to get the area of intersection. Is there a way to intersect a RotatedRect with another Rect or RotatedRect in c++?

A: You can use the rotatedRectangleIntersection function:
cv::rotatedRectangleIntersection    (   const RotatedRect &     rect1,
const RotatedRect &     rect2,
OutputArray     intersectingRegion
)


text:
Q: Show DIVs with greatest value Ok, so I'm making a "tip of the week" slider. Basically it's for my client, which is the reason I'd need to simplify the posting process as much as possible.
Right now it is just a slider for 4 divs: http://juuso.kivinen.org/tofw/
That is not the most recent version, because I haven't had time to update it yet(server ver.).
So basically(sorry for the long intro) my question is:
How can I make jquery load the first 4 divs from an external html file?
Or should I move to php?
The basic structure of my code would be:

A: Without more information a complete answer isn't possible, but you should look at the .load() method for jQuery. You are able to load partial sections of external files. http://api.jquery.com/load/
for example:
$('#EXTERNAL_CONTENT1').load('tips.html #external1')

What will the structure of the file you want to load from look like? Is your client going to be continually appending to that file?

A: I hope you have set up some code in your server to serve the EXTERNALCONTENT
then
$.get("urlToGetEXTERNALCONTENT",function(data){
$("#EXTERNALCONTENT4").html(data);
});

A: You can use the ".load()" method to pluck content out of a loaded document. In your case:
$('#placeToPutStuff').load(yourUrl + ' #slider', function() { /* ... */ });

A: This can be done using lt() and load():
$('#container').load('path/to/page.html #divContainer div:lt(4)');

Demonstration of concept: http://davidrhysthomas.co.uk/play/loadDemo2.html (original version: http//:davidrhysthomas.co.uk/play/loadDemo.html).


text:
Q: Printing (in C) to IDE console on STM32CubeIDE I'm starting to use CubeIDE to program a NUCLEO-F401RE board (with sensors attached) and in one of my projects I had to get the voltage of the board and print it somewhere on my laptop (connected to the board via usb cable).
I got this to work using HAL_UART_Transmit function to send the string and PuTTY, on my laptop, to receive and print the string.
Now, I noticed that there is a Console integrated in the IDE where the IDE automatically prints control information, compilation errors and such and I'd like to print the voltage (possibly using printf since I'm programming in C) here rather than using PuTTY, but it doesn't seem so straightforward (as in many other IDEs that I've used) from what I've read on the internet, for instance, here.
I get that here we have two different computers talking to each other, so printing using printf is not as easy as in other situations where code is written, compiled and executed all on the same computer.
My question is:
why isn't there a "console tab" in the IDE where the result of the printf, generated on the board, is displayed? And if there is, how to set it up? Is it simply some settings configuration in the project properties or do I have to modify the low level I/O C functions as stated in the discussion linked above?
Thank you.

A:
Create a new Command Shell Console.

Configure the new Console just as you did with PuTTY.


text:
Q: How to use queue to move my snake with c++ i have some problem in changing Direction of my snake,how to change this code,because i want Instead of having only one coordinate (variables x and y) i have to have the coordinates of every part of the snake. Using std::queue to remember the coordinate of every part of the snake. To make the snake move draw space (" ") on the last item in the queue and remove the last item from the back of the queue (pop_back), and add new item in the front of the queue (push_front) and draw asterisk there ("*").
help me to implement this
this is my code but it works wrong,because with this code my snake didn't change the direction and instead goes down vertically it goes down horizontally
My Code :
#include <iostream>
#include <vector>
#include <conio.h>
#include <windows.h>
#include <stdio.h>

using namespace std;

void gotoxy(int eex, int eey)
{
    COORD coord;
    coord.X = eex;
    coord.Y = eey;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}

int main()
{

    int x=0,y=10,lx=0,ly=0;
    for(int i=10;;i++)
    {
        gotoxy(i,y);
        cout<<"***";
        Sleep(100);
        lx=i;
        ly=y;
        gotoxy(lx,ly);
        cout<<"   ";
        if(kbhit())
        {
            for(int j=ly;;j++)
            {
                gotoxy(lx,j);
                cout<<"***";
                Sleep(100);
                ly=j;
                gotoxy(lx,ly);
                cout<<"   ";
            }

        }
    }
    return 0;
}

i dont't know how change my coorinate


text:
Q: How to rename labels to jenkins job on a condition or without a condition through a groovy script? Am trying to rename 300 jenkin Jobs- lables through a Groovy script
am not able to find any links or examples to refer and do
can you please help ?
a template or the code snippet referring will be much useful
I tried using hudson.model.* - not sure which method to use
I used hudson.instance.items to change the job name but not able to find one to change the lable in a job
changelable(items){

    for( item in items) {
        println(item.name)

        def job = "test"

        if (item.name == job ){
            item.name = job +""+modified
        }
        println(item.name)
    }
}


text:
Q: Disabling checkbox when a select menu has values I have a select menu with about four options. The first option of the select menu has NO value. The other options have values. When a user selects an option that has a value, I need the checkbox disabled, otherwise, if they go back to the option with the blank value, the checkbox is re-enabled.
The code below successfully disables the checkbox, BUT I want the checkbox to be re-enabled when the user clicks on the first blank option of the select menu.
$(document).ready(function(){
$('#select-menu').change(function() {
  if ($(this).val() !== ':first-child') {
        $("#related-checkbox").attr("disabled", true);
  } else {
    $("#related-checkbox").attr("disabled", false);
            }
});
});

A: The statement says
if ($(this).val() !== ':first-child') {

literally checks if selected value string is 'first-child', not whether it is the first child. Just set it to blank
if ($(this).val() !== '') {

If you want to check whether it is the first option (not whether it is blank) then you can compare the first child's val to the selected element's val
if ($(this).val() == $(this).children(':first-child').val())

A: Did you mean to say: "I want the checkbox to be re-enabled when the user clicks on the first non-blank option of the select menu."?
$("#related-checkbox").removeAttr("disabled");


text:
Q: remote mysql will not connect via php/mysqli Basically I have an application that needs to do a remote mysql connection to get data. I have a local testing mysql server running on an ip like 192.168.1.100 with default ports, and heidiSQL has absolutely no problem connecting. However when I try to do the same with php it takes a long time to load then I get the following error.
Connect Error (2003) Can't connect to MySQL server on '192.168.1.100' (110)

I have triple checked my configuration and see no variance between the login details I use with HeidiSQL and php so this error has me beat. Is there perhaps some sort of php.ini configuration value I have to set to allow remote connections? Google has not been very helpful with this...
Heidi is on my laptop, the mysql server is on a virtual linux server and the server running the script is on a local dedicated machine. They are all within the same network. You might have something there now that I think about it, there is a modem-router attached to the dev server and a router under it acting as a wireless switch. so the firewall on the router could be the cause.
The virtual machine is using a bridged adapter.
UPDATE:
We took the easy way out as this was taking more time then it needed to, so we created a live server to run the mysql server instead of having it local.
To help anyone who has a similar problem I also attempted to forward ports via ssh reverse proxy to bypass any firewall, I was unsuccessful but I can imagine it was just a mistake in the actual command I was doing.

A: "the script is on a local dedicated machine", other than your local machine. Your MySQL is not reachable from your local network, perhaps because of a local firewall (on your physical laptop) or because your virtual machine is NAT'ed.


text:
Q: How to access to laravel routing resource methods? I am using laravel to have access to my database. I have used the command php artisan make:controller CategoriesController --resource in the terminal to create a class where I can access different methods in one route.
The routing code for the class is: Route::apiResource("categories", CategoriesController::class);. With /categories I can get to the index() method (via get), where I can show my table values. But I do not know how I can use other methods. For example I have created test() with a simple return ["Result"=>"Working"].
I have tried /categories/test /categoriestest /categories%test but I can not show the result from test().
Simple routing works fine when I use specific routes for every method, but I want to make a more clear code so I would like to use the --resource to only have one route.


text:
Q: How do I send request and recieve response from REST API using javascript? I have a local server running on my computer which has an in-built REST API. the base url of api is: http://127.0.0.1:8090/ehr/api/v1 . Now I want to make a client application for this server using this api. To log in this server, the api url is baseurl/login with POST method. It takes username, password and organization as parameters and returns an auth token in json if the login is successful. Now I want to create a form in html and javascript which will ask the username, password, organization and log in the user if response is an auth token, otherwise if the response in an error instead of token, user will not be able to log in. What should be the html and javascript code for this form? I typed the following code to output the auth token but it showed no result. even the console log is empty.

Login

    <form method="post">
        <input type="text" name="u" placeholder="Username" id="username" required="required" />
        <input type="password" name="p" placeholder="Password" id="password" required="required" />
        <input type="text" name="p" placeholder="Organization" id="organization" required="required" />
        <button type="submit" onclick="loginfunc()">Let me in.</button>

    </form>

edit: I changed the login function based on suggestions to this:
function loginfunc(){
                var baseurl = "http://localhost:8090/ehr/api/v1";
                var funcurl = "/login";
                var username = document.getElementById("username");
                var password = document.getElementById("password");
                var organization = document.getElementById("organization");
                var url = baseurl+funcurl+"?username="+username+"&password="+password+"&organization="+organization;
                var xmlHttp = new XMLHttpRequest();
                xmlHttp.onreadystatechange = function () {
                    if(xmlHttp.readyState === XMLHttpRequest.DONE && xmlHttp.status === 200) {
                        console.log(xmlHttp.responseText);
                    }
                };
                xmlHttp.open( "POST", url, true); // false for synchronous request
                xmlHttp.send( null );
                document.write(xmlHttp.responseText);
            }

but now I get 401 unauthorized error at xmlHttp.send() function. I can't understand why as when I make request to same url using a REST client like insomnia, it works fine and returns auth token.

A: The request you're making to the server is asynchronous, so your code cannot just take the response immediately. This is done using a callback:
xmlHttp.onreadystatechange = function () {
  if(xmlHttp.readyState === XMLHttpRequest.DONE && xmlHttp.status === 200) {
    console.log(xmlHttp.responseText);
  }
};


text:
Q: Built-in module enabled at kernel configuration is missing I configured a debian kernel 5.10.57 to add the HSR/PRP module. I enabled it as built-in <*>. Then i compiled and installed the kernel using make deb-pkg and dpkg -i *.deb respectively.
The new kernel is running.
debian@debian:~$ uname -r
5.10.57

The HSR/PRP module path is in the builtin.modules file :
debian@debian:~$ cat /lib/modules/5.10.57/modules.builtin |grep hsr
kernel/net/hsr/hsr.ko

But the hsr directory (and the .ko file) does not exist.
debian@debian:~$ ls /lib/modules/5.10.57/kernel/net/ |grep hsr
debian@debian:~$

So the module is not loaded.
debian@debian:~$ lsmod |grep hsr
debian@debian:~$

In the /usr/src/linux-5.10.57/ folder, containing the kernel I compiled, the hsr configuration files are all here.

debian@debian:~$ ls /usr/src/linux-5.10.57/net/hsr/
hsr_debugfs.c  hsr_forward.c   hsr_framereg.h  hsr_netlink.c  hsr_slave.h
hsr_device.c   hsr_forward.h   hsr_main.c      hsr_netlink.h  Kconfig
hsr_device.h   hsr_framereg.c  hsr_main.h      hsr_slave.c    Makefile
debian@debian:~$

I tried a few commands to build the .ko file but nothing worked.
debian@debian:/usr/src/linux-5.10.57/net/hsr$ make
make: *** No targets.  Stop.
debian@debian:/usr/src/linux-5.10.57/net/hsr$
debian@debian:/usr/src/linux-5.10.57/net/hsr$ make install
make: *** No rule to make target 'install'.  Stop.
debian@debian:/usr/src/linux-5.10.57/net/hsr$
debian@debian:/usr/src/linux-5.10.57/net/hsr$ make modules
make: *** No rule to make target 'modules'.  Stop.
debian@debian:/usr/src/linux-5.10.57/net/hsr$
debian@debian:/usr/src/linux-5.10.57/net/hsr$ make modules_install
make: *** No rule to make target 'modules_install'.  Stop.

If you want to know what is in the Makefile :
debian@debian:/usr/src/linux-5.10.57/net/hsr$ cat Makefile
# SPDX-License-Identifier: GPL-2.0-only
#
# Makefile for HSR
#

obj-$(CONFIG_HSR)       += hsr.o

hsr-y                   := hsr_main.o hsr_framereg.o hsr_device.o \
                           hsr_netlink.o hsr_slave.o hsr_forward.o
hsr-$(CONFIG_DEBUG_FS) += hsr_debugfs.o
debian@debian:/usr/src/linux-5.10.57/net/hsr$

Here are my questions :

*

*Does a builtin module need a .ko file to be in the path required by the /lib/modules/5.10.57/modules.builtin file  to be loaded ?

*If yes, how can I generate or find the hsr.ko file I need ?

A: Since you configured the driver as built-in, rather than a module (<M> in  the kernel configuration), it is part of the kernel binary (bzImage etc.). It will always be "loaded" whenever that particular kernel binary is booted.
You won't see it as a separate .ko file, nor will you be able to force the .ko file to be built.