Starcraft 2: Tips for the Path of Ascension challenge

Question: I can't seen to find a way to get below 25 units lost in this challenge.
In first part of the challenge I lose around 9-10 units.
Second part is pretty ok, I lost 3-4 units there, but in 3rd part I lose around 10-15 units every time. Mostly I lose zealots to siege tank in the very last part of the challenge.
Do you have any tips for this challenge.
EDIT: Path of Ascension is protos challenge, where you need to chose type of units to counter 3 different enemy groups.
Answer: In the beginning...
On the very first round, Blink your Stalkers up to the high ground for the Helions. You might need to leave one on the ground to entice them over. Once there, You can deal with about half of them fairly quickly, while the other half attack the pylon. Then Blink down and finish them off. Shouldn't lose any units (1 max). Make sure you have them all selected, and if one is taking a lot of damage, move it away.
You can get away with using only 4 Colossi against the marines. Same deal as the stalkers: if one is taking a lot of dmg, move it out of range and then back into range when they marines start targetting another unit.
This leaves you with a Colossus for the Siege Tanks. My path was to make 2 more Colossus hallucinations, and let the zealots charge in.
(I think i've got the waves right....I might not. Apologies if this is the case. Shall fix it up when i get home....)
With some patience, finesse and tweaking, you should be fine.
Answer: For the last part I used hallucinations along with the shield to help protect from incoming tank fire.  I found it helped to split the forces above and below, making sure the zealots charged the tanks.
For the hallucination, try and make the tanks splash their own units
Comment: That's a different challenge.  Path of Ascension is protos challenge, where you need to chose type of units to counter 3 different enemy groups.
Comment: My mistake.  I updated with what I remember doing.
Answer: I just got 0 losses total pretty easily.  It's all a matter of using the right units :)  Here's how:
Top:  Send your stalkers and archons.  Have them attack the battle-cruiser immediately, then once it's dead just attack-move to kill the rest.  No micro required.
Middle:  Send the sentry and your collossi.  Put all three collossi above the cliff (tell them to hold-position), and create a collosus-hallucination below it (run the sentry away so he doesn't die).  When the hallucination dies, bring one of the collosi down to draw their fire away from the pylon. When it's nearly dead, bring it back up the cliff and bring another down.  Before the third one dies, all the enemies should be dead.  Very little, very simple micro.
Bottom:  Bring your immortals, phoenixes, and high templar.  Use the templar's storm on the marauders immediately (run him away so he doesn't die), then attack-move the immortals to the back so they kill the marauders then the tanks.  Meanwhile, use all your phoenixes to graviton-beam some siege-tanks near the back.  You'll only need a little micro to move some low-health immortals away (I only had to move one).
Note that I did not use the zealots at all - they died too easily.
Answer: The siege tanks on the final round were what kept getting me.
For that round in particular:
a) Spread out your immortals. Their hardened shields aren't worth anything if the combined volleys of the siege tanks are dealing damage to the shields of 5 immortals each attack. Spreading out the immortals means the siege tank splash damage isn't so deadly to them.
b) use hallucinate. I used my high templar on the battlecruiser for feedback, but you might also look into using psistorm if you think it'll help. You can spawn two hallucinated archons who'll easily soak up some of the damage.
c) move your troops up to the starting bubble. It means the marauders get obliterated by your zealots + immortals (they are armored, after all) and then the zealots immediately charge into the siege tanks, where the tanks start killing themselves with friendly fire splash damage.
If that wasn't understandable, try this video instead:
Answer: I'm answering my own question because i finally managed to get to gold level on this challenge by using some non standard tactics.
On the final stage instead of using unit compositions recommended in hints I decided to go with:
Against battlecruiser and vikings I used stalkers, zealots and hight templar. I feedback BC with HT and focus fire my stalkers on the BC while zealots got rid of any landing vikings.
Against hellions and reapers I used colossi and archons (colossi on high ground and a bit of micro with archons).
Against marauders and tanks I used immortals with shield from sentry and Phoenixes. I used phoenixes to reduce incoming damage by lifting 4 of the siege tanks.
Answer: You can do this with good micro if you follow the in game hints.
With stalkers, as they take damage blink them up on the high ground.  don't start off on the high ground.  If the high ground is out of range, just blink it back.  You can do this easily with 0 losses.
Use your immortals to counter the tanks and the zealots to counter the marauders.  What you want to do here is time your attack just right. move in your immortals first from the south side so they get targeted by the first wave of siege attacks. then charge in your zealots from the north to take out the marauders.  You may lose one or two zealots here but shouldn't lose any immortals.  Back out any immortals that are getting low on health.  Don't cluser them in a circle either because microing immortals that are taking damage from the front to the back will be impossible.
I used my sentry with the Arcons and Colossi which is a bit over kill but I had no use for my sentry.  I just put all the colossi on the ridge and setup a forcefield between the arcons and the incoming wave of units to stall.
It took several tries to get gold on all challenges but I did it by following the hints and practicing my micro which i believe is the purpose of these challenges. (or macro depending on the challenge)


I can't find the installed application (HDSentinel_GUI) anywhere

Question: I've downloaded and installed HDSentinel GUI tar package but I can't see it in the application panel. Where can I find it?
I've installed it as below:
tar -xvf hdsentinel_gui64bit.tar.xz
cd HDSentinel_GUI
sudo ./install.sh

Content of install.sh:
#!/bin/bash
clear
echo ""
echo "Unzip the HDSentinel_GUI archive to /home/your user name/HDSentinel_Light/"
echo ""
##Unzip the HDSentinel_GUI archive
unzip HDSentinel_GUI.zip -d ~/
echo ""
echo "Copy icon the icon folder"
echo ""
##Copy icon the icon folder
sudo cp ~/HDSentinel_GUI/HDSentinel_GUI.ico -t /usr/share/icons
echo "Set owner and permission for icon"
echo ""
##Set owner and permission for icon
sudo chmod 444 /usr/share/icons/HDSentinel_GUI.ico
echo "Make directory 'usr/share/bin' if not present"
echo ""
##make directory usr/share/bin if not present
sudo mkdir -p /usr/share/bin
echo "Premission for folder"
echo ""
##premission for folder
sudo chmod -R a+rwx /usr/share/bin
echo "Copy to bin library"
echo ""
##Copy the bin folder
sudo cp ~/HDSentinel_GUI/HDSentinel_GUI -t /usr/share/bin
sudo cp ~/HDSentinel_GUI/HDSentinel -t /usr/share/bin
echo "Set premission for application"
echo ""
##Set premission for application
sudo chmod a+rwx /usr/share/bin/HDSentinel_GUI
sudo chmod a+rwx /usr/share/bin/HDSentinel
echo "Make directory for user menu if not present"
echo ""
##Make directory for user menu if not present
sudo mkdir -p ~/.local/share/applications
echo "Copy launcher to user menu"
echo ""
##Copy launcher to user menu
sudo cp ~/HDSentinel_GUI/Hard_Disk_Sentinel_GUI.desktop -t ~/.local/share/applications
echo "Set premission for menu launcher"
echo ""
##set premission for menu launcher
sudo chmod a+rwx ~/.local/share/applications/Hard_Disk_Sentinel_GUI.desktop
echo "Copy launcher to Asztal if present"
echo ""
##copy launcher to desktop
##sudo cp ~/HDSentinel_GUI/Hard_Disk_Sentinel_GUI.desktop -t ~/Asztal
##echo "Copy launcher to Desktop if present"
echo ""
##copy launcher to desktop eng
##sudo cp ~/HDSentinel_GUI/Hard_Disk_Sentinel_GUI.desktop -t ~/Desktop
echo ""
##echo "Set premission for launcher (Desktop)"
echo ""
##Set premission for launcher
##sudo chmod a+rwx ~/Desktop/Hard_Disk_Sentinel_GUI.desktop
echo ""
##echo "Set premission for launcher (Asztal)"
echo ""
##set premission for launcher
##sudo chmod a+rwx ~/Asztal/Hard_Disk_Sentinel_GUI.desktop
echo "Remove install temp directory (/home/your user name/HDSentinel_GUI/)"
##Remove ~/HDSentinel_GUI directory
rm -d -rf ~/HDSentinel_GUI

Comment: Could you include the content of the `ìnstall.sh` file?
Comment: Can you add the output of `ls ~/.local/share/applications | grep -i Hard`
Comment: What steps did you follow to install it?
Comment: I'll add it to original question.
Comment: Did the install procedure produce any errors? From that file, you should have a desktop shortcut.
Comment: There was no error but I don't have a desktop icon.
@Someone this turns out nothing. I just installed ubuntu few hours ago.
Comment: Is there any directory named `HDSentinel_GUI` in your `~/` directory?
Comment: That is home directory, right? No, there isn't.
Comment: @AndrewHarlan Try running: `sudo unzip ~/Downloads/HDSentinel_GUI.zip -d ~/`.
Comment: No such file or directory it says. Actually I found it at usr/share/bin directory.
Comment: Where is the `.zip` file of HDSentinel?
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/133924/discussion-between-andrew-harlan-and-someone).
Answer: The script copied the executable files to /usr/share/bin/:
sudo cp ~/HDSentinel_GUI/HDSentinel_GUI -t /usr/share/bin
sudo cp ~/HDSentinel_GUI/HDSentinel -t /usr/share/bin

The "launcher" (a .desktop file) was copied to /.local/share/applications/.
sudo cp ~/HDSentinel_GUI/Hard_Disk_Sentinel_GUI.desktop -t ~/.local/share/applications

Comment: When I double click on the .desktop file, it opens with text editor. Shouldn't it suppose to launch the application instead?
Answer: Apparently, there were some errors with the installation script ie. There was no .zip file in ~/ for the desktop launchers.  We fixed the error in this chat room.
Here are the steps we followed:

Reinstall the application:
cd /tmp && wget https://www.hdsentinel.com/hdslin/hdsentinel_gui64bit.tar.xz && tar -xvf hdsentinel_gui64bit.tar.xz && cd HDSentinel_GUI && sudo ./install.sh

The ~/ directory now had a directory named HD_Sentinel_GUI.

Next, we created a launcher file at desktop and the applications overview:
sudo cp ~/HDSentinel_GUI/Hard_Disk_Sentinel_GUI.desktop ~/Desktop

Next, we gave executable permissions to the file so that it won't open with a text editor:
sudo chmod +x ~/HDSentinel_GUI/Hard_Disk_Sentinel_GUI.desktop

Next, we created a desktop launcher for the Applications Overview:
sudo cp ~/Desktop/Hard_Disk_Sentinel_GUI.desktop /usr/share/applications/

Now, the app was appearing as a launcher and was working as expected!


Gmail removes the src attribute of img tag

Question: I have red many posts around google and stackoverflow. Seems like none of them worked for me. And many people can't figure it out. Is it really so hard to put html inline image and if it's possible in 2019, how should we do it?

is show as only

I am using PHPMailer and dont need to attach it. Is there a solution for this ? Thank you!
Comment: Gmail is terrible in many respects – and this is one of the ways. You may have more luck with embedded images (and corresponding `cid` identifiers to reference them from your HTML) or `data` URLs, but those methods are of course much less efficient.
Comment: External images get filtered out by default, so that the requests they would cause can not be used to determine when / that a mail is read by the recipient (little thing called _privacy_.) The recipient has the option to view the mails with those external images - but they have to actively trigger that. If you want to send images that always get shown - then you need to actually _inline_ them directly into the mail. (What you are doing with the above, is not "inlining".)
Comment: @Toma Show us your PHP code
Answer: Php Mailer email image you can use src tag but keep that in mind you have to add public link for the src like : http://example.com/image.png not project image path.
Comment: That's not what's being asked here - images are in the original source message, but gmail is removing them.


