text:
Q: Is it possible to use dynamic attributes with Q objects in Django 1.5.1? I'm using django-transmeta for translated fields and I need to perfom some searches using these translated fields.
Suppose we have a Model with a translatable field called translated_field.
In the first approach we can think something, as usual, like:
Q(translated_field__icontains="some value")  # This fails, as `translated_field` field does not exist

The second approach would be to hardcode all possible language versions. E.g.:
Q(translated_field_en__icontains="some value")  # English version
Q(translated_field_es__icontains="some value")  # Spanish version
# Add as many as available languages

This second option seems really hardcoded and I wonder abount a possible third option doing something like:
Q(getattr("translated_field") + get_language() + "__icontains"="some value")  # pseudocode

Or even better... is there any option with **kwargs available using Q objects?
Thanks!

A: You can generate the lookup argument name dynamically, use it as a dictionary key, then use **kwargs when creating the Q object.
field_name_contains = "translated_field" + get_languaage() + "__icontains")
kwargs = {field_name_contains: "some value"}
q = Q(**kwargs)


text:
Q: Comparing sine wave and triangular for spwm using comparator i am trying to generate sinusoidal PWM by comparing sine and triangular wave.
First i just tried to compare sine wave with reference voltage in order to check the working of op-amp. I get a problem in using op-amp(741) as a comparator at high frequency, so i used comparator by the suggestions from electronics stack exchange.
enter link description here
Which work great for comparing sine with reference voltage.
Later i noticed that there is a offset problem. Input waveform having an offset of 0 volt, but when i connect my input (both sine or triangular wave) to a comparator. The input waveform get changes by it dc offset to 6 volt.
Input waveform before connecting to a comparator
Offset voltage = 0 volt

Input waveform after connecting to a comparator
Offset voltage = 6 volt

How to compensate the offset voltage to zero volt after connecting with comparator.
Circuit..
Triangular Waveform...

Comparing triangular wave reference voltage...

Without connecting with comparator

How to compensate the offset voltage to zero volt after connecting with comparator.

redpajama_set_name: RedPajamaStackExchange


text:
Q: GPSBabel KML document has incorrect name I'm using GPSBabel to convert GPX tracks in a directory to KML linestrings using the following:
@ECHO OFF
setlocal
for %%i in (C:\Users\...\*.gpx) do (
    gpsbabel.exe -t -i gpx -o kml,points=0 %%i %%~di%%~pikml\%%~ni.kml
)

This works great, except that all KML documents have the name "GPS device". I'm new to GPSBabel and after reading what appears to be the relevant documentation I'm not sure if it's possible to provide the output document's name. So far my best option seems to be post-processing with a find / replace operation but I'd like to avoid this.
How can I tell GPSBabel what to use as the KML document name?


text:
Q:  height not changing in if statement I have an image in my HTML and i am trying to change its dimensions depending on the fact if it is portrait or landscape so that it doesn't cause much distortion. I have 3 buttons 'Small', 'Medium', 'Large' and each button changes height and width.
This is the if statement i have written yet but on clicking the button nothing happens
$('#large').click(function() {
var height = document.getElementById('#uploadedPhoto').clientHeight;
var width = document.getElementById('#uploadedPhoto').clientWidth;
    if (height > width) {
        $('#upoladedPhoto').css('height', '95%');
        $('#upoladedPhoto').css('width', '85%');
    }
    else if (height < width) {
        $('#upoladedPhoto').css('height', '85%');
        $('#upoladedPhoto').css('width', '95%');
    }
    else {
        $('#upoladedPhoto').css('height', '95%');
        $('#upoladedPhoto').css('width', '95%');
        }
});

This is the css of the uploadedImage /
#upoladedPhoto {
display:none;
position:relative;
cursor:move;
max-height:100%;
max-width:100%;
left: 5em;
opacity:0.75;
}

The 3 buttons work when there is no if statement but in that case i only change the css property not taking in to consideration whether it is in potrait mode or landscape
If there is a better method to attempt this then please share.
Thanks

A: You are mixing javascript with jquery,
that will be
document.getElementById('uploadedPhoto').clientHeight;

instead of
document.getElementById('#uploadedPhoto').clientHeight;

And I think there are some issues regarding clientHeight read here & here.
You can use simple jquery
$('#uploadedPhoto').height();

A: document.getElementById('#uploadedPhoto') is wrong
try
document.getElementById('uploadedPhoto')

You shouldn't include the # in the id passed to document.getElementById
Besides that, the id itself is different in the $ function and in the getElementById function. It seems there was a typo which doesn't reflect in the getElementById, that's why the if is having trouble.
I made a fiddle for your review.

A: try something like
$('#large').click(function() {
$("img#upoladedPhoto").load(function()
{
        var width = this.width;
        var height = this.height;
    if (height > width) {
        $('#upoladedPhoto').css('height', '95%');
        $('#upoladedPhoto').css('width', '85%');
    }
    else if (height < width) {
        $('#upoladedPhoto').css('height', '85%');
        $('#upoladedPhoto').css('width', '95%');
    }
    else {
        $('#upoladedPhoto').css('height', '95%');
        $('#upoladedPhoto').css('width', '95%');
        }
});
});

A: Looks fine to me. Haven't tested it, but couldn't it just be a typo? When you're fetching the element by Id, you wrote #uploadedPhoto, but then, in the if{} statements you wrote #upoladedPhoto. See the difference? You're trying to apply some CSS to a non exisiting div ;-)


text:
Q: Love2D values updating too fast I'm making this game, and it involves enemies. it's pretty boring for them to stay the same speed so I want the enemy speed to increase as the player scores higher. It's difficult to make certain algorithms with love since mostly everything is updated every frame with this game engine. Which is what is actually giving me the problem right now.
The first part of my logic is correct (the part where the enemy.speed increases after the player_score passes 10) but once it passes (or reaches) 10, the enemy.speed value will continue to increase by 10 every frame. Even with the enemiesReadyToSpeedUp boolean that I put in place specifically for this reason! (to stop the enemy.speed from rapidly increasing)
so once the player score exceeds 10 the game becomes unplayable since the enemy begins to move at the "speed of light."
function enemySpeedUp()

    -- Once player score > scoreLimit + 10, enemy's speed will increase by 10,
    -- and the scoreLimit will increase by 10

    enemiesReadyToSpeedUp = false
    scoreLimit = 0

    if(player_score >= scoreLimit + 10) then
        enemiesReadyToSpeedUp = true
    end

    if(enemiesReadyToSpeedUp == true)then
        enemy.speed = enemy.speed + 10
        scoreLimit = scoreLimit + 10
        enemiesReadyToSpeedUp = false
    end
end

Things I've Tried:

*

*Writing this function pretty much the same without any booleans. (meaning I increase the enemy's speed once the player's speed exceeds 10. instead of making a boolean true, and then increasing the enemy's speed based off the boolean)

*Hard coding every possible combination in which an enemy would need to speed up. but that requires a lot of if statements, is very inefficient, and is also just in general bad coding practice. but it does work, and I'm actually considering doing it that way if nothing else works.

*Lastly, I also tried enemy.speed = enemy.speed + player_speed but that was a pretty obvious mistake as enemy.speed increased every frame and I got the same result as my first mistake.

A: Your mistake is initializing scoreLimit with 0 right within enemySpeedUp() function.
Move that assignment out, do it at the same place where you set initial player_score value.


text:
Q: How to show/hide a div on mouseover using jquery? I have a table in this format.

         div one
         2222

         div two
         2222

and a jquery function to show/hide a div on mouseover
$(function() {
$('#divOne').hover(function() {
    $('#Details').show();
}, function() {
    $('#Details').hide();
});
});

5555

I want to display the "details" div on a popup when i mouseover on each td.
The "Details" div appears when I mouse over the first row. But it is not shown when i mouseover on the second row.
I'm not sure where I go wrong.
Any ideas would be appreciated.

A: There should only be one ID on the page. Change your ID's for classes and your selector for a class selector:

         div one
         2222

         div two
         2222

And:
$(function() {
$('.divOne').hover(function() {
    $('#Details').show();
}, function() {
    $('#Details').hide();
});
});

A: you cant give same id to multiple element
live code is here http://jsfiddle.net/GSz5X/

         div one
         2222

         div two
         2222

5555shdrhdrh

$(function() {
$('.divOne').hover(function() {
    $('#Details').toggle();
});
});

A: First of all you have repeated ids on elements, which is wrong. use classes instead, ids should be unique

         div one
         2222

         div two
         2222

then change your code
$(function() {
  $('.divOne').hover(function() {
    $('#Details').show();
  }, function() {
    $('#Details').hide();
  });
});

this will end up (with your actual markup) with the result that your div will be shown when you hover on the table and it will be hidden when you don't

A: USE class instead of ID
$(function() {
$('.divOne').hover(function() {
    $('#Details').show();
}, function() {
    $('#Details').hide();
});
});

HTML:
div one

A: The id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document).

     div one
     2222

     div two
     2222

    5555

A: Change your id's to class identifiers.
See example here:
http://jsfiddle.net/A7f2p/


text:
Q: Netplan configuration is not persistent I have configured my network interfaces in my Ubuntu bionic (18.04) server using netplan, and afterwords I ran netplan apply and the configuration kicked in.
In particular, I configured the DNS servers, and my server did resolved ips with the nameservers I configured in my netplan configuration.
But, after reboot, the configuration didn't last and any resolving was by default to the 127.0.0.53 nameserver. Only after running netplan apply the configuration kicked in again.
How can I make the netplan configuration persistent to reboots?
Output of cat /etc/*-release:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

A: Typically once netplan configurations are written to /etc/netplan these will be persistent over reboots. Although I have seen issues where the netplan apply doesnt complete as expected when the interface is active. I have found adding --debug to the apply to be useful to see what is really happening
sudo netplan --debug apply


text:
Q: Could not load Logmanager "org.jboss.logmanager.LogManager" java.lang.ClassNotFoundException: org.jboss.logmanager.LogManager I am using Visualvm tool and trying to establish remote connection through jmx. I need to connect to my remote server which is ubuntu 14.04. My web application is running on Docker and jboss/wildfly is running on docker. Below is the dockerfile.
FROM jboss/wildfly:10.1.0.Final
RUN /opt/jboss/wildfly/bin/add-user.sh username password --silent
ENV JBOSS_LOG_MANAGER_LIB /opt/wildfly-8.2.0.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.2.Final.jar
ENV JAVA_OPTS="-XX:PermSize=4096m -XX:MaxPermSize=1024m -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses -Dcom.sun.management.jmxremote.rmi.port=8686 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=8787 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=x.x.x.x -Xbootclasspath/p:$JBOSS_LOG_MANAGER_LIB -Djboss.modules.system.pkgs=org.jboss.logmanager -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:/opt/wildfly-8.2.0.Final/modules/system/layers/base/org/jboss/logging/main/jboss-logging-3.1.4.GA.jar -Xbootclasspath/p:/opt/wildfly-8.2.0.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.2.Final.jar"
ADD project_web.war /home/ubuntu/SampleTest/project
ADD standalone.xml /opt/wildfly-8.2.0.Final/standalone/configuration
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"]
ENV OFFLINE_DB_USERNAME username
ENV OFFLINE_DB_URL jdbc:mysql://x.x.x.x:3306/%s?useLegacyDatetimeCode=false&useTimezone=true&serverTimezone=UTC
ENV OFFLINE_DB_SERVER_URL jdbc:mysql://x.x.x.x:3306/offlineserver?useLegacyDatetimeCode=false&useTimezone=true&serverTimezone=UTC
ENV OFFLINE_DB_PASSWORD password
EXPOSE 8787

My run command is-
sudo docker run -e JAVA_OPTS="-Dlog4j.configurationFile=log4j2_dev.xml -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=8787 -Dcom.sun.management.jmxremote.rmi.port=8686 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=x.x.x.x -Xbootclasspath/p:/opt/wildfly-8.2.0.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.2.Final.jar -Djboss.modules.system.pkgs=org.jboss.logmanager -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:/opt/wildfly-8.2.0.Final/modules/system/layers/base/org/jboss/logging/main/jboss-logging-3.1.4.GA.jar -Xbootclasspath/p:/opt/wildfly-8.2.0.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.2.Final.jar" -p 9595:8080 -p 9696:8080 -p 8787:8787 -v /home/ubuntu/SampleTest/project/logs:/opt/wildfly/standalone/log --restart=always -d sample/testweb:20170615

By executing docker log along with container id, I get the below error-
WARNING: Failed to load the specified log manager class org.jboss.logmanager.LogManager
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logmanager/Level
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.jboss.modules.Module.run(Module.java:320)
    at org.jboss.modules.Main.main(Main.java:505)
 Caused by: java.lang.ClassNotFoundException: org.jboss.logmanager.Level
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:348)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
    ... 4 more

A: You can only specify the -Xbootclasspath once. My guess would be it's picking up the last instance and ignoring the others. You need to combine them into a single argument. It probably should look something like:
-Xbootclasspath/p:/opt/wildfly-8.2.0.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.2.Final.jar:/opt/wildfly-8.2.0.Final/modules/system/layers/base/org/jboss/logging/main/jboss-logging-3.1.4.GA.jar:/opt/wildfly-8.2.0.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.2.Final.jar


text:
Q: Button does not recognize function i.e. nothing happens on click I'll buy you a beer via Paypal if you can help me out! I have been stuck with this problem for hours, please hear me out.
I am using a live search on my site. When the visitor types something into the form on the index.php page, the form either gives out results or in case nothing is found in the database, it outputs a button instead on the index.php page under the form via echo function. (the page where the search form is ran from is search.php).
That means this button (under the id #Ne) is not on the index.php page HMTL but is echoed through search.php on to the index page.
What i am trying to do is to hide the search form with one of the buttons. The search form is on the index.php page under the id #iskanje.
This is the javascript I am using. If i put this script on the index.php page nothing happens, and if i put it on the search.php page it crashes the whole search form.

This is the HTML on the index.php page:

Za katero vrsto storitev bi radi oddali vaše povpraševanje?

        <input type="text" id="search" autocomplete="off">

This is some excerpts from the search.php page:
$text = '<button id="Ne">Želim oddati povpraševanje</button>';

and this is the whole echo in case results are not found.
echo($output . " " . $text);

I hope I have been clear enough. I can even provide the source files if you can help me out with this.
I have also tried
$( document ).ready(function() {
   $( "#Ne" ).click(function() {
      $( "#iskanje" ).hide( "slow" );
   });

});

Thanks!

A: Is the #Ne button added before or after the JavaScript is run? If the button doesn't "exist" when the browser assigns the click handler to the button, it won't work.
However, you can bind the click handler to the parent of the button, like this:
$("body").on("click", "#Ne", function() {
  $( "#iskanje" ).hide( "slow" );
});

This says "bind the click handler to body, and everytime body is clicked, check if it was the button with ID "Ne".
I don't know the direct parent of #Ne, but whatever that is would be more appropriate than body

A: The button is not available on DOM ready as you are appending the button dynamically.
Use event-delegation - on(),
$(document).on("click","#Ne",function() {
    $( "#iskanje" ).hide( "slow" );
});

A: try
$( "body" ).on('click', '#Ne', function() {
  $( "#iskanje" ).hide( "slow" );

});
I guess jquery doesn't find the button, because it's inserted after onload ...

A: first you have to use $(document).ready to wait for the DOM to load
second thing is are using jquery post or get method ?
if your answer is yes then you need to use .done() method
$.post(url,{argumets},function(data){
   //data is what is retrieved from the search.php
   // could be empty result in our case we are sending button back
   // or displaying results in case we have some results

}).done(function(){

//put here the button code
// this should work for you
});


text:
Q: get data from two table(query) i'm getting an error when querying two table . "Incorrect syntax near 'tbl_programme'." when i run the below codes.I want to retrieve data from two tables.
// Define the ADO.NET objects.
        SqlConnection con = new SqlConnection(connectionString);
        string selectSQL = "SELECT * FROM tbl_team";
        SqlCommand cmd = new SqlCommand(selectSQL, con);
        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
        DataSet dsPubs = new DataSet();

        // Try to open database and read information.
        try
        {
            con.Open();
            adapter.Fill(dsPubs, "tbl_team");

            // This command is still linked to the data adapter.
            cmd.CommandText = "SELECT * tbl_programme";
            adapter.Fill(dsPubs, "tbl_student_project_choice");

            DataRelation test = new DataRelation("test",
            dsPubs.Tables["tbl_team"].Columns["teamId"],
            dsPubs.Tables["tbl_student_project_choice"].Columns["choiceGroupId"]);
            dsPubs.Relations.Add(test);

        }

A: You have missed FROM keyword in your SELECT statement,
cmd.CommandText = "SELECT * FROM tbl_programme";
                         // ^ HERE


text:
Q: How to display html with css stylesheet in TextView? Converting html file to spanned object and displaying it in TextView works fine but what if I want to also apply css styles?
I've tried to combine css styles with html file but styles ale ignored by Html.fromHtml() method.
How can I display text modified by css styles in my TextView?

A:
what if I want to also apply css styles?

That is not supported by Html.fromHtml(). You will need to build your own HTML/CSS parser and build your own formatted string, perhaps using SpannableStringBuilder.


text:
Q: Compare $(1+i)^t$ and $1+i\cdot t$ for positive $i$ and $t$ Suppose $i>0$. Show that
(i) if $0<t<1$ then $(1+i)^t < 1+i \cdot t$, and
(ii) if $t>1$ then $(1+i)^t > 1+ i\cdot t$.
For (ii), if I took the limit of $\frac{(1+i)^t}{(1+i\cdot t)}$ as $t$ approaches infinity and showed that it was $0$, would that be valid?
For (i) I thought about taking derivatives to show that the rate of change of one function is greater than the other over the interval.
I am not sure how to go through with either of these ideas for the problems, or if I am even in the right direction. Please help!

A: Take the function $f(x)=(1+x)^t-1-xt$ with $t> 0$. Note that $f(0)=0$ and for $x>0$, we have
$$
f'(x)=t\left((1+x)^{t-1}-1\right)
$$
which is strictly positive for $t>1$ and strictly negative for $t<1$. By the Mean Value Theorem, you can infer that $f(x)>0$ for all $x>0$ whenever $t>1$ and $f(x)<0$ for all $x>0$ whenever $t\in(0,1)$.

A: This is immediately obvious if you use Bernoulli inequality (which you probably can't), but for (ii) it's better to show using Binomial expansion, so that LHS is
$$
(1+r)^n = 1+ \binom{n}{1}r + R(n,r)
$$
with the remainder term strictly positive, hence your inequality.


text:
Q: Docker Swarm, image can start, but how to interpret error code I have several docker containers on Ubuntu, but when I deploy them I have no log.
But with this command I have an error code, see:
ID                          NAME                                    IMAGE
                                                                          NODE                          DESIRED STATE       CURRENT STATE           ERROR                       PORTS
7sutdpifo8dfgszhpupg1cocr   identity_identityserver.1       registry.gitlab.com/myreg/mycorp/identityserver:1.0.684@sha256:3013e4fca0a2114d523e82ca09fcc31e772614e0633d80b45dc8a1424cfb7e55   vmi366339.myhosting.net   Running             Running 6 seconds ago
aca6n64b4v2s1gx3udo3x7z4x    \_ identity_identityserver.1   registry.gitlab.com/myreg/mycorp/identityserver:1.0.684@sha256:3013e4fca0a2114d523e82ca09fcc31e772614e0633d80b45dc8a1424cfb7e55   vmi366339.myhosting.net   Shutdown            Failed 13 seconds ago   "task: non-zero exit (1)"
0732wp72lq26vrs7lzqz6devx    \_ identity_identityserver.1   registry.gitlab.com/myreg/mycorp/identityserver:1.0.684@sha256:3013e4fca0a2114d523e82ca09fcc31e772614e0633d80b45dc8a1424cfb7e55   vmi366339.myhosting.net   Shutdown            Failed 25 seconds ago   "task: non-zero exit (1)"
pvk32f71d36qxmxnjmmyghkl6    \_ identity_identityserver.1   registry.gitlab.com/myreg/mycorp/identityserver:1.0.684@sha256:3013e4fca0a2114d523e82ca09fcc31e772614e0633d80b45dc8a1424cfb7e55   vmi366339.myhosting.net   Shutdown            Failed 39 seconds ago   "task: non-zero exit (1)"
k71kbeu6x6ob0n4l94chzovg3    \_ identity_identityserver.1   registry.gitlab.com/myreg/mycorp/identityserver:1.0.684@sha256:3013e4fca0a2114d523e82ca09fcc31e772614e0633d80b45dc8a1424cfb7e55   vmi366339.myhosting.net   Shutdown            Failed 52 seconds ago   "task: non-zero exit (1)"

I only have this message: "task: non-zero exit (1)"
Also, my docker logs are empty and the application are empty too.
I got this error since our migration to .NET 5, we build our images with the following docker file:
### >>> GLOBALS
ARG ENVIRONMENT="Production"
ARG PROJECT="IdentityServer.Host"
### <<<

#--------------------------------------------------
# Build / Publish
#--------------------------------------------------

# debian buster - AMD64
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build

### >>> IMPORTS
ARG ENVIRONMENT
ARG PROJECT
### <<<

ARG NUGET_CACHE=https://api.nuget.org/v3/index.json
ARG NUGET_FEED=https://api.nuget.org/v3/index.json

# Copy sources
COPY src/ /app/src
ADD common.props /app

WORKDIR /app

# Installs NodeJS to build typescripts
#RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -yq curl git nano
#RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -yq nodejs build-essential
#RUN npm install -g npm
#RUN npm install

RUN apt-get update
RUN apt-get install curl
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs
RUN npm install
RUN npm install -g parcel-bundler

# Installs the required dependencies on top of the base image
# Publish a self-contained image
RUN apt-get update && apt-get install -y libgdiplus libc6-dev && dotnet dev-certs https; \
    dotnet dev-certs https --clean;  \
    dotnet publish --self-contained --runtime linux-x64 -c Debug -o out src/${PROJECT};

#--------------------------------------------------
# Execute
#--------------------------------------------------

# Start a new image from aspnet runtime image
#FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS runtime
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS runtime

### >>> IMPORTS
ARG ENVIRONMENT
ARG PROJECT
### <<<

ENV ASPNETCORE_ENVIRONMENT=${ENVIRONMENT}
ENV ASPNETCORE_URLS="http://+:80;https://+:443;https://+:44385"
#ENV ASPNETCORE_URLS="http://+:80"
ENV PROJECT="${PROJECT}.dll"

# Make logs a volume for persistence
VOLUME /app/Logs

# App directory
WORKDIR /app

# Copy our build from the previous stage in /app
COPY --from=build /app/out ./

# Installs the required dependencies on top of the base image
RUN apt-get update && apt-get install -y ffmpeg libgdiplus libc6-dev

# Ports
EXPOSE 80
EXPOSE 443
EXPOSE 44385

# Execute
ENTRYPOINT dotnet ${PROJECT}

I have change this:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
to this:
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
Is there another way to check why an app does not start?


text:
Q: How to hide your linksys webpanel from your public ip I have Apache Web Server setup on my Raspberry Pi 3B+ and it's open to the internet through port forwarding. I also have it connected to a domain, but I have to do:8888 at the end of the domain each time if I don't it infinity loads unless I put the:8888. How do I make it so I don't have to type the:8888 at the end each time?
Model Number for my router is EA9500

A: So there are a few things going on here, and they are combining into somthing that appears confusing (but is actually rather simple once we unpack it).
First, your Router has two interfaces, the WAN and the LAN. On the WAN side, TCP\80 is mapped to a port forward rule, but on the LAN interface, TCP\80 is used for the Router Management website.
So the first thing you need to understand is that a NAT router won't let you hit both interfaces from any position on the network (LAN or WAN). On a standard home router, when a packet addressed to your router is received, it will be handled by the nearest interface, and since you have different services on each interface, the result will be different if you are inside the LAN, or on the WAN side. This is why when you connect to the public IP or DNS name from Inside the LAN, you get the Router Management page. It does Not mean however that people hitting tcp\80 from the WAN can see your router page.
Even if you did not have the same port configured on both interfaces, you would not be able to connect to the public IP/DNS name from inside the LAN, without a technology called NAT Hairpinning (also called Reflective NAT). This feature is common on enterprise grade routers, but uncommon on home/SOHO grade devices.
Now all this isn't really a problem, because there is no need to hit the public IP from within the LAN. There isn't a NAT between your LAN devices, so your clients can just access the server directly at :8888.
Finally, the reason you have to add :8888 on the end, is that browsers will only go to port 80 or port 443 by default, so you have to add the port number to the url if you want to use another port. if you don't like having it on 8888, and the server doesn't already have a service on port 80, you can reconfigure your service to run on 80, and change your port forwarding rule to point to :80 instead. then your LAN clients would only need to enter the server IP/Name.
Hope that helps


text:
Q: When previewing my site–its perfect, but when uploading online–my slider doesn't work. I am a bit new with Java and HTML/CSS and I was wondering if anyone can help me out with this. I have built my entire portfolio site and when I preview it in Safari and Firefox it looks great. However, when I put it online it shows that the images are still loading and the slider isn't working due to the "loading" icon.
I would appreciate it so much if someone can help me with this. I have been up all night looking at the FAQ for the slider I got and can't find out what my deal is... I also tried to use the original versions of the jquery files to see I edited something wrong, but still found no answer.
Thanks so much!
My site is www.shelbylynnebaker.com and it's uploaded and not working if you wish to look at the HTML/CSS coding in-depth

A: The images is not found:
"NetworkError: 404 Not Found - http://www.shelbylynnebaker.com/images/1.jpg"
"NetworkError: 404 Not Found - http://www.shelbylynnebaker.com/images/2.jpg"

etcetera
You probably forgot to upload them?

A: Looks like you're getting some images not loading which could have something to do with it: 'blank.png' and '1.png' aren't loading.
Also it looks like there is an issue with the Google Fonts you're trying to use.
Open your site in Firefox with Firebug installed and look at the Net tab.


text:
Q: Does the "condition" (? :) operator work in JavaScript as in C? Example:
var x, y, z;
//...
x > 100 ? y = x : z = x ;

A: Yes it does work the same although operator precedence is always tricky so I would recommend parenthesis to avoid confusion.
tangentially related..
You can also use || in JavaScript similar to the null coalescing operator ?? in C#

A: I'm not sure if this works:
x > 100 ? y = x : z = x ;

But this works:
y = x > 100 ? foo : bar ;

A: Yes, ternary operators work the same way in Javascript. Your example is combining a lot of expressions, so precedence might be an issue. You should parenthesize to ensure precedence.

A: This should help you (in the future):
https://developer.mozilla.org/en/JavaScript/Reference/Operators/Operator_Precedence
First of all the > comparison will be evaluated because it has precedence 8. ?: has precedence 15, lower than 16 for =. This means that the ternary operator will be run before any assignments (i.e. the first operand, the condition, will be evaluated and then only a branch will be chosen).
Also a simple test
//x = 50;
x = 200;
x > 100 ? y = x : z = x ;
alert((typeof y)+'|'+(typeof z));

would have answered you question.

A: Yes it works the same in that it has the following basic syntax
condition ? true-expression : false-expression

It only evaluates the expression, and hence processes side effects, for the expression dictated by the conditional.
Here's a link to the Mozilla documentation on the ternary operator

*

*https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/Conditional_Operator

A: Yes, ternary operators work the same way in Javascript as they do in C, C++, C#, Java, Javascript, Perl, and PHP.

A: Yes, according to the conditional operator Wikipedia article and the ECMA-262 standard (see section 11.12).

A: Here's a different approach. You can use the ternary to select the variable as a string within square brackets.
This window assumes y and z are global. Otherwise, you would need to give the proper context.
window[x > 100 ? 'y' : 'z'] = x;


text:
Q: ¿cómo inhabilitar y deshabilitar un select con otro select? este es el select principal:
id=tipo_boleto
<select id="tipo_boleto" name="tipo_boleto" >

y los otros select son
id=boleto_2d
<input type="number" min="0" max="8" id="boleto_2d" size="5" name="boletos[2D][cantidad]" placeholder="0" disabled>

id=boleto_3d
<input type="number" min="0" max="8" id="boleto_vip" size="5" name="boletos[VIP][cantidad]" placeholder="0" disabled>

id=boleto_vip
<input type="number" min="0" max="8" id="boleto_3d" size="5" name="boletos[3D[cantidad]" placeholder="0" disabled>

el codigo que tendo para habilitarlo es:

$('#tipo_boleto').change(function(){
  $('#boleto_2d').removeAttr('disabled');
});

$('#tipo_boleto').change(function(){
  $('#boleto_3d').removeAttr('disabled');
});

$('#tipo_boleto').change(function(){
  $('#boleto_vip').removeAttr('disabled');
});

pero el problema es que al cualquier cambio en el select principal se habilitan los tres y quiero que al seleccionar en el principal : "2D" me habilite el 2d y al volver a poner el principal en value 0 se vuelva a desabilitar el segundo select

A: No estás analizando el valor del select. Necesitas una sola función donde primero deshabilitas todos los campos y luego analizas el valor seleccionado para saber cuál habilitar:

$('#tipo_boleto').change(function(){
  // Deshabilitar todos
  $('#boleto_2d').attr('disabled', true);
  $('#boleto_3d').attr('disabled', true);
  $('#boleto_vip').attr('disabled', true);
  // Habilitar solo uno, dependiendo del valor
  switch ($(this).val()) {
      case '2D':
          $('#boleto_2d').removeAttr('disabled');
          break;
      case '3D':
          $('#boleto_3d').removeAttr('disabled');
          break;
      case 'VIP':
          $('#boleto_vip').removeAttr('disabled');
          break;
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select id="tipo_boleto" name="tipo_boleto">
  <option value="0">Selecciona</option>
  <option value="2D">2D</option>
  <option value="3D">3D</option>
  <option value="VIP">VIP</option>
</select>

<input type="number" min="0" max="8" id="boleto_2d" size="5" name="boletos[2D][cantidad]" placeholder="2D" disabled>

<input type="number" min="0" max="8" id="boleto_vip" size="5" name="boletos[VIP][cantidad]" placeholder="VIP" disabled>

<input type="number" min="0" max="8" id="boleto_3d" size="5" name="boletos[3D][cantidad]" placeholder="3D" disabled>


text:
Q: Approximate area of overlap of rotated rectangles I need to estimate the overlap ratio of two rectangles of arbitrary size and orientation.
I know how to perform the exact computation, using the Sutherland-Hodgman algorithm, which can be optimized for this case.
Anyway as I need to use that function intensively and perfect accuracy isn't required (say 10% error can be tolerated), I was wondering if it cannot be evaluated in a faster way, preferably branchless.
If that helps, one can assume the same aspect ratio for both rectangles, and ratio of the areas not exceeding 4.

Update:

*

*For unrotated rectangles, the formula is
(min(W0,DX+W1) - max(-W0,DX-W1)).(min(H0,DY+H1) - max(H0,DY-H1))
or zero if any of the two factors is negative, where DX, DY are the differences between center coordinates, W and H denote the respective half sizes.

*It is probably worthwhile to look at the curve of the common area for given placement of the centers and given sizes, when you vary the relative rotation angle.

A: Sutherland-Hodgman algorithm is intended for intersection of convex clip polygon with arbitrary one. I would expect that algorithm especially designed for convex-convex case is faster.
I had good practical experience with O'Rourke algorithm (O(m+n)) for alike problem
(area of intersections between two sets of thousands of rotated rectangles).
Code link is here - convconv. AFAIR, some simplifications were possible for rectangles.
Another algorithm
I doubt that any approximation approach could find a result significantly faster and with controlled accuracy.


text:
Q: Creating a Flutter torrent stream plugin using torrentstream-android plugin , unable to start the download progress Url for the below Code : https://github.com/amankapur007/openflix_torrent
I am trying to convert https://github.com/TorrentStream/TorrentStream-Android to the flutter plugin .
I am able to start the stream and am also able to prepare it , but after that nothing happens , neither the download starts nor streaming start (Streaming i am not worried right now , moreover i want file download to start).
Please find the code below
package com.example.openflix_torrent;

import android.os.Environment;

import androidx.annotation.NonNull;

import com.github.se_bastiaan.torrentstream.StreamStatus;
import com.github.se_bastiaan.torrentstream.Torrent;
import com.github.se_bastiaan.torrentstream.TorrentOptions;
import com.github.se_bastiaan.torrentstream.TorrentStream;
import com.github.se_bastiaan.torrentstream.listeners.TorrentListener;

import java.io.File;

import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.Registrar;

/** OpenflixTorrentPlugin */
public class OpenflixTorrentPlugin implements FlutterPlugin, MethodCallHandler {
  @Override
  public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
    final MethodChannel channel = new MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "openflix_torrent");
    channel.setMethodCallHandler(new OpenflixTorrentPlugin());
  }

  public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "openflix_torrent");
    channel.setMethodCallHandler(new OpenflixTorrentPlugin());
  }

  @Override
  public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
    if (call.method.equals("getPlatformVersion")) {
      init();
      try {
        Thread.sleep(1000);
        start();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    } else {
      result.notImplemented();
    }
  }

  @Override
  public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
  }

  TorrentStream torrentStream;
  public void init(){
    TorrentOptions torrentOptions = new  TorrentOptions.Builder()
            .autoDownload(true)
            .saveLocation(Environment.getDownloadCacheDirectory())
            .removeFilesAfterStop(false)
            .build();
    this.torrentStream =  TorrentStream.init(torrentOptions);
    torrentStream.addListener(new TorrentListener() {

      @Override
      public void onStreamPrepared(Torrent torrent) {
        System.out.println("onStreamPrepared");
      }

      @Override
      public void onStreamStarted(Torrent torrent) {
        System.out.println("onStreamStarted");
      }

      @Override
      public void onStreamError(Torrent torrent, Exception e) {
        System.out.println("onStreamError"+ e.getMessage());
      }

      @Override
      public void onStreamReady(Torrent torrent) {
        System.out.println("onStreamReady");
      }

      @Override
      public void onStreamProgress(Torrent torrent, StreamStatus status) {
        System.out.println("onStreamProgress");
      }

      @Override
      public void onStreamStopped() {
        System.out.println("onStreamStopped");
      }
    });
    System.out.println("Initialized");
  }

  public void start(){
    this.torrentStream.startStream("https://yts.lt/torrent/download/FF495923151031A547AE14C1CA9F0DFF8EA26A0B");
    try {
      Thread.sleep(10000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    System.out.println("Started");
  }

}

Please find the output

NOTE : init() and start() are called at the runtime .
Please find the github for the above code .
git@github.com:amankapur007/openflix_torrent.git


text:
Q: Como faço para comparar duas Strings em c Basicamente o que quero fazer. É receber na linha de comandos uma String.Só que à String introduzida, têm que estar na base binária, por isso que faço um if para verificar se é binário ou não.  O meu problema está no if , porque independentemente do valor que introduza. Sempre entra no if.  - Agradeço pela vossa ajuda!
int main(){

     char binario [50][100]={"0000","0001","0010","0011","0100","0101","0110","0111","1000","1001","1010","1011","1100","1101","1110","1111"};

     char nome [50][100];

     int contador=0;

      printf("Insira um valor");
      scanf("%s",nome[0]);

    while(nome[contador]!='\0'){

            if (nome[0] != binario[contador])
            {
                printf("Base inicial invalida");
                break;
            }

            contador++;
     }

     return 0;

}

A: Observe essa expressão:
if (nome[0] != binario[contador])

O resultado disso vai ser a comparação entre o endereço de dois ponteiros de memória. Esses dois endereços nunca serão iguais, e portanto, ele sempre vai entrar no if.
O que você vai querer é usar a função strcmp:
if (strcmp(nome[0], binario[contador]) != 0)

Entretanto, gostaria de frisar que o seu programa tem outros problemas que me levantam as seguintes dúvidas:

*

*Por que declarar 50 nomes se você só precisa de 1?

*Por que fazer conversão de decimal para binário usando strings, valores tabelados e tentativa-e-erro ao invés de fazer o cálculo de divisões sucessivas para isso?

A: Você pode usar a função strcmp, declarada no arquivo de cabeçalho (ou arquivo header) string.h. Note que a função strcmp compara o conteúdo das strings e não seu tamanho.
Exemplo:
strcmp(string1,string2);

A função te retornará até três valores. São eles:

*

*= 0: as duas strings são idênticas.

*> 0: o primeiro caractere diferente tem um valor maior que na outra string.

*< 0: o primeiro caractere diferente tem um valor menor que na outra string.

Veja o exemplo:
#include <stdio.h>
#include <string.h>

int main ()
{
  char key[] = "maçã";
  char buffer[80];
  do {
     printf ("Adivinhe minha fruta favorita? ");
     fflush (stdout);
     scanf ("%79s",buffer);
  } while (strcmp (key,buffer) != 0);
  puts ("Resposta correta!");
  return 0;
}

Saída:

Adivinhe minha fruta favorita? laranja
Adivinhe minha fruta favorita? maçã
Resposta correta!

Leia aqui e aqui também em inglês.


text:
Q: C++ Zoom into the centre of the screen in 2D coordinates I'm having difficulty working out the correct calculations in order to zoom into the centre of the screen in 2D coordinates whilst keeping everything in the correct scale.
I have a vector which I use to handle moving around my map editor as follows:
scroll = sf::Vector2<float>(-640.0f, -360.0f);

It's set at -640.0f, -360.0f to make 0,0 the centre of the screen on initialising (based on my window being 1280x720).
My zoom value ranges from 0.1f to 2.0f and it's increased or decreased in 0.05 increments:
zoomScale = zoomScale + 0.05;

When drawing elements on to the screen they are drawn using the following code:
sf::Rect<float> dRect;
dRect.left = (mapSeg[i]->position.x - scroll.x) * (layerScales[l] * zoomScale);
dRect.top = (mapSeg[i]->position.y - scroll.y) * (layerScales[l] * zoomScale);
dRect.width = (float)segDef[mapSeg[i]->segmentIndex]->width;
dRect.height = (float)segDef[mapSeg[i]->segmentIndex]->height;

sf::Sprite segSprite;
segSprite.setTexture(segDef[mapSeg[i]->segmentIndex]->tex);
segSprite.setPosition(dRect.left, dRect.top);
segSprite.setScale((layerScales[l] * zoomScale), (layerScales[l] * zoomScale));
segSprite.setOrigin(segDef[mapSeg[i]->segmentIndex]->width / 2, segDef[mapSeg[i]->segmentIndex]->height / 2);
segSprite.setRotation(mapSeg[i]->rotation);
Window.draw(segSprite);

layerScales is a value used to scale up layers of segments for parallax scrolling.
This seems to work fine when zooming in and out but the centre point seems to shift (an element that I know should always be at 0,0 will be located at different co-ordinates as soon as I zoom). I use the following to calculate what the position as at the mouse to test this as follows:
mosPosX = ((float)input.mousePos.x + scroll.x) / zoomScale)
mosPosY = ((float)input.mousePos.y + scroll.y) / zoomScale)

I'm sure there's a calculation I should be doing to the 'scroll' vector to take into account this zoom but I can't seem to get it to work right.
I tried implementing something like below but it didn't produce the correct results:
scroll.x = (scroll.x - (SCREEN_WIDTH / 2)) * zoomScale - (scroll.x - (SCREEN_WIDTH / 2));
scroll.y = (scroll.y - (SCREEN_HEIGHT / 2)) * zoomScale - (scroll.y - (SCREEN_HEIGHT / 2));

Any ideas what I'm doing wrong?

A: I will do this the easy way (not most efficient but works fine) and only for single axis (second is the same)
it is better to have offset unscaled:
scaledpos = (unscaledpos*zoomscale)+scrolloffset

know center point should not move after scale change (0 means before 1 means after):
scaledpos0 == scaledpos1

so do this:
scaledpos0 = (midpointpos*zoomscale0)+scrolloffset0; // old scale
scaledpos1 = (midpointpos*zoomscale1)+scrolloffset0; // change zoom only
scrolloffset1+=scaledpos0-scaledpos1;                  // correct offset so midpoint stays where is ... i usualy use mouse coordinate instead of midpoint so i zoom where the mouse is

when you can not change the scaling equation then just do the same with yours
scaledpos0 = (midpointpos+scrolloffset0)*zoomscale0;
scaledpos1 = (midpointpos+scrolloffset0)*zoomscale1;
scrolloffset1+=(scaledpos0-scaledpos1)/zoomscale1;

Hope I did no silly error in there (writing from memory). For more info see

*

*Zooming graphics based on current mouse position


text:
Q: How to get the last X Characters of a Golang String? If I have the string "12121211122" and I want to get the last 3 characters (e.g. "122"), is that possible in Go? I've looked in the string package and didn't see anything like getLastXcharacters.

A: The answer depends on what you mean by "characters". If you mean bytes then:
s := "12121211122"
lastByByte := s[len(s)-3:]

If you mean runes in a utf-8 encoded string, then:
s := "12121211122"
j := len(s)
for i := 0; i < 3 && j > 0; i++ {
    _, size := utf8.DecodeLastRuneInString(s[:j])
    j -= size
}
lastByRune := s[j:]

You can also convert the string to a []rune and operate on the rune slice, but that allocates memory.

A: You can use a slice expression on a string to get the last three bytes.
s      := "12121211122"
first3 := s[0:3]
last3  := s[len(s)-3:]

Or if you're using unicode you can do something like:
s      := []rune("世界世界世界")
first3 := string(s[0:3])
last3  := string(s[len(s)-3:])

Check Strings, bytes, runes and characters in Go and Slice Tricks.


text:
Q: TypeError: MyApp is not a constructor, when using webpack 2 to create library and export es6 class My goal is to create a myapp.min.js file, that can be included in a website, and then, anywhere below on that page a file can can call.
const newInstance = new MyApp(userOptionsObject);

However, I keep getting a is not a constructor error. Here is the relevant part of my webpack config:
module.exports = {
  context: path.join(__dirname, ''),
  devtool: debug ? "cheap-module-eval-source-map" : "source-map",
  entry: ["./js/MyApp.js"],
  output: {
    path: path.join(__dirname, '/dist/'),
    filename: 'myapp.min.js',
    library: 'MyApp',
    libraryTarget: 'var',
  },
};

my MyApp.js looks like this:
export default class MyApp {
  constructor(userOps) {
    this.userOps = userOps;
  }
  toString() {
    return 'Hello visitor';
  }
}

So, inside a browser I would encounter for example:
  <script src="myapp.min.js"></script>
  <script>
    var newInstance = new MyApp({some: "options"});
  </script>

Here is also my babelrc
{
    "presets": [
      ["es2015", { "loose": true, "modules": false }]
  ]
}


text:
Q: How do you render PDF file in Svelte/JavaScript? I am working on a college project.
Can someone help me understand how best I could render a PDF file on the client side (svelte + javascript + UIKit)?
I managed to fetch the URL (http://localhost:4000/api/v1/document/14), parse JSON to get the document.Body data and log it to the developer console.
I have looked at several sources online and have not been able to render the file on the client side.
I have a Go API backend that reads file data based on the path referenced to it in the DB. I then populate the Body field with file content in bytes.
// GetDocument - retrieves documents by their ID from the database
func GetDocument(ID uint) (Document, error) {
    ....code here..........
    // read the filename and return the contents (bytes).
    body, err := os.ReadFile(document.Path)
    if err != nil {
        glog.Errorf("unable to read file: %v", err)
    }
    document.Body = string(body)

    return document, nil
}

I have confirmed the JSON response body contains file data using postman.
{
    "ID": 14,
    "CreatedAt": "2022-02-23T12:08:46.313118Z",
    "UpdatedAt": "2022-02-23T12:08:46.313118Z",
    "DeletedAt": null,
    "path": "/app/docs/sample.pdf",
    "title": "sample.pdf",
    "version": "1.0",
    "author": "",
    "body":"%PDF-1.4\n%äüöß\n2 0 obj\n<</Length 3 0 R/Filter/FlateDecode>>\nstream\nx��M�,7�޿�΁��䏲ah虞\t��݁=���͆���撿Y�e��^w^��˲$�[�2g��8�2���O��Stp����9����'�����=�p�'�'ᜦ�����7����\tM�f7O?O�x�\t�����\fk��&\\�����?^��I�ʏ�����q�~�pvD5DC�U��q(�lb�c^��+�z6���ъ�ѻ\t`\fЊ�э�^��vf<�I�2�����S,��\tad�i\"\t����Q����ĕQ\"��92I�Ї��28��$Y����\r^�H����\u000b>!���g�,bh�D���Z~^�f�W�>_\n>��~n�Ut��� ������\tGD��1���U���+�\f�艗���`=�^�\r?�̥<�i~�lV��z��z�ጽv�^��m��ȼ�^�V&���/������k��.�W��1}��m�u����Y�ҏ�E������1�:��\f�%9[t���{����^;ţۺ=�'ŗ��\fIM�����{�����;*h��\t,�T�L��ܫ�ۖ�������s��-R�d�M��4�Ǚ�]���7Nۮ)\/���TUDŽժ���D�>>�_��V��\n��K�^R�٨���\u000b�fe��~��MOB�۟=a�ˎ~:��:�l��5�\r�)��|�*0o�SpG���=�ufL9c��p���ʓ�{�.fp����j��LM��\\r���K>5��D��I�O�jӯ�-s��3�̞P)`��}�ŏO?�X�qL[�+4�G��V���b�_�����|y�$�̾yZ��[���e�[�����/�dOpP\bF\r$��&���&esU�����f�q8��?\nendstream\nendobj\n\n37 0 obj\n34718\nendobj\n\n38 0 obj\n<</Type/FontDescriptor/FontName/Symbol\n/Flags 4\n/FontBBox[-180 -293 1089 1010]/ItalicAngle 0\n/Ascent 1010\n/Descent -293\n/CapHeight 1010\n/StemV 80\n/FontFile 36 0 R\n>>\nendobj\n\n39 0 obj\n<</Length 995/Filter/FlateDecode>>\nstream\nx�]��n\"9��=OQ˞E\u000b�oDB�|����&3@��A���E޾��gn�Hr\bU�w\\V���XO����������t����Ǵ����xZܭ��q�}���o��b9����~�O/��v��}���:}_���<��X�:��xz������O�˷�m<]����a8�/�8?�.����e����a��x��:���|^�a�?�Aٟ��e����u\\lW��a���b<~��n������_�i�]�kW��9ߑ���䵲!eK�ʎ��=�+rPސ7���{�H�ʉ��39+rQ�����sí�o�7�������7��F~���o��\r~#��o�7�������7��F~���o��\r~#��o�����������[�V~���o�[�-~+��o�����������[�V~���o�[�-~+����w�������w�;�N~�����;�~'����w�������w�;�N~�����;�~'���M�����{�^~�����{�=~���������������{�^~�����{�=~/����������Z��?���� ������?���A��?���� ������?b�2G�Q��9�1G�#����h�7����/�H��2�2Qe\"e��D�D����*)U&R&�L�LT�H��2�2���aD=�D��b�bI�Œ�%�%KKz\t�?�O�'�I��?ɟ�'��$Ÿ�O�����������ğ������?���g�Y��?˟�g�3���2���2�,Ɵ������?���g�?k�3럵����/��E����h�bȚ�X��*������/��E���q�3>~��_�/������/�W�U����_�</�[\rY�VKּ�U��e��,Cݐe��dj$wC�oZ7dr7���@e�4�����\rs���g���=ӯo���\r3sӚ7�Mk�07uo���7�M��ͬ��fV�v3�o���_\": ����k�L�|��Ǽ~��9�x�9\t^�����GM�\nendstream\nendobj\n\n40 0 obj\n<</Type/Font/Subtype/Type1/BaseFont/Symbol\n/ToUnicode 39 0 R\n/FirstChar 0 /LastChar 255\n/Widths[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n250 333 713 500 549 833 778 439 333 333 500 549 250 549 250 278\n500 500 500 500 500 500 500 500 500 500 278 278 549 549 549 444\n549 722 667 722 612 611 763 603 722 333 631 722 686 889 722 722\n768 741 556 592 611 690 439 768 645 795 611 333 863 333 658 500\n0 631 549 549 494 439 521 411 603 329 603 549 549 576 521 549\n549 521 549 603 439 576 713 686 493 686 494 480 200 480 549 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n762 620 247 549 167 713 500 753 753 753 753 1042 987 603 987 603\n400 549 411 549 549 713 494 460 549 549 549 549 1000 0 0 658\n823 686 795 987 768 768 823 768 768 713 713 713 713 713 713 713\n768 713 0 0 0 823 549 250 713 603 603 1042 987 603 987 603\n494 329 0 0 0 713 0 0 0 0 0 0 0 0 0 0\n0 329 274 686 0 686 0 0 0 0 0 0 0 0 0 0\n]\n/FontDescriptor 38 0 R>>\nendobj\n\n41 0 obj\n<</F1 35 0 R/F2 20 0 R/F3 30 0 R/F4 40 0 R/F5 25 0 R\n>>\nendobj\n\n42 0 obj\n<</Font 41 0 R\n/XObject<</Im13 13 0 R>>\n/ProcSet[/PDF/Text/ImageC/ImageI/ImageB]\n>>\nendobj\n\n1 0 obj\n<</Type/Page/Parent 15 0 R/Resources 42 0 R/MediaBox[0 0 595 842]/Annots[\n14 0 R ]\n/Group<</S/Transparency/CS/DeviceRGB/I true>>/Contents 2 0 R>>\nendobj\n\n4 0 obj\n<</Type/Page/Parent 15 0 R/Resources 42 0 R/MediaBox[0 0 595 842]/Group<</S/Transparency/CS/DeviceRGB/I true>>/Contents 5 0 R>>\nendobj\n\n7 0 obj\n<</Type/Page/Parent 15 0 R/Resources 42 0 R/MediaBox[0 0 595 842]/Group<</S/Transparency/CS/DeviceRGB/I true>>/Contents 8 0 R>>\nendobj\n\n10 0 obj\n<</Type/Page/Parent 15 0 R/Resources 42 0 R/MediaBox[0 0 595 842]/Group<</S/Transparency/CS/DeviceRGB/I true>>/Contents 11 0 R>>\nendobj\n\n43 0 obj\n<</Count 5/First 44 0 R/Last 46 0 R\n>>\nendobj\n\n44 0 obj\n<</Count 0/Title<FEFF004C006F00720065006D00200069007000730075006D00200064006F006C006F0072002000730069007400200061006D00650074002C00200063006F006E00730065006300740065007400750072002000610064006900700069007300630069006E006700200065006C00690074002E0020004E0075006E00630020006100630020006600610075006300690062007500730020006F00640069006F002E>\n/Dest[1 0 R/XYZ 74.7 697.1 0]/Parent 43 0 R/Next 45 0 R>>\nendobj\n\n45 0 obj\n<</Count 0/Title<FEFF00430072006100730020006600720069006E00670069006C006C006100200069007000730075006D0020006D00610067006E0061002C00200069006E0020006600720069006E00670069006C006C0061002000640075006900200063006F006D006D006F0064006F00200061002E>\n/Dest[4 0 R/XYZ 74.7 537.2 0]/Parent 43 0 R/Prev 44 0 R/Next 46 0 R>>\nendobj\n\n46 0 obj\n<</Count 2/First 47 0 R/Last 48 0 R\n/Title<FEFF004C006F00720065006D00200069007000730075006D00200064006F006C006F0072002000730069007400200061006D00650074002C00200063006F006E00730065006300740065007400750072002000610064006900700069007300630069006E006700200065006C00690074002E>\n/Dest[7 0 R/XYZ 74.7 785.3 0]/Parent 43 0 R/Prev 45 0 R>>\nendobj\n\n47 0 obj\n<</Count 0/Title<FEFF004D0061006500630065006E006100730020006D006100750072006900730020006C00650063007400750073002C0020006C006F0062006F00720074006900730020006500740020007000750072007500730020006D00610074007400690073002C00200062006C0061006E006400690074002000640069006300740075006D002000740065006C006C00750073002E>\n/Dest[7 0 R/XYZ 74.7 558.4 0]/Parent 46 0 R/Next 48 0 R>>\nendobj\n\n48 0 obj\n<</Count 0/Title<FEFF0049006E00200065006C0065006900660065006E0064002000760065006C006900740020007600690074006100650020006C0069006200650072006F00200073006F006C006C0069006300690074007500640069006E00200065007500690073006D006F0064002E>\n/Dest[7 0 R/XYZ 74.7 321.4 0]/Parent 46 0 R/Prev 47 0 R>>\nendobj\n\n15 0 obj\n<</Type/Pages\n/Resources 42 0 R\n/MediaBox[ 0 0 595 842 ]\n/Kids[ 1 0 R 4 0 R 7 0 R 10 0 R ]\n/Count 4>>\nendobj\n\n14 0 obj\n<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[92 355.7 189.9 371.4]/A<</Type/Action/S/URI/URI(https://products.office.com/en-us/word)>>\n>>\nendobj\n\n49 0 obj\n<</Type/Catalog/Pages 15 0 R\n/OpenAction[1 0 R /XYZ null null 0]\n/Outlines 43 0 R\n/Lang(en-US)\n>>\nendobj\n\n50 0 obj\n<</Creator<FEFF005700720069007400650072>\n/Producer<FEFF004C0069006200720065004F0066006600690063006500200034002E0032>\n/CreationDate(D:20170816144413+02'00')>>\nendobj\n\nxref\n0 51\n0000000000 65535 f \n0000138560 00000 n \n0000000019 00000 n \n0000002806 00000 n \n0000138722 00000 n \n0000002827 00000 n \n0000006544 00000 n \n0000138866 00000 n \n0000006565 00000 n \n0000010276 00000 n \n0000139010 00000 n \n0000010297 00000 n \n0000010502 00000 n \n0000010523 00000 n \n0000141115 00000 n \n0000140996 00000 n \n0000061445 00000 n \n0000073054 00000 n \n0000073077 00000 n \n0000073272 00000 n \n0000073769 00000 n \n0000074103 00000 n \n0000081507 00000 n \n0000081529 00000 n \n0000081725 00000 n \n0000082091 00000 n \n0000082317 00000 n \n0000091907 00000 n \n0000091929 00000 n \n0000092129 00000 n \n0000092531 00000 n \n0000092791 00000 n \n0000100402 00000 n \n0000100424 00000 n \n0000100627 00000 n \n0000101037 00000 n \n0000101308 00000 n \n0000136140 00000 n \n0000136163 00000 n \n0000136346 00000 n \n0000137411 00000 n \n0000138386 00000 n \n0000138459 00000 n \n0000139156 00000 n \n0000139212 00000 n \n0000139626 00000 n \n0000139956 00000 n \n0000140304 00000 n \n0000140690 00000 n \n0000141271 00000 n \n0000141386 00000 n \ntrailer\n<</Size 51/Root 49 0 R\n/Info 50 0 R\n/ID [ <F6E9CC2B383667A7FACE2422EADAAE69>\n<F6E9CC2B383667A7FACE2422EADAAE69> ]\n/DocChecksum /6555A4DFC7A04D784A4A9B0AF82889CB\n>>\nstartxref\n141561\n%%EOF\n"
}

FileViewer.svelte

hello

screen capture of application console log

A: I have found a solution to my question in other stack overflow posts. For anyone with a similar issue please refer to the links below.
Once I changed how the file was retrieved from the Db on the backend, I could call that endpoint on the front-end. This renders a PDF file in a new tab.
{document.title}

*

*Do I need Content-Type: application/octet-stream for file download?

*How to download file in browser from Go server


text:
Q: Jquery:Uncaught TypeError: Cannot read property 'top' of undefined I'm having above error though this Jquery function is working fine.
Html:

Digital Library

            What is Digital Library?

A digital library is a special library with a focused collection of digital objects that can include text, visual material, audio material, video material, stored as electronic media formats (as opposed to print, microform, or other media), along with means for organizing, storing, and retrieving the files and media contained in the library collection.

            How to search for specific ebook?

To search an ebook, you just need to search for your desire ebook in below text boxes.When you click on search, a table with relevant results will show up.

            How to download ebook?

To download an ebook you just need to click on download link, in the table results

Jquery:

But because of this there is a link that is not opening.
Html:

Ebooks

Research Journal

I've already checked link spelling and other aspects but can't find any solution. Please help me! Thank you

A: That tells you that there is no element matching the selector in target. Since there's no matching element, offset returns undefined; when you try to do undefined.anything, you get an error.
So you need to look at target and figure out why it's not a valid selector for the element you're trying to get. You can do that with the debugger built into your browser by setting a breakpoint on the scrollTop: $(target).offset().top line and hovering the cursor over the target variable.
Now that you've quoted the HTML, we can see that the elements with the class open don't have a #context attribute (which would be a very, very strange name to choose — and extremely awkward to write, if it's even possible — in any case).
If you added data-context="one" and such:
What is Digital Library?

..and then used data-context:
var target = this.getAttribute("data-context");

...and showed the element:
$(target).show();

...it would work:

$(document).on('click', '.open', function(event) {
  event.preventDefault();
  var target = "#" + this.getAttribute('data-context');
  $(target).show();
  $('html, body').animate({
    scrollTop: $(target).offset().top
  }, 2000);
});

Digital Library

  What is Digital Library?

A digital library is a special library with a focused collection of digital objects that can include text, visual material, audio material, video material, stored as electronic media formats (as opposed to print, microform, or other media), along with
    means for organizing, storing, and retrieving the files and media contained in the library collection.

  How to search for specific ebook?

To search an ebook, you just need to search for your desire ebook in below text boxes.When you click on search, a table with relevant results will show up.

  How to download ebook?

To download an ebook you just need to click on download link, in the table results

That said, it's much more complicated than necessary as the links and the paragraphs they're showing are right next to each other. The links dont' need ids at all (they never did, unless you're using them for something you haven't shown) and neither do the paragraphs (unless, again, you're using them for something you haven't shown). Instead, just use $(this).next():
$(document).on('click', '.open', function(event) {
  event.preventDefault();
  var target = $(this).next();
  target.show();
  $('html, body').animate({
    scrollTop: target.offset().top
  }, 2000);
});

$(document).on('click', '.open', function(event) {
  event.preventDefault();
  var target = $(this).next();
  target.show();
  $('html, body').animate({
    scrollTop: target.offset().top
  }, 2000);
});

Digital Library

  What is Digital Library?

A digital library is a special library with a focused collection of digital objects that can include text, visual material, audio material, video material, stored as electronic media formats (as opposed to print, microform, or other media), along with
    means for organizing, storing, and retrieving the files and media contained in the library collection.

  How to search for specific ebook?

To search an ebook, you just need to search for your desire ebook in below text boxes.When you click on search, a table with relevant results will show up.

  How to download ebook?

To download an ebook you just need to click on download link, in the table results

A: *

*If there is an error, the function don't work fine.

*You get the attribute #context but I think you need attribute context (without #).

*The HTML you shared is not related with the Javascript

To solve it:

Because the error is produced because $(target) is not finding any element, so there is not offset() method and there is not top property.

A: Instead of this code,

 event.preventDefault();
    var target = "#" + this.getAttribute('#context');
    $('html, body').animate({
        scrollTop: $(target).offset().top
    }, 2000);

use this,
event.preventDefault();
$("body, html").animate({
            scrollTop: $($(this).attr('context')).offset().top
        }, 2000);


text:
Q: Basic java - passing values to an object array
public static void main(String[] args) {
    staples[] stemp = new staples[8];
    int j;

    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        for (j = 0; j < 8; j++) {
            System.out.print("Enter your name : ");
            stemp[j].setName(reader.readLine());

            System.out.println("Enter your age : ");
            stemp[j].setAge(Integer.parseInt(reader.readLine()));
        }

        for (j = 0; j < 8; j++) {
            System.out.print("Employee number:" + "j:" + "name:" + stemp[j].getName() + " Age:" + stemp[j].getAge());
        }

        reader.close(); // VERY IMPORTANT TO CLOSE

        System.out.println("Program ended");
    } catch (java.io.IOException ex) {
        System.out.println("Error is " + ex.getMessage());
    }
}

I am trying to pass values to the the array object stemp which has two attributes name and age. What is the correct syntax to input the values to the array? Is the syntax above correct?

A: You need to add stemp[j] = new staples();, otherwise you get NPE.
When you create an array in Java, JVM allocates space for N references to your objects, but not for the objects themselves. You need to allocate these one by one using the new operator.
for ( j=0;j<8;j++)
{
     stemp[j] = new staples();
     System.out.print("Enter your name : ");
     stemp[j].setName(reader.readLine());
     System.out.println("Enter your age : ");
     stemp[j].setAge(Integer.parseInt(reader.readLine()));
}

A: public static void main(String[] args) {
    staples[] stemp = new staples[8];
    int j;

    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        for (j = 0; j < 8; j++) {
            System.out.print("Enter your name : ");
            stemp[j] = new staples();
            stemp[j].setName(reader.readLine());

            System.out.println("Enter your age : ");
            stemp[j].setAge(Integer.parseInt(reader.readLine()));
        }

        for (j = 0; j < 8; j++) {
            System.out.print("Employee number:" + "j:" + "name:" + stemp[j].getName() + " Age:" + stemp[j].getAge());
        }

        reader.close(); // VERY IMPORTANT TO CLOSE

        System.out.println("Program ended");
    } catch (java.io.IOException ex) {
        System.out.println("Error is " + ex.getMessage());
    }
}


text:
Q: How to assert presence of java applet using selenium? Does anyone know how to verify presence of java applet using Selenium IDE. I want to verify the presence of Ephox text editor in a form, so I can verify the element but how do I assert that it is Ephox.

A: I don't know about the Ephox editor, but to answer your java applet question: you could just have selenium verify that the element is present.
So if the applet was contained in this tag:
<applet width="81" height="120" name="clock1" code="tz.class" codebase="applets/" style="background-color: transparent;">

I would use the below code in Selenium IDE to verify that it's present.

    verifyElementPresent
    css=applet

Cheers,
Sam


text:
Q: How to upgrade to a specific build of windows 10 So, I have a Windows 10 installation that has all kinds of issues.
It's running Windows 10 Enterprise, 10.0.17134.1130 (x64)
I'm trying to restore this with DISM, using another installation of windows 10 as the source image, however, I'm having trouble getting this new installation to the correct version.
Currently, it is on: 10.0.10240, but when I try to run the MSU file windows10.0-kb4525237-x64_dc82c2b90ed23d496f5f17acbb1dc5698634ac80.msu I get a prompt saying this update isn't supported on my computer ...
Running windows update will put me on an update that is way too high for me to be able to run DISM.
Any ideas?
[Edit]
Rephrase ..
I have a windows 10 installation that is corrupt. This installation is windows 10 Enterprise, 10.0.17134.1130. This installation was once upon a time created using this ISO: SW_DVD5_WIN_ENT_10_64BIT_English_MLF_X20-26061.ISO
I now have a second installation of Windows 10 Enterprise, using the same ISO. However, before I run windows update, the build is 10.0.10240.
I need to get this second installation up to a version that matches my corrupt installation, in order to run DISM. However, whenever I run Windows Updates, it puts me at a build higher than desired.

A:
I'm trying to restore this with DISM, using another installation of
  windows 10 as the source image, however, I'm having trouble getting
  this new installation to the correct version.

You obviously cannot use a Windows 10 version 1507 installation to repair a Windows 10 version 1803 installation.  This means you must manually update Windows 10 version 1507 to Windows 10 version 1803.

I now have a second installation of Windows 10 Enterprise, using the same ISO. However, before I run windows update, the build is 10.0.10240.  I need to get this second installation up to a version that matches my corrupt installation, in order to run DISM. However, whenever I run Windows Updates, it puts me at a build higher than desired.

This is due to the fact that Windows 10 version 1803 is currently is not supported.  The reason you are being offered Windows 10 version 1903 is due to the fact that it is the currently supported version of Windows 10.  This means you must download a Windows 10 version 1803 ISO and manually update the Windows 10 version 1507 installation.
You can use this tool to download the Windows 10 Enterprise version 1803 ISO.  If you do not trust the tool then you can download the required ISO from the Licensing Service Center.
Source: Where can I get a clean ISO of a specific build of Windows 10?
However, you might run into issues, trying to upgrade 1507 directly to 1803.  If that happens you will have to incrementally upgrade to each version.  If you run into problems, you will want to avoid allowing the installation environment (from within Windows) to download updates since that will not give you the end result you want.  I actually documented that entire process, and the problems I ran into, in a previous answer to a different question.
You could avoid the issues trying to upgrade the second installation by simply installing Windows 10 version 1803 on the system using the ISO you download.  You can also use that same ISO, on the problem machine, and use it to repair the installation.
Source: My Windows 10 version 1511 won't update to latest 1803?

when I try to run the MSU file windows10.0-kb4525237-x64_dc82c2b90ed23d496f5f17acbb1dc5698634ac80.msu I get a prompt saying this update isn't supported on my computer

KB4525237 can only be installed on Windows 10 version 1803.


text:
Q: Calculate the sum of all numbers from 1 to a given number using for loop (Also pls tell me where i am wrong) number = int(input("Enter the number: "))

for i in range(1, number+1):
    print(sum(i))

#this where i left and pls tell where i am wrong

A: sum(...) can be used with an iterable:
numbers = [1, 2, 3, 4]
print(sum(numbers))

Using a for loop you have to save sum in a variable and store result into this
Example:
number = int(input("Number: "))
sum = 0
for i in range(1, number + 1):
    sum += i
print(sum)

A: You're code is wrong in that you're using sum(I) for each item in the list. Each iteration, you're trying to sum an int, not an iterable, print(sum(1)), print(sum(2)), ..
number = 5
print(sum(range(number+1))

A: Before for loop, you have to create the variable sum, which adds and save the partial sum in every iteration:
sum=0 #initialize sum
for i in range(1, number+1):
    sum=sum+i # you have to add current i to the partial sum
    #you can use the contract form sum+=i for the line above
print(sum)


text:
Q: Why do not work the onTap in gesturedetector? `
class SearchOffScreen extends StatelessWidget {
  const SearchOffScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return DefaultLayout(
      child: SafeArea(
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 16.0),
            child: Column(
                children: [
                  const SizedBox(height: 200.0,),
                  InkWell(
                    child: IgnorePointer(
                      child: MainSearchTextFormField(),
                    ),
                    onTap: () {
                      print("call");
                    },
                  ),
                ]
            )
        ),
      ),
    );
  }
}

`
I don't know why the MainSearchTextFormField is not working when I click the MainSearchTextFormField. I hope the SearchOffScreen switches the SearchOnScreen when I click the MainSearchTextFormField.
Please help me.
I hope the SearchOffScreen will be switched the SearchOnScreen when I clicked the MainSearchTextFormField. Bit it didn't.

// this is search_on_screen
class SearchOnScreen extends StatelessWidget {
  const SearchOnScreen ({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return DefaultLayout(
      child: SafeArea(
        top: true,
        bottom: false,
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 0.0),
          child: Column(
            children: [
              CupertinoSearchTextField(
                suffixInsets: EdgeInsets.only(right: 16),ts.only(left: 16),
                padding: EdgeInsets.only(left: 15,top: 15, bottom: 15),
                decoration: BoxDecoration(
                  border: Border(bottom: BorderSide(width: 0.5, color: Color(0xff868686)))
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
// This is search_off_screen
class SearchOffScreen extends StatelessWidget {
  const SearchOffScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return DefaultLayout(
      child: SafeArea(
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 16.0),
          child: GestureDetector(
            onTap: (){
              Navigator.of(context).push(
                MaterialPageRoute(
                    builder: (BuildContext context){
                      return SearchOnScreen();
                    }
                ),
              );
            },
            child: Container(// <-- add this
              child: Column(
                children: [
                  const SizedBox(height: 200.0,),
                  IgnorePointer( // <-- add this
                    child: MainSearchTextFormField(),
                  )
                ], //children
              ),
            ),
          )
        ),
      ),
    );
  }
}
// This is dart.main
void main() {
  runApp(
    _App(),
  );
}

class _App extends StatelessWidget {
  const _App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        fontFamily: 'NotoSans',
      ),
      debugShowCheckedModeBanner: false,
      home: SearchOffScreen(),
    );
  }
}

A: Because the textfield has pointer to its self you need to disable that in order GestureDetector tap work, so wrap your MainSearchTextFormField with IgnorePointer and then replace GestureDetector with InkWell:
child: Column(
  children: [
     const SizedBox(height: 200.0,),
     InkWell(
       child: IgnorePointer(
          child: MainSearchTextFormField(),
       ),
       onTap: (){
          Navigator.of(context).push(
            MaterialPageRoute(
                builder: (BuildContext context){
                  return SearchOnScreen();
                }
            ),
          );
        },
     ),
  ]
)


text:
Q: Child process can't access shared memory in C I have a program where I want to set up a pointer to a struct as shared memory. I think I've set up the shared memory correctly in the main method; then I call a function to initialize the struct, and fork. However, the child process can't access the shared memory; the parent process works as expected, which isn't that big of a surprise. I know for sure that the child process executes and works, but it cannot access the shared memory, so the function doesn't really do much besides print out printf statements.
struct OverSharedData{
    struct SharedData ** rep;
    int rop;
};

void initialize( struct OverSharedData * bill){
bill->rep = (struct SharedData**)malloc(sizeof(struct SharedData*)*consumerthreads);
int on =0;
for (on=0; on<consumerthreads; on++) {
    *(bill->rep+on) = (struct SharedData *)malloc(sizeof(struct SharedData));
    init(*(bill->rep + on), on); //
 }}

int main(int argc, const char * argv[])
{

    databases(argv[1]); /* Takes care of setting up the database*/
    categories(argv[2]); /*Takes care of setting up the book categories*/
    bookorders = argv[3];

    key_t key = ftok("garbage.txt", 71);
    int eyedee = shmget(key, sizeof(struct OverSharedData ),
                        IPC_CREAT | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
    if (eyedee == -1)
    {
        perror("shmget");
        exit(1);
    }

    struct OverSharedData *remp = (struct OverSharedData *) shmat(eyedee, 0, 0);

    if (remp == (void *) -1)
    {
        perror("shmat");
        exit(1);
    }

    initialize(remp);
    struct SharedData * d = *(remp->rep + 0);

    printf("Hallo\n");
    shmctl(eyedee, IPC_RMID, 0);

    pid_t forkk = fork();

    if (forkk==0) {
        /*THIS DOES NOT WORK*/
        printf("Entered consumer check: %d\n", remp->rop);

         int z = 0;
         pthread_t Consumer_Threads[consumerthreads];
         for (z=0; z<consumerthreads; z++) {
         remp->rop = z;
         d = *(remp->rep + z);
         d->da = z;
         pthread_create((Consumer_Threads+z), 0, Consumer, d);

         }
         for (z = 0; z<consumerthreads; z++) {
         pthread_join(Consumer_Threads[z], NULL);
         }
         shmdt(remp);

    }

    else{
       /*THIS WORKS*/
        printf("Entered Producer: %d\n",remp->rop);

        pthread_t Produc;
        pthread_create(&Produc, 0, Producer, remp);
        pthread_join(Produc, NULL);

        printf("Hey guys: %d\n", remp->rop);
        shmdt(remp);
    }

My guess is that I didn't initialize the struct correctly, but I'm not all too clear what I'm doing wrong. I left out some of the other initializing code but I figured since I can't even access the int in the OverSharedData struct, it's more of a matter where I can't access the struct in the first place.

A: The problem is that your shared data (the single OverSharedData object) contains pointers to non-shared data.  You need to allocate all the data that you want shared in the shared memory segment, rather than with malloc.  Something like:
static void *shared_available;
static size_t shared_left;
void init_shared(size_t size) {
    key_t key = ftok("garbage.txt", 71);
    int eyedee = shmget(key, size,
                        IPC_CREAT | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
    if (eyedee == -1) {
        perror("shmget");
        exit(1); }
    shared_available = shmat(eyedee, 0, 0);
    if (shared_available == (void *) -1) {
        perror("shmat");
        exit(1); }
    shared_left = size;
}
void *alloc_shared(size_t size) {
    void *rv = shared_available;
    if (size > shared_left) {
        fprintf(stderr, "Ran out of shared memory!\n");
        exit(1); }
    shared_available = (char *)rv + size;
    shared_left -= size;
    return rv;
}

OverSharedData *initialize() {
    init_shared(sizeof(struct OverSharedData) +
                       sizeof(struct SharedData *) * consumerthreads +
                       sizeof(struct SharedData) * consumerthreads)
    OverSharedData *bill = alloc_shared(sizeof(OverSharedData));
    bill->rep = alloc_shared(sizeof(struct SharedData*)*consumerthreads);
    for (int on=0; on<consumerthreads; on++) {
        bill->rep[on] = alloc_shared(sizeof(struct SharedData));
        init(&bill->rep[on], on); }
}

The above will still have problems if the init routine tries to store pointers to non-shared memory into the SharedData struct (you don't show the definition of either, so we can't say).
If you want to be able to more flexibly allocate and manage shared memory across processes, you really need to use a general purpose shared memory allocator/manager, such as this


text:
Q: Simple probability At a dance there are $n=3$ married couples: Ann and Andy, Betty and Boris, and Danielle and Dan. The wives select a husband at random with whom to share a dance. What is the probability that each of the three men dances with a woman other than his spouse.
In each pair, I denoted wives with a lowercase letter and husbands with an uppercase. The pairs are aA, bB, and dD. I counted $9$ ways in which women could select men.
aA, aB, aD
bB, bA, bD
dD, dA, dB
So there are $6$ ways to select other spouses. The probability is $\frac{6}{9}$, which is $0.67$, but the answer is $0.33$. What's wrong? Maybe I misunderstood the question, because English is my second language. Please help.

A: Answer:  The total number of ways you can pair them is ofcourse 9.  A can choose to dance with b or c.  Suppose he chooses to dance with b.  B will have a choice between a and c. She has to select a because C cannot dance with c.  Similarly, If A chooses to dance with c, C will have a choice to dance with b, because B cannot dance with b.  Thus either way, there are only three possible choices and thus 3/9  = 0.333


text:
Q: On the norm formula $N(IJ) = N(I)N(J)$ in an order of an algebraic number field Let $K$ be an algebraic number field of degree $n$.
Let $\mathcal{O}_K$ be the ring of algebraic integers of $K$.
Let $R$ be an order of $K$, i.e. a subring of $K$ which is a free $\mathbb{Z}$-module of rank $n$.
Let $\mathfrak{f} = \{x \in R | x\mathcal{O}_K \subset R\}$.
Let $I$ be a non-zero ideal of $R$.
If $I + \mathfrak{f} = R$, we call $I$ regular.
For the properties of regular ideals, see this.
We denote by $N(I)$ the number of elements of the finite ring $R/I$.
If $I$ and $J$ are regular ideals of $R$, we have $N(IJ) = N(I)N(J)$ as proved in my answer to this question.
I wonder if the formula still holds when one of them is not regular.
And I came up with the following proposition.
Proposition
Let $R$ be an order of an an algebraic number field.
Let $I$ be a regular ideal, $J$ be a non-zero ideal of $R$.
Then $N(IJ) = N(I)N(J)$.
Outline of my proof
I generalized the result of this and proved $R/J$ is $R$-isomorophic to $I/IJ$.
See my answer below for the detail.
My question
How do you prove the proposition?
I would like to know other proofs based on different ideas from mine.
I welcome you to provide as many different proofs as possible.
I wish the proofs would be detailed enough for people who have basic knowledge of introductory algebraic number theory to be able to understand.

A: Lemma
Let $I$ be a regular ideal, $J$ be a non-zero ideal of $R$.
Then there exists non-zero $\alpha \in I$ and an ideal $M$ such that $\alpha R = IM, M + J = A$.
Proof:
By this question, $I$ is uniquely decomposed as a product of regular prime ideals.
Let $I = P_1^{e_1}...P_n^{e_n}$ be the prime decomposition, where $P_1,\cdots,P_n$ are distinct regular prime ideals and $e_i \ge 1$ for all $i$.
Let $Q_1, ..., Q_m$ be all the distinct prime ideals which contain $J$, but not contain $I$.
For each $i$ choose $\alpha_i\in\ P_i^{e_i}\setminus P_i^{e_i+1}$.
For each $j$ choose $\beta_j\in\ A\setminus Q_j$.
Note that $P_1,\cdots,P_n$ and $Q_1, ..., Q_m$ are maximal ideals.
Hence, by the Chinese Remainder Theorem, there exists $\alpha\in A$ such that
$\alpha\equiv\alpha_i\pmod{P_i^{e_i+1}}$ for all $i$ and
$\alpha\equiv\beta_j\pmod{Q_j}$ for all $j$.
Since $\alpha \in P_i^{e_i}$ for all $i$, $\alpha \in I$.
Since $I$ is invertible by this question, there exists an ideal $M$ such that $\alpha R = IM$.
Clearly $M + J = A$
Proof of the proposition
It suffices to prove that $R/J$ is isomorphic to $I/IJ$.
By the lemma, there exist non-zero $\alpha \in I$ and an ideal $M$ such that $\alpha R = IM, M + J = R$.
Then $IM + IJ = I$.
Let $\psi\colon R \rightarrow I/IJ$ be the $R$-homomorphism sending $x$ to $\alpha x$ (mod $IJ$).
Since $\alpha R + IJ = I$, $\psi$ is surjective.
It remains to prove that $\psi$ is injective.
Suppose $\alpha x \in IJ$ for $x \in R$.
It suffices to prove that $x \in J$.
Since $\alpha R = IM$, $IMx \subset IJ$.
Since $I$ is invertible, $Mx \subset J$.
Since $M + J = R$, there exist $\mu \in M$ and $\beta \in J$ such that $\mu + \beta = 1$.
Since $\mu x + \beta x = x$, $x \in J$ as desired.


text:
Q: Flutter - anyone have a Flow example to conditionally wrap with left and right align? Newbie question...
Looking at Flutter docs, looks like Flow will solve a problem.
Unfortunately, there is no example provided (or available by searching on the date of this question) and it is giving some trouble in implementing correctly.
Here's how I'd like two elements to behave, similar to CSS float left and float right.
When there's sufficient screen width, make two things adjacent
-------------------------------
| THINGHERE   BIGGERTHINGHERE |
-------------------------------

When there's not sufficient screen width, stack with top left aligned, bottom right aligned
--------------------------
| THINGHERE              |
|        BIGGERTHINGHERE |
--------------------------

I'm currently using Wrap with calculated widths on the elements, but it seems like Flow would do this more gracefully.
Anyone have an example that achieves this use case?

A: Flow is not for such case. Wrap is the only thing you want.
The main reason is because Flow size can't depend on it's children size. Which means it's impossible to use it to achieve what you asked for.
If you need a more complex layout, you can instead create your own RenderBox. As RenderBox can get much more complicated layout logic.


text:
Q: Unix command for finding and deleting folders with folder names in date format I have folder names in the below date format
20130801
20130802
20130803
20130804
20130805
20130806
20130807
20130808
.
.
.
20130819

Similarly ,I have folders created from past two years for each day, and each of these folders have some files in it.
I am trying to find a unix command that would search for folders created on Saturdays and Sundays and delete all the contents in the folder and the folder itself.
For example, in the dates that I have mentioned above, folders with names 20130803 and 20130804 and the contents inside it should be deleted.

A: You can use the date function to identify the weekend days:
find . -path "./2013*" -printf "%f\n" | \
awk '{ \
cmd = sprintf( "date -d %s +\"%a\"", $0 ); \
cmd | getline value; close( cmd ); \
if( value ~ /Sat/ || value ~ /Sun/ ) print $0; \
}'

where all of that is actually on one line could go on one line.  I've used the "\" to make it more readable though.  You could drop the "\" and make it all one line from the shell.
That will output the directory names that correspond to "Sat" or "Sun" ( locale specific ) from the find output.  You could use the output to create a script to "rm -r" the directories.
You could also directly use find's date formatting "%Aa" (which is backed by the same strftime format parsing as date) if you know that all of the directories update dates match their names.  I assumed that wasn't the case (because it's not for my test).
For example with the directories that I made to test:
find . -path "./2013*" -printf "%Aa\n"

yields
Tue
Tue
Tue

which isn't as useful.

A: You can create a bash script (a.bash) to do that :
#!/bin/bash

for i in $(\ls -1d 2013*);
  do
     if [ $(date -d "$i" +%a) == "Sun" ] || [ $(date -d "$i" +%a) == "Sat" ]; then
          echo "$i is weekend. Delete the content";
          rm -rf "$i"/*;
     fi;
done

execute ./a.bash


text:
Q: checkboxes disappear on button click gridview I populated a gridview with a checkbox programatically like this :
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
 {
   if (e.Row.RowType != DataControlRowType.Header)
  {
    e.Row.Cells[ColumnSelect].Controls.Add(new System.Web.UI.WebControls.CheckBox());
 }
}

but when I click any button on the form the checkbox controls disappear before I can figure out which ones were clicked.  how can I save that info ?
thanks,
Diana

A: These controls need to be recreated every single time on Load. In short, dynamic controls in an ASP.NET application lose existence on a post back. You will want to create a List<CheckBox> that you store in Session and use that list to rebuild these controls in Load.


text:
Q: get File value from div element I have html file input
<input type="file"  id="file" />

and get file value then append it to  FormData() like that
        var formData=new FormData();
        formData.append("file",file.files[0]);

It works fine ,but I changed input file to dropzone.js div element like that

How can I get file data from div and append it to FormData()

A: Check the events list in the dropzone docs for more examples.
var myDropzone = new Dropzone("#file");
//When a file is added to the list
myDropzone.on("addedfile", function(file) {
    //Do whatever you want
});

A: Excellent article to get you started: uploading files.
This is where I started :)
A sample from the article, to read file's meta-data:

function handleFileSelect(evt) {
  evt.stopPropagation();
  evt.preventDefault();

  var files = evt.dataTransfer.files; // FileList object.

  // files is a FileList of File objects. List some properties.
  var output = [];
  for (var i = 0, f; f = files[i]; i++) {
    output.push('
', escape(f.name), ' (', f.type || 'n/a', ') - ',
                f.size, ' bytes, last modified: ',
                f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
                '
');
  }
  document.getElementById('list').innerHTML = '
' + output.join('') + '
';
}

function handleDragOver(evt) {
  evt.stopPropagation();
  evt.preventDefault();
  evt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
}

// Setup the dnd listeners.
var dropZone = document.getElementById('drop_zone');
dropZone.addEventListener('dragover', handleDragOver, false);
dropZone.addEventListener('drop', handleFileSelect, false);

Drop files here

<output id="list"></output>

You can also read the content of the file using the FileReader, extending the previous sample for reading the actual file (also code from the same article):

function handleFileSelect(evt) {
  evt.stopPropagation();
  evt.preventDefault();

  var files = evt.dataTransfer.files; // FileList object.

  // files is a FileList of File objects. List some properties.
  var output = [];
  for (var i = 0, f; f = files[i]; i++) {
    output.push('
', escape(f.name), ' (', f.type || 'n/a', ') - ',
      f.size, ' bytes, last modified: ',
      f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
      '
');
    // Only process image files.
    if (!f.type.match('image.*')) {
      continue;
    }

    var reader = new FileReader();

    // Closure to capture the file information.
    reader.onload = (function(theFile) {
      return function(e) {
        // Render thumbnail.
        var span = document.createElement('span');
        span.innerHTML = [''
        ].join('');
        document.getElementById('list').insertBefore(span, null);
      };
    })(f);

    // Read in the image file as a data URL.
    reader.readAsDataURL(f);
  }
  document.getElementById('list').innerHTML = '
' + output.join('') + '
';
}

function handleDragOver(evt) {
  evt.stopPropagation();
  evt.preventDefault();
  evt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
}

// Setup the dnd listeners.
var dropZone = document.getElementById('drop_zone');
dropZone.addEventListener('dragover', handleDragOver, false);
dropZone.addEventListener('drop', handleFileSelect, false);

Drop files here

<output id="list"></output>


text:
Q: How do you join three or more records from the same table? I have table with a lot of data in it, and we would like a way to essentially flag certain documents to indicate that they are related to (x) other documents:
TABLE A
-----------
id
name
created_at
modified_at

Records:   id        name              created_at              modified_at
            1       arlo g    2020-04-29 12:30:00      2020-04-29 12:30:00
            2     kenny ws    2020-04-29 12:32:00      2020-04-29 12:32:00
            3      roger w    2020-04-29 12:36:00      2020-04-29 12:36:00
            4     frank lw    2020-04-29 12:41:00      2020-04-29 12:41:00
            5    depeche m    2020-04-29 12:43:00      2020-04-29 12:43:00
            6       manson    2020-04-29 12:46:00      2020-04-29 12:46:00

Now - assume a user is viewing document id 1. They want to tie it to documents 3 and 4.
If a user then opens document 1, the system can easily pull documents 3 and 4.

*

*On the same note - if a user opens document 3, they can easily pull documents 1 and 4.

Is this possible? I am not sure how to structure a query clause to pull the document ids for a given document, such that the list is the same each time no matter which one of those documents is queried on.

A:
If a user then opens document 1, the system can easily pull documents 3 and 4.
On the same note - if a user opens document 3, they can easily pull documents 1 and 4.

This looks like the relation have NO parent-child type. So the solution may be
CREATE TABLE r ( group_id INT UNSIGNED,
                 table_a_id INT UNSIGNED,
                 PRIMARY KEY (table_a_id)
              /* PRIMARY KEY (group_id, table_a_id) */
               );

So if you need in "if a user opens document 3, they can easily pull documents 1 and 4", then all 3 table_a values (1,3,4) must belong the same group.
The primary key selection is dependent by the fact does a definite document may belong to one group only or to more than one group.
When you need to obtain the whole group members by one member of a group you will use
SELECT t2.*
FROM table_a t1
JOIN r       r1   ON t1.id = r1.table_a_id
JOIN r       r2   ON r1.group_id = r2.group_id
JOIN table_a t2   ON r2.table_a_id = t2.id
WHERE t1.name = 'initial document name'

A: As this is a many-to-many relationship.
CREATE TABLE r (from INT UNSIGNED, to INT UNSIGNED, PRIMARY KEY(from,to));

Relations are fetch by aliasing the source tbl multiple times like
   SELECT t1.id, t1.name, t2.id, t2.created_at, t2.name
   FROM tbl t1
   LEFT JOIN r ON t1.id = r.from
   JOIN tbl t2 ON t2.id = r.to
   WHERE ...

So t1 and t2, are table aliases of tbl with the same fields, however their rows (not documents) are based on the join criteria.

A: This idea is to store related documents as a chain of links:
create table link
( x int not null primary key
, y int not null unique
);

insert into link (x,y) values (1,3),(3,4);

If we were to add a link we attach it either first or last. I.e
insert into chain (x,y) values (5,1);

or:
insert into link (x,y) values (4,5);

If we remove one document (say 3), we delete one link and update the other.
The transitive closure of link is how all documents are related to each other:
with recursive backward as (
  select 1 as x, 0 as iter
  union all
  select l.x, iter + 1 from link l join backward b on l.y = b.x
),   forward as (
  select 1 as x, 0 as iter
  union all
  select l.y, iter + 1 from link l join forward b on l.x = b.x
)
select x from forward where iter > 0
union
select x from backward where iter > 0

The document in question is used as a seed for the two recursive CTE:s:
select 1 as x, 0 as iter

If the closure of a document is supposed to be reflexive, i.e. contain itself, just remove the predicate where iter > 0
Fiddle
If you are on a version less than 8, or if you have large chains where recursive queries are to slow, you may consider some kind of Incremental Evaluation System (IES). The idea is quite simple, we create a table for the transitive closure of link:
create table tc
( x int not null
, y int not null
, primary key (x,y)
);

Now, whenever a chain is modified, the TC must change accordingly. A trigger that detects insert of links may be implemented as:
delimiter //
create trigger ira_link
after insert on link
for each row
begin
    insert into tc (x,y)
    select NEW.x, NEW.y
    union all
    select tc.x, NEW.y from tc where NEW.x = tc.y
    union all
    select NEW.x, tc.y from tc where NEW.y = tc.x
;
end //
delimiter ;

insert into link (x,y) values (1,3);
insert into link (x,y) values (3,4);
insert into link (x,y) values (0,1);
insert into link (x,y) values (4,5);
insert into link (x,y) values (6,7);

We may ask for what documents that is related to 3 with:
select x from tc where y = 3
union
select y from tc where x = 3;

0
1
4
5

or with the slightly shorter:
select case when x = 3 then y else x end
from tc where 3 in (x,y);

It is a pity that functions that return tables are not implemented, something like:
select * from get_tc(3)

would be a nice abstraction
I'll leave the triggers for DELETE, UPDATE as an exercise for the reader. I could not use the previous link due to restrictions for triggers, but you can use https://www.db-fiddle.com/


text:
Q:  doesn't work inside a table ? I have a problem getting an <asp:UpdatePanel..> to work inside a
..

 structure and I don't know why. When the UpdatePanel is commented out everything works fine, but when I un-comment the UpdatePanel the contents of the

 tag doesn't even show up in Visual Studio 2010. This content does display when I run the web page but the UpdatePanel doesn't work. Non of my other web pages in this project have this problem but, then again, I use
s instead of
s in them.
One other thing. The  is in my MasterPage.
Here is my script:

<asp:UpdatePanel ID="W9UpdatePanel" runat="server" UpdateMode="Always">
    <ContentTemplate>

W-9 Information:

             <asp:Button ID="btnDownloadW9Pdf" runat="server"
             Text="Download W-9"  onclick="btnDownloadW9Pdf_Click" AutoPostBack="True" />
             <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator24"
              runat="server" ControlToValidate="txtFirstPaymentAmount" Display="Dynamic"
              ErrorMessage="The dollar amount you entered is in the wrong format."
              ForeColor="Red" ValidationExpression="^\d+(\.\d\d)?$">*</asp:RegularExpressionValidator>--%>
              <asp:CheckBox ID="chkW9FormSubmitted" runat="server" AutoPostBack="True"
              oncheckedchanged="chkW9FormSubmitted_CheckedChanged"
              Text=" I have submitted this W-9 Form" />

    </ContentTemplate>
</asp:UpdatePanel>

The event fires for both the button and the checkbox but the entire page is refreshed.
Thanks for your help.

A: UpdatePanel needs to render a div or span in order to function correctly. Since neither of these elements can be rendered between table rows, UpdatePanel does not have a placeholder to render the postback response html, and thus it doesn't work.
A workaround in your case may be to see which part of your page does not need to be inside the update panel and leave it outside. You could leave just the contents of  inside the UpdatePanel.

A: <asp:ScriptManager ID="scm" runat="server">
</asp:ScriptManager>
<fieldset>
<legend>Truck Master Entry Form</legend>
<asp:UpdatePanel ID="upd1" runat="server">
<ContentTemplate>

                        Truck no :

                        <asp:TextBox ID="truckno" runat="server" Width="120px" Height="20px" />

                        Size :

                        <asp:DropDownList ID="drptrucksize" runat="server" Width="120px" Height="20px" DataValueField="WEIGHT"
                            DataTextField="SIZE" OnSelectedIndexChanged="drptrucksize_SelectedIndexChanged"
                            AutoPostBack="true" />

                        Type :

                        <asp:TextBox ID="txttrucktype" runat="server" Width="120px" Height="20px" />

                        Weight :

                        <asp:TextBox ID="txtweight" runat="server" Width="120px" Height="20px" />

                        <asp:Button ID="btnsave" runat="server" Text="Save" Width="100px" Height="50px" />
                        <asp:Button ID="btncancel" runat="server" Text="Cancel" Width="100px" Height="50px" />

        </ContentTemplate>
    </asp:UpdatePanel>

A: The update panel need to be put outside the table. Look at
Mohammad Shahnawaz's code.