SSRS 2005 - Subscription Email is squished to the left

Question: I have a data driven subscription that uses web archive as the format to embed the report in an e-mail message.
My problem is that the report is smashed over to the left in a thin band, approximately 150 - 200 pixels wide (my guess).
When I open it in outlook it is smashed.  I can click to view it in a browser, which opens it in IE.  In IE, it looks fine.
How do I get the report to expand horizontally to fit in my e-mail?
Here's a few settings that might be necessary to figure this out, but I'm not sure if they have anything to do with the issue I'm seeing.

Size is set to 8.5in wide by 4in high
Margin is set to 1in, 1in, 1in, 1in
Interactive size is 8.5in by 11in

EDIT:
Interestingly, when I turn on the ruler in Outlook, the slider is set and will not move from the width of the smashed report.
Answer: Have you tried the email extension for SSRS?
http://msdn.microsoft.com/en-us/library/ms160334.aspx
Comment: That is exactly what I'm using.
Comment: But it does not address the formatting issues.  That only addresses how to send a report through e-mail.
Comment: are you using the std setup for the SMTP server and allowed host names? I am trying to replicate the issue on my side.
Comment: what report regions/widgets are you using in the report: tables, matrix, list, maps, etc.? When I send a table to Outlook 2010 using SSRS in SQL Server 08 R2, I cannot replicate your issue.
Comment: There is no table, because the report is just text boxes and an image.  Since my datasets (three of them for all the data) only return 1 row, any time I inject data into my text I do something like `First(Fields!FirstName.Value, "UserDataSet")`
Answer: As a hack, I've created a 1 px tall, 8.5 inch wide white image and embedded it in my report. This forces the report to 8.5 inches wide, but doesn't explain how to get the rendering engine to make the report expand automatically.
Answer: We faced a similar problem and after a lot of workarounds we finally found out the one parameter in SSRS configuration that did the trick: OutlookCompat. With this enabled the HTML4.0 e-mails no longer look squished in Outlook.
See the MSDN documentation for more details. You can set this value either in the SSRS configuration file (for all reports and callers) or directly when calling the ASMX.
Example of the SSRS configuration:
<code><Extension Name="HTML4.0" Type="...">
    <Configuration>
       <DeviceInfo>
          <OutlookCompat>True</OutlookCompat>
       </DeviceInfo>
    </Configuration>
</Extension>
</code>
Answer: If you're using outlook 2007 to view the report, this problem has a hotfix.
http://support.microsoft.com/kb/935399


What could prevent a motorised CD player drawer from opening after not being used for an extended period of time?

Question: Many years ago, I used to use a CD player that had an opening drawer - you'd press a button, the drawer would open, you'd insert the CD and then either push the drawer closed or use the same button. For some unknown reason to me now, this drawer somehow became damaged and after being off for several hours, it'd take around 50 presses of the button before the drawer would open. The button would press without issue, but each time I pressed the button I could hear the drawer sticking until it'd just open - if I kept using the button to open the drawer it'd open without issue, but if I stopped for an extended period of time I'd have to repeat the same process outlined above. This drawer would open outwards - it wasn't a flip-up kind of thing.
What could have changed in the period of time that I stopped opening the drawer to make it stick and not open? I'm not an expert on these types of things, and even though I no longer use this particular player I've always been interested to know!
Thanks.
Comment: Not a direct answer, and I think this is probably off topic for the site, but here is a [good video from Technology Connections](https://www.youtube.com/watch?v=L6iyUSnrGk0) that explains how the changers work.
Comment: Be aware the DIY in our name is in the context of home repair, not general fix-it, so expect an off-topic close.  For that you can try lifehacks.se, but ifixit.com is better still.
Comment: the tray is probably ejected by a small motor that uses a pulley and a rubber o-ring to power the mechanism .... the rubber o-ring probably degraded and snapped
Answer: The grease on the pinion gear could have dried out or the bearing surfaces, usually plastic on plastic. There are things that could cause this that we may not think about, but if you have ever opened one of these up the motors are tiny and many are monitored or they open and close based on how much current is being drawn, two much current you hear them try to cycle but they cannot. A paper clip or large needle will usually release a stuck tray (small hole usually just under the tray that opens) manually opening the drawer can sometimes get them working again for a while.
Comment: Yeah, that's surely what it is. It works after some time because the heat of the PC's operation is warming it up.  And yes, the motor control electronics are monitoring torque (~~ current) to save motor, mechanism and drive electronics.
Comment: if heat helps,it might be grease softening up. often dusty grease causes this. opening and closing the tray a few dozen times might thin out the grease to the point it will cold open again.


How to fix an uneven (curved) upper window box to install blinds?

Question: The top of my window frame is curved, probably as a fail in construction. Just noticed it when I was trying to install new blinds.
You can see it in the picture below that it is uneven by the center of the frame.

Now when I try to install the blinds I need like another quarter inch for the edge to latch into the holder:

Is there any simple solution? I can think in adding spacers (which I just did temporarily, but looks quite ugly), or to do some sanding in the center to remove the extra material in the curved part and then repainting.
Edit: Forgot to add that the frame is vinyl.
Thanks a lot!
Comment: Is the board loose (i.e. can you push it up in the center), or is it firmly attached in that position?
Comment: Has it always been bowed like that? Is the board loose? Is the window easily operable? I really hope that's not a result of compression from a foundation or house settling issue because if it is then any "fix" you implement will give way over time.
Comment: The board is not loose, it is firmly attached.
The window is operable (house was just built).
Answer: I would insert the spacer as you suggest, and then re-trim the front. Sanding 1/4in is a lot of work.
It seems that the casing trim is straight, but the window box is curved. You can get small trims (e.g. pine stop molding) which you could mount to the front face of the box, butting it against the existing casing and against or even in front of the top of the blind frame.
Comment: Thanks P2000. Forgot to add that the frame is vinyl, would that change the your suggestion?
Comment: You mean the frame of the blinds, right? I have those too. Yes, but the pine/oak trim won't have to cover the vinyl entirely, just a little lip if anything. The point is to cover the gap after you apply the spacers.
Comment: I meant what I called the frame of the window is vinyl. You called it window box, which seems to be the correct name. I noticed it is vinyl when I drilled the holes for the blind holders.
Comment: Ah, well in that case you really can't sand. And the sag is perhaps because the vinyl is under tension. You'd have to remove the box to see what's causing the bending. So, still easiest to the front of it.
Answer: This could be an easy fix or a time-consuming one - but worth a shot. With a vinyl window casing I would carefully remove the window trim at the top. That will enable you to see what you're dealing with. If there is a gap in the middle between the window casing and the header you should be able to close it up with a couple of brads. However, The window is almost certainly shimmed. I'm guessing that when they shimmed the window the installer may have over-shimmed at the center point. It's easy to do with a vinyl casing. If so, it's an easy fix. Knock out the shim and insert a narrower one.
If the problem is a warped header then it'll get a lot more complicated requiring removing the casing and sanding or go back to placing a spacer under the brackets.
Comment: This worked. Builder came and had to remove the trimming and and remove the extra material that was causing the problem behind.


How to return just the number value of a user's attribute in AD

Question: At my hospital I am trying to write a script to add security when unlocking a user's account.
when running this code,
import-module ActiveDirectory
$user = Read-Host -prompt 'User name of Person locked out'
$id = get-aduser $user -properties '*'| select -property employeeNumber

$id outputs as "@{employeeNumber=someNumber}"
is there any way to set the $id to just output 'someNumber'?
Thanks in advance!
Answer: You can utilize -ExpandProperty 'employeeNumber' on the Select-Object cmdlet.
Alternatively:
$id = (Get-ADUser $user -Properties '*').employeeNumber


Can't open pdf in Webview , No Activity found to handle Intent error

Question: I made a lot of searching before asking here.
I cant open a pdf in my Webview , i had the following error : No Activity found to handle Intent error.
Here is the code of the WebBrowser activity :
webview.setWebChromeClient(new WebChromeClient() {

public void onProgressChanged(WebView view, int progress) {
   activity.setProgress(progress * 100);
     }
     });

 webview.setWebViewClient(new WebViewClient() {
   public boolean shouldOverrideUrlLoading(WebView view, String url) {
          if (url.endsWith("pdf")) {

      Intent intentUrl = new Intent(android.content.Intent.ACTION_VIEW);
          intentUrl.setDataAndType(Uri.parse(url),MIME_TYPE_PDF);
         startActivity(intentUrl);

        }
                  else{
              view.loadUrl(url);
          }
              return true;
          }

public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
     //Users will be notified in case there's an error (i.e. no internet connection)
     Toast.makeText(activity, "Oops! Connexion inexistante ou " + description, Toast.LENGTH_SHORT).show();
                }
     });

  //This will load the webpage that we want to see
  webview.setPictureListener(this);
  webview.loadUrl(WebAddress);
}

Here is the manifest xml :
    <application android:icon="@drawable/icon" android:label="@string/VisitEnsta">
     <activity android:name=".SplashScreen"
              android:label="@string/app_name">
            <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
     </activity>

     <activity android:name=".main"
           android:configChanges="locale"></activity>

     <activity android:name=".Apropos"></activity>

    <activity android:name=".Resultat"
          android:configChanges="locale"></activity>

    <activity android:name=".SyntheseVocale"
          android:configChanges="locale"></activity>

    <activity android:name=".Visite"
          android:configChanges="locale"></activity>

    <activity android:name=".RssActivity" android:theme="@style/ListTheme"></activity>

    <activity android:name=".WebBrowser">
        <intent-filter>
         <action android:name="android.intent.action.VIEW" />

        </intent-filter>
    </activity>

    <activity android:name=".Utilities">
    <intent-filter>
         <action android:name="android.intent.action.VIEW" />

        </intent-filter>
    </activity>

    <activity android:name=".StudentsAccess">
    <intent-filter>
         <action android:name="android.intent.action.VIEW" />

        </intent-filter>
    </activity>

</application>
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA"/>

</manifest>

I have adobe reader installed on my phone, and i debug on a real device (Galaxy S).
Her is the error trace :
06-12 20:13:10.312: E/AndroidRuntime(3311): android.content.ActivityNotFoundException:               No Activity found to handle Intent { act=android.intent.action.VIEW dat=http://www.ensta-bretagne.fr/images/contenu//EspaceDocumentation/depliant_institutionnelle_fr_novembre2011_web.pdf typ=application/pdf }

Please have you any solution ?
Comment: See my answer **[here](http://stackoverflow.com/a/14151204/1931228)**. My solution discourages the use of setDataAndType as it doesn't seem to work with PDF types via online link.
Answer: Here is the code which i have used to view the pdf file in webview.
Please check it .
WebView webview=new WebView(SpecialityAllManuals.this);
                        webview.getSettings().setJavaScriptEnabled(true);
                        String pdf = "http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf";

                        webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + pdf);

Comment: Thanx, it has been a while since i dropped the idea of showing .pdf in webview, but i think your contribution will help many programmers in this case.
Comment: what if the pdf is stored locally and no internet @itsrajesh4ugys?
Answer: Use Adobe Reader (or another installed pdf viewer) via an intent. See this solution on SO here
Comment: Does not work, i always have the same error, even when i specify the package, it's really making me crazy ...
Comment: Are constrained to using only the webview to display this pdf or are u free to do this any other way?
Comment: I managed to download it, but my objectif is to dosplay it with in the webview.


Expansion of integral

Question: How can I expand the integral
\begin{equation}
\int_{t}^{\infty}\frac{\exp(-x)}{x}dx
\end{equation}
 to compute it numerically.
Comment: what do you mean by "expand the integral"?
Comment: Are we in the range $t\gg 1$ or $t\in(0,1)$?
Comment: See exponential integral (https://en.wikipedia.org/wiki/Exponential_integral)
Comment: You mean using Taylor series ? Like
$$
\int_{t}^\infty \sum_{i=0}^\infty (-1)^i x^{i-1}/i!
$$ ?
Comment: Long story short: series expansion for small values of $t$, continued fraction for large values of $t$.
Answer: This is an exponential integral with known series expansion:
$$\int_t^{+\infty}\frac{e^{-x}}x~\mathrm dx=-\gamma-\ln(t)-\sum_{k=1}^{+\infty}\frac{(-t)^k}{k\cdot k!}$$
Other such approximations may be found here.
Comment: (+1) This is the way to go if $t$ is close to $0$. If $t\gg 1$ the continued fraction representation provides a faster technique for numerical evaluation. Our answers complete each other.
Comment: Thanks for you comment @JackD'Aurizio
Answer: Assuming $t>0$ we have
$$ I(t)=\int_{t}^{+\infty}\frac{dx}{x e^x} = \frac{1}{te^t}\int_{0}^{+\infty}\frac{dx}{\left(1+\frac{x}{t}\right)e^x}$$
and
$$ \frac{1}{te^t}=\frac{1}{te^t}\int_{0}^{+\infty}\frac{dx}{e^x}>I(t)>\frac{1}{t e^t}\int_{0}^{+\infty}\frac{dx}{e^{\frac{x}{t}}e^x} = \frac{1}{(t+1)e^t} $$
might be good enough for pratical purposes. If you require a greater accuracy, you might use the continued fraction representation:
$$ I(t) = \frac{e^{-t}}{(t+1)-\frac{1}{(t+3)-\frac{4}{(t+5)-\frac{9}{(t+7)-\frac{16}{(9+t)+\ldots}}}}} $$
Comment: @SimplyBeautifulArt: they are indeed equivalent - http://functions.wolfram.com/GammaBetaErf/ExpIntegralEi/10/
Comment: Hm... this looks slightly different from the continued fraction on the [Wikipedia](https://en.wikipedia.org/wiki/Exponential_integral#Approximations)
Answer: The function you are integrating is decays quite quick. So let $f(x) = \frac{\exp(-x)}{x}$, choose small $\Delta x$ and just compute:
$$\sum\limits_0^Mf(t + n\Delta x)\Delta x$$
where $M$ is some big number (the idea is that there is no point to compute the values all the way to infinity since you will be adding zero's.)
How to check if your $\Delta x$ is fine? Make is twice as small and recompute - if not much changed then you are fine. How to make sure your $M$ is big enough? Make it twice as big and recompute!
Comment: This is effective only if $t\gg 1$. $f(x)=\frac{1}{x e^x}$ has a non-integrable singularity in a right neighbourhood of zero, hence for small values of $t$ SBA's strategy is way superior.

Expansion of integral


No backend available (GLMakie, CairoMakie, WGLMakie)

Question: I am following an Agents.jl tutorial (https://juliadynamics.github.io/Agents.jl/stable/examples/schelling/) and get the following error when executing this piece of code. Any ideas why?
using Agents
using InteractiveDynamics
using CairoMakie

groupColor(a) = a.group == 1 ? :blue : :green
groupMarker(a) = a.group == 1 ? :circle : :rect

fig, _ = abm_plot(model, ac = groupColor, am = groupMarker, as = 10)

#Note that abm_plot is a function from InteractiveDynamics.jl which uses makie
#and model is an AgentBasedModel obj created from Agents.jl

#Out >
No backend available (GLMakie, CairoMakie, WGLMakie)!
Maybe you imported GLMakie but it didn't build correctly.
In that case, try `]build GLMakie` and watch out for any warnings.
If that's not the case, make sure to explicitely import any of the mentioned backends.

Answer: Had to update InteractiveDynamics package from 0.14.6 to 0.15.1. The answer to this problem can be found in the following thread.
https://discourse.julialang.org/t/no-backend-available-glmakie-cairomakie-wglmakie/62984/6


adjust Python fuction to parse xml

Question: I need to read an XML file in an external domain.
my code:
tree = ET.ElementTree(file=urllib2.urlopen('http://192.168.2.57:8010/data/camera_state.xml'))
root = tree.getroot()
root.tag, root.attrib

for elem in tree.iter():
    print elem.tag, elem.att

I could not get into the structure I need, the result of my function is this below:
CameraState {}
Cameras {}
Camera {'Id': '1'}
State {}
Camera {'Id': '2'}
State {}
Camera {'Id': '3'}
State {}
Camera {'Id': '4'}
State {}

I need to adjust this Python function to get into a result as below:
<CameraState>
    <Cameras>
        <Camera Id="1">
            <State>NO_SIGNAL</State>
        </Camera>

        <Camera Id="2">
            <State>OK</State>
        </Camera>
    </Cameras>
</CameraState>

Comment: can you add an overview of your original XML file, this would help a lot.
Answer: You do have the parsed structure. It's just about the way you are accessing it.
Use getchildren to access children nodes. An example of recursively printing the structure:
import xml.etree.ElementTree as ET

def print_tree(node, prefix=''):
    print(prefix, node.tag, node.attrib, node.text.strip())
    for child in node:
        print_tree(child, prefix + ' ')

tree = ET.ElementTree(file=<your file>)
root = tree.getroot()

print_tree(root)

It gives:
CameraState {}
 Cameras {}
  Camera {'Id': '1'}
   State {} NO_SIGNAL
  Camera {'Id': '2'}
   State {} OK

However, I recommend you take a look at xmltodict:
import xmltodict

with open(<your file>) as f:
    tree = xmltodict.parse(f.read())

print(tree)

It gives you OrderedDicts:
OrderedDict([('CameraState', OrderedDict([('Cameras', OrderedDict([('Camera', [OrderedDict([('@Id', '1'), ('State', 'NO_SIGNAL')]), OrderedDict([('@Id', '2'), ('State', 'OK')])])]))]))])

adjust Python fuction to parse xml


Clone animated attribute

Question: I have recently changed my drag and drop game to make it easier for young users.
Basically instead of dragging and dropping letters to spell words you now click the letter and it animates into the correct area automatically.
My problem is when I had the drag and drop function the letters would clone so you could use each one more than once in a game. Now they don't.
Is there a different way of doing that outside the drag and drop event?
$('.drag').on('click', function(e) {
e.preventDefault();

var target     = $('.drop-box.spellword:not(.occupied):first');
var targetPos  = target.position();
var currentPos = $(this).offset();
var b = $(this);

if(target.length) {

    if(b.attr("data-letter") == target.attr("data-letter")){
        $(this).addClass('wordglow3').css('color', 'white');
            $('.minibutton').prop('disabled', true);
        } else {
            $(this).addClass('wordglow');
            $('.minibutton').prop('disabled', true);
    }

        b.remove().appendTo('table').css({
        'position' : 'absolute',
        'top' : currentPos.top,
        'left': currentPos.left
        });
        {
        b.animate({
           top  : targetPos.top,
            left : targetPos.left
        }, 'slow', function() {
            b.remove().css({ top: 0, left: 0 }).appendTo(target);
            target.addClass('occupied');
        });
      }
   }
});

This is what I used in the drag and drop function...
    $('.drag').draggable({
    helper: 'clone'
});

Answer: You can clone() the element and animate() the clone:
if (target.length) {
    $(".minibutton").prop("disabled", true);
    b.clone().addClass(
        b.data("letter") == target.data("letter") ? "wordglow3" : "wordglow"
    ).appendTo("table").css({
        background: "transparent",
        position: "absolute",
        top: currentPos.top,
        left: currentPos.left
    }).animate({
        top: targetPos.top,
        left: targetPos.left
    }, "slow", function() {
        $(this).css({
            top: 0,
            left: 0
        }).appendTo(target);
        target.addClass("occupied");
    });
}

(As a side note, you do not have to call remove() before appendTo(), as the element will be moved if it already has a parent.)
Comment: When they clone they take the css from the ones that go to the grid how can I stop this. This fiddle will show you what I mean http://jsfiddle.net/smilburn/3qaGK/8/ @Frédéric Hamidi
Comment: If I understand your comment correctly, you probably have to add the `wordglow` and `workglow3` classes to the clone instead of the original element.
Comment: How would i differentiate the two styles though in that part of the code? @Frédéric Hamidi
Comment: Well, as probably by comparing the `data-letter` attributes as you're doing right now :) I'll try to integrate that part in my answer.
Answer: You could manually clone your element using the following:
$(e.target).clone().after(e.target);
Comment: Where in the function would you put that? @phunder
Comment: You add it when you start dragging the original element.

Clone animated attribute


Burnt sheathing behind outlet

Question: I heard buzzing and popping noises behind this kitchen outlet so I opened it up and it looks like this:

What might've caused this? And to repair this, do I have to cut up the drywall and replace the wires/sheathing? Or just wrap whatever is in the box with black tape?
Comment: I agree with mac.  If things are melting/burning, it's time to call a pro.
Comment: I'm going to say its time to cut power to that circuit at the breaker panel and call a professional electrician.
Comment: Completely disagree with @mac.  This is a DIY forum, and our goal is to answer questions, and this is certainly a question that's easily answerable.
Answer: (Old post, but needs a much better answer)
"What might've caused this?"
I see obvious arcing under the sheath, it looks like water intruded and high current from the black conductor, through a nick in the black wire insulation flowed to the ground wire. These nicks happen when carelessly cutting the sheath. Once that current started flowing, perhaps the insulation melted enough to establish the arc, as you heard.
"And to repair this, do I have to cut up the drywall and replace the wires/sheathing? Or just wrap whatever is in the box with black tape?"
Somehow new wire must be run because the spot with the arcing happened must be eliminated. That arcing ate away from the conductor.
Sometimes the box can be removed and wire fished through the wall.
Answer: The best thing to do is set yourself about 2 hours of free time, turn off the power to any wire near that box (use one of those electric sensors), make sure you have a flash light, around.
First, pull as much of the wires free as you can, restrip everything and get new caps and tape everything new.  If you think or even suspect another shitty splice is outside the box then yes, break through the drywall and make sure you tape and replace any splices there as well.
edit: ha, just saw that's not drywall...well tile is not as easy to fix, but honestly it's not that bad either...just a bigger project.
edit: am I seeing water damage (the green on the copper and debris in the box?)  Just make sure there's no water leaking in your wall....
source: own several very old houses - I do this everytime I change a ceiling light - they are just masses of cloth tape and garbage...
Comment: There shouldn't be any splices behind the drywall that are not in an accessible junction box. If there are, they are against code. (unless an approved splicing device like [this one](https://diy.stackexchange.com/questions/4493/is-there-a-way-to-simply-splice-in-an-additional-length-of-12-2-nm-b-cable/4535#4535) is used)
Comment: "pull as much of the wires free"?? The wire won't pull into the box, there won't be any slack inside the wall!
It is really important to replace the conductor that arced. It is also important to have conductors without nicked insulation, so that water intrusion won't establish a bridge from the hot lead to ground.
Comment: it's about 1 ft from the kitchen sink which is currently clogged to the roof. Using the garbage disposal causes water to shoot from the roof pipe so it's possible, but what about rain? Wouldn't the box just overflow?

Burnt sheathing behind outlet


JavaScript button not resizing on mobile correctly

Question: I am creating a search bar in my HTML and I am trying to put a magnifying glass button at its end. It looks fine on desktop, but on mobile the button is taller than the search bar. Much thanks if you know how to get it to be the same height on every viewport.

.autocomplete {
  position: absolute;
  top: 50%;
  left: 15%;
}

button[type=reset] {
  background-color: #34587F;
  color: #fff;
  position: absolute;
  border: 0;
  font-size: 2vw;
  border-radius: 10%;
  width: 20%;
  height: 100%;
}

  <input id="searchField" type="text" name="search" placeholder="SEARCH" />
  <button type="reset" id="submit" onclick="goTo();">
       </button>

Appearance on desktop
Appearance on mobile
Comment: Just give your `autocomplete` `display: flex` and your `input` `width: 100%` that's all and if you are added some special padding for your input remove it or update the post and add it
Comment: @JS_INF that did the trick, thanks a bunch.
Answer: It looks like you're setting the height of the reset to height: 100% for the parent autocomplete div. Make sure that you're also setting the height of the input/searchField to the same height (i.e. 100%) to match that of the reset button. If they're styled the same, make sure you set a height for the autocomplete class. Having an unset height for an absolutely positioned parent, with relative height children, may be causing your issues.
Comment: Is something like this:

input {

      border: none;

      background-color: #f1f1f1;
      padding: 2%;

      font-size: 2vw;

      border-radius: 5%;

      height: 100%;

   }

what you're referring to?
Comment: Try setting a height to the `autocomplete` class. Having an unset height for an absolutely positioned parent may be causing your issues.
Comment: Thanks for your help. Adding a height to the autocomplete class made the height stay the same, but the button now repositions itself above the search bar on mobile devices. [picture](https://imgur.com/dOZSZOQ)
Comment: Alright! I would recommend trying `display: flex` for the `autocomplete` class. Also, remove the absolute positioning from the button. This should achieve what you want, but you may have to make some adjustments to the width of the search bar (i.e. `width: 100%`). I edited my original answer to match the solution to your original problem.


How to simplify this expression using tensor notaion?

Question: $\nabla^2 (\phi A)-A \nabla^2 \phi -2(\nabla \phi \cdot\nabla)A$
Where $A,\phi$ are any sufficiently smooth vector and scalar fields respectively.
Answer: $\nabla^2 (\phi \vec A)=\partial_i^2(\phi A_j)=\phi \partial_i^2(A_j)+2\partial_i (\phi) \partial_i(A_j)+A_j\partial_i^2(\phi)=\phi \nabla^2 \vec A+2(\nabla \phi \cdot \nabla)\vec A+\vec A \nabla^2 \phi$
And the rest is trivial.
Comment: can i ask why $\partial_i(\phi)\partial_i(A_i)=(\nabla\phi \cdot \nabla)A$
Comment: i thought $\partial_j(\phi)\partial_j(A_i)=(\nabla\phi \cdot \nabla)A$
Comment: Yes, you are correct.


Bash script: "read" command not responding

Question: I am writing a bash script that will

Downlaod a website's html code into a file "index.html"
Ask user for file type and search "index.html" for number of matched file types

This is the function that will complete step 2:
1. function findFiles() {
2.      echo "Enter file type to search for (include '.') || Type EXIT to terminate program "
3.      read fileType
4.
5.      while [[ "$fileType" != "EXIT" ]];
6.      do
7.          if [[ $(grep -q $fileType index.html) = 1 ]]; then
8.              grep -F "$fileType" index.html >> foundFiles.txt
9.          fi
10.     done
11.
12.     rm index.html
13. };

When executed, line 3 prompts for user input but does not respond when I hit enter, example follows:
2021-09-26 12:41:06 (2.66 MB/s) - 'index.html' saved [94126]

Enter file type to search for (include '.') || Type EXIT to terminate program
.pdf
.txt

foo
AAAA

I have tried declaring a local variable $fileType first, using read -p and putting a semicolon at the end of line 3. The result is always the same and I have not been able to find a solution. I'm aware that what follows line 3 is flawed, but I just would only like help with line 3 as the following lines are something I would like to work on myself to learn more about bash scripting.
Any ideas are appreciated.
Comment: Show us how you're executing this function.
Answer: It isn't supposed to respond. It is doing exactly what it should: it reads the input and assigns it to the variable fileType. However, you then have a while loop which is checking the value of a variable that never changes:
while [[ "$fileType" != "EXIT" ]];

Since the value of $fileType is set only once and before the while loop, that while becomes an infinite loop unless you pass EXIT on the first try. In any case, your script wouldn't work anyway since the output of grep -q pattern file will never be 1. In fact, it will always be empty since that's what grep -q does. I suspect you meant to check the exit status of the command but, even that is pointless: there is no benefit in reading the entire file once with grep -q only to then read it all over again with grep -F.
Here's a working version of your function:
function findFiles() {
  while [[ "$fileType" != "EXIT" ]];
  do
    echo "Enter file type to search for (include '.') || Type EXIT to terminate program "
    read fileType
    grep -F "$fileType" index.html >> foundFiles.txt
  done
     rm index.html
 };

Or, if you want to avoid creating an empty foundFiles.txt if no matches were found, you can try:
function findFiles() {
  while [[ "$fileType" != "EXIT" ]];
  do
    echo "Enter file type to search for (include '.') || Type EXIT to terminate program "
    read fileType
    if grep -qm1 "$fileType" index.html; then
      grep -F "$fileType" index.html >> foundFiles.txt
    fi
  done
     rm index.html
 };

The -m ensures the grep exits after the first match so you don't need to read the whole file twice. Note how I am not using the command substitution ($(command)) syntax since I am checking that the command was successful, and not trying to use its output.
Comment: Yes! Thank you, this has fixed my problem and I understand your solution, which helps me a lot. I'll work on the script to make sure it does exactly what I'm trying to get it to do.
Answer: You seem to be catching yourself in an endless loop. If the user did not type "EXIT", then the while loop will go on forever. Any additional text you type is just being echoed to the terminal.


how to get the entry url on the page, after navigation?

Question: I have the following scenario:
I want to pass a parameter to a pagefoo.com?bar=x, but foo.com automatically redirects based on language to foo.com/en and I am loosing the bar parameter.
I don't mind I'm in foo.com/en, I just want the bar parameter.
The Referer solution does not work, as it automatically redirects, and it's the one before foo.com?bar=x.
Is there a JavaScript or jQuery solution to this problem?
edit
I just have a script on the page, foo.com is not my domain, I have the script on both  foo.com and foo.com/en. The problem is that on foo.com the script does not get called, and on foo.com/en I don't have the parameters any more.
The page foo.com redirects by this method:
<meta http-equiv="Refresh" content="0;URL=foo.com/en" />
I can't modify this method, and I don't want to, as the solution would not be generic.
Comment: I can't think of a single non-malicious reason why you would have a script running on `foo.com` and not be able to talk to the owner of `foo.com` about it.
Comment: How is the redirection done? Who does the redirection?
Comment: `foo.com` does the redirection, I just have a script an all the pages, the problem is that on `foo.com?bar=x` it does not get do run, and on `foo.com/en` it does run, but I don't have the param any more
Comment: OK so the question is, how does foo.com do the redirection? Is it a host that does this automatically for you? Do you have any control over it? In other words, can you please provide some details about the mechanics of the redirection, if you know it?
Comment: One reason would be that it is not so cool to tell everybody take this script, but also modify your page. Talking to the owner would have been the last option, I'm happy that I found the fragment identifier solution, which works perfect. It was not such a big problem, it clearly had a clean way to solve. I saw Google Analytics using the same practice.
Answer: No, there isn't.
If foo.com?bar=x and foo.com?bar=y should have different content, then they shouldn't redirect to the same resource.
Answer: Have you tried changing the redirect so that it includes anything after the domain name e.g. the script name, querystring, etc. in the redirect?
Answer: Found the solution, it was much easier, just change from
foo.com?bar=x
to
foo.com#bar=x
This way, the hash tag remains, so I have foo.com/en#bar=x
Thank you for your answers.
Answer: You could use a PHP catch...
If you have
foo.com?bar=x
and you want to redirect to
foo.com/en?bar=x
use this
<meta http-equiv="Refresh" content="0;URL=foo.com/en?bar=<?php echo $_GET["bar"]; ?>" />
the resulting redirect will be
foo.com/en?bar=x


Adding rows to Datatable does not work as expected

Question: My program gets data from a mariadb-database and I want to display the contents I get from the database in a table created as an instance of the MDDataTabl-class. I read that I can pass the data as a list of lists to the class.
from kivymd.app import MDApp
from kivymd.uix.datatables import MDDataTable
from kivy.metrics import dp
import datetime

dataforrows=[]
dataofrow=[]

# cur is where the elements from the database query are stored in.

for (Field1,Field2,Field3) in cur:
    dataforrows.append(Field1)
    dataforrows.append(Field2)
    dataforrows.append(Field3)
    temprow=dataforrows.copy()
    dataofrow.append(temprow)
    dataforrows.clear()
print(dataofrow)

The construction of my list works as expected, as the output of print(dataofrow)to the CLI shows:
[['01', '2-2', datetime.date(2020, 2, 28)],
['02', '1-1', datetime.date(2020, 2, 28)],
['03', '1-8', datetime.date(2020, 2, 28)],
['07', '1-3', datetime.date(2020, 2, 28)],
['11', '1-4', datetime.date(2020, 2, 28)],
['06', '', datetime.date(2020, 2, 28)],
['10', '1-8', datetime.date(2020, 2, 28)],
['05', '2-1', datetime.date(2020, 3, 3)],
['09', '', datetime.date(2020, 3, 6)],
['08', '1-3', datetime.date(2020, 3, 6)],
['04', '', datetime.date(2020, 3, 6)]]

The problem arises when I try to fill the table with dataofrow. Only 5 items are displayed and no scrollbar is visible. Here is the snippet that creates the table:
table = MDDataTable(pos_hint={'center_x': 0.5, 'center_y':0.5},
                    column_data=[
                                ("Field1", dp(30)),
                                ("Field2", dp(30)),
                                ("Field3", dp(30))
                            ],
                    row_data=dataofrow
        )

Even when pasting the output manually into the sourcecode only the first 5 rows are displayed. Also filling the empty '' with something makes no difference in the visual output.
What am I missing here?
Answer: You could try adding the "rows_num" value to the MDDataTable description as shown below. This will show 200 rows of content with scrollbar.
table = MDDataTable(pos_hint={'center_x': 0.5, 'center_y':0.5},
                rows_num=200,
                column_data=[
                            ("Field1", dp(30)),
                            ("Field2", dp(30)),
                            ("Field3", dp(30))
                        ],
                row_data=dataofrow
    )


What are the steps to evaluate $\int \frac{1}{x^2+1} dx$?

Question: I research this with Google, but apparently, it is so straightforward the websites give the answer as I already know that ...it is the arc Tan and on youtube one fellow substitutes the complex number for x and sure enough it works......
I can't help but think there is a straightforward way to do this with very minimal steps...and not using complex numbers. Does anyone out in the community know how?
Comment: Are you asking how to come up with the idea to substitute $x=\tan t$?
Comment: Knowing the basic functions' derivatives is a big must to enter into antidifferentiation and integration.
Comment: Maybe try a book ?
Comment: You just have to be able to read a table of derivatives  from right to left. Actually, this integral should be known by heart.
Comment: @Bernard I think the OP is asking why this derivative is correct, and this is a question which can be answered.
Comment: @PatrickStevens Indeed, I'm not sure why people were so unkind to op here. It's a valid question.
Comment: x = tan t ?    I though of that but how do ya know x will be some tangent of t?  ...just thought there was an easy way using a simple right triangle...no big deal
Answer: Here's how you prove that it's correct, if you've just plucked out of the air that the answer is $\tan^{-1}$ and you want to know why this is.
$$\int \frac{1}{1+x^2} \ \mathrm{d}x$$
Consider $\dfrac{\mathrm{d}}{\mathrm{d}x} \tan^{-1} \tan(x) = \sec^2(x) {\tan^{-1}}'(\tan(x))$ by the chain rule.
The left-hand side is just the derivative of $x$, so is $1$.
So multiplying both sides by $\cos(x)^2$, have $\cos(x)^2 = {\tan^{-1}}'(\tan(x))$.
So (writing $x = \tan^{-1}(u)$) have ${\tan^{-1}}'(u) = \cos(\tan^{-1}(u))^2$.
Now consider $\cos(x)^2 + \sin(x)^2 = 1$, so $1 + \tan(x)^2 = \sec(x)^2$; letting $x = \tan^{-1}(u)$, obtain $$1 + \tan(\tan^{-1}(u))^2 = \sec(\tan^{-1}(u))^2$$
where the left-hand side is just $1+u^2$, so $\cos(\tan^{-1}(u))^2 = \frac{1}{1+u^2}$.
Therefore ${\tan^{-1}}'(u) = \frac{1}{1+u^2}$, and hence integrating both sides $$\tan^{-1}(u) = \int \frac{1}{1+u^2} \ \mathrm{d}u$$
Comment: I will buy this ..thanx...I was hoping someone would know how to do it using a right triangle and making the hypotenuse  x^2 + 1 and one of the sides 1.....
Answer: If you want more steps here's a step by step solution:
First make the substitution: $ x=\tan(\theta) $ | $dx = \sec^2(\theta)d\theta$
When plugging the new substituted variable you get:
$$\int \frac{\sec^2(\theta)}{\sec^2(\theta)}d\theta = \theta $$
Since $\theta=\arctan(x)$ the final answer is:
$$\int \frac{1}{x^2+1}dx = \arctan(x) + C $$
C is some arbitrary constant.


Geometry Dash won't open

Question: I was going to play Geometry Dash on Steam. When I tried to open it, the game said "Running" for a few seconds, and then it just reverted back to "Play".
What I've tried:

Uninstalling and reinstalling
Clearing the files completely (using Everything - Voidtools)
Using compatibility settings
Using the log.txt

And all it said was something like:

(settings.cc) : version is not 1

And nothing worked.
Specs:

Processor: AMD Ryzen 5 4600H with Radeon Graphics 3.00GHz
RAM: 8 GB
OS: Windows 10 Home (x64)

(Before, my Geometry Dash would work.)
Answer: I'm not an expert, but this worked for me when I encountered this bug so I hope it helps.
Press WIN+R and type appdata, then click Local. Go the the Geometry Dash folder, and delete CCGameManager, CCGameManager2, CCLocalLevels, and CCLocalLevels2.
When you open your game, it will reset some stuff like songs and levels. But once you log into your account, it should work fine.

Geometry Dash won't open


Save Value Returned in Either URI or Response to Test Context Using Cypress IO

Question: I want to create a variable for a key that is returned in the URI, and also in the xhr response.  I tried going the route of URI, since that seemed easiest, but not sure how to tell it to only save a portion of the URI, rather than the entire value.
.url().then(($url) => {
            const moveKey = $url.text(/someString.+?(?=\/)/);
            cy.log(moveKey);
        })

I also tried using cy.route and cy.wait, but wait always times out.
cy.server()
        .route('/overview').as('getMove')
        .wait('@getMove').then((xhr) => {
            const moveKey = xhr.move.key;
        })

url = https://app.com/move/xxxxxx/overview
Comment: If you want to extract key from the active location: can you try using `cy.location` (refer: https://docs.cypress.io/api/commands/location.html#Examples)
Comment: `cy.server()` cannot be chained further. Refer: https://docs.cypress.io/api/commands/server.html#Yields
Comment: @Sree.Bh Tried adding `cy` in front of `.route` and `.wait`, still timed out.
Answer: Thanks to @Srinu Kodi's suggestion I as able to figure this out using match.
.url().then(($url) => {
            const moveKey = $url.match(/someString.+?(?=\/)/);
            cy.log(moveKey);
        })

The log outputs an array with the key I needed.  Thanks all for the help!
Answer: This is not an issue with Cypress. It requires lil concepts on javascript strings. Please use below snippet and it works as per the requirement.
it('test', ()=>{
    cy.url().then(fullURL=>{
      fullURL = 'https://app.com/move/xxxxxx/overview';
      let arr = fullURL.substr(fullURL.indexOf('move')).split('/');
      let moveKey = arr[1];
      cy.log(moveKey);
    }
  )})

Comment: I'd remove the line `fullURL = 'https://app.com/move/xxxxxx/overview';`  The key is dynamic, so cannot be known ahead of time, and the variable has already been set when you typed `then(fullURL`


omp_get_thread_num() returns bugged number?

Question: The codes are of thousands of lines, so I cannot pasted them, but the function flow looks somehow like:
void Func_1(double * x, int nx, NUM_THREADS)
{
  omp_set_num_threads(NUM_THREADS);
 //...
};

void Func_2(double *y, int ny, NUM_THREADS)
{

 omp_set_num_threads(NUM_THREADS);
   //...
  #pragma omp parallel for
    for (int i=0; i<N; ++i)
    {
      int threadID=omp_get_thread_num();
       //...
     };

 };

int main (void)
{

//...
  Func_1(x, nx, NUM_THREADS);
  Func_2(y, ny, NUM_THREADS);

//...

};

So basically I get two functions, each call omp_set_num_threads within the function, the problem is, now if I build the program, then the threadID returned in the runtime is total nonsense, the threadID becomes some very large int number like 16113312... that far exceeding NUM_THREADS.
Have anyone experienced similiar problems with Open MP(Intel ICC 13.0)?
Btw, a possible hint is, However I build Func_1 and Func_2 in seperate DLL library and ask the main() to call these functions from the DLL instead of build them all-together with the main(), then all works fine.
Comment: I doubt the function itself returns gibberish. Rather check your code for out-of-bounds array accesses that could possibly lead to local stack variables being overwritten.
Comment: I agree with Hristo. I don't think `omp_get_thread_num()` is a problem. 16113312 = 0xF5DEA0, possibly corrupted by overflow.
Comment: How are you determining the value?  Are you using `printf` by any chance?  If you do that from inside the parallel region, you're bound to have your output corrupted unless you serialize access.
Answer: I had experienced this error, when I was trying to set different number of threads than what  is needed to export. i.e. before starting your applications you will have to
export OMP_NUM_THREADS  4

Check if the number of threads in this location is different than what you use in omp_set_num_threads();
Hope this helps.


Should I change cast iron drain stack? Galvanized Drains too?

Question: Currently renovating 2 bathrooms that are above each other and the full plumbing stack is exposed. The house is from the 1950's and has a cast iron drain stack and connects to the bathtubs and sink drains/venting with galvanized pipe. All looks to be in decent shape overall, but does it make sense to change it now while things are open?
I ran the water on high and all seems to be flowing and draining as expected.
The basement is unfinished so I can easily make repairs to the main drain line (And 1st floor bathroom) that comes down from the drain stack if a horizontal line ever breaks or needs repair. Its the vertical in the wall that I'm most curious about, and the galvanized drain from the 2nd floor tub. A plumber friend told me they normally just leave the vertical stack since it typically never has issues but the horizontal drain lines in the basement are worth considering but they can easily be fixed later in the unfinished basement.
Is it common to replace the entire cast iron drain stack when you have walls open, or is that cast probably fine since its a vertical drop? How about the galvanized pipe from the tub drain that still looks like its visually in good condition?
Thanks!
Comment: Cast iron probably good for many more years.  The galvanized not to sure about, would at least to take apart a small section to check the inside.
Comment: I DK the entire answer, esp. regarding the galv. but one advantage of iron pipe is that it's pretty quiet, replace with with plastic ABS drain line and you might get more noise.
Comment: "Should I" is going to get about as many saying "yes" as "no", because without being there to do an onsite inspection, there's no real way we can know. Cast iron can last centuries (witness: bridges & buildings in the UK), but yours _might_ be just about ready to quit. There's no telling.
Comment: Thanks everyone, lots of solid points and things to consider.
Answer: If you are doing a gut reno of a bathroom you should replace any 70 year old galvanized pipe you find in the walls except maybe dry vents.
Replacing 70 year old cast iron with PVC is a coin toss.  It won't last forever, but it might last another 50 years and your PVC pipe and rubber ferncos might not.  We don't know. There aren't any 100 year old 3 inch PVC risers.
I was in the same position.  I had the walls open, didn't obviously need to replace the vertical cast iron.  It would add about $2000 to an already expensive project.  Before I decided, my other vertical stack, in a bathroom I was not renovating, developed a crack and I had to rip open the kitchen and a bathroom to repair it.   Since they two stacks were the same age and material I decided to do them both.  But you, without a clear indication that your stack is reaching end of life, might have to roll the dice.
It's definitely the case that you can hear water running through PVC drains in the wall, but not through cast iron.
Comment: Great points all around. I think I'll do some good visual inspecting, and possibly cut a few of the galvanized pipes at some points where I can then continue on with a Fernco and PVC, that way I get a really good look on the inside joint areas and see how they look. I may even have a small camera I can snake it just to get an idea of if the walls are slim.

I'll also ask a plumber who I have doing some other work his opinion, but I didn't want to do that without getting some input first since my guess was the verticals may be ok.
Comment: A camera is a good idea.  There are some good self-contained ones (don't need phone or laptop) with multiple cameras for front and side view for under $100.  It's very hard though to see hairline cracks in cast iron.  A pressure test might help, though out of my league and I don't know if that's wise in old cast iron.


Given a matrix and its reduced row echelon form, resolve the image and the kernel.

Question:
The matrices $$A = \begin{bmatrix}1&-2&9&5&4\\1&-1&6&5&-3\\-2&0&-6&1&-2\\4&1&9&1&-9\end{bmatrix}$$
  $$B=\begin{bmatrix}1&-2&9&5&4\\0&1&-3&0&-7\\0&0&0&1&-2\\0&0&0&0&0\end{bmatrix}$$ are row equivalent. Find bases for Col $A$ and Nul $A$ and give the dimensions of these subspaces.

How exactly can I do this?
Answer: Let B be the 2nd matrix.  To find a basis for col(A), take the columns of A corresponding to the leading 1's in B.  To find a basis for nul(A), solve $Bx=0$ and find a basis for this solution space.
Answer: Immediately:
$$\mathbf{A}\in\mathbb{R}^{4\times 6}$$
The problem is to resolve a space of dimension $4$.

The row reduction identifies the fundamental columns:
$$
\mathbf{A} =
\left[
\begin{array}{crrcr}
 \boxed{1} & -2 & 9 & 5 & 4 \\
 0 & \boxed{1} & -3 & 0 & -7 \\
 0 & 0 & 0 & \boxed{1} & -2 \\
 0 & 0 & 0 & 0 & 0 \\
\end{array}
\right]
$$
The three fundamental columns identify the three vectors which span the $\color{blue}{range}$ space:
$$
\left[ \begin{array}{rrrcr}
 \color{blue}{1}  & \color{blue}{-2} & 9 & \color{blue}{5} & 4 \\
 \color{blue}{1}  & \color{blue}{-1} & 6 & \color{blue}{5} & -3 \\
 \color{blue}{-2} & \color{blue}{0}  & -6 & \color{blue}{1} & -2 \\
 \color{blue}{4}  & \color{blue}{1}  & 9 & \color{blue}{1} & -9
\end{array} \right]
$$
Formally,
$$
 \color{blue}{\mathcal{R}\left( \mathbf{A} \right)} = \text{span } \left\{ \,
\color{blue}{\left[
\begin{array}{r}
  1 \\
  1 \\
 -2 \\
  4 \\
\end{array}
\right]}, \,
\color{blue}{\left[
\begin{array}{r}
 -2 \\
 -1 \\
  0 \\
  1 \\
\end{array}
\right]}, \,
\color{blue}{\left[
\begin{array}{r}
 5 \\
 5 \\
 1 \\
 1 \\
\end{array}
\right]}
\, \right\}
$$
The matrices have rank $\rho = 3$.
Therefore, the range space $\color{blue}{\mathcal{R}\left( \mathbf{A} \right)}$ has dimension $3$.

The Fundamental Theorem of Linear Algebra dictates that a matrix $\mathbb{A}\in\mathbb{C}^{m \times n}$ induces the four fundamental subspaces:
$$
\begin{align}
%
  \mathbb{C}^{n} =
    \color{blue}{\mathcal{R} \left( \mathbf{A}^{*} \right)} \oplus
    \color{red}{\mathcal{N} \left( \mathbf{A} \right)} \\
%
  \mathbb{C}^{m} =
    \color{blue}{\mathcal{R} \left( \mathbf{A} \right)} \oplus
    \color{red} {\mathcal{N} \left( \mathbf{A}^{*} \right)}
%
\end{align}
$$
One vector is needed to complete the domain, the vector which will provide the span for $\color{red} {\mathcal{N} \left( \mathbf{A}^{*} \right)}$.
The $\color{red}{null}$ space vectors are found through Gauss-Jordan elimination of the augmented matrix.
Clear column 1.
$$
%
\left[
\begin{array}{rrcc}
 1 & 0 & 0 & 0 \\
 -1 & 1 & 0 & 0 \\
 0 & 2 & 1 & 0 \\
 0 & -4 & 0 & 1 \\
\end{array}
\right]
%
\left[ \begin{array}{c|c}
  \mathbf{A} & \mathbf{I}_{4}
\end{array} \right]
%
=
\left[
\begin{array}{crrrr|rrcc}
 \color{gray}{1} & -2 & 9 & 5 & 4 & 1 & 0 & 0 & 0 \\
 \color{gray}{0} & 1 & -3 & 0 & -7 & -1 & 1 & 0 & 0 \\
 \color{gray}{0} & -2 & 6 & 11 & -8 & 0 & 2 & 1 & 0 \\
 \color{gray}{0} & 5 & -15 & -19 & 3 & 0 & -4 & 0 & 1 \\
\end{array}
\right]
%
= \xi_{1}
$$
Clear column 2.
$$
\left[
\begin{array}{crcc}
 1 & 2 & 0 & 0 \\
 0 & 1 & 0 & 0 \\
 0 & 2 & 1 & 0 \\
 0 & -5 & 0 & 1 \\
\end{array}
\right]
%
\xi_{1}
=
\left[
\begin{array}{ccrrr|rrcc}
 \color{gray}{1} & \color{gray}{0} & 3 & 5 & -10 & -1 & 2 & 0 & 0 \\
 \color{gray}{0} & \color{gray}{1} & -3 & 0 & -7 & -1 & 1 & 0 & 0 \\
 \color{gray}{0} & \color{gray}{0} & 0 & 11 & -22 & -2 & 4 & 1 & 0 \\
 \color{gray}{0} & \color{gray}{0} & 0 & -19 & 38 & 5 & -9 & 0 & 1 \\
\end{array}
\right]
%
= \xi_{2}
%
$$
Normalize row three, then clear column 3.
$$
\left[
\begin{array}{ccrc}
 1 & 0 & -5 & 0 \\
 0 & 1 & 0 & 0 \\
 0 & 0 & 1 & 0 \\
 0 & 0 & 19 & 1 \\
\end{array}
\right]
%
\xi_{2}
=
\left[
\begin{array}{ccrcr|rrrc}
 \color{gray}{1} & \color{gray}{0} & 3 & \color{gray}{0} & 0 & -\frac{1}{11} & \frac{2}{11} & -\frac{5}{11} & 0 \\
 \color{gray}{0} & \color{gray}{1} & -3 & \color{gray}{0} & -7 & -1\ & 1\ & 0\  & 0 \\
 \color{gray}{0} & \color{gray}{0} & 0 & \color{gray}{1} & -2 & -\frac{2}{11} & \frac{4}{11} & \frac{1}{11} & 0 \\\hline
 \color{gray}{0} & \color{gray}{0} & 0 & \color{gray}{0} & 0 & \color{red}{\frac{17}{11}} & \color{red}{-\frac{23}{11}} & \color{red}{\frac{19}{11}} & \color{red}{1} \\
\end{array}
\right]
%
$$
The red vector is
$$
 \color{red} {\mathcal{N} \left( \mathbf{A}^{*} \right)} = \text{span } \left\{ \,
\color{red}{
\left[
\begin{array}{r}
  17 \\
 -23 \\
  19 \\
  11 \\
\end{array}
\right]}
\, \right\}
$$

The decomposition of the image of $\mathbf{A}$
$$
\begin{align}
  \mathbb{C}^{m} &=
    \color{blue}{\mathcal{R} \left( \mathbf{A} \right)} \oplus
    \color{red} {\mathcal{N} \left( \mathbf{A}^{*} \right)} \\
%
% range
&=
\text{span } \left\{ \,
\color{blue}{\left[
\begin{array}{r}
  1 \\
  1 \\
 -2 \\
  4 \\
\end{array}
\right]}, \,
\color{blue}{\left[
\begin{array}{r}
 -2 \\
 -1 \\
  0 \\
  1 \\
\end{array}
\right]}, \,
\color{blue}{\left[
\begin{array}{r}
 5 \\
 5 \\
 1 \\
 1 \\
\end{array}
\right]}
\, \right\}
% null
\oplus
\text{span } \left\{ \,
\color{red}{
\left[
\begin{array}{r}
  17 \\
 -23 \\
  19 \\
  11 \\
\end{array}
\right]}
\, \right\}
\end{align}
$$
The dimension of the $\color{red}{null}$ space is $1$.

The rank-nullity theorem as applied to this matrix $\mathbf{A}\in\mathbf{R}^{4\times 6}_{3}$
$$
\begin{align}
  \text{rank } \mathbf{A} + \text{nullity } \mathbf{A} &= n \\
  3 + 1 & = 4
\end{align}
$$

Another example. Here the matrix is symmetric $m=n$ and it is more challenging to keep track of vector spaces: Find base and dimension of given subspace


Does a set() field pointcut get invoked if field is set via reflection?

Question: I have a field set pointcut, which seems to do as I expect. Its defined as follows
before(Object newval): set(@Serviced private * *.*) && args(newval)
The above is meant to capture: whenever a private field attribute, annotated with @Serviced, is set call my before advice.
Everything seems to work fine, except for the one case in my code that sets a variable matching the above via java reflection ( ie  via java.lang.reflect.Field.set(....).
Any idea's how I can catch that "set" also?
Thanks
Answer: As you have noticed, the set() pointcut cannot intercept reflective field changes. But if you control (i.e. can weave aspects into) the code calling the Field.set*(..) methods, you can work around that issue by also using reflection. Here is a complete, compileable code sample illustrating the solution:
Sample annotation:
package de.scrum_master.app;

import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Serviced {}

Sample entity class with main method:
package de.scrum_master.app;

public class Person {
    @Serviced private int id;
    @Serviced private String name;
    private String country;

    public int getId() { return id; }
    public void setId(int id) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getCountry() { return country; }
    public void setCountry(String country) { this.country = country; }

    public void setIdReflective(int id) throws Exception {
        Person.class.getDeclaredField("id").setInt(this, id);
    }

    public void setNameReflective(String name) throws Exception {
        Person.class.getDeclaredField("name").set(this, name);
    }

    public void setCountryReflective(String country) throws Exception {
        Person.class.getDeclaredField("country").set(this, country);
    }

    @Override
    public String toString() {
        return "Person [id=" + id + ", name=" + name + ", country=" + country + "]";
    }

    public static void main(String[] args) throws Exception {
        Person person = new Person();
        person.setId(11);
        person.setName("Tin Man");
        person.setCountry("Oz");
        System.out.println("Before reflective setters: " + person);
        person.setIdReflective(22);
        person.setNameReflective("Cowardly Lion");
        person.setCountryReflective("The Land of Oz");
        System.out.println("After reflective setters:  " + person);
    }
}

As you can see, only two out of three private fields have the @Serviced annotation. Setters are called for all three fields twice: once normally and once via reflection.
Aspect intercepting both normal and reflective field changes:
package de.scrum_master.aspect;

import de.scrum_master.app.Serviced;
import java.lang.reflect.Field;

public aspect ServicedFieldChangeInterceptor {
    before(Object newValue):
        set(@Serviced private * *) && args(newValue)
    {
        System.out.println(thisJoinPointStaticPart + " -> " + newValue);
    }

    before(Object newValue, Field field):
        call(public void Field.set*(Object, *)) && args(*, newValue) && target(field)
    {
        if (field.getAnnotation(Serviced.class) == null)
            return;
        System.out.println(thisJoinPointStaticPart + " -> " + field + ", " + newValue);
    }
}

Sample output when running Person.main:
set(int de.scrum_master.app.Person.id) -> 11
set(String de.scrum_master.app.Person.name) -> Tin Man
Before reflective setters: Person [id=11, name=Tin Man, country=Oz]
call(void java.lang.reflect.Field.setInt(Object, int)) -> private int de.scrum_master.app.Person.id, 22
call(void java.lang.reflect.Field.set(Object, Object)) -> private java.lang.String de.scrum_master.app.Person.name, Cowardly Lion
After reflective setters:  Person [id=22, name=Cowardly Lion, country=The Land of Oz]

The output clearly shows that both advice only "do something" (in this case print information to standard output) for fields annotated with @Serviced, whereas other fields are skipped. While the set() pointcut applies statically, the reflective one needs to determine if the target field has a matching annotation dynamically.
Comment: Can you show what the annotation style (instead of the AspectJ syntax) would be for this?
Comment: The conversion is trivial. Did you even try? If so, please ask a new question, link to this answer and show exactly what you did and explain what is not working or what errors you get.


Dell Latitude D430 reboots after "Try Ubuntu without installing"

Question: I'm trying to install Ubuntu 14.04 on an old Dell Latitude D430. Both install and live reboot the machine. I've tried all the F6 Other Options to no avail.
I can boot with Hiren's Boot CD and run some of the graphical OS options including Mini-XP and a Seagate Acronis application.
I can boot the Hiren's Linux based rescue environment (Parted Magic 2012-10-10) if I use:
<code>    nolapic nopcmcia noscsi nogpm consoleboot nosmart
</code>
that gets me to the console and if I use
<code>    startx
</code>
the GUI starts OK.
Anyone got any ideas how to beat this?
Comment: I forgot to mention, I'm using the amd64 version but i386 doesn't work either.
Answer: Use the netinstall iso (mini.iso) to install xubuntu or lubuntu.
https://help.ubuntu.com/community/Installation/MinimalCD


When are sector sub-types determined?

Question: The sector map in FTL is a multi-pathed "tree" with each leaf colored to represent its type:

Green: Civilian sectors
Red: Hostile sectors
Purple: Nebula sectors

Sector colors appear to be generated at the beginning of the game, and they remain the same throughout the course of the current game. However, each sector type has a number of sub-types available. For example, a "Civilian" sector can appear as one of the following:

Civilian sector
Engi controlled sector
Engi homeworlds
Zoltan controlled sector
Zoltan homeworlds

Are these sub-types also selected at the very beginning of the game, or are they chosen when the player moves from one sector to the next? Would multiple play-throughs of a single save game result in the same possible sectors every time?
Answer: Yes - sector type is determined at the start of the game
The sector layout, sector type and sector subtype is determined at the start of the game, so save scumming will not result in getting different sector sub types.
I tested this by doing the following

Start the game
Proceed to the end of the sector
Save and exit
Go to My Documents\My Games\fasterthanlight and make a copy of continue.sav
Start the game
Go to the next sector and check sector type
Exit the game
Restore continue.sav
Start the game
Go to the next sector and check sector type

So, I got to the end of the sector, saved and exited and backed up my game file as mentioned above before clicking "Next Sector":

I then restarted the game and clicked "Next Sector" to progress;

As you can see, the sector types shown that I am able to progress to are "Uncharted" and "Civilian". I selected "Civilian" to see if this would then generate one of the subtypes but just got a plain "Civilian" zone:

I exited the game and restored my backup save and tried again, selected the "Civilian" sector and again found that this was just a plain Civilian sector.
I repeated this process two more times to rule out the possibility of any random luck generating the same sector types repeatedly. With this in mind, it looks like the sector types are generated at the start of the game.
Comment: Well, there goes my attempt at unlocking the Crystal Cruiser. I was able to complete the first two steps of that quest, but I didn't get a Rock Homeworld sector in my map. :(
Comment: Great answer!

@JonahBishop There are some pretty good tutorials on the Steam FTL forums for that if you don't mind restart scumming. I got the crystal cruiser in 2-3 hours using one method.

When are sector sub-types determined?


how to get a few items from the set?

Question: please help to get two of the three li. I use the following script:
import lxml.html

doc = lxml.html.document_fromstring("""

111

222

333

""")
lis = doc.xpath('//li')
i = 0
result = []
for elem in lis:
    result.append(elem)
    i = i + 1
    if i > 1: break

print(result)

but I need to sample made no xpath-expression and cycle, but only xpath-expression.
Answer: You can use position() to reduce your XPath result set, eg:
result = doc.xpath('//li[position() <= 2]')
# [<Element li at 0x7f7728684530>, <Element li at 0x7f7728684590>]

how to get a few items from the set?


JDK 11 SSL Error on valid certificate (working in previous versions)

Question: The following code throws an error in JDK 11:
<code>    HttpURLConnection con = (HttpURLConnection) new URL("https://sis.redsys.es/sis/realizarPago").openConnection();
    con.setRequestMethod("GET");
    con.getResponseCode();
</code>
The error is:
<code>javax.net.ssl.SSLHandshakeException: extension (10) should not be presented in server_hello
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:128)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:312)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:268)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
at java.base/sun.security.ssl.SSLExtensions.<init>(SSLExtensions.java:71)
at java.base/sun.security.ssl.ServerHello$ServerHelloMessage.<init>(ServerHello.java:169)
at java.base/sun.security.ssl.ServerHello$ServerHelloConsumer.consume(ServerHello.java:860)
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:390)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:445)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:178)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:877)
at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:810)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:383)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
</code>
It was working in any previous JDK (I've tested in 7, 8, 9 and 10).
The certificate seems valid as it's recognized by browsers or most SSL test i've found in internet.
I've tried disabling host name verifying, disabling cacerts, adding the DigiCert to the cacerts file without any luck.
It seems like a bug in openJDK. Tested in build 26, 27 and 28 (release candidate).
Comment: It is not the certificate it is the server sending incorrect data in the SERVER_HELLO message.
Comment: This seems to be an issue of the server. Until now it was accepted by all clients, however OpenSSL and other have started to be more strict on what is allowed: https://mta.openssl.org/pipermail/openssl-dev/2017-October/009802.html
Comment: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8209982
Comment: I understand, but there is no compatibility flag (I couldn't see anything in the source code). So there is no workaround other than waiting for them to fix their certificate (which could take very long) or to create a "proxy" server to bypass the certificate. This is preventing us from upgrading to java 11 and it is a widely used payment system in spain
Comment: Sorry, you are right. I'll write them, let's see if they can fix it.
Comment: The build [`JDK12-ea-9` is out](http://jdk.java.net/12/), were you able to test if this was fixed?
Comment: Yes, I can confirm it works in jdk 12. I hope that the backport will make it into 11, anyway I made a workaround using nginx as a "SSL proxy" so I can use jdk 11 for now.
Comment: the irony here is that Tomcat is one of the servers with the "bad" implementation.
Answer: The issue is currently resolved in JDK 12 https://bugs.openjdk.java.net/browse/JDK-8209965, and was included in ea-9.
The backport to JDK 11 has also been resolved https://bugs.openjdk.java.net/browse/JDK-8210005 and is included in

11.0.3 (Oracle JDK)
11.0.2 (OpenJDK)

Some background to this can be found in the comments here https://github.com/openssl/openssl/pull/4463/files

TLS 1.3 adds a scheme for the server to indicate
           to the client its list of supported groups in the
           EncryptedExtensions message, but none of the relevant
           specifications permit sending supported_groups in the ServerHello.
Nonetheless (possibly due to the close proximity to the
           "ec_point_formats" extension, which is allowed in the ServerHello),
           there are several servers that send this extension in the
           ServerHello anyway.
Up to and including the 1.1.0 release,
           we did not check for the presence of nonpermitted extensions,
           so to avoid a regression, we must permit this extension in the
           TLS 1.2 ServerHello as well.
Answer: It's now solved in JDK 11.0.2, released in 16th January 2019
Comment: is it  really solved in 11.0.2? as people said that it will be solved at 11.0.3?
Comment: maybe another case
Comment: No, its not. At least not in openjdk.
Comment: It is solved, do you have a counter example? Have you tried the sample from the question? why do you say it's not solved?
Comment: No its not. May be solved for your case, not for all the cases.
Comment: This is about the question in the top, if you have a different case you should specify


Wpf styles: styling a label in a listbox

Question: Is there a way to define a style that is applied to an object only in certain cases?
For example: A style for labels that are part of an item template in a listbox.
I know you can create a key for a style and specify what style to apply to the label directly, but is there another more generic way?
Comment: Haven't tried it, but you might be able to create a DataTrigger in the item's DataTemplate.Triggers that Sets Style to a particular resource.  I'm not sure if data trigger Setter elements will resolve resources or not.
Answer: You should be able to define the style at the lowest level in the hierarchy where it becomes relevant and set the TargetType of the style without a key.
This will force the style to apply to the defined type down the hierarchy relative to its definition.
In this instance the resource would live within the ListBox and thus get applied to your template.
<ListBox.Resources>


Git Command to know current repository

Question: Any command to know which remote repository currently I am connected to?
If I browse to a directory which contains a .git folder. Can I run any command to know which remote repository this .git folder is mapped to ?
Answer: There is no 1:1 local:remote mapping for Git repos. Every repo can have several remotes, or even none at all.
You can use git remote -v to get a list of all remotes currently in your local repo's config. Note that these are only aliases for certain convenience, and you can directly fetch from and push to any remote repos by using their URLs.
Answer: Yes, you can do this with git remote -v. See git help remote for other remote-related options.
Answer: git config -l | grep remote
git remote
git remote -v

Git Command to know current repository


Creating GUI why drag and drop is worse than writing a code?

Question: As the title says, why better programmers write the code to create a GUI element. E.g. jTable, I am noob and I am used to drag it from swing controls and drop it there on my panel. But smarter way is to create jPanel in the code, isn't it?
I can see one reason and it is that later in the GUI class I have easier access to it.
So the question is why is there both possibilities and which one is the right one and which one is more professional?
EDIT: I am not asking on your personal opinion I am asking what is better and for what reason. I want to know facts not opinions.
Comment: Please read [ask] and [What topic can I ask?](http://stackoverflow.com/help/on-topic) as this question is opinion based. I sometime code or use Netbeans for my UI needs, it all depends on what I'm doing.
Comment: Tell me how could I know it is subjctive question? I was just asking what is more professional not what do you prefer. Did you get me? Thank you
Comment: It does not really matter how you get the code, as long as it has the right result.  There is no way to answer the question because both ways are right.
Answer: This is entirely subjective, but many people stay away from gui builders for several reasons:

They hide implementation details from you, which is bad for novices.
The code they generate is not really meant to be fiddled with by humans, so going in and changing your code is much more difficult.
Using a gui builder adds a dependency on that gui builder, which is generally a bad thing. What if that gui builder stops being maintained?

Again though, this is entirely subjective, and whether you use a gui builder or code it yourself is up to you and your context. This isn't really a question for SO.
Comment: It is not that entirely subjective. You answered my question pretty well by telling me those 3 points and any of those are not subjective because they are facts, aren't they?
Comment: Well, your question has been closed for being opinion-based, so there's your answer. I've given you *my* reasons for not liking gui-builders, and plenty of people agree with me. However, other people would argue that gui builders are good for getting something up and running. For example, the Java tutorials recommend the netbeans gui builder. I disagree with that entirely (again, novices should NOT use a gui builder), but that's what makes it subjective.


Using same URL for multiple diferent ROUTES - Angular 2+

Question: I need to make a angular application to work with same url for multiple routes. Example:
Route 1. Instead of navigating to:

/partner/urlparameter

Navigate to:

/partnerurlparameter

Route 2. Instead of navigating to:

/user/urlparameter

Navigate to:

/userurlparameter

Where the path is "/" followed by a dynamic value which is the parameter.
Is there a way do achieve that?
Here is how my route is configured:

{ path: '/partner/:partnerId', component: PartnerComponent },
{ path: '/customer/:customerId', component: CustomerComponent },

I want to have something like this:

{ path: '/partner/:partnerId', component: PartnerComponent },
{ path: '/:customerId', component: CustomerComponent },
Comment: can you show your routes confi
Comment: Hi Chellappan, I have edited my post and added my routes
Answer: Here is an example of what you want to achieve, follow the link for same.
Let me know if there are any changes.
<code>import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';

import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';
import { CustomerComponent } from '../customer/customer.component';
import {PartnerComponent} from '../partner/partner.component';

export const routes: Routes = [
  { path: 'partner/:partnerId', component: PartnerComponent },
  { path: ':customerId', component: CustomerComponent },
  { path: '', component: HelloComponent, pathMatch:'full' },
];

@NgModule({
  imports: [BrowserModule, FormsModule, RouterModule.forRoot(routes)],
  declarations: [AppComponent, HelloComponent, CustomerComponent, PartnerComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }
</code>
Comment: Hi! Thanks so much for your reply.. The thing is that I need both routes to point to the same url. Like /:partnerId and /:customerId. I also have other routes so they need to keep working too.


Do I have to install drivers after an installation?

Question: Do I have to install drivers for all of my devices after I install Ubuntu?  Does Ubuntu have generic drivers for most computer equipment (video, audio, network adapters)
Comment: Has most drivers.  Use a LiveDVD to boot to verify most component.
Comment: Is the hardware working?  Then no.
Answer: Ubuntu will install most drivers automatically, and it recognizes quite a bit of hardware. Some of it might require proprietary drivers, though. You have to decide if you're philosophically ok with that.

How do I install additional drivers?


Riemann problem - Are two shocks possible?

Question: Given the hyperbolic conservation law
\begin{align*}
u_t + f(u)_x = 0, \; x \in \mathbb{R}, t > 0 \\
u(x,0) = u_0(x), \; x \in \mathbb{R}
\end{align*}
with $f : \mathbb{R} \to \mathbb{R}$, $f''(u) > 0$ for all
$u \in \mathbb{R}$ and the initial condition
\begin{equation}
u_0(x) = \begin{cases}
u_l &,  x < 0 \\
u_r &, x \geq 0
\end{cases}
\end{equation}
for $u_l, u_r \in \mathbb{R}$. Is it possible
that there exist's a weak solution $u$ which is piecewise constant  and has exactly two shocks?
So far what I got is:
Assume $u \in L_{loc}(\mathbb{R} \times \mathbb{R}^+)$ is a weak
solution of the riemann problem with two shocks $\psi_1$ and $\psi_2$. Since
$u$ has two shocks, it has 2 formations of discontinuity and therefore under
the assumption that $u$ is piecewise constant
\begin{equation}
u(x,t) = \begin{cases}
u_l &, x < at  \\
u^* &, at \leq x \leq bt \\
u_r &, x > bt
\end{cases}
\end{equation}
for some $a,b \in \mathbb{R}$ with $b > a$. Now $u$ is a weak solution of the hyperbolic conservation law if
\begin{equation}
\int^{\infty}_{0}{\int_{\mathbb{R}}{u \Phi_t + f(u) \Phi_x dx dt}} = -\int_{\mathbb{R}}{u_0(x) \Phi(x,0) dx} \mbox{ for all } \Phi \in C^1_0(\mathbb{R}^2).
\end{equation}
By partial integration I got
\begin{align}
\int^{\infty}_{0}{\int_{\mathbb{R}}{u \Phi_t dx dt}} = &-\int_{\mathbb{R}}{u(x,0) \Phi(x,0) dx} \\
&- a(u_l - u^*)\int^{\infty}_{0}{\Phi(at, t) dt} \\
&- b(u^* - u_r)\int^{\infty}_{0}{\Phi(bt, t) dt}
\end{align}
and
\begin{equation}
\int^{\infty}_{0}{\int_{\mathbb{R}}{f(u) \Phi_x dx dt}} = \Big(f(u_l) - f(u^*)\Big) \int^{\infty}_{0}{\Phi(at, t) dt} + \Big(f(u^*) - f(u_r) \Big)\int^{\infty}_{0}{\Phi(bt, t) dt}.
\end{equation}
Now if $\psi_1'(t) = \frac{f(u_l) - f(u^*)}{u_l - u^*}$ and
$\psi_2'(t) = \frac{f(u^*) - f(u_r)}{u^* - u_r}$ are the shock velocities
there can be exactly two shocks and $u$ is a piecewise constant weak solution of the
riemann problem. I am not sure if this is right.I read that there cannot be exactly two shocks for a piecewise constant function, but I can't see why.
Answer: What you are observing is one of the core difficulties of balance / conservation laws: The loss of uniqueness through weak solutions. This is why you have to examine your solution whether it fulfills entropy conditions, which exclude some solutions while permitting others.
In your case for a strictly convex flux $f''(u) > 0$, however, you cannot have two shocks. For a more general $f$, it is possible. I argue below why that is.
By the method of characteristics, we look for a curve $x(t)$ along which the solution of the PDE stays constant:
\begin{align} \frac{\mathrm d}{\mathrm dt} u\big(x(t), t \big) &\overset{!}{=}0 \\
\overset{\text{Chain rule}}{\Rightarrow}\partial_t u + \big(\partial_x u\big) x'(t) &\overset{!}{=}0 \end{align}
Now compare this to your PDE $\Big($under the assumption that $f = f(u) \neq f(x) \Big)$:
$$\partial_u + f(u)_x = \partial_u + f'(u)u_x \overset{!}{=}0$$
Thus, the ODE for the characteristic reads:
$$ x'(t) = f'(u) = f'\Big(u\big(x(t), t\big) \Big)$$
The assumption that $u$ stays constant along characteristics $x(t)$ implies now that $u\big(x(t), t \big)$ is exactly the same as at the initial time $t = t_0 = 0$:
$$u\big(x(t), t \big) = u\big(x(0), 0\big) = u_0\big(x(0)\big).$$
As a consequence, the ODE for the characteristic is trivial:
\begin{align} x'(t) &= f'\Big(u_0\big(x(0)\big) \Big) = \text{const}  \\
\Rightarrow x(t) &= f'\Big(u_0\big(x(0) \big) \Big) \cdot t + x(0)\end{align}
Consquently, you have exactly two types of characterists: One with $x(0) < 0$ have slope $f'(u_L)$ and the other starting at $x(0) > 0$ with slope $f'(u_R)$.
Now, if $u_L > u_R$, you have a single shock with speed given by the Rankine-Hugoniot condition. In the opposite case, $u_R > u_L$ the entropy conditions dictate a rarefaction solution:
$$u(x, t) = \begin{cases} u_L & x \leq f'(u_L) t \\
[f']^{-1}(x / t) & f'(u_L) t < x < f'(u_R) \\
u_R & x \geq f'(u_R) \end{cases} $$
Note how the strictly convex flux $f''(u) > 0 \: \forall \: u \: \in \mathbb{R}$ ensures that $f'(u) $ is monotonically increasing, thus invertible.
In the case of a non strictly convex / concave flux, you have to get your hands dirty and find a way to "join" the states $u_L, u_R$ in an entropy-admissible way. Then you can also have two shocks with a rarefaction in between, see for instance this notes, page 27.


What's the use of multiple asterisks in the function call?

Question: I can't think of any practical use of multiple asterisks in the function call:
void foo(int a, char b)
{

}

int main(void)
{
    (**************foo)(45, 'c');

    //or with pointer to function:
    void (*ptr)(int, char) = foo;
    (******ptr)(32, 'a');
}

Why is this thing allowed both in C and C++?
Comment: It's explicitly allowed for the sake of C obfuscated code contests.
Comment: probably the original coder was being payed per character of code rather than per line
Comment: @TomTanner Can't you even put newlines between the asterisks? That would really be great ;)
Comment: you can put as much white space in there as you like
Answer: One of the standard conversions, in both C and C++, is the function-to-pointer conversion; when a function name appears in an expression, it can be converted into a pointer to that function. So:

foo is equivalent to &foo
*foo is equivalent to *(&foo), or foo
**foo is eqivalent to **(&foo), or *foo, or foo

and so on.
This means that you can legally add as many * as you like before a function name without changing its meaning. There's no reason to do that, though.
Answer:
Why is this thing allowed both in C and C++?

I can't speak for C++, but for C at least a function designator is converted to a pointer:

126.96.36.199 - 4
A function designator is an expression that has function type. Except
  when it is the operand of the sizeof operator or the unary & operator,
  a function designator with type ''function returning type'' is
  converted to an expression that has type ''pointer to function
  returning type''.

Applying the indirection operator yields a function designator:

18.104.22.168 - 3
The unary * operator denotes indirection. If the operand points to a
  function, the result is a function designator

So no matter how many times you apply the indirection operator you'll get the same thing: a function designator that's immediately converted to a pointer.

In my opinion there's little or no use in doing this.
Answer: Because the * operator expects an address value. And whenever a value is expected (as opposed to an object or function glvalue), the lvalue to rvalue, function to pointer and array to pointer conversions are applied on an operand. So the dereferenced function immediately again converts to a pointer when again dereferenced.
These all either read values from objects or produce a pointer value that refers to the beginning of an array or function respectively.
These rows of dereferences have no purpose other than for the lulz of it.
Answer: The way i understand it is
* is a pointer to a memory address
& is the value at the Memory address

*foo means pointer to foo memory address
**foo means *(*foo) *(foo memory address) This is a different value from *foo

it continues like that...


I can't find most packages in Ubuntu 16.04 LTS pakcage manager

Question: I updated my Ubuntu from 15.10 to 16.04 LTS. Very good release, I'm really happy with it, for sure it is much more stable than the 15.10 was. However, when opening the package manager I cannot find most packages. I had added all the most common repos in 15.10 and I am able to install any package I need using sudo apt-get install, however I cannot find those packages when using the new UI in the package manager. For instance, I've installed R and Idle3 using the command line, but if I look for those programs in the package manager using the search box nothing comes up. How can this be?
Comment: Are you using Synaptic? Have you enabled all the correct "Sources" in the Software Manager?
Comment: Not all packages are listed in the Ubuntu Software Center.
Answer: I assume with "I had added all the most common repos in 15.10" you mean third-party repositories like PPAs? Repositories are specific for different Ubuntu releases. For example, the (arbitrarily chosen) Cinnamon Nightly PPA is available for Ubuntu releases from Trusty to Yakkety. Each of these releases gets a different set of packages from the PPA.
Because of that, third-party repositories get routinely disabled in the upgrade process (when you switch from one Ubuntu release to another). After the upgrade, you can look through your third-party repos. Some you can just switch to the new Ubuntu release you're using (for example from "wily" to "xenial"), because the repo maintainer offers the repo for that version as well. Some repos may have become obsolete, because the packages you added the repo for are now part of the main Ubuntu release. Some repos are not available for the Ubuntu release you're running now, so you can't use them any more.


Furnace stop and start continuesly

Question: I notice today that my new furnace will stop after about half hour and start again in a few minutes. The room temperature is 66 and I set it to 70. It took several stop and start before it reaches 70. What could be the reason, too heavy filter or not enough air coming back? The air filter is Honeywell Allergen Plus Pleated FPR 7 Air Filter.
Comment: The type of furnace is likely to be more instructive than the air filter.
Comment: Not likely. Why aren't you asking the installer to troubleshoot?
Comment: The air filter is brand new. The unit was installed last year.
Comment: Well then... Tell us something about the filters before and after. Help us help you.
Comment: @isherwood I am tired of working with them. If I know the cause I may do a better job than them.
Comment: @isherwood I bought the filter from HD this month. I don't know what else can be wrong with it.
Comment: Neither do we unless you tell us what the type of filters are. Please edit your post to add more detail.
Answer: The filter is only one aspect of an over heating furnace. The diagnosis is as simple as taking its temperature. Get a digital meat thermometer. Take the temperature at the inlet and the outlet of the furnace. All furnaces will have their minimum and maximum heat rise listed on the name plate. In leu of that number 50 degrees is a good middle ground. Subtract the inlet temperature from the outlet temperature. If it is within the specified range you are good. If it is really high like above 150 degrees you are likely tripping the high limit and need more air flow. Open all registers, remove the filter and put the fan to high speed. If the heat seems good and you have an analog thermostat it could be the heat anticipator is not set correctly. Analog thermostats have a small wire or coil of wire mounted near the mercury bulb or the bimetallic spring. It heats up a little to shut the heat off about a quarter to a half degree before the set point so it can glide to a stop. If it is set incorrectly it can shut off several degrees early. With the limited information you have provided those two suggestions are most likely but there could be any number of causes.
Comment: could also be a faulty flame sensor

Furnace stop and start continuesly


Input not appearing when executing function

Question: I need that when the option "otros" of a select is clicked, an input appears. To do so, I have made this script which is not working fine (input does not appear).
html/php
<select onclick='atencion_otros()' id="atencion" name="atencion">
    <option selected>Atención</option>
    <option>Otros</option>
    <?php if($copy){ echo '<option selected>' . $atencion . '</option>';
    $result = mysqli_query($con,"SELECT * FROM `contactos_pmt` ORDER BY nombre_contacto");
    while($row = mysqli_fetch_array($result)){
     ?> <option> <?php echo $row['nombre_contacto']; ?> </option>

<?php
     }
    }
    if($cargar_cliente){
    $result = mysqli_query($con,"SELECT * FROM `contactos_pmt` WHERE
    nombre_empresa = '$nombre_cliente' ORDER BY nombre_contacto");
    while($row = mysqli_fetch_array($result)){
     ?> <option selected> <?php echo $row['nombre_contacto']; ?> </option>

<?php
     }
    }
    ?>
</select>
<input onkeypress="return event.keyCode != 13;" style="display:none;" id="atencion_otros" name="atencion_otros" placeholder="Atención" />

Javascript

Do you have any idea of why the input is not appearing?
Comment: maybe try `onchange()` ? https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onchange
Comment: Why are you clogging up the question with PHP? The problem doesn't appear to have anything to do with PHP. Provide a [mcve] with the plain HTML instead.
Comment: give value to your options `Otros`
Comment: @okante — In the absence of a value attribute, the value will be the text content of the element
Comment: @delboy1978uk not working with onchange(). Thank you
Comment: @Quentin you're Right
Comment: As already commented above you need to give value attribute to your select options. Then onclick event is not right choice, use onchange event. With onchange event binding you can ensure the change in value is reflected.
Comment: Side note: looks like your `` will end up with ``s between some of the ``s. Don't think that's valid. Not sure it'll have any visual effect either. Also you'll likely have more than one option with the "selected" attribute set at one time, which makes no sense.
Answer: First add value attributes in all your <option>.
Then add event Listener.
document.addEventListener('DOMContentLoaded',function() {
    document.getElementById('atencion').onchange=atencion_otros;
},false);

now your function
function atencion_otros() {
    if (document.getElementById('atencion').value == 'Otros') {
        document.getElementById('atencion_otros').style.display = 'block';
    } else {
        document.getElementById('atencion_otros').style.display = 'none';
    }
  }

Now remove onclick attribute from your <select>.


How do I fix a value error when using scipy.integrate odeint function?

Question: I'm an engineering student and I'm trying to figure out how to use the odeint function from the scipy.integrate module (I've only ever used ode45 in MATLAB). I'm attempting to numerically solve a simple second order mass, spring, dashpot system. Below is the code I've written (specifically I'm using Jupyter Notebook and running the latest version of Python 3):
import numpy as np
from scipy.integrate import odeint
from matplotlib.pyplot as plt
%matplotlib inline

# Numerical solution to mx" + bx' + kx = f(t)

# Define state vector y and its derivative
def translational(x,t,m,b,k,f):
    y = [x[0], x[1]] # state vector
    ydot = [x[1], f -b/m*x[1] - k/m*x[0]] # derivative of state vector
    return ydot

# Parameters for the system
t = np.arange(0,10,0.01)
IC = [0, 0] #[x0 v0]
m = 10 # kg
b = 2 # N*s/m
k = 5 # N/m
f = 5*np.cos(10*t)
y = odeint(translational,IC,t,args=(m,b,k,f))

When I execute the code it returns the following error:
TypeError                                 Traceback (most recent call last)
TypeError: only size-1 arrays can be converted to Python scalars

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
<ipython-input-7-423018367c52> in <module>
     20 k = 5 # N/m
     21 f = 5*np.cos(10*t)
---> 22 y = odeint(translational,IC,t,args=(m,b,k,f))

~\anaconda3\lib\site-packages\scipy\integrate\odepack.py in odeint(func, y0, t, args, Dfun, col_deriv, full_output, ml, mu, rtol, atol, tcrit, h0, hmax, hmin, ixpr, mxstep, mxhnil, mxordn, mxords, printmessg, tfirst)
    239     t = copy(t)
    240     y0 = copy(y0)
--> 241     output = _odepack.odeint(func, y0, t, args, Dfun, col_deriv, ml, mu,
    242                              full_output, rtol, atol, tcrit, h0, hmax, hmin,
    243                              ixpr, mxstep, mxhnil, mxordn, mxords,

ValueError: setting an array element with a sequence.

For the life of me I can't figure out what's wrong. Any help is much appreciated! Thanks.
Comment: Is that all of the traceback?  I would focus on the type error.  I think some parameter is an array with more than one value, while it should be a scalar (or just one value).
Answer: f is an array of numbers, and therefore so is f -b/m*x[1] - k/m*x[0], so the return value of your function translational is not correct.
Instead of attempting to precompute the values of f, what you should do is use the expression for the function in translational:
def translational(x,t,m,b,k):
    y = [x[0], x[1]] # state vector
    f = 5*np.cos(10*t)
    ydot = [x[1], f -b/m*x[1] - k/m*x[0]] # derivative of state vector
    return ydot

and remove f from the args parameter of the odeint function call.


Does this 3D rendering method exist? How is it called? Is there any C++ algorithm for it?

Question: I've been thinking about making my own 3D rendering engine in C++, but I don't know much about math that's required to do it. I'm not even sure if it's possible or if it even exists or how it's called.
It goes like this. Let's imagine a 3D body that has 6 vertices and 8 faces. It's like a pyramid on top of an upside-down pyramid. Each face is a triangle, but let's imagine that every line between the triangle points is a three-dimensional bezier curve. That would make each face look like a tent. If we do that, then we get a sphere. Now, imagine if instead of rendering that sphere by subdividing the tents into triangles we render the tents exactly how they are and imagine if we don't render raster graphics, but rather vector graphics in PostScript/Flash/ActionScript/GhostScript format in ASCII that can be opened by Notepad and rendered as a semi-transparent PNG image at any resolution without losing quality.
When rendering 3D triangles, matrix operations are used if I'm not mistaken. There's a matrix with some values and then a determinant is calculated. But these values are constants. What if the values depend on a formula of the bezier curve that's in 3D space? How can we stuff the formula into the matrix? And a better question; how can we stuff that into an algorithm or into OpenGL or into a language that a graphics card can process instead of the CPU? Does such a formula, matrix or an algorithm exist?
Now, I'm not thinking about rendering simple spheres, but rendering something like this: https://www.blendswap.com/blends/view/24878
I'm thinking about making a lightweight renderer in assembly for an ESP32 SoC or some other Arduino microcontroller/processor/SoC which would render all that onto an LCD or a PAL/NTSC TV via a composite AV jack, but that's another topic.
My question is whether or not such a rendering method exists, how it's named, is it free to use, is it patented and is there any permissive-licensed C++ code for it (MIT, zlib/png, Apache, BSD). Please let me know.
Comment: The object with 6 vertices and 8 triangles is called an octahedron. https://en.wikipedia.org/wiki/Platonic_solid
Answer: Yes, such rendering exists. It is called a parametric surface and there are several methods you can render such entities. In this case you are talking of bezier patches.

Turn the object into enough triangles. The triangilation is called tesselation or meshing depending on what literature you read.
There are lots of applications that do this allready. Most cad applications work this way and many graphics apps like blender can work
this way.

raytrace or raymarch the surface in a shader.

Microdice the surface

etc.

The reason this is not often done is that the on line tesselation is for most intent and purposes just a hindrance to asset developpers. You get the same with subdivision schemes and its just easier. The primary reason to drag the bezier (or nurbs, or t-splines...) is that unless you need to find better intersection of underlying primitives then it is often just a waste of resources. Although subdividing your mesh  via a subdivision surface is allready more useful
Answer: The 1994 game Ecstatica and its 1997 sequel rendered ellipsoid segments instead of triangles, but I don't think anyone else has ever used this exact technique. Direct raytracing of Bézier patches was a popular research topic in production graphics a few years ago, but the industry has moved onto polygon mesh subdivision. Subdivision gives much more predictable results for artists, and polygon meshes are much easier to deal with inside the renderer.

I've been thinking about making my own 3D rendering engine in C++, but I don't know much about math that's required to do it.

I hope you're up for learning lots of linear algebra, then. This is a great idea for a hobby project to learn from, but don't go into it thinking you can get by without learning any maths.
Comment: While it is not common in games it does exist in applications