Difference between a vector in $\Bbb{R^1}$ and a scalar

Question: Many people say that they are the same, even I can't find much difference in them except that a vector/ matrix can be multiplied by any scalar, but to multiply it with a vector in $\Bbb{R^1}$ the vector or matrix should be of the order $1\times n$. What's and why is there a difference in this case?
Comment: One context where the distinction can be important is when a $1 \times 1$ matrix appears as a factor in a matrix product. For example, if $x$ is a $n \times 1$ column vector, then $x^T x$ is a $1 \times 1$ matrix, so the product $(x^T x) x^T = x^T x x^T$ makes sense. If we did not maintain the distinction that $x^T x$ is a $1 \times 1$ matrix as opposed to a scalar, we might be tempted to slide the "scalar" to the other side of the product (after all, you can do this with actual scalars) to obtain $x^T (x^T x) = x^T x^T x$. But this no longer makes sense: $x^T x^T$ is illegal.
Comment: I think you may be confusing the restrictions on dimensions for matrix multiplication with those for addition, for multiplication only the "inner" dimensions need to match.
Comment: yes, i understand that only the 'inner dimensions' need to match, if any vector in R1 were a scalar it wouldn't have been necessary  for the inner dimensions to match, but it is not the case
Comment: This is similar to [Is $\mathbb{R}^1$ really the same as $\mathbb{R}$](https://math.stackexchange.com/q/4124752/26369)
Answer: Referring to formal definitions, the main difference is that:

When you consider $\mathbb R$ as a field, the multiplication is an internal operation. That is maps an ordered pair $(x,y) \in \mathbb R^2$ to $z= x \cdot y \in \mathbb R$.
When you consider $V = \mathbb R$ as a one-dimensional vector space, then the multiplication is formally a scalar multiplication defined between two distinct objects: the field $\mathbb R$ and $V$.


Memory Leaks in Browser

Question: Please tell me how to find out the memory leak in browser and what is the best way to solve the problem. Is there any guideline for writing javascript to avoid memory leak?
And also if you can tell me some problem which you experienced related to memory leak and how did you debug and find out the solution would provide a great understanding to me.
Thanks
Answer: Look at this IBM article on Memory leak patterns in JavaScript
Answer: For Internet Explorer you can try sIEve or the JavaScript Memory Leak Detector from Microsoft (The link to the documentation seems to be broken). In Firefox there is the Leak Monitor Add-on. There is also a list of tools for Firefox here.
UPDATE:
There is a new version of the Microsoft memory leak detector at the link below.
Link

Memory Leaks in Browser


Using jQuery's .one on a group of elements

Question: I'm using the following code to preventDefault the first time a .headlink  element is clicked. The issue is it's counting the first click on any element with the class.
For example if I have three links with class .headlink a user could click one, and the others would no longer be active. Is it possible to combine my code with jQuery's .this function to make the .one specific to each individual link with this class?
$(".headlink").one("click", function(event) {
    event.preventDefault();
});

Comment: The `.one` IS specific to each element ([.one](http://api.jquery.com/one/))
Answer: The one() method means that the event will only fire once for each individual instance of the elements in the selector.
Instead, assuming you want the event to fire once only for all the elements of the selector, you would need to manually detach all the event handlers for that event. Try this:
$(".headlink").on("click.headlink", function(event) {
    event.preventDefault();
    $('.headlink').off('click.headlink'); // remove the handler on all elements

    // your logic here...
    // $(this).doSomethingCool();
});

Example fiddle
Note that I namespaced the event so that when it's removed only this specific click handler is affected, not all the click() handlers that are bound to the affected elements.


Issue with Maven dependencies on a 32bit and 64 bits platform

Question: I have an issue with my pom.xml file. I have a project made with Spring MVC and uses this dependency:
<dependency>
    <groupId>net.sf.jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>6.3.0</version>
</dependency>

The project was developed on a 64bits Gnome Debian based system and works fine, but yesterday I tried to checkout the project from Github on a 32 bit Debian LXDE laptop, but I have Maven errors, Eclipse keeps saying that I have missing dependencies:

Missing artifact org.olap4j:olap4j:jar:0.9.7.309-JS-3
Missing artifact com.lowagie:itext:jar:2.1.7.js5

Although I'm using the the same software version on both machines (32 and 64 bits):

Eclipse Mars.
apache-tomcat-8.0.33.
jdk1.8.0_92

The solution I found (after almost kill maven) was to add the extra maven dependencies required. For me this solution didn't have to much sense because it's only needed on the 32 bits machine:

<dependency>
    <groupId>com.lowagie</groupId>
    <artifactId>itext</artifactId>
    <version>2.1.7</version>
</dependency>

<dependency>
    <groupId>org.olap4j</groupId>
    <artifactId>olap4j</artifactId>
    <version>1.2.0</version>
</dependency>

After a research I discovered that Jasperreports 6.3.0 has already included the missing dependencies in the jar file, that's why on the 64bits machine the only dependency needed is the jasperreports 6.3.0.
My questions are:

Why do I need to have two versions of pom file: one for the 32 bits
computer and the other for the 64bits computer considering that the
software tools version are the same?.
How can I have only one version of pom file that works on both platforms?.

Thanks in advance!
Comment: That is indeed  strange. Do you also use the same maven version on both machines? And what JDK do you use (which version and what architecture)? (Since you could use a 32 Bit JDK on a 64 bit machine...)
Answer: I think the best result is when you add the JasperSoft repository to your pom.xml/settings.xml:
<repository>
    <id>jaspersoft.artifactory</id>
    <url>https://jaspersoft.jfrog.io/artifactory/third-party-ce-artifacts/</url>
</repository>

this repo replace https://jasperreports.artifactoryonline.com
The 32/64bit in java almost doesn't matter because the JVM. It is JVM that does the "dirty job"


Plotting real-time Spectrogram from a input device

Question: I'm trying to plot in real-time a spectogram from the default input device data. I plot an animation using FuncAnimation from matplotlib module but I don't understand why the plot does not update with the new data from the buffer.
This is what I have so far.
<code>from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
import numpy as np
import rtmixer
import math
import sounddevice as sd

FRAMES_PER_BUFFER = 512
NFFT = 4096
NOVERLAP = 128

window = 100000
downsample = 10
channels = 1

def create_specgram(frame):
    global plotdata

    spec, freqs, t = plt.mlab.specgram(plotdata[:,-1], Fs=samplerate)
    xmin, xmax = np.min(t) - pad_xextent, np.max(t) + pad_xextent
    extent = xmin, xmax, freqs[0], freqs[-1]
    arr = np.flipud(10. * np.log10(spec))

    return arr, extent

def update_plot(frame):

    global plotdata

    while ringBuffer.read_available >= FRAMES_PER_BUFFER:
        read, buf1, buf2 = ringBuffer.get_read_buffers(FRAMES_PER_BUFFER)
        assert read == FRAMES_PER_BUFFER
        buffer = np.frombuffer(buf1, dtype='float32')
        buffer.shape = -1, channels
        buffer = buffer[::downsample]

        assert buffer.base.base == buf1
        shift = len(buffer)
        plotdata = np.roll(plotdata, -shift, axis=0)
        plotdata[-shift:, :] = buffer
        ringBuffer.advance_read_index(FRAMES_PER_BUFFER)

    arr, _  = create_specgram(frame)
    image.set_array(arr)
    return image,

device_info = sd.query_devices(device=None, kind='input')
samplerate = device_info['default_samplerate']

pad_xextent = (NFFT - NOVERLAP) / samplerate / 2
length = int(window * samplerate / (1000 * downsample))
plotdata = np.zeros((length, channels))

stream = rtmixer.Recorder(device=None, channels=channels, blocksize=FRAMES_PER_BUFFER,
                          latency='low', samplerate=samplerate)

ringbufferSize = 2**int(math.log2(3 * samplerate))

ringBuffer = rtmixer.RingBuffer(channels * stream.samplesize, ringbufferSize)

fig, ax = plt.subplots(figsize=(10, 5))
arr, extent = create_specgram(0)
image = plt.imshow(arr, animated=True, extent=extent, aspect='auto')
fig.colorbar(image)

ani = FuncAnimation(fig, update_plot, interval=1, blit=True, cache_frame_data=False)

with stream:
    ringBuffer = rtmixer.RingBuffer(channels * stream.samplesize, ringbufferSize)
    action = stream.record_ringbuffer(ringBuffer)
    plt.show()

</code>
Does anyone know what I'm doing wrong here?
I would expect something like this moving from right to left.

And this is what I get (I'm playing something different than just noise):
Comment: good question, but too much code, please reduce to this:
[minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)
Comment: My bad, I updated the code with minimal lines.
Answer: Your code works perfectly for me, updating as you described!
Therefore, the answer is lying in your system.
I started it under a linux computer from the console, it did not work inside an IDE (spyder), because there, the ouput settings don't allow to start a separate window.
Small side note: you have to set limits to the color scale, otherwise it keeps it fixed from the starting value, which is 1 in your case.
Comment: Thank you for your answer. Did you try while playing somethind on the input device, does the spectrogram updates as desired?
How exactly the system can be causing this issue?
Comment: Yes, this is what I mean: It reacts to the microphone and updates the plot. Meanwhile also checked on Windows, running Anaconda, here it works, too.
With "system" I mean mostly how you use Python. As mentioned: try it outside an IDE, just from the command line, since IDEs often redirect plots a little bit.


Should I keep downspout extenders installed during the winter?

Question: Should downspout extenders be kept installed during winter? For some reason, I think they facilitate ice formation to creep up the spout?
When I say downspout extenders, I mean these
Comment: problem with those is that not all water drains out of the extenders which can then freeze
Comment: How about finding a square and hard plastic version, which would ensure water would drain and then it would be okay?
Answer: Proper drainage depends on a constant gradient. These flexible pipes don't provide that.
Those concentric corrugations and the flexibility that allows them to follow ground contour with a portion of the length dropping into a depression or having to go over an obstruction leaves a pool of water that freezes.
Elbows and rigid downspout stock to get the roof runoff out away from the foundation works best. There are fold-up metal/vinyl 48/60" extenders available that allow for flowerbed maintenance.
If you have a lot of winter precipitation as rain, or a lot of melt-water, you need to get the runoff out and away from the house foundation, which is the purpose of a proper downspout system. Thus, extending the outflow of the downspouts is needed year around to prevent this.


confusion with setting model in a route handler

Question: In the "Specifying a Route's Model" section of the Ember documentation, it says a controller's model property can be assigned by implementing the model hook in a route; it also says this behavior can be changed by implementing the setupController hook.  This led me to conclude that I can assign a model by doing one or the other.  But when I looked at the Ember documentation for "Setting Up a Controller," example shows the setupController hook requiring a function that takes two parameters: controller & model.  Documentation just says "model is the route handler's model.  For more information, see Specifying a Route's Model."  This leads me to conclude I need to do both steps.
If I don't need to do both steps, what's the difference between one vs. the other?
Answer: In most cases, you can simply override model and forget about setupController. Sometimes you don't need to override anything at all.
The default behaviour of setupController is to set the model property (which is aliased to the content property) of the controller to the current route's model (supplied as an argument). Usually this argument is the return value of the model hook, unless the route has a dynamic segment and is accessed via {{linkTo}}, {{render}}, or the like (ie. not directly from a url). In this case, the model hook is bypassed and setupController is given whatever model was supplied in the transition.
If your route has a dynamic segment, the model hook makes a guess at what you're looking for by default. Given a route path something/:post_id, the default model hook will return App.Post.find(:post_id). If your route does not have a dynamic segment (e.g. /posts) then you have to override model to return the record(s) you want.
If you need to set additional properties beyond model or content on your controller, then you should override setupController. This will circumvent the default behaviour, so it is up to you to assign the model argument to the model or content property of your controller (or not). If you so choose, you may ignore the model argument altogether and set the controller's properties to whatever you like. The downside to this approach is that a model supplied by transition into a route with a dynamic segment will not get set on the controller.


How to set the project sources JDK version in Netbeans?

Question: From the console javac builds with JDK 14 fine.

Using sdkman to install JDK 14 as:
thufir@dur:~$
thufir@dur:~$ which java
/home/thufir/.sdkman/candidates/java/current/bin/java
thufir@dur:~$
thufir@dur:~$ java -version
openjdk version "14.0.1" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.1+7, mixed mode, sharing)
thufir@dur:~$
thufir@dur:~$ javac -version
javac 14.0.1
thufir@dur:~$

Netbeans only shows the sources as 11:

but 14 is available as a platform:

How can I set 14 as the default platform (or even remove 11), but, more importantly, set 14 as the sources version for the project as in the first screenshot?
see also:
how to use Java 9 zulu from sdkman?

even creating a new project still shows the source binary as 11 and not 14 with no way to select 14.  Ideally, would remove 11 entirely and just go to 14.
Comment: Please check this question and the answers to it. Maybe can help you to install the sources for Java 14: https://askubuntu.com/questions/755853/how-to-install-jdk-sources/1104463#1104463 After you install them you have to check out how to include them in Netbeans. Maybe they will appear automatically but I am not sure because I do not use this IDE.
Comment: I am using java 14 as here:  https://stackoverflow.com/q/61849514/262852  so gradle is compiling and running java-records, which are only in version 14.  But, the IDE is *partially* stuck on 11.  As in the screenshots, the IDE shows 14 **and** 11.
Answer: In your Projects tree, expand the Build Scripts and edit the build.gradle file.
You should find somewhere a line that contains :
sourceCompatibility = '11'
Edit this line and change it to sourceCompatibility = '14'.
Clean and build your project, and re-open the project properties. You should now see your Source / Binary format to 14.
By the way, this information does not mean that your IDE is stuck on 11. It is just the target JVM version of your application. Having '11' will keep your code compatible with a JVM 11.
If your code is intended to run on a server for which you or a sysadmin manage the JVM version, you can choose the version you prefer and benefit from the latest JVM updates.
But if you plan to distribute a rich-client application that will run on a config that you don't know, I would rather consider keeping this compatibility as "old" as possible. Some people still have a JVM 1.8 on their computers, and probably not a majority uses Java 14 ;)


What is the term when individual parts of product design and development done well but released product has terrible UX?

Question: It's more prevalent in large corporations, also called something like "teams not talking to each other".
Like when product has great UI but bad integration with hardware that results
in terrible UX.
For example, in modern Android TVs the UI may look very nice and sleek but overall operation is sluggish, because UI was designed and tested on faster hardware and pushed to less capable hardware. Both teams did their work right but integrated result is bad.
Comment: I always knew it as *UI design gap* or *UX gap*, no idea if there' is an official name, but if you search Google for those terms you' find a lot of results, so it seems to be an accepted convention. Anyway, Im also looking for answers, good question.
Comment: Researching about your question, I found the concept of **_The Valley of Disappointment_**, something I don't know about, so it would be interesting to find an answer applied to UI/UX.
Answer: As you pointed out in the question, there are a number of reasons why this happens and there are any number of formal or informal ways to describe it, so perhaps I can suggest some here and see if other people in the community would like to add to it.

Teams/individuals not talking to each other = working in silos

Deficiencies in the handover process resulting in gaps = throwing
something over the fence

Differences in the maturity/skill level of teams = delivery team
balance

I would say that what you are essentially describing also covers the fact that the first part of the double diamond process is intended to find the 'right problem to solve' which is about coming up with the root cause of a problem or identify an opportunity, and the second part of the double diamond is about 'solving the problem right', which is about designing and building to the specifications.
That means there could also be incorrect assumptions made in the initial research process or perhaps changes or differences in the requirements during the delivery process (e.g. UI was designed and tested on faster hardware and pushed to less capable hardware).


Optimize for e.g. youtube on older hardware

Question: I am trying to revamp an old HP Mini netbook and make it into a useable mini laptop with Lubuntu 16.04. The laptop was unuseably slow when it still ran Windows 7, now with Lubuntu it can be taken seriously once again. Thank you, Lubuntu team.
There is one thing so far which I have found works worse than it did on Windows 7, this is playing Youtube videos. Even when using the HTML5 player, I cannot get past 360p without getting immense framerate drops. The laptop used to be able to handle 480p without issues, and this is what I'd like to get to. The screen is too small and crappy to enjoy benefits of even higher resolutions anyway.
I have read through this high-quality answer. I haven't fully followed the guide yet of watching youtube through an external player, but it is true that downloaded video can be played significantly more smoothly.
Before resorting to 'work-arounds' like embedding youtube videos in external players, is there more I could do to get the web player to work? Going from Firefox to Chromium already helped (on Firefox I could only watch videos on 144p, too little to be able to read subtitles). The laptop's 1 GB of RAM won't be the problem I think, but the 1.66 Ghz Intel Atom N455 processor is a bottleneck. It's a 32 bit system. Internet speed is not a problem. Let me know if you need more specs, I am pretty sure this is the full list of specs.
Answer: I would say that the graphics processor is your bottleneck. I read an article about the Intel GMA 3150 saying 720p is not possible with it.
As you would like to watch Videos in 480p, it should still be possible.
I would guess that VLC might be slightly better than Chrome or Firefox when it comes to Video processing. So your wish of not needing an external player might not be possible.
Try to watch the videos from VLC directly

Run VLC media player and navigate to Tools > Preferences.
Under Show settings, select All.
Click on inputs / codec tab on the left. Under Track Settings, click the Preferred video resolution drop-down list and select 480p (Choose whatever quality you want).
Media --> Open Network Stream ... (Paste the Youtube Link here)

If that is still too slow or your video website is not Youtube, try to use youtube-dl to download and play the downloaded Video. Although it's named "youtube-dl", this tool can download videos from many websites.
Playing from local hard drive might render a bit better.
Install via:
<code>sudo apt-get install libav-tools youtube-dl
</code>
As you like to download the 480p Version, you should see this answer how to Download specific Quality.
Comment: Thank you, I will give it a try soon. Any idea as too why this webplayer would function better in a Windows 7 OS?
Comment: Not sure. The official intel graphics driver for windows might be slightly better.
Comment: SMPlayer (as suggested in the answer I linked to) works flawlessly. Guess I'll just have to live with this instead of the web player. On a side note, it doesn't stop to amaze what a light linux distro can do to an old netbook.


ERROR Class 'FirebaseApp' incorrectly implements interface 'App'

Question: Trying to serve up my angularCLI and Firebase resulted in this error... What do I do?

ERROR in node_modules/angularfire2/app/firebase.app.module.d.ts(5,22):
  error TS2420: Class 'FirebaseApp' incorrectly implements interface
  'App'.   Property 'firestore' is missing in type 'FirebaseApp'.
  node_modules/angularfire2/app/firebase.app.module.d.ts(12,28): error
  TS2694: Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/database/firebase_list_observable.d.ts(14,62):
  error TS2694: Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/database/firebase_list_observable.d.ts(15,48):
  error TS2694: Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/database/firebase_list_observable.d.ts(16,92):
  error TS2694: Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/database/firebase_object_observable.d.ts(11,31): error TS2694: Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/database/firebase_object_observable.d.ts(12,37): error TS2694: Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/database/firebase_object_observable.d.ts(13,24): error TS2694: Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/interfaces.d.ts(12,32): error TS2694:
  Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/interfaces.d.ts(13,35): error TS2694:
  Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/interfaces.d.ts(14,35): error TS2694:
  Namespace 'firebase' has no exported member 'Promise'.
  node_modules/angularfire2/interfaces.d.ts(15,44): error TS2694:
  Namespace 'firebase' has no exported member 'Promise'.
webpack: Failed to compile.

package.json
{
  "name": "oshop",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0",
    "angularfire2": "^4.0.0-rc.1",
    "bootstrap": "^4.0.0",
    "core-js": "^2.4.1",
    "firebase": "^4.9.1",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "^1.6.7",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  },
  "description": "This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.7.",
  "main": "karma.conf.js",
  "author": "",
  "repository": {
    "type": "git",
    "url": "imnickvaughn"
  }
}

Comment: The first thing you should do Is share the code where you are setting up firebase as it is impossible to give you an answer without see what you are doing
Comment: I just wanted to post my solution for others... I am hoping they'll find this when they search the error I posted and then try out my solutions.  Ill put in my package.json though
Answer: You should first try:
(if you have your angular cli and firebase installed)

In terminal type: npm install -S angularfire2@latest

once you do this your angularfire2 will read:
        "angularfire2": "^5.0.0-rc.6",
...and thats it
If that's not enough look at these sources and try...
https://github.com/angular/angularfire2/issues/1338
https://github.com/angular/angular-cli/issues/4391
npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest

rm -rf node_modules dist
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install
ng update [this wasn't working so I just changed it to ng init I believe]

npm install -g firebase-tools
npm install -S angularfire2@latest

Using the above advice and reinstalling all dependencies also works for this problem...
npm WARN deprecated firstname.lastname@example.com: use uuid module instead
https://github.com/kelektiv/node-uuid/issues/155
...Also the firebase command wouldn't work in my oh-my-zsh until I typed exactly:
npm install -S -D -g firebase-tools

Into vs code terminal.
Hopefully this saves someone an hour or five...
Comment: not working anymore:
% npm install -S angularfire2@latest
npm WARN deprecated firstname.lastname@example.com: AngularFire has moved, we're now @angular/fire
Answer: for me fix was changing FirebaseApp class to :
export declare class FirebaseApp implements FBApp {
name: string;
options: {};
auth: () => FirebaseAuth;
database: () => FirebaseDatabase;
messaging: () => FirebaseMessaging;
storage: () => FirebaseStorage;
delete: () => Promise<any>;
firestore: () => FirebaseFirestore;
automaticDataCollectionEnabled:boolean
}

Answer: Just downgrade firebase version using the following:
First, go to your project directory and then this command
 npm install --save email@example.com.*

it worked for me.
Answer: I just added automaticDataCollectionEnabled:boolean in class FirebaseApp.
It's work for me.
Answer: do some changes in package json
"angularfire2": "^5.0.0-rc.6.0",
"firebase": "^4.12.1"
Answer: Solution():

install this command in your firebase project

npm i --save firstname.lastname@example.com email@example.com

it will work.
Answer: I used this
export declare class FirebaseApp implements app.App {
    installations(): import("firebase").installations.Installations;
    performance(): import("firebase").performance.Performance;
    remoteConfig(): import("firebase").remoteConfig.RemoteConfig;
    analytics(): import("firebase").analytics.Analytics;
    name: string;
    options: {};
    auth: () => FirebaseAuth;
    database: (databaseURL?: string) => FirebaseDatabase;
    messaging: () => FirebaseMessaging;
    storage: (storageBucket?: string) => FirebaseStorage;
    delete: () => Promise<void>;
    firestore: () => FirebaseFirestore;
    functions: (region?: string) => FirebaseFunctions;
}

Answer: You getting below error ?
ERROR in node_modules/angularfire2/app/firebase.app.module.d.ts(5,22)
webpack: Failed to compile.
Please don't do anything, just install latest version of angularfire2
npm install -S angularfire2@latest
Comment: you repeated my answer?


How should I go about fire proofing my garage?

Question: I am working on an old house that has a garage that needs some updating.  The shared wall with the garage has the old house siding (when presumably there was no attached garage).  There is a partial ceiling (50%) that holds attic space.  The part that doesn't have attic space has the rafters exposed.  I also have crawl space access behind the stairs leading from the garage to the kitchen.
After reading several of the questions and answers in this DIY exchange, it appears I need to:
(1) Install 5/8" sheetrock on top of (or in place of) the old siding that is installed in the shared wall.
(2) I need to find a fireproof solution to the crawlspace access (or close the access entirely with 5/8" sheetrock)
(3) I need to figure out a way to make the ceiling/roof fireproof.
For (3) I was thinking of extending the attic floor to cover 3/4th of the garage.  I would build a wall on the edge that I am not extending.  I would then install 5/8" sheetrock to the "new" garage ceiling (attic floor) and to the new attic wall.  Now, what do I do with:
(a) access door to attic?  Does it have to be fireproof?  Can I build same access door that I see built with pull-down stairs?  This access door doesn't seem tightly sealed like some of the answers I have seen suggest it needs to be.
(b) what do I do with the exposed rafters in the area i did not extend attic?  Do I need to install 5/8" sheetrock like a vaulted ceiling would have?
Depending on the answer to (a), can I use the same technology to fireproof the access to my crawlspace?
Lastly, on the 3 sides of the garage that do not share a wall with the house, can I just install 1/2" drywall?  And, any additional considerations regarding insulation of any of the 4 walls?
Comment: Relevant: [IRC: Gypsum board](http://diy.stackexchange.com/questions/16543/under-what-circumstances-is-5-8-drywall-required)
Comment: Just a thought; any wood-framed structure *will* become fully engaged. Any "fireproofing" effort here will slow the spread of a fire originating in the garage, but it will not contain such a fire indefinitely, nor will it prevent the structure itself catching fire.
Comment: Are you being made to do this, or just want to add more protection? There are many things you can do to slow down a fire .Its how much you want to spend.. Sheetrock on the wall to the house from floor to top of raters helps..And you can tape it and add another layer if you want. It will help but if you have a old wooden door. I would  go one layer of dry wall and a metal door. .Cutting down where walls can act like vents seal holes add some wood blocking to frame helps  .Fiber glass insulation in voids helps.
Answer: For the Access to the Crawlspace and Attic you can use a Fire Rated Access Hatch. We used one in our Garage. I can't seem to find the Make/Model, though its something like this. They come in all sizes.
You also want to have Any Wall Penetrations with Fireproofing. If you have Plumbing (water heater, Vent Stack, Electrical, etc that is not behind the sheetrock you need a fireproof barrier. They make several things to do this


I want to print If person is minor or major or senior citizen based on age when I entered in registration form using angular

Question: Here If I filled registration form I got the all employee details in one page but now I want
in that I have to print the column as is person minor or major or senior citizen category using angular.

            ID
              Employee Name
              Employee EmailId
              Age
              Category
              Salary
              ACTION

          {{emp.id}}
          {{emp.empName}}
          {{emp.empEmail}}
          {{emp.empAge}}

         18 else userloggedOut">major

         <ng-template #userloggedOut>

           minor

        </ng-template>

          {{emp.empSal}}
          <button style="margin-left: -100px;" class="btn btn-danger btn-xs" (click)="delteUser(emp.id)"> Delete</button>

The above code is print the whether minor or major but I didn't get code for senior citizen
please help the code for to print senior citizen also if I enter age above 60
Comment: You can create and use a [pipe](https://angular.io/guide/pipes) for that.
Answer: On of the possibilities would be to *ngIf :
<td *ngIf="emp.empAge < 21">Minor
= 21 && emp.empAge < 70">Major
 70">Senior

Comment: if I have age 21 it show the senior if I add above code
Comment: I edited my post. In my country you're major from 18yo. You just have to change 18 by 21
Comment: Iam new to angular please help me sir
Comment: @sudhach I edited my post because it's impossible to do this with NgSwitch. I apologize. You can simply use *ngIf :)
Comment: I have one more doubt can u please clarify that sir


Fourier Transform of the following L2 function

Question: Consider the $L^2(\mathbb{R})$ function
$$h(x) = \dfrac{1}{\sqrt{\pi}}\dfrac{(x-i)^k}{(x+i)^{k+1}}, \quad k \in \mathbb{Z}.$$
Recall that we may define the Fourier transform $\mathcal{F}: L^2(\mathbb{R}) \rightarrow L^2(\mathbb{R})$ by letting $$\mathcal{F}[f](\xi) = \int_{\mathbb{R}} f(x) e^{-i x \xi} dx$$ on $L^1(\mathbb{R})\cap L^2(\mathbb{R})$ and extending by continuity.
I want to compute the Fourier transform of $h$, but have been unable to perform the integration.
By the statement of the problem, I know that this Fourier transform should be zero a.e. on the positive real line, when $k \geq 0$ (a fact I have not been able to show either).
Any ideas how to tackle the problem?
Edit: Here $L^2(\mathbb{R})$ are equivalence classes of functions $\mathbb{R} \rightarrow \mathbb{C}$.
Answer: Start by writing
$$
             \frac{1}{x+i} = -i\int_{0}^{\infty}e^{it(x+i)}dt,\;\;\; x\in\mathbb{R}.
$$
Then differentiate $k$ times with respect to $x$:
$$
     (-1)^k\frac{k!}{(x+i)^{k+1}}=-i\int_{0}^{\infty}e^{it(x+i)}(it)^{k}dt \\
     \frac{1}{(x+i)^{k+1}}=\frac{(-1)^{k+1}}{k!}i\int_{0}^{\infty}e^{itx}e^{-t}(it)^{k}dt.
$$
Then you can write $(x-i)^{k}$ in powers of $(x+i)$:
$$
         (x-i)^{k}=(x+i-2i)^{k}=\sum_{n=0}^{k}{{k}\choose{n}}(x+i)^{n}(-2i)^{k-n}.$$
The function $h(x)$ is then seen to be the inverse Fourier transform of a function that vanishes on the negative real axis. So the Fourier transform of $h$ must vanish on the negative real axis, and the desired Fourier transform can be written as a finite sum of functions given above.


Closing a gap in a thick wall with drywall

Question: I'm trying to close a gap in the wall with drywall.

Since the wall is so thick (25cm) it's too expensive to fill it all up with insulation.
In addition, there are no 25cm metal studs I can easily buy.
One idea is to go with a single 7.5cm stud and double drywall (2x1.25cm) on each side.
This will cover the hole with drywall half way.

Drywall wise that's a good enough option, but then I'm left with having to smooth the edge on the side that will remain open, and that looks more complicated than dry-walling.

Update 1
There was a suggestion to do this as two separate walls.
This was considered, but it's not clear how to install the inner drywall once the first wall is in place, as shown on the picture below.

Update 2
The suggestion below was mentioned.
I originally considered a variation of this option to fill everything in between the drywall with insulation. Gave up on that once I couldn't find proof that the so much insulation is worth the money.
I'm considering the suggestion on the picture, to just fill the insulation in between the studs without adding extra drywall inside.
I thought the insulation won't stand on it's own without the drywall but and reconsidering this thought.

How would you solve this problem if the focus is to have it done with drywall as much as possible and the focus is acoustic insulation (so not carrying capacity or thermal)?
Comment: Can you clarify the term "smote"? It's not in our local vernacular. And this is a great application for two 'normal' (~100mm thick) walls because of the desire for sound isolation.
Comment: Good update — thanks. 4 layers of drywall would give more sound insulation than 3 (easy to do, btw, if you build one wall first) than 2, but you might be looking at diminishing returns. I regret that I'm not an expert in this; hopefully someone will come along with solid STC numbers.
Comment: https://www.stcratings.com/assemblies.html ... see especially #6, "Drywall between double studs can dramatically reduce the STC rating of an assembly." So easier is better! And I'm an expert now ;)
Comment: Your bottom option: two rows of parallel 7.5 cm deep metal studs but only use two layers of drywall on the outsides. No inner dywall needed. Fill the inside space with insulating batts.
Comment: Are you really thinking to do four separate (i.e. not doubled up) layers of drywall?  If so, it looks like you have 25 cm to deal with.  If you have 1.25 cm drywall and 7.5 cm studs, it seems like you have 5 cm of space.  Are you telling me you can't find a stud (or other lumber material) that's 5 cm?
Answer: It's not clear to me what your actual preferences are with respect to insulation and drywall. You mention several scenarios. However, the simple fact is that you can build one wall to your liking, then build the other wall on the floor. Apply as much drywall as you like to the inner (upper, when under construction) face, then tip it up and fasten it in place with the appropriate backset for the remaining drywall.
Be aware that you must square the wall carefully since you're sheathing it. Take diagonal measurements of both the opening and your framed wall and be sure they match. Leave a bit of a gap for safety (6mm should do).
One other suggestion is to remove any corner bead around the opening before beginning. It adds unnecessary thickness and curvature to the wall which makes finishing the drywall more difficult.
Comment: Thanks,
I'm comparing options with the focus on best bang for buck acoustic insulation and ease of installation.
Eventually I'll likely clean up the question to give a comparison of the approaches so it doesn't grow into a mess.


Insert data into 2 tables

Question: This is my code for enrolling students:
First I will like to store student info into tblStudentRecord and I would like to store it in another table tblSection1.
This is my code to do this:
If (MsgBox("The records you entered will be saved to the database. Do you want to proceed to the enrolment?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes) Then
      Dim cmd As New OleDb.OleDbCommand
      If Not cnn.State = ConnectionState.Open Then
           cnn.Open()
      End If
      Dim converter As New ImageConverter
      Dim iByte As Byte()
      iByte = converter.ConvertTo(picStud.Image, GetType(Byte()))
      cmd.Connection = cnn
      Try
           With cnn
           If .State <> ConnectionState.Open Then
                .Open()
           End If
           strsql = "INSERT INTO tblStudRecord(LName,FName,MName,BMonth,BDay,BYear,StudAge,StudGender,StudNationality,StudReligion,TownCity,Province,StudPNum,StudAddress,FatherName,FOccupation,FContact,FAddress,MotherName,MOccupation,MContact, MAddress, GuardianName, GContact, GAddress, StudStatus, LastSchAtt, sPlace, GrdYr, DateofReg, ForGrdYrLvl,studPic,sStatus)" & _
                     "VALUES (@LName,@FName,@MName,@BMonth,@BDay,@BYear,@StudAge,@StudGender,@StudNationality, @StudReligion , @TownCity , @Province , @StudPNum,@studAddress , @FatherName , @FOccupation , @FContact , @FAddress , @MotherName , @MOccupation, @MContact , @MAddress , @GuardianName , @GContact , @GAddress , @StudStatus , @LastSchAtt , @sPlace , @GrdYr , @DateofReg , @ForGrdYr,@picStud,'Enrolled')"

          cmd.CommandText = strsql
          cmd.Connection = cnn

          cmd.Parameters.AddWithValue("@LName", txtLName.Text) '2
          cmd.Parameters.AddWithValue("@FName", txtFName.Text) '3
          cmd.Parameters.AddWithValue("@MName", txtMName.Text) '4
          cmd.Parameters.AddWithValue("@BMonth", cboBMonth.SelectedItem) '5
          cmd.Parameters.AddWithValue("@BDay", cboBDay.SelectedItem) '6
          cmd.Parameters.AddWithValue("@BYear", cboBYear.SelectedItem) '7
          cmd.Parameters.AddWithValue("@StudAge", txtAge.Text) '8
          cmd.Parameters.AddWithValue("@StudGender", cboGender.SelectedItem) '9
          cmd.Parameters.AddWithValue("@StudNationality", txtNationality.Text) '10
          cmd.Parameters.AddWithValue("@StudReligion", txtReligion.Text) '11
          cmd.Parameters.AddWithValue("@TownCity", txtTownCity.Text) '12
          cmd.Parameters.AddWithValue("@Province", txtProvince.Text) '13
          cmd.Parameters.AddWithValue("@StudPNum", txtMobileNumber.Text) '14
          cmd.Parameters.AddWithValue("@studAddress", txtHomeAddress.Text) '15
          cmd.Parameters.AddWithValue("@FatherName", txtFatherName.Text) '16
          cmd.Parameters.AddWithValue("@FOccupation", txtFatherOccupation.Text) '17
          cmd.Parameters.AddWithValue("@FContact", txtFatherContact.Text) '18
          cmd.Parameters.AddWithValue("@FAddress", txtFatherAddress.Text) '19
          cmd.Parameters.AddWithValue("@MotherName", txtMotherName.Text) '20
          cmd.Parameters.AddWithValue("@MOccupation", txtMotherOccupation.Text) '21
          cmd.Parameters.AddWithValue("@MContact", txtMotherContact.Text) '22
          cmd.Parameters.AddWithValue("@MAddress", txtMotherAddress.Text) '23
          cmd.Parameters.AddWithValue("@GuardianName", txtGuardianName.Text) '24
          cmd.Parameters.AddWithValue("@GContact", txtGuardianContact.Text) '25
          cmd.Parameters.AddWithValue("@GAddress", txtGuardianAddress.Text) '26
          cmd.Parameters.AddWithValue("@StudStatus", cboStatus.SelectedItem) '27
          cmd.Parameters.AddWithValue("@LastSchAtt", txtLastSchoolAttended.Text) '28
          cmd.Parameters.AddWithValue("@sPlace", txtPlace.Text) '29
          cmd.Parameters.AddWithValue("@GrdYr", txtGradeYearLvl.Text) '30
          cmd.Parameters.AddWithValue("@DateofReg", txtDateofRegistration.Text) '31
          cmd.Parameters.AddWithValue("@ForGrdYr", cboYearLvl.SelectedItem) '32
          cmd.Parameters.AddWithValue("@picStud", iByte)

Comment: Do tables tblStudentRecord and tblSection1 have the same field names?
Answer: Call cmd.ExecuteNonQuery() function at the last.
Answer: If tables tblStudentRecord and tblSection1 have the same fields or columns, try this...
strsql = "INSERT INTO tblStudRecord(LName,FName,MName,BMonth,BDay,BYear,StudAge,StudGender,StudNationality,StudReligion,TownCity,Province,StudPNum,StudAddress,FatherName,FOccupation,FContact,FAddress,MotherName,MOccupation,MContact, MAddress, GuardianName, GContact, GAddress, StudStatus, LastSchAtt, sPlace, GrdYr, DateofReg, ForGrdYrLvl,studPic,sStatus)" & _
         "VALUES (@LName,@FName,@MName,@BMonth,@BDay,@BYear,@StudAge,@StudGender,@StudNationality, @StudReligion , @TownCity , @Province , @StudPNum,@studAddress , @FatherName , @FOccupation , @FContact , @FAddress , @MotherName , @MOccupation, @MContact , @MAddress , @GuardianName , @GContact , @GAddress , @StudStatus , @LastSchAtt , @sPlace , @GrdYr , @DateofReg , @ForGrdYr,@picStud,'Enrolled')" & _
         ";" & _
         "INSERT INTO tblSection1(LName,FName,MName,BMonth,BDay,BYear,StudAge,StudGender,StudNationality,StudReligion,TownCity,Province,StudPNum,StudAddress,FatherName,FOccupation,FContact,FAddress,MotherName,MOccupation,MContact, MAddress, GuardianName, GContact, GAddress, StudStatus, LastSchAtt, sPlace, GrdYr, DateofReg, ForGrdYrLvl,studPic,sStatus)" & _
         "VALUES (@LName,@FName,@MName,@BMonth,@BDay,@BYear,@StudAge,@StudGender,@StudNationality, @StudReligion , @TownCity , @Province , @StudPNum,@studAddress , @FatherName , @FOccupation , @FContact , @FAddress , @MotherName , @MOccupation, @MContact , @MAddress , @GuardianName , @GContact , @GAddress , @StudStatus , @LastSchAtt , @sPlace , @GrdYr , @DateofReg , @ForGrdYr,@picStud,'Enrolled')" & _
         ";"

Insert data into 2 tables


solution for second order differential equation

Question: Please support me on this problem. I have tried so hard but couldn't get the answer
$$
yy'' + yy' + 1 =0
$$
Thank you very much.

The original equation can be simplified to
$$y''+y'+\frac{1}{y}=0\tag{1}$$
using $u=\frac{dy}{dx}$ and $y''=\frac{du}{dx}=u\frac{du}{dy}.$ Then Eqn. $(1)$:
$$u\frac{du}{dy}+u+\frac{1}{y}=0.\tag{2}$$
Eqn. $(2)$ can be reduced to $\frac{du}{dy}=-1-\frac{1}{uy}$, then
$$du=-dy- \frac{dy}{uy}.\tag{3}$$
Integrate both side of eqn. $(3)$: $u=-y- \int \frac{dy}{uy}.$ I am stuck right here. Anyone can help me. Thank you.
Comment: "I have tried so hard (...)" Please show us what you tried, as well as some background on the problem
Comment: What have you tried?  Where are you stuck?
Comment: y''+y'+1/y=0 (1)  using u=dy/dx; y''=du/dx=udu/dy. Then Eqn. (1): udu/dy+u+1/y=0 (2). Eq
Comment: The original equation can be simplified to y''+y'+1/y=0 (1) ; using u=dy/dx; y''=du/dx=udu/dy. Then Eqn. (1): udu/dy+u+1/y=0 (2). Eqn. (2) can be reduced to: du/dy=-1-1/(uy) then du=-dy- dy/(uy) (3). Integrate both side of eqn. (3) : u=-y- ∫dy/(uy). I am stuck right here. Anyone can help me. Thank you.
Answer: Defining $u=y'(x)$, we can rewrite the ODE $yy''+yy'+1=0$ as
$$
yu\frac{du}{dy}+yu+1=0 \implies \frac{du}{dy}+1=-\frac{1}{yu}. \tag{1}
$$
Let $v:=u+y$; then
$$
\frac{dv}{dy}=\frac{du}{dy}+1=-\frac{1}{yu}=-\frac{1}{y(v-y)}
$$
$$
\implies\frac{dy}{dv}=y^2-vy. \tag{2}
$$
Equation $(2)$ is a Riccati equation. It can be converted to a second order linear ODE with the substitution $y=-\frac{w'}{w}:$
$$
\frac{dy}{dv}=-\frac{w''}{w}+\frac{(w')^2}{w^2}=\frac{(w')^2}{w^2}+\frac{vw'}{w}
$$
$$
\implies w''+vw'=0 \implies w'=C_1e^{-v^2/2}\implies w=C_2+C_1\int_0^v e^{-t^2/2}\,dt, \tag{3}
$$
hence
$$
y(v)=-\frac{w'}{w}=\frac{C_1e^{-v^2/2}}{C_2+C_1\int_0^{v}e^{-t^2/2}\,dt}
=\frac{e^{-v^2/2}}{a+\int_0^{v}e^{-t^2/2}\,dt}. \tag{4}
$$
Let's now determine $x(v)$, which, together with the expression for $y(v)$ given by Eq. $(4)$, yields the solution to the initial ODE in parametric form:
$$
\frac{dv}{dx}=\frac{du}{dx}+\frac{dy}{dx}=y''+y'=-\frac{1}{y}
\implies \frac{dx}{dv}=-y=\frac{w'}{w}
$$
$$
\implies x(v)=\ln(w)+b=\ln\left(a+\int_0^{v}e^{-t^2/2}\,dt\right)+b. \tag{5}
$$
Comment: Because $yy''=y\frac{dy'}{dx}=y\frac{dy'}{dy}\frac{dy}{dx}=y\frac{du}{dy}u$.
Comment: Sorry, why in (1) the first addend is $yu \displaystyle \frac{du}{dy}$ instead of $y \displaystyle \frac{du}{dy}$?
Comment: Thank you very much
Comment: If I have the boundary conditions, please let me know how can we solve for constants a and b. For example if y(x=0)=y0 and y'(x=0)= A. Thank you very much
Comment: Let $v_0:=v(x=0)$; then, according to the definition of $v$ (given after Eq. $(1)$), $v_0=u(x=0)+y(x=0)=y'(x=0)+y(x=0)=A+y_0$. Now, use Eq. $(4)$ with $y(v_0)=y_0$ to determine $a$, and Eq. $(5)$ with $x(v_0)=0$ to determine $b$.
Answer: $$yy''+yy'+1=0$$
This is a second order ODE of the autonomous kind. As already noted in comment the usual way to reduce the order is the change of function :
$$y'=\frac{dy}{dx}=u(y) \quad\implies\quad \frac{d^2y}{dx^2}=\frac{du}{dy}\frac{dy}{dx}=u\frac{du}{dy}$$
$$y\,u\frac{du}{dy}+y\,u+1=0$$
Let $v(y)=u(y)+y\quad\implies\quad \frac{du}{dy}=\frac{dv}{dy}-1$
$$y\,(v-y)(\frac{dv}{dy}-1)+y\,(v-y)+1=0$$
$$y\,(v-y)\frac{dv}{dy}+1=0$$
$$\frac{dy}{dv}=(y-v)y$$
This is a first order ODE of the Riccati kind. The usual way to solve it is the change of function :
$y=-\frac{1}{w(v)}\frac{dw}{dv}\quad\implies\quad \frac{dy}{dv}=-\frac{1}{w}\frac{d^2w}{dv^2}+\frac{1}{w^2}\left(\frac{dw}{dv}\right)^2$
$$-\frac{1}{w}\frac{d^2w}{dv^2}+\frac{1}{w^2}\left(\frac{dw}{dv}\right)^2=\left(-\frac{1}{w(v)}\frac{dw}{dv}-v\right)\left(-\frac{1}{w(v)}\frac{dw}{dv} \right)$$
$$\frac{d^2w}{dv^2}=-v\frac{dw}{dv}$$
$$\frac{dw}{dv}=c_1\exp\left(-\frac12 v^2 \right)$$
$$w(v)=c_1\sqrt{\frac{\pi}{2}}\text{erf}\left(\frac{v}{\sqrt{2}}\right)+c_2$$
Now one has to come back to $\quad y(v)=-\frac{1}{w(v)}\frac{dw}{dv}\quad$ then to the inverse function i.e.: $v(y)$ then to  $\quad u(y)=v(y)-y\quad$ then to $\quad x(y)=\int \frac{dy}{u(y)}\quad$ then to the inverse function $y(x)$ which is the final solution. This is the theory but in fact the closed forms doesn't exist in terms of a finit number of standard functions.
As a consequence in practice numerical calculus is necessary. So the simplest way is to solve directly the original ODE thanks to numerical method of calculus.
Note that simplifications might appear in particular cases of boundary conditions eventualy making possible the analytical solving.
Comment: Thank you very much!


Save as UTF 8 error in Eclipse screen. Why the program is not running?

Question: Sometimes I see a pop appears in Eclipse, which is not run in my code. I wanted to know how to fix this error?. How do I get rid of this error
Comment: Possible duplicate of [How to support UTF-8 encoding in Eclipse](https://stackoverflow.com/questions/9180981/how-to-support-utf-8-encoding-in-eclipse)
Answer: You seem to be having some Unicode characters, which can't be saved in your default file encoding as your default (e.g. ANSI) might not be able to represent that character. E.g. Characters from Arabic, Hindi, Urdu or even emojis can't be represented in ANSI due to which you need to change the file encoding to UTF-8 after which you will be able to save your file contents successfully and run your program.
For solving this problem,

click on Windows menu
Select Preferences
Expand General by clicking it
Click on Workspace
There in bottom left you will see 'Text file encoding'
By default it might be CP1252, so just change it to UTF-8
Then you should have no problems saving and running your program.

Let me know if you face any issues.


Reply all replies to self?

Question: The mail client Microsoft Outlook have the option to use "Reply All" in a mail conversation. When you hit the "Reply All"-button, your name sometimes turn up in the to-box, meaning you'll also receive the e-mail you are currently writing – which is annoying.
Technically Microsoft MVPs' answers that this behavior depends on Outlook not knowing your e-mail address and adds "all" recipients as receivers. Without knowing much of Exchange server, there must be a way to remember that the mail I'm currently replying to, was the e-mail sent to me, and as a consequence not adding my e-mail address in the to-box.

It must be possible to improve the behavior of the Reply All-button. Why haven't Microsoft changed the behavior to improve the User Experience of Outlook?
Comment: Interestingly, if you send someone an email and then you want to send a follow-up on that, and you hit Reply on your sent email, you get just yourself in the To box. But if you hit Reply All, you get just the original recipient in the To box. I use this all the time.
Comment: Have you considered that some people might like this functionality? This seems to be based on your personal opinion.
Comment: @dhmholley Among the people I've asked; developers, managers and operators - no one understands why you write an e-mail to yourself as well. But there might be - I havn't made a research study on the topic, yet :)
Comment: Well, e-mails aren't really suited for group-tasks...  This is one of those "If all you have is a hammer, then everything looks like a nail"-situations.
Comment: note that some email providers will let you create alt email addresses so outlook won't see an email matching your log-in details when one of those is used
Comment: @JørnE.Angeltveit True, but many things on the internet aren't doing what they were designed to do. Still Gmail manages to reply to all without mailing everthing to you again.
Comment: Hehe. Most things, perhaps?  Regarding e-mails I've seen lots of creative uses.  Some users like to CC/BCC *everything* to themselv, so that they *only* need to look for stuff in the "Inbox".  Others like to delete old messages, because the original message is already included in new mail.  Then you have all the users who add *their comments* somewhere inside your message.  Usually with a different font, font-color or simply by prefixing their line (or your line) with a ´>´ sign.  (This was very popular in the 90's, and you could easily tell your/their email appart by counting all the '>>>' :)
Comment: Ahhh - those were the days. Still one can enable that "feature" on Outlook :-)
Comment: "If all you have is a *spammer*, then everything looks like a *mail*" ... :-P
Comment: Closing this as it's not really a suitable question for the site anymore.
Answer: That "Reply To All" is not the only annoyance of how Outlook handles replies. Another example: if you open an email you send to someone and want to follow up with that person, you hit "Reply", and instead of putting the other person's email in To:, Outlook puts your own.
Gmail acts differently though and I got spoiled by both how it handles "Reply To All" and "Reply" to your own email. And it did make very much sense to me back then when I first noticed these nice user experience considerations put into Gmail.
Now to answer your question of why MS hasn't changed:
Microsoft has been notorious for not focusing on UX until it starts hurting their bottom line. They build (or acquire) apps and then just sell them through their creative sales force. That's been until recently when the competition in the software space became aggressive with other vendors on the scene.
Only with Windows 7 when Microsoft noticed those like Ubuntu stepping on their toes with lightweight OS's, they really focused on the speed and UX of their OS. SharePoint has been clunky all this time and only the recent versions saw improvements once cloud-based content repositories started to tap into their share.
When it comes to Outlook there is not competition (unless you move entirely to cloud based email like Google Apps), so Microsoft devoted only some effort to improving it (although I admin to love many of the improvements that came with Office 2007 and 2010).
It's also one of those things when something that's implemented ages ago doesn't change, until someone at some point takes a fresh look at it (just like Gmail did). So if a button says "Reply To All" and it used to serve to reply to "..All", no questions asked, then it will continue doing that.
However it should be a fairly simple logic to get done:

If a "Reply To All" is hit, don't include myself. Quoted someone saying "behavior depends on Outlook not knowing your e-mail address" - this is simply not true: your email address is the one you have set up in your POP/IMAP configuration of Outlook, and the one which gets populated in the From: field.
Similarly, if "Reply" is hit, and if there was only one addressee in the original email, instead of myself (again) include original addressee.

Those MVPs who answer the forums are technical people (and they are not the team who builds Outlook, but third-party Microsoft partners), and technical people are rarely good UX people.
P.S.: Microsoft did take a fresh look at email with the new Outlook.com, which is a lot smarter and has been built with very many fresh looks put into it (it's almost like Microsoft hired or contracted some of the Google engineers). Something even tells me Reply To All and Reply work properly there.
Answer: Microsoft products tend to suffer from trying to be too smart and to predict the users' wishes. Sometimes they manage to pull it off, but often they don't. Especially in MS Word this can get to really terrible proportions, making it an extremely frustrating program to use and driving users up the wall.
An action needs to be predictable. If a button says "Reply All", it's a great idea to have it do just that. Trying to be one step ahead and interpret the users' wishes for them is a dangerous game. It can be awesome when it works, but you feel positively helpless when it doesn't.
Answer: I like the way it is, Reply to all will keep the conversation alive if it's in your inbox as well, as this would keep track of the previous mails of same subject with reply of others and your reply to it as well. Which would keep the conversation sequentially ordered, instead of going back to sent box see what you replied it saves all that trouble. :-)
Any ways if you don't want the mail to be sent to you, you can remove your name from receivers list. Hope this justifies the design to you.

Reply all replies to self?


Partition does not show up after editing fstab

Question: I'm on Ubuntu 16.04 64bit and wanted to have auto-mount of partitions (NTFS) after boot up. I edited the /etc/fstab file and added the following line of code:
UUID=5CB5FBB62D2AA5D5 /partitions ntfs rw,auto,users,exec,nls=utf8,umask=003,gid=46,uid=1000    0   0

After this addition the partition with that UUID does not show up in nautilus left side navigation bar, instead all its contents are found in /partitions. How can I make the partition show up in nautilus?
Comment: @Zanna, yes, I can go to nautilus. Before mounting the partition was visible in the left side bar of nautilus as a partition, after editing fstab it is not seen and I need it to show.
Comment: does changing the mountpoint in fstab to something conventional like /media/windows instead of /partitions help (do `mkdir /media/windows` too)
Comment: @Zanna, let me try that.
Comment: @Zanna, that works. Please add your comment as an answer.
Comment: Great, it's done :)
Answer: Mountpoints for other partitions should be in /media
Make a new mountpoint for your NTFS partition:
mkdir /media/windows

or if not windows then whatever you prefer to call it
Now edit your fstab to correspond to that mountpoint:
UUID=5CB5FBB62D2AA5D5 /media/windows ntfs rw,auto,users,exec,nls=utf8,umask=003,gid=46,uid=1000    0   0

On reboot the partition will show up as a device in the left panel.
See fstab help for reference.
Comment: can i do the same for ext4?
Answer:
To create a mount point first, run "sudo mkdir /media/drive_name", in place of "drive_name", choose anything you like
Now in terminal run "sudo nano /etc/fstab"

#/etc/fstab: static file system information.
#
#Use 'blkid' to print the universally unique identifier for a
#device; this may be used with UUID= as a more robust way to name   devices
#that works even if disks are added and removed. See fstab(5).
#
#<file system> <mount point>   <type>  <options>       <dump>  <pass>
#/ was on /dev/sda6 during installation
UUID=3aea4570-4011-4247-9636-68317385324d /               ext4      errors=remount-ro 0       1
#swap was on /dev/sda5 during installation
UUID=b8dbe189-e496-4241-9d78-082447c5f632 none            swap    sw                0       0
#media on /dev/sda7
UUID=03F2C97A5650DB67   /media/drive_name                 ntfs    rw,suid,dev,exec,auto,user 0       0

In the above fstab file, "#media on /dev/sda7" has been manually added including the UUID (to see a partitions UUID run "sudo blkid /dev/sda*, *=partition_number") and for specific partition types, do the following,  if your partition type is fat32 then replace ntfs with fat32 and it applies likewise for any other partition types. press cntl+x , on confirmation promt press y to save the edits, and then reboot and you will see your desired drive will be auto-mounted on the partition list, :)


Tundra Express Fast Travel Not Working

Question: I recently did all the tundra express missions but when I wanted to go back there, I couldn't use the fast travel there, instead I had to go through Three Horns Valley. Is there anyway to fix this?
Answer: What I think you're describing is not being able to use the fast travel station at the happy pig motel in three horns divide. If that is the case, you'll need to complete the mission "No Vacancy" which you can pick up nearby on the echo attached to the bounty board there.

Completing that mission turns on the power to the three horns divide fast travel station.
If you mean you're using a fast travel station but tundra express is not on the list of locations, that's a different issue, so please let me know if that's the case.

Tundra Express Fast Travel Not Working


I can't access my input field in my controllar - AngularJS

Question: I'm using the Ionic framework which uses AngularJS and I can't access my input field "groupName" in my controller, I just get "undefined".
I thought using ng-model would inject it in the scope of my controller?
<ion-pane>
<ion-header-bar align-title="left" class="bar-positive">

        <button class="button" ng-click="saveNewGroup()">Save</button>

</ion-header-bar>
<ion-content>

            <input type="text" placeholder="Name" ng-model="groupName">

</ion-content>

And the code in my controller:
$scope.saveNewGroup = function() {
    console.log($scope.groupName); // prints "undefined" all the time
};

Comment: Do you add ng-controller to your desired html-tag?
Comment: No since I'm using Ionic I set the controller in the ui-router file
Comment: ng-model assign value to var groupName. Then you need write groupName not groupName.text.  console.log($scope.groupName)
Comment: It doesn't seem to be added in scope anywhere + you aren't even passing it to the function. So, there's that.  In other words, defined $scope.groundName in your controller  and then you will find that it binds. then you should be able to log out groupName.
Answer: Define $scope.groupName in your controller
It seems like you didn't define it in your controller so you are trying to access an undefined variable. Define it, and apply the correct controller to the model and you will find it data-binding properly.
Cheers.
EDIT: Glad it worked.
Comment: A: It should, but for some reason this is causing an issue. I've had similar issues with ionic making me crazy. Developing a phonegap app with ionic. I locally tested your code, and it works fine... Let me paste it for you so you can test it
Comment: This solved it, thanks. Question: I set $scope.groupName to an empty object in my controller and now it works fine. How come I have to do this? I thought Angular would "fetch" the ng-model attribute and inject it into the scope automatically?


Search through a markdown using sed

Question: The Problem
I multiple Markdown files in a folder, formatted like so...
# Cool Project
* Random Text
* Other information
TODO: This is a task
TODO: This is another task

And I've written a script that pulls out all the strings that start with TODO from all the files...
 ag TODO: ~/myfolder/journal | sed  's/\(^.*:\)\(.*\)/TODO:\2 /g' | sed ''/TODO:/s//`printf "\033[35mTODO:\033[0m"`/'' | sed ''s/![a-zA-Z0-9]*/$(printf "\033[31;1m&\033[0m")/''

and this gives me an output like this
TODO: This is a task
TODO: This is another task

I was wondering if it would be possible to look backward from the pattern using sed to identify and pickup the line that starts with /^# / and appended it to the end of the string... something like this
TODO: This is a task # Cool Project
TODO: This is another task # Cool Project

Answer: You could do this in a single awk itself. With your shown samples, could you please try following, written and tested with GNU awk.
awk '/^# /{val=$0;next} /^TODO/{print $0,val}' Input_file

Explanation: Adding detailed explanation for above.
awk '             ##Starting awk program from here.
/^# /{            ##Checking condition if line starts from hash space then do following.
  val=$0          ##Creating val which has current line value getting stored init here.
  next            ##next will skip all statements from here.
}
/^TODO/{          ##Checking condition if line starts with TODO then do following.
  print $0,val    ##Printing current line and val here.
}
' Input_file      ##Mentioning Input_file name here.

Answer: Using sed:
sed -n '/^#/h;/^TODO/{G;s/\n/ /p}' file

Search for lines beginning with # and add to hold space (h) Then when a line begins with "TODO", append hold space to pattern space (G) and substitute new lines for a space.

Search through a markdown using sed


Resetting my textboxes does not work all the time. How to fix?

Question: I am using asp.net 3.5 (codebehind c#). My users are running IE 7 or 8. I have a data entry page with several TextBoxes.
When I want to clear the all the TextBoxes, I do a sever.transfer back to the same page.
Maybe 99% of the time, this clears the TextBoxes. Every so often it does not.
I know that a roundtrip to the server has happened because:

The dropdown lists and radiobuttonlists on the page get reset, and
DB processing happened as shown by a record having been saved to the
DB.

The inconsistency is confusing me.
What could be causing the TextBoxes to persist data in this way and how can I prevent it from ever happening?
It is resulting in users saving the same data twice.
I don't think this would have anything to do with it, but there are also various js functions on the page for validation, capitalizing the first letter of an input, etc
Comment: Are you able to reproduce this behavior on "clean" IE installations, i.e. installations where people don't have any add-in's.  There are add-ins that "save" your form data to help save time refilling forms.
Comment: Why are you doing a Server.Transfer? You should probably do a Response.Redirect instead.
Comment: @kevin - One less page call with Server.Transfer?
Comment: I am not able to reproduce this behavior at all. That is the problem. However, I will check the machines that are being used to see if they have any add ins. Can you suggest some add ins to look for? Even if there are addins, why would they only cuse this to happen about 1% of the time?
Comment: The one that I personally use is LastPass, https://lastpass.com
Comment: Even if there are addins, why would they only cause this to happen about 1% of the time?
Comment: Well I guess that's the next question, if you find users with addins like this, are they able to reproduce it consistently.  It's all part of troubleshooting, I'm just trying to offer ideas that you can look at.  In the end, this is most likey a browser issue and has absolutely nothing to do with your code, unless your code is refilling the TB's from a cookie or view state or something.
Comment: @LillLansey You might want to read the answer to this question http://stackoverflow.com/a/4862741/1191903 that explains what Server.Transfer does vs Response.Redirect - I would guess this is the cause of your issues.
Answer: As this MSDN article describes the Server.Transfer method, this is probably not the right way to empty the TextBoxes. The method explicitly keeps all state information.
A better approach is described within this answer:
foreach (var item in Page.Controls)
        {
            if (item is TextBox)
            {
                ((TextBox)item).Text = "";
            }
        }

You will keep the roundtrips to just one, and you could keep all other user inputs as they were, if you like.


Ubuntu Core 18: serial-getty@.service keeps timing out, delaying initial boot

Question: I have a custom ARM device that I am trying to enable Core 18 on. email@example.com gets into a failure loop (whereupon it times out starting the service for 90 seconds, then tries to start up 8 more times like this, until it gives up) that delays the rest of the boot. It does eventually fail, and finishes booting the system so that I can SSH in, but when it gets in this state, the serial interface behaves... strangely. The initial config menu seems to keep resetting over and over.
On the second boot, the service seems to start fine and the serial console behaves normally. My current working theory is that perhaps something is not configured in time to start the serial-getty@.service.
Has anyone ever encountered this before? How do I fix it in the image? Push comes to shove, should I submit a bug report?
EDIT: It would probably be acceptable to disable the service, though on Core, I'm not sure how that'd be done at install time. Perhaps an install hook?
Comment: On an already-installed Core system, you login normally (using ssh) and `sudo systemctl disable email@example.com` so it simply doesn't run at boot. On a custom install, depends upon if you need a serial login at all; production devices should not be using a custom login instead of millions of users trying to login using your personal Ubuntu One ssh key.
Comment: That would probably be an acceptable solution. How would I do this? An install hook?
The issue only happens on initial install. The device is already configured with a default login and password via a configure hook.
Comment: If nobody's going to use the serial port, then sure -- a disabling install hook seems appropriate. My thought: A default install of Core in a VM or on a Pi doesn't time out the same way. This leads me to suspect that you perhaps don't have a working serial port connection anyway. If you DO have a working serial port connection, then seems like you have discovered a bug that should be investigated instead.
Answer: It turns out that this is actually sort of a known issue already and can be solved simply by updating your kernel. I updated from 4.14 to 4.19 and it works now.


How do I open json file from resx file?

Question: I have resources.resx file and I have resources folder. I'm trying to get one json file from it.
project structure:
code I have
string resxFile = @".\resources.resx";
using (ResXResourceSet resxSet = new ResXResourceSet(resxFile)) {

                using (JsonDocument document = JsonDocument.Parse((FileStream)resxSet.GetObject("allCivs"))) {
                    ...
                }
            }

I get this error:
As far as I understand, I am not correctly specifying the path to the "resx" file, because the program tries to find this file in the "bin" folder.
How can I correctly specify the path to it? Are my further actions for reading the json file correct?
EDIT:
data inside allCivs.json(just two elements,there are 43 like those):
"Austria": {
        "Лидер": [
            {
                "image": "civStuffIcons/Австрия_Лидер1.png",
                "Мария Терезия": {
                    "Персоналия": "Дипломатическая уния:Позволяет тратить  золото на то, чтобы присоединять или делать сателлитами города-государства, которые оставались вашими союзниками 5 и более ходов."
                }
            }
        ],
        "Уникальный юнит": [
            {
                "image": "civStuffIcons/Австрия_Уникальный юнит1.png",
                "Гусар": {
                    "Эпоха": "Новейшее время",
                    "Замещает": "Кавалерист",
                    "Сила": "34"
                }
            }
        ],
        "Уникальное здание": [
            {
                "image": "civStuffIcons/Австрия_Уникальное здание1.png",
                "Кофейня": {
                    "Замещает": "Мельница",
                    "Эффект": "+5% ед. продукции +2 ед. продукции Увеличивает на 25% ОВЛ скорость возникновения великих людей в городе.Может быть построена в любом городе."
                }
            }
        ],
        "Флаг": "civsFlags/austria.png"
    },
{
    "America":{
       ...
    }
}

data inside Resources:
I need to loop through this file and, for example, get all country names(in this example it's "Austria","America")
Answer: Fist, get file "allCivs" ,then you must parse json "allCivs" and Find Countries
Final Code
string resxFile = @".\resources.resx";
List<string> _listCountry = new List<string>();
using (ResXResourceSet resxSet = new ResXResourceSet(resxFile))
{

 byte[] allCivs =(byte[]) resxSet.GetObject("allCivs");
 var texts = System.Text.Encoding.UTF8.GetString(allCivs, 0, allCivs.Length);

var jsonObject = JObject.Parse(texts);

 foreach (var x in jsonObject)
 {
   _listCountry.Add(x.Key);
 }

}

Additional information
1.Way Solve Fist Problem ,you must change "Copy to output directory"  properties on file resources.resx

1.Right click resources.resx -> properties.
2.Change 'Copy to output directory' to "Copy Always" or "Copy if Newer "

2.Read a key, you can use below code
  var Value = resxSet.GetString("allCivs");

 //using (JsonDocument document = JsonDocument.Parse((string)resxSet.GetObject("Test")))
 //{
//    var d = "";
  //}

3.Read all of keys, you can use below code
foreach (DictionaryEntry entry in resxSet)
{
   string resourceKey = entry.Key.ToString();
   object resource = entry.Value;
}

4.You can get List Country in json file with use below code
using Newtonsoft.Json.Linq;

string text = File.ReadAllText(@"Test.json");
            var jsonObject = JObject.Parse(text);

            List<string> _list = new List<string>();
            foreach (var x in jsonObject)
            {
                _list.Add(x.Key);
            }

Comment: "allCivs" file is json, so when I use (string)resxSet.GetObject("allCivs")) I get an error, and when I use (FileStream)resxSet.GetObject("Test")) I also get an error. What class should i cast this object to?
Comment: all Civs is string(string json),you can serialize   json to other class c#,I edited my code and Add read all keys,with GetString you can get value
Comment: Perhaps, I texted something wrong, but "allCivs" is json file, and I need to read it. As I see  you thought that the "resxSet" is json and you go through it in a loop. But I need to loop through the "allCivs" json file
Comment: Unless "allCivs" is an item of the file resources.resx?Don't you have "allCivs" inside resources.resx?please show data "allCivs" and expected data
Comment: if you want read json in json file use this is code "string text = File.ReadAllText(@"./person.json");
        var person = JsonSerializer.Deserialize(text)"
Comment: I added in question what you asked.
About your last comment. Do I need to create class Person? If yes, I think it's gonna be a bit difficult, because I have a lot of data in json file
Comment: As I understand .resx file is just a file which connected with some folder with resources, so there is nothing inside .resx file. Am I wrong?
Comment: ResX file in C# is an essential resource file format that is used to store localized strings, images, audio files, and other types of resources that are used in an application ,I edited my code (Final Code) based on Your Comment(include: Read " .resx file" or "allCivs"  and Find Country)

How do I open json file from resx file?


Getting the img src property from fiddler core

Question: How do i obtain the img src property from fiddler core? I would like to obtain the value highlighted in blue

                Fiddler.FiddlerApplication.BeforeRequest += delegate (Fiddler.Session oS) {
                //Console.WriteLine("Before request for:\t" + oS.fullUrl);
                    Console.WriteLine(oS.oRequest.headers.RequestPath.ToString());
                // In order to enable response tampering, buffering mode must
                // be enabled; this allows FiddlerCore to permit modification of
                // the response in the BeforeResponse handler rather than streaming
                // the response to the client as the response comes in.

                if ((oS.responseCode == 200) && oS.oResponse.headers.ExistsAndContains("Content-Type", "image/"))
                {
                    //Console.WriteLine("giving url");
                    //Console.WriteLine(oS.GetRedirectTargetURL());
                }//oS.bBufferResponse = true;
            };

            Fiddler.FiddlerApplication.BeforeResponse += delegate (Fiddler.Session oS) {
                if ((oS.responseCode == 200) && oS.oResponse.headers.ExistsAndContains("Content-Type", "image/"))
                {
                    oS.utilDecodeResponse();
                    //Console.WriteLine("writing bytes");
                    //Console.WriteLine(oS.GetRedirectTargetURL());

                    //Console.WriteLine(oS.responseBodyBytes.ToString());
                    // oS.responseBodyBytes is a byte[] containing the image
                    //Image img = Image.FromStream(new MemoryStream(oS.requestBodyBytes));
                    //Bitmap oBMP = new Bitmap(new MemoryStream(oS.responseBodyBytes));

                    //Console.WriteLine("{0}:HTTP {1} for {2}", oS.id, oS.responseCode, oS.fullUrl);
                    // Now oBMP is an image object which contains the picture...
                }

                // Uncomment the following two statements to decompress/unchunk the
                // HTTP response and subsequently modify any HTTP responses to replace
                // instances of the word "Microsoft" with "Bayden"
                //oS.utilDecodeResponse(); oS.utilReplaceInResponse("Microsoft", "Bayden");
                //Console.WriteLine("\n");
                //Console.WriteLine("fininihs");

            };

            Fiddler.FiddlerApplication.AfterSessionComplete += delegate (Fiddler.Session oS) { //Console.WriteLine("Finished session:\t" + oS.fullUrl);
                if ((oS.responseCode == 200) && oS.oResponse.headers.ExistsAndContains("Content-Type", "image/"))
                {
                    //Console.WriteLine("giving url");
                    //Console.WriteLine(oS.GetRedirectTargetURL());
                }
            };

In which portion do i have to place my code? BeforeRequest? BeforeResponse? or AfterSession?
Answer: Looks like that would be the request header. You could probably check it in BeforeRequest with something like:
var src = oS.oRequest.headers.Exists("src") ? oS.oRequest.headers["src"] : "",

In the BeforeResponse you can get the full url of the image.
var url = oS.fullUrl;


many to many relation query in hibernate (native)

Question: I have a 3 tables as follows
Post
    pid pname

TagPost
    tagid postId postTime

Tag
    tagid tagNam

One post can have multiple tags and one tag can have multiple posts. Basically a  n*n mapping.
Now how can I model following into HQL queries using session.createQuery()

Select all challenges which has for a given tag order by creation time of post I can do post.getTagSet(), but I want only n newest posts.
Select all post  which has java as one of its tags? Order by postTime.
Is this right way to model this kind of situation  in terms of performance? Or should I have a  following structure?
postid pname postTime tags

Value of tags column in this case can be comma seperated.
Sample value of tags column = java,hibernate
Answer: Your fist design with three tables is the better one considering all the situations. You can run queries efficiently. These kinds of queries are very common in HQL.

to get n newest posts you can have a query like :
Query query = session.createQuery("select tagPost.tag from TagPost as tagPost where tagPost.post = :post ORDER by tagPost.postTime");
query.setMaxResults(n); // n is your expect newest number

this one is also simple:
Query query = session.createQuery("select tagPost.post from TagPost as tagPost where tagPost.tag = :tag ORDER by tagPost.postTime");
query.setMaxResults(n); // n is your expect newest number

In both the cases, you need to pass your object parameters to the query before calling query.list(); (first case post, second case tag).
Thanks and happy coding!


Response properly when changing innerWidth in an event handler with vanilla Js

Question: I desire to change the innerHTML of an element when the viewport becomes smaller than 1024pxs.
I ought to do so without any jQuery, only with vanilla Js.
So far I tried these solutions:
(function changeTextualName() {

if (window.innerWidth <= 1024) {
    document.querySelector(".logo-text a").innerHTML = "example1
 example2";
} else {
    document.querySelector(".logo-text a").innerHTML = "example1 | Example2";
}

}());

This first solution worked only partially: It did work the first time the webpage wed loaded, but not on resizes (the "event" in the philosophical meaning of the sense due to the lack of an event listener, won't be cleared).
I also tried this solution, which doesn't work at all:
(function changeTextualName() {

window.addEventListener("innerWidth <= 1024", function() {
        document.querySelector(".logo-text a").innerHTML = "example1
 Example2";
}

}());

As a newcomer I miss something with the logic. I kept reading listening to resize events and didn't see any code example dealing with values like 1024 or whatever. Maybe jQuery (or creating a library from a scratch - something I have no intention to do in this case) is a must after all?
Update for Saar:
enter image description here
Comment: you have a small mistake, the event listener should listen to "resize" window.addEventListener('resize',function(){// your code});
Comment: Thanks to Saar's comments & answer I understand my mistake: I called the function once, in webpage bootstrapping, and didn't initiate the callback concept properly so there wasn't a callback on each resize. I thank Saar for the help.
Answer: Just call your method in the event listener of 'resize'

function changeTextualName() {

if (window.innerWidth <= 1024) {
    document.querySelector(".logo-text a").innerHTML = "example1
 example2";
} else {
    document.querySelector(".logo-text a").innerHTML = "example1 | Example2";
}
window.addEventListener('resize',changeTextualName);
Comment: Sorry, had a typo there. Stressful day, very hard year of my life, much confusion. either way I should work with an IDE instead a simple text editor.
Comment: Oh, I understand my mistake: I called the function once, in webpage bootstrapping, and didn't initiate the callback concept properly so there wasn't a callback on each resize. Thanks to you I understand my mistake.
Comment: happy to help :)
Comment: In your changeTextualName function only do alert(1); and see if it's called.
Comment: Yes it is. If you now go to the site it is.
Comment: The problem is with your querySelector, in the console it shows you receive null
Comment: your 2nd querySelector is missing a dot, should be (".logo-text a") instead of ("logo-text a")


SAS, handle Macro output

Question: I took a SAS macro from SAS website, in order to list all the file in a folder.
Thit is the full reference: http://support.sas.com/kb/25/074.html .
And that's the code:
%macro drive(dir,ext);
  %let filrf=mydir;
  /* Assigns the fileref of mydir to the directory and opens the directory */
  %let rc=%sysfunc(filename(filrf,&dir));
  %let did=%sysfunc(dopen(&filrf));
  /* Returns the number of members in the directory */
  %let memcnt=%sysfunc(dnum(&did));
   /* Loops through entire directory */
   %do i = 1 %to &memcnt;
     /* Returns the extension from each file */
     %let name=%qscan(%qsysfunc(dread(&did,&i)),-1,.);
     /* Checks to see if file contains an extension */
     %if %qupcase(%qsysfunc(dread(&did,&i))) ne %qupcase(&name) %then %do;
     /* Checks to see if the extension matches the parameter value */
     /* If condition is true prints the full name to the log       */
      %if (%superq(ext) ne and %qupcase(&name) = %qupcase(&ext)) or
         (%superq(ext) = and %superq(name) ne) %then %do;
         %put %qsysfunc(dread(&did,&i));
      %end;
     %end;
   %end;
  /* Closes the directory */
  %let rc=%sysfunc(dclose(&did));
%mend drive;

/* First parameter is the directory of where your files are stored. */
/* Second parameter is the extension you are looking for.           */
/* Leave 2nd paramater blank if you want a list of all the files.   */
%drive(c:\,sas)

This macro (obviously) works fine, problem is that returns the results on the log.
I need to put those results into a SAS dataset in order to schedule other operations.
How can I do it?
Thanks in advance.
Answer: First off, if you can make a pipe, you can do:
filename dirlist pipe "dir /b c:\*.sas";

data myfiles;
infile dirlist lrecl=512 truncover;
input
@1 fullname $512.;
filename = scan(fullname,-1,'\');
run;

If you do need to use that macro due to system restrictions, you can't just take the output from it directly as it doesn't do anything other than print to the log.  You'll need to do one of two things:

Use PROC PRINTTO to redirect the log to a file, which you can then parse
Change the line of code that actually does something.  %put %qsysfunc(dread(&did,&i));  If you change this to, say,
filename = dread(&did,&i);
output;

then you call the macro from inside a data step and you can use the results.  Realistically you might be better off just running all of that in a datastep and not bothering with the macro - it's more complicated than it needs to be in order to be macro-only; in a datastep that's shorter.

SAS, handle Macro output


PHP function to insert html tags before specific characters

Question: I have a challenge where I have some dynamic text which have striped all HTML tags so on my end become a little weird. For example:
Composizione tessuto: sottoveste: 95% viscosa, 5% elastan, parte superiore: 100% poliestere. Manica lunga Tessuto leggeroColore:BiancoLunghezza:Mini
In all texts there is Colore and Lunghezza at the end but as you can see it's one word.
What would be the best way to insert HTML tag p before Colore and Lunghezza so it's become more readable?
Answer: You can use regex to split the string into few parts:

before "Colore"
"Colore"
after "Colore" to beginning of "Lunghezza"
"Lunghezza"
after "Lunghezza"

And then wrap 1, 2 and 3, and 4 and 5 in
 and
.
<?php
$re = '/^(.+)(Colore)(.+)(Lunghezza)(.+)$/m';
$str = 'Composizione tessuto: sottoveste: 95% viscosa, 5% elastan, parte superiore: 100% poliestere. Manica lunga Tessuto leggeroColore:BiancoLunghezza:Mini';
$subst = '
$1

$2$3

$4$5
';

$result = preg_replace($re, $subst, $str);

The result is then

Composizione tessuto: sottoveste: 95% viscosa, 5% elastan, parte superiore: 100% poliestere. Manica lunga Tessuto leggero

Colore:Bianco

Lunghezza:Mini

Live example: https://regex101.com/r/2aGxB0/1
Comment: Wow! Just one question. $str is different for every product, but it has same endind with Colore and Lunghezza. Because there is static text in code, will this work just for exact same texts?
Comment: @Karnak The regex divides the string into parts based on the location of the words "Colore" and "Lunghezza". So as long as the full string contains these words, it will work the same way with other strings. If some don't end with the words, you'll need to create multiple regex patterns to accomodate for different words.