text:
Q: States not getting stored in database using city-state gem in ruby on rails so I am using a gem called city-state gem in my web application to populate a dropdown list with the 50 states of US, but I am unable to save the selected value in the database,maybe I am missing something here, I have the following code:
<%= form_for(resource, as: resource_name, :class=>'well form-horizontal' ,:style=>"margin-top:30px",url: registration_path(resource_name)) do |f| %>
  <select name="form[state]">
    <% CS.states(:us).each do |key, value| %>
      <option value="<%= key %>"><%= value %></option>
    <% end %>
  </select>
<% end %>

I tried using
<%= f.select :state, value %>

but that would give me an empty dropdown list, any help appreciated.Thanks in advance.
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓","authenticity_token"=>"w1dXvna7zYZ96f9pNtCdm3ruIHu/J9+kXZ6rxoPy+7QJCqTDAs+Y1ZcOgUvRiJEEZpyJ3S0qpLEbfoKEr+15bw==", "user"=>{"firstname"=>"Han", "lastname"=>"Park", "gender"=>"Male", "dob(1i)"=>"1996", "dob(2i)"=>"12", "dob(3i)"=>"6", "ssn"=>"1432229824", "driver_license"=>"D768765764", "street_address"=>"1000 north", "city"=>"New York", "zip"=>"60098", "email"=>"han@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "tandc"=>"true"}, "state"=>"MD", "commit"=>"Sign Up"}
DEPRECATION WARNING: ssn is not an attribute known to Active Record. This
behavior is deprecated and will be removed in the next version of Rails. If
you'd like ssn to be managed by Active Record, add `attribute :ssn to your
class. (called from block in attr_encrypted at /Users/reynold/.rvm/gems/ruby-
2.2.2/gems/attr_encrypted-
3.0.3/lib/attr_encrypted/adapters/active_record.rb:75)
(0.3ms)  BEGIN
User Exists (0.8ms)  SELECT  1 AS one FROM "users" WHERE "users"."email" = $1
LIMIT $2  [["email", "han@saveup.com"], ["LIMIT", 1]]
SQL (6.2ms)  INSERT INTO "users" ("email", "encrypted_password", "created_at",
"updated_at", "firstname", "lastname", "gender", "encrypted_ssn",
"encrypted_ssn_iv", "street_address", "city", "zip", "driver_license",
"tandc", "dob") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12,
$13, $14, $15) RETURNING "id"  [["email", "han@saveup.com"],
["encrypted_password",
"$2a$11$asC6.rG.aYUXJa8Ps.Gbeu3FzTFw64urmIB2KK9rxj94sH71gXaYm"],
["created_at", "2017-12-06 22:17:55.383121"], ["updated_at", "2017-12-06
22:17:55.383121"], ["firstname", "Han"], ["lastname", "Park"], ["gender",
"Male"], ["encrypted_ssn", "eWjL/lDpivR3T9cXx1w6rg==\n"], ["encrypted_ssn_iv",
"Rt/5Tl6PkwvqOjDC9nN1ng==\n"], ["street_address", "1000 north"], ["city",
"New York"], ["zip", "60098"], ["driver_license", "D768765764"], ["tandc",
"t"], ["dob", "1996-12-06"]]
(0.6ms)  COMMIT
(0.3ms)  BEGIN
SQL (2.4ms)  UPDATE "users" SET "sign_in_count" = $1, "current_sign_in_at" =
$2, "last_sign_in_at" = $3, "current_sign_in_ip" = $4, "last_sign_in_ip" = $5,
"updated_at" = $6 WHERE "users"."id" = $7  [["sign_in_count", 1],
["current_sign_in_at", "2017-12-06 22:17:55.397080"], ["last_sign_in_at",
"2017-12-06 22:17:55.397080"], ["current_sign_in_ip", "127.0.0.1/32"],
["last_sign_in_ip", "127.0.0.1/32"], ["updated_at", "2017-12-06
22:17:55.398231"], ["id", 18]]
(0.5ms)  COMMIT
Redirected to http://localhost:3000/
Completed 302 Found in 276ms (ActiveRecord: 11.1ms)

Started GET "/" for 127.0.0.1 at 2017-12-06 16:17:55 -0600
User Load (0.8ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1
ORDER BY "users"."id" ASC LIMIT $2  [["id", 18], ["LIMIT", 1]]
Processing by HomeController#roothome as HTML
Rendering home/roothome.html.erb within layouts/application
Rendered shared/_comparechart.html.erb (1.0ms)
Rendered shared/_disclaimer.html.erb (0.7ms)
Rendered home/roothome.html.erb within layouts/application (8.1ms)
Rendered _navbar.html.erb (4.6ms)
Completed 200 OK in 478ms (Views: 474.8ms | ActiveRecord: 0.0ms)

A: Instead of building out the form tag and options manually wouldn't it be cleaner to let rails do it? This would also have fixed the name issue for you:
<%= form_for(resource, as: resource_name, :class=>'well form-horizontal' ,:style=>"margin-top:30px",url: registration_path(resource_name)) do |f| %>
  <%= f.select :state, CS.states(:us) %>
<% end %>

Rails will also handle populating the current value when editing for you this way.

A: I'm guessing (since you didn't show us your controller code) that you expect state to be a part of the user params. But, as you can see, it is not:
{
  "utf8"=>"✓",
  "authenticity_token"=>"w1dXvna7zYZ96f9pNtCdm3ruIHu/J9+kXZ6rxoPy+7QJCqTDAs+Y1ZcOgUvRiJEEZpyJ3S0qpLEbfoKEr+15bw==",
  "user"=>{
    "firstname"=>"Han",
    "lastname"=>"Park",
    "gender"=>"Male",
    "dob(1i)"=>"1996",
    "dob(2i)"=>"12",
    "dob(3i)"=>"6",
    "ssn"=>"1432229824",
    "driver_license"=>"D768765764",
    "street_address"=>"1000 north",
    "city"=>"New York",
    "zip"=>"60098",
    "email"=>"han@gmail.com",
    "password"=>"[FILTERED]",
    "password_confirmation"=>"[FILTERED]",
    "tandc"=>"true"
  },
  "state"=>"MD",
  "commit"=>"Sign Up"
}

I think it's because you do:
<select name="form[state]">

You probably want something like:
<select name="user[state]">

I'm not sure about that syntax, so you'll have to monkey with it.


text:
Q: How to include images in a jekyll project hosted on github? I'm building a blog using jekyll and hosting it on github with gh-pages. The root of my project can be see seen below:
├── LICENSE
├── README.md
├── _config.yml
├── _img
│   ├── 2016-09-09\ 14.48.20.png
│   └── 2016-09-09\ 15.25.09.png
.
.
.
├── _posts
│   ├── 2016-09-08-seven-weeks-before-applying-to-devops-job.markdown
│   └── 2016-09-09-an-hour-with-ansible.md
.
.
.
├── _site
│   ├── 2016
│   │   └── 09
│   │       ├── 08
│   │       │   └── seven-weeks-before-applying-to-devops-job.html
│   │       └── 09
│   │           └── an-hour-with-ansible.html
│   ├── LICENSE
│   ├── README.md
│   ├── about
│   │   └── index.html
│   ├── css
│   │   └── main.css
│   ├── feed.xml
│   └── index.html
├── about.md
├── css
│   └── main.scss
├── feed.xml
└── index.html

The documentation gives the following example:

Because of Jekyll's flexibility, there are many solutions to how to do this. One common solution is to create a folder in the root of the project directory called something like assets or downloads, into which any images, downloads or other resources are placed. Then, from within any post, they can be linked to using the site's root as the path for the asset to include. Again, this will depend on the way your site's (sub)domain and path are configured, but here are some examples (in Markdown) of how you could do this using the site.url variable in a post.

Including an image asset in a post:
... which is shown in the screenshot below:
![My helpful screenshot]({{ site.url }}/assets/screenshot.jpg)

I've tried several different ways but non are working once I push gh-pages up:
![]({{ site.github.url }}/_img/2016-09-09 14.48.20.png)

![]({{ site.url }}/_img/2016-09-09 15.25.09.png)

I've also tried "keeping" the _img directory by putting the following in my _config.yaml
# Build settings
markdown: kramdown

keep_files: ["_img"]

But this also is not working. So how do I include images in a jeykll project hosted on github?
Thanks for your help :)

A: Every folder beginning with an underscore won't be copied to the build destination. The most common way is to store images is to add them to a assets/img folder.
If you want to use _img you have to add to your _config.yml:
include:
  - "_img"

A: *

*Create a folder for your images, you can name it according to your wish (mine is "images")

*Find the image address of that image that you want to include in your post
(You can do that by going to your folder image and right click on your image, then copy image address)

*Now you use that address in your post without any problem.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Video pixelated issue in Wowza RTSP streaming using Amazon S3 I am using Wowza streaming server (VODS3) on Amazon EC2 and files on S3 bucket.
Videos are played via RTSP.
RTSP is working fine, but the video quality is not good. Video gets pixelated in between.
I've taken Wowza from Amazon market place.
Do I need to set any configuration or something else?

A: I would suggest trying the default sample.mp4 file that comes with your install of Wowza.  Upload that to your s3 account and try playing that back and see if there is a difference? You might use ffmpeg to encode your custom files prior to uploading to s3 to ensure smooth playback.  If you are playing back on Android device, you may also try (depending on manufacturer and version) hls playback.


text:
Q: Show that the generators of the adjoint representation of $U(N)$ are hermitian. I'm trying to show that the generators of the adjoint representation of $U(N)$ are hermitian. I know that;
$$
U(N) \ = \ \left\{ \ U \in \mathbb{M}_{N \times N}(\mathbb{C})\ | \ U^{\dagger} = U^{-1} \ \right\} \\
\mathfrak{u}(N) \ = \ \left\{ \ T \in \mathbb{M}_{N \times N}(\mathbb{C})\ | \ T^{\dagger} = -T\ \right\}
$$
Bear with me because I've been taught what the adjoint representation is by physicists (lol).
I'm told it's the representation such that $\mathrm{Ad}_{g}(T_{a}) = g T^{a} g^{-1}$, where $g \in U(N)$ and $T^{a}$ are the generators of $\mathfrak{u}(N)$. Supposedly we treat the Lie algebra $\mathfrak{u}(N)$ as the vector space over which the Lie Group acts.
My question is, how do I even determine WHAT the generators of the adjoint representation are? I have no clue how to start doing this question. (Surely the generators of the adjoint representation are not just $T^{a}$? This seems too simple.)


text:
Q: Reading iso-8859-1 rss feed C# WP7 I'm trying to read a rss feed which uses the iso-8859-1 encoding.
I can get all elements fine, the problem is when I put it in a textblock it will not show all characters. I'm not sure what i'm doing wrong. i've tried a few solutions I found on google but this didn't work for me. I must be missing something.. It's also the first time I really work with anything other than utf-16. I never had to convert anything before.
The app works as follows I downloadstring async(WebClient). So when that is called I get a string containing the complete rss feed.
I have tried getting the bytes, then encoding.convert.. But I must be missing something.
Like this is a sample
        WebClient RSS = new WebClient();
        RSS.Encoding = Encoding.GetEncoding("ISO-8859-1");
        RSS.DownloadStringCompleted += new         DownloadStringCompletedEventHandler(RSS_DSC);
        RSS.DownloadStringAsync(new Uri("some rss feed"));

public void RSS_DSC(object sender, DownloadStringCompletedEventArgs args)
    {

        _xml = XElement.Parse(args.Result);
        foreach(XElement item in _xml.Elements("channel").Elements("item"))
                {
                   feeditem.title = item.Element("title").Value;
                      // + all other items

                }
    }

I've tried this aswell
private void RSS_ORC(object sender, OpenReadCompletedEventArgs args)
    {
        Encoding e = Encoding.GetEncoding("ISO-8859-1");

        Stream ez = args.Result;

        StreamReader rdr = new StreamReader(ez, e);
        XElement _xml = _xml = XElement.Parse(rdr.ReadToEnd());
        feedlist = new List<Code.NewsItem>();

        XNamespace dc = "http://purl.org/dc/elements/1.1/";
        foreach (XElement item in _xml.Elements("channel").Elements("item"))
        {

            Code.NewsItem feeditem = new Code.NewsItem();
            feeditem.title = item.Element("title").Value;
            feeditem.description = item.Element("description").Value;
            feeditem.pubdate = item.Element("pubDate").Value;
            feeditem.author = item.Element(dc + "creator").Value;

            feedlist.Add(feeditem);
        }
        listBox1.ItemsSource = feedlist;
    }

Though titles contain characters that are not displayed well either. Like.. I can get the encoding to partially work. Instead of having these characters: the square with a question mark, a question mark or the singe square.
Don't get me wrong I'm a total beginner on this. But the solutions that has been posted on the web do not solve it for me.
Note that I removed the encoding part because it wasn't working :/
If someone would be able to help me that would be amazing.

A: You can specify an encoding by setting encoding before calling client.DownloadStringAsync:
webClient.Encoding = Encoding.GetEncoding("iso-8859-1")

In your code sample you do not create the XML doc anywhere. Are some code missing? You should initialize it with something like:
var xml = XDocument.Load((string)args.Result);

A: If it helps, you can use:
    var myString = HttpUtility.HtmlDecode(feeditem.description);

This way every special character will be decode, you can then display myString correctly

A: Windows Phone 7 and Silverlight does not support other encodings such as ISO-8859-1, they only support ASCII and the Unicode encoders.  For anything else you will need to use OpenReadAsync  to get a stream of bytes then apply your own implementation of an encoding.
This blog might be helpful to you in creating one.

A: ISO-8859-1 most definitely is supported in WP7. It is the only one of the ISO-8859-* encodings that is. I use an XmlReader to deserialize RSS streams and UTF-* and ISO-8859-1 are the only encodings that are supported by that class (windows-* and ISO-8859-2 and above throw exceptions in the XmlReader c'tor).
Try using an XmlReader like this (without specifying the encoding):
 using (XmlReader reader = XmlReader.Create(stream))
 {
     ...
 }

The XmlReader will get the encoding from the xml declaration in the stream.
You may still have problems displaying the upper half of the characters (above 0x80). I had this problem in feed me (my WP7 app) and used this little hack to fix things up:
    public static string EncodeHtml(string text)
    {
        if (text == null) return string.Empty;

        StringBuilder decodedText = new StringBuilder();
        foreach (char value in text)
        {
            int i = (int)value;
            if (i > 127)
            {
                decodedText.Append(string.Format("&#{0};", i));
            }
            else
            {
                decodedText.Append(value);
            }
        }
        return decodedText.ToString();
    }

It only works in a WebBrowser control of course, but that is the only place that I ever saw an incorrect display.
Hope this helps,
Calum

A: This worked for me when needing to decode the rss xml. It's generic enough so that it will support all encryption types supported by .NET
        WebClient wcRSSFeeds = new WebClient();
        String rssContent;

        // Support for international chars
        Encoding encoding = wcRSSFeeds.Encoding;
        if (encoding != null)
        {
            encoding = Encoding.GetEncoding(encoding.BodyName);
        }
        else
        {
            encoding = Encoding.UTF8;  // set to standard if none given
        }
        Stream stRSSFeeds = wcRSSFeeds.OpenRead(feedURL); // feedURL is a string eg, "http://blah.com"

        using (StreamReader srRSSFeeds = new StreamReader(stRSSFeeds, encoding, false))
        {
            rssContent = srRSSFeeds.ReadToEnd();
        }


text:
Q: Remote power shell through load balancer I want to connect to exchange server via remote Powershell. When I connect directly with server URL I am able to create the session. But in the production I have many instances of exchange server, So I have created loa balancer for them and tried to connect with load balancer URL through remote Powershell. But I am getting
Connecting to remote server failed with the following error message: WinRM cannot process the request. The following error occurred while using Kerberos authentication: The computer is unknown to Kerberos. Verify that the computer exists on the network, that the name provided is spelled correctly, and that the Kerberos configuration for accessing the computer is correct. The most common Kerberos configuration issue is that an SPN with the format HTTP/ is not configured for the target. If Kerberos is not required, specify the Negotiate authentication mechanism and resubmit the operation. For more information, see the about_Remote_Troubleshooting Help topic.

A: Have you tried use IP address to connect to remote powershell? Are you able to telnet to port which you used?
In addition, you can have a read of this article to learn a bit more about selective trusts and whether or not it's affecting you.
A similar case for your reference.


text:
Q: How to draw gradient in SKShapeNode? I am trying to draw gradient in SKShapeNode object.
I draw a triangle with a color using alpha component and it works fine. And I would like to add gradient so one edge of the triangle disappears slowly to the background. What I want to achieve is to simulate sight range of a character.
I have found one answer regarding this challenge: How to apply a gradient to SKShapeNode created from a path, but the answer doesn't work in XCode 13.1.
The reason is that proposed solution of adding SKTexture can't be compiled:
var testTexture = SKTexture(size: CGSize(width: 200, height: 1), color1: CIColor(red: 1.0, green: 0.0, blue: 1.0, alpha: 1.0), color2: CIColor(red: 1.0, green: 0.0, blue: 1.0, alpha: 0.0), direction: GradientDirection.Left)

It results in the error "Cannot find 'GradientDirection' in scope...". And I cannot find any other method to add gradient.
I have found another answer which says that it isn't possible, but it is from 2013, so maybe something changed (How to create a Gradient in Spritekit?).
I also tried this solution: https://augmentedcode.io/2017/11/12/drawing-gradients-in-spritekit/, but it doesn't produce any effect and decreases performance of the application.

A: Some sources from the internet directed my to OpenGL Shading Language: https://www.khronos.org/opengl/wiki/Core_Language_(GLSL).
Here is partly solution:
let sight = SKShapeNode()
let gradientShader = SKShader(source: "void main() {" +
                                          "float distanceFromCenter = distance(v_tex_coord, vec2(0.5,0.5));" +
                                          "gl_FragColor = vec4(0.6, 0.3, 0.0, distanceFromCenter*6.0);" +
                                          "}")
sight.fillColor = .clear
sight.fillShader = gradientShader

Here are helpful links: Drawing a circle with a shader in SpriteKit, https://thebookofshaders.com/02/, Add shader for SKShapeNode, https://developer.apple.com/documentation/spritekit/skshapenode/controlling_shape_drawing_with_shaders.
The above solution was half way, but after another couple of hours I managed to achieve what I wanted to.

let pos = n.sprite.position
let frame = n.sight.frame
let x = (pos.x - frame.minX) / frame.width
let y = (pos.y - frame.minY) / frame.height
let gradientShader = SKShader(source: "void main() {" +
                                          "float distanceFromCenter = distance(v_tex_coord, npcLocation);" +
                                          "float alpha = 0.8 - distanceFromCenter;" +
                                          "if (alpha < 0) { alpha = 0.0;}" +
                                          "gl_FragColor = vec4(0.0, 0.0, 0.0, alpha);" +
                                          "}")
  gradientShader.uniforms = [SKUniform(name: "npcLocation", vectorFloat2: vector_float2(Float(x), Float(y)))]
  n.sight.fillColor = .clear
  n.sight.fillShader = gradientShader


text:
Q: How prove $(x-1)^4(x-2)^4\cdots(x-2013)^4+2014$ is reducible?
Let $$f(x)=(x-1)^4(x-2)^4(x-3)^4\cdots(x-2013)^4+2014\tag{1}$$
Prove or disprove: $f(x)$ is reducible on the field of rational numbers $Q$.

this problem is background from this :
How to prove that $f(x)=(x-1)^2(x-2)^2(x-3)^2\cdots(x-2013)^2+2014$ is reducible?
and  Dear Michael Zieve use nice methods to solve it.
then I find this similar
problem is from :(George Polya,《Problems and Theorems in Analysis II》)
show that: $$(x-1)^4(x-2)^4\cdots(x-2013)^2+1$$ is also irreducible.
He post this solution on $page 327$.
let $$p_{0}(x)=(x-1)(x-2)\cdots(x-2013)$$
then
$$p^4_{0}(x)+1=[1-p_{0}P_{-1}(x)][1-p_{0}(x)P_{1}(x)]$$
where $p_{-1}(x)$ and $p_{1}(x)$ are polynomial with integral coefficients and with leading cofficient $-1$.and so on,you can download this book see full solution,
But my problem I can't,Thank you.
my try:
$$p^4_{0}(x)+2014=[A+p_{0}(x)P_{-1}(x)][B+p_{0}(x)P_{1}(x)]$$

A: This polynomial is irreducible.  This follows from the argument in my answer to this MO question.  Namely, write
$$p(x):=(x-1)(x-2)\dots (x-2013).$$  Exactly as in my MO answer, if $p(x)^4+2014$ is reducible over $\mathbf{Q}$ then $p(x)^2-\sqrt{-2014}$ is reducible over $\mathbf{Q}(\sqrt{-2014})$.  Say the factorization is $p(x)^2-\sqrt{-2014}=g(x)h(x)$ where we may assume that $g(x)$ and $h(x)$ are monic.  Then, as in my MO answer, the roots and hence the coefficients of $g$ and $h$ must be algebraic integers, so $g,h\in\mathbf{Z}[\sqrt{-2014}][x]$.  Thus, for $1\le i\le 2013$, we have
$$
-\sqrt{-2014} = p(i)^2-\sqrt{-2014} = g(i)h(i),
$$
so that $g(i)$ divides $\sqrt{-2014}$ and hence (again as in the MO answer) $g(i)\in\{\pm 1,\pm\sqrt{-2014}\}$.
If $g(i)=g(1)$ for every $i=1,2,\dots,2013$, then $g(x)-g(1)=p(x)G(x)$ for some $G\in\mathbf{Z}[\sqrt{-2014}][x]$.  Since $g(i)h(i)=\sqrt{-2014}$, it follows that $h(i)=h(1)$ for every $i=1,2,\dots,2013$, so that $h(i)-h(1)=p(x)H(x)$ for some $H\in\mathbf{Z}[\sqrt{-2014}][x]$.  Now $$p(x)^2-\sqrt{-2014}=g(x)h(x)=(g(1)+p(x)G(x))\cdot (h(1)+p(x)H(x)).$$
Equating leading terms on both sides (and recalling that $g$ and $h$ are nonconstant) implies that $G=H=\pm 1$.  Subtracting $p(x)^2$ from both sides gives
$$
-\sqrt{-2014} = g(1)h(1) + p(x)\cdot G\cdot (g(1)+h(1)),
$$
so we must have $g(1)=-h(1)$ and $g(1)^2=\sqrt{-2014}$, which is impossible.
Hence we have $g(i)\ne g(j)$ for some $i,j$ with $1\le i<j\le 2013$.  This gives a contradiction in exactly the same way as in my MO answer: first, it follows that $g(r)\ne g(s)$ for some $r,s$ with $1\le r < s\le 2013$ and $s>r+2$.  But $s-r$ divides $g(s)-g(r)$ in $\mathbf{Z}[\sqrt{-2014}]$, where $s-r$ is an integer $\ge 3$ and $g(s)-g(r)$ is the difference between two distinct elements in $\{\pm 1,\pm\sqrt{-2014}\}$, which is impossible.
Note: the same argument yields irreducibility of $\prod_{i=1}^n (x-a_i)^4 + d$ whenever the $a_i$ are distinct integers, $n\ge 6$, and $d$ is a squarefree integer such that $d>1$ and $d\not\equiv 3\pmod{4}$.  Presumably this is the result that Wegner proved (as in user68061's comment to the present question).


text:
Q: Why doesn't the IMG scale maintaining aspect-ratio? CSS So I am trying to put some PNG files/Logos side-by-side in one line. I used flexbox for this purpose. However, the aspect ratio of the files is not correct. When I increase the Width, the size increases, however, it takes up the full Height and the aspect ratio breaks down.
The HTML:
`

`
The CSS:
`
.companyLogos {
        width: 96%;
        margin: 0 auto;
        display: flex;
        justify-content: space-evenly;
    }

    .companyLogos img {
        width: 8%;
    }

`

I am trying to do this:

A: You have to set object-fit: contain like this:

.companyLogos {
  width: 96%;
  margin: 0 auto;
  display: flex;
  justify-content: space-evenly;
}

.companyLogos img {
  width: 8%;
  object-fit: contain;
}

I hope this will help you.

A: Following two approaches would be useful-
1. Using object-fit: contain-
If we use object-fit: contain; the image keeps its aspect ratio, but is resized to fit within the given dimension.

.companyLogos {
  width: 96%;
  margin: 0 auto;
  display: flex;
  justify-content: space-evenly;
}

.companyLogos img {
  width: 8%;
  object-fit: contain;
}

2. Using object-fit: cover-
If we use object-fit: cover; the image keeps its aspect ratio and fills the given dimension. The image will be clipped to fit.

.companyLogos {
  width: 96%;
  margin: 0 auto;
  display: flex;
  justify-content: space-evenly;
}

.companyLogos img {
  width: 8%;
  object-fit: cover;
}


text:
Q: Incrementing a function with two parameters with a FOR loop Okay so the instructions are to create a function with two parameters. A start number and a increment number. The For loop is supposed to start at the 'startNum' and it is is supposed to increment a number of times (specified by the second parameter in the function). I am still new to programming and especially loops so to my understanding of them I feel that this should work. I have tried this for a day now with many different ways and can't seem to figure it out. Some suggestions would be helpful!
function myLoop(startNum,increment) {
  for (i = startNum; i >= increment; i++);
}
console.log(myLoop(2,14));

These are the official instructions for this problem:
Create a function called myLoop that takes in two parameters.
The first parameter should represent a starting number and the second is how many times the starting number should be incremented.
Use a for loop to increment the first parameter a number of times equal to the second parameter.  Then return the modified number.
For example, if the first parameter is 3 and the second parameter is 4, the number three should be increased by one each time the for loop runs, and the for loop should run 4 times. This should return the number 7

A: If you simply wants to return the number, then simply the following will do
function myLoop(startNum,increment)
{
  return startNum + increment;
}

However, there were some issues with the code you had shared, it should be
function myLoop(startNum,increment) {
  for (i = startNum; i >= ( increment + startNum ); i++); //observe that <= is replaced with >= and increment with ( increment + startNum )
  return i;
}

A: Not sure if that's what you wanted?

function myLoop(startNum,increment) {
  for (i = 0; i < increment; i++){
    startNum++;
  };

  return startNum;
  }
console.log(myLoop(2,14));


text:
Q: Images embedded in Articles not being displayed in migrated Joomla website Images embedded in Articles not being displayed in migrated Joomla website
I have migrated a Joomla 3.7.2 website from an old server to a new server using a particularly messy  technique. Basically, I exported the database and then copied the important folders and it all worked remarkably well barring one very specific feature. Articles with images in them no longer display the images in the new site.
I have System - SEF enabled in both sites (and switching it off makes no difference)
I use JCE and in code view the typical line displaying the image looks like this:

In both sites.
JCE is configured to use Relative URLs in both sites. If I turn that OFF then I get the image displayed in the new site. Of course that's just a hack around the problem not a solution to it.
Path to Files Folder, and Path to Images Folder is set to images in both sites.
HTML inspector on the old site shows the

And on the new site

And if you hover over the url it says "could not load the image". The missing first '/' is clearly the problem but what is it that puts it there after the article is saved by the editor and before the html is displayed in the browser?

A: Slightly embarrassed to pretend this is an answer but today I got the prompt to update Joomla to 3.7.3 and of course immediately afterwards the problem has gone away.


text:
Q: The Correct Way to Wrap a Button with a Link Fairly new to coding html and css and want to make sure I'm keeping my code clean and closing tags correctly.
I'm working with an html template and trying to correctly create links from my buttons.
The way I've wrapped them in Brackets is working properly on the page and the links are working correctly, but Brackets is showing some red tags meaning I've not wrapped something properly.
Could someone show me where I'm doing this incorrectly, as I'd like to follow good code form moving forwards.
Thanks so much.
Current code for the button below:

 <a href="contact_us.html"<button class="button -blue -bordered">Contact Us</button>

A: You need to close your link tag:

  <button class="button button-blue button-bordered">
    Contact Us
  </button>

BUT I wouldn't wrap a button with a link and instead style the link as a button.

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
Contact Us

Also look at this answer as Our_Benefactors stated in the comments: How to create an HTML button that acts like a link?

A: There is a small mistake actually.
You forget > for  tag.
Try this.

   <button class="button -blue -bordered">
       Contact Us
   </button>

A: You are missing a > bracket for the HREF.

     <button class="button -blue -bordered">

              Contact Us

      </button>


text:
Q: Android edittext with shadow like cardview I have tried to implement edittext with shadow like the https://www.google.com.gh/imghp using this layerd xml
<?xml version="1.0" encoding="utf-8"?>

<!-- most important is order of layers -->

<!-- Bottom right side 2dp Shadow -->
<item>
    <shape android:shape="rectangle" >
        <solid android:color="#d8d8d8" />

        <corners
            android:bottomLeftRadius="7dp"
            android:bottomRightRadius="7dp" />
    </shape>
</item>

<!-- White Top color -->
<item android:bottom="3px"
    android:left="3px"
    android:right="3px">
    <shape android:shape="rectangle" >
        <solid android:color="#FFFFFF" />

        <corners
            android:bottomLeftRadius="10dp"
            android:bottomRightRadius="10dp" />
    </shape>
</item>

.but have not succeded. can anyone place help

A: Try this into layer-list drawable file-
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Drop Shadow Stack -->
    <item>
        <shape>
            <padding android:top="1dp" android:right="1dp" android:bottom="2dp" android:left="1dp" />
            <corners android:radius="5dp" />
            <solid android:color="#00CCCCCC" />
        </shape>
    </item>
    <item>
        <shape>
            <padding android:top="1dp" android:right="1dp" android:bottom="2dp" android:left="1dp" />
            <corners android:radius="5dp" />
            <solid android:color="#10CCCCCC" />
        </shape>
    </item>
    <item>
        <shape>
            <padding android:top="1dp" android:right="1dp" android:bottom="2dp" android:left="1dp" />
            <corners android:radius="5dp" />
            <solid android:color="#20CCCCCC" />
        </shape>
    </item>
    <item>
        <shape>
            <padding android:top="1dp" android:right="1dp" android:bottom="2dp" android:left="1dp" />
            <corners android:radius="5dp" />
            <solid android:color="#30CCCCCC" />
        </shape>
    </item>
    <item>
        <shape>
            <padding android:top="1dp" android:right="1dp" android:bottom="2dp" android:left="1dp" />
            <corners android:radius="5dp" />
            <solid android:color="#50CCCCCC" />
        </shape>
    </item>

    <!-- Background -->
    <item>
        <shape>
            <solid android:color="#ffffff" />
            <corners android:radius="0dp" />
        </shape>
    </item>
</layer-list>

A: Check this code:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<!-- most important is order of layers -->

<!-- Bottom right side 2dp Shadow -->
<item >
    <shape android:shape="rectangle">
        <solid android:color="#000000" />
    </shape>
</item>

<!-- Bottom 2dp Shadow -->
<item>
    <shape android:shape="rectangle">
        <solid android:color="#BEBEBE" />
    </shape>
</item>

<!-- White Top color -->
<item android:bottom="3px" android:right="3px" android:top="3px" android:left="3px">
    <shape android:shape="rectangle">
        <solid android:color="#FFFFFF" />
    </shape>
</item>


text:
Q: Observable.create(...).map is not a function I just learn Pluralsight - Getting Started with Reactive Programming with RxJS
Why not work?
I use RXJS 6.2.0
import {Observable} from 'rxjs';

const numbers = [1, 5, 10];
const source = Observable.create(observer => {

  let index = 0;
  let produceValue = () => {
    observer.next(numbers[index++]);

    if (index < numbers.length) {
      setTimeout(produceValue, 2000);
    } else {
      observer.complete();
    }
  };

  produceValue();

}).map(n => n * 2)
  .filter(n => n > 4);

source.subscribe(
  value => console.log(`value: ${value}`),
  e => console.log(`error: ${e}`),
  () => console.log('complete')
);

A: I was doing the same course and was able to solve this using pipe and typing the variable in the parameters of the arrow functions, in the following way:
...
let source = Observable.create(observer => {

    let index = 0;
    let produceValue = () => {

        observer.next(numbers[index++]);

        if (index < numbers.length) {
            setTimeout(produceValue, 250);
        } else {
            observer.complete();
        }
    }

    produceValue();
}).pipe(
    map((n: number) => n * 2),
    filter((n: number) => n > 4)
);
...

Requiring using operators inside of pipe is a recent change on the way RxJs works, so some courses and references may be out of date.

A: as recommended on comment, you should use pipe now.
Your code edited :
import {Observable} from 'rxjs';
import {map, filter} from 'rxjs/operators';
const numbers = [1, 5, 10];
const source = Observable.create(observer => {

  let index = 0;
  let produceValue = () => {
    observer.next(numbers[index++]);

    if (index < numbers.length) {
      setTimeout(produceValue, 2000);
    } else {
      observer.complete();
    }
  };

  produceValue();

}).pipe(map<number, number>(n => n * 2),filter(n => n > 4)); // Here we pipe operators, you can provide any number of operators. or chain many pipe.

source.subscribe(
  value => console.log(`value: ${value}`),
  e => console.log(`error: ${e}`),
  () => console.log('complete')
);

online sample


text:
Q: How do I set splash screen and other activities in order at android manifest? I am trying to add my splash screen to appear first and then it will go to sign up page. My android manifest code is below. I know right now my intent default is on sign up and view is on splash. I tried my changing them in between. In that case, splash screen appears first and goes directly to mainactivity. Please help!

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mohsin.tourlog">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".SplashActivity"
            android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

        </activity>
        <activity android:name=".signin" />
        <activity android:name=".signup"
            android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
            <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter></activity>

        <activity android:name=".MainActivity">

        </activity>
    </application>

</manifest>

A: try this(like this you have to implement yours):
  <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="abhiandroid.com.splashscreen">

<application
android:allowBackup="true"
android:icon="@drawable/abhiandroid"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SplashActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity android:name=".signin"/>
<activity android:name=".MainActivity"/>

</application>

</manifest>

splash activity:
    public class SplashActivity extends Activity {

Handler handler;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splashfile);

    handler=new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent intent=new Intent(SplashActivity.this,MainActivity.class);
            startActivity(intent);
            finish();
        }
    },3000);

}
}

A: Remove your intent-filter from your "signup" activity.
from
 <activity android:name=".signup"
    android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter></activity>

to
<activity android:name=".signup"
    android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />

If you want to display your Splash Activity for a few seconds then proceed to your Signup. You'd likely want to use Handler class to wait for a few secs then call upon the activity using intent.

A: First, AndroidManifest is to define activity for the system.
You should set
<intent-filter>
      <action android:name="android.intent.action.MAIN" />

      <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

for your splash screen and in the splash screen set startActivity() whatever you want and whatever your condition.


text:
Q: youtube api V3 quota cost? - making an app that allows user to upload to their account If you set up a OAuth for Youtube within your app that allows users to upload videos, does each video cost towards your 10,000pt quota?
I run a personal uploading bot and it does 3ish uploads per day within the 10,000 point quota but if I was to scale out as an app this wouldn't work since 5 users would max it out.
So if a user approves your app for upload permissions, would this cost toward your clients 10,000pts or is it 10,000 points per user per day?
Also how easy is YouTube's quota expansion form process if it is the former?
https://support.google.com/youtube/contact/yt_api_form?hl=en

A: By checking the quota calculator you will be able to see what each call costs.  The vido.insert call for example costs 1600 quota.
If you check the google developer console and check your quota it might look something like this.

As you can see one of them states "per user" while the other does not.
Queries per day 10,000 is a project based quota. while Queries per minute per user is a user based quota.
It sounds like you should be applying for a quota extension if the 10,000 limit is not enough for your needs.

Also how easy is YouTube's quota expansion form process if it is the former?

Its a long process google says it takes twenty days my experience is three to six months average.  You need to be prepared to get a NO.  You also need to be prepared to have your quota shut down suddenly because they detect something they identity as spam or a violation.  In the event of a shutdown you will need to apply for a new extension.  Which again will take time.


text:
Q: How to display the form with all the fields of an object in edit mode in lightning? I have table which display the records of particular object and table shows only 4-5 fields also each row having edit button. I want to display the all the fields of that record in edit format after clicking on edit button.
Is this possible? Please suggest me any alternate way if this is not possible.

A: You can use force:recordEdit component

A force:recordEdit component represents the record edit UI for the specified recordId.

OR
force:editRecord event for your use case.

This event opens a page to edit the record specified by recordId.

Refer to the documentation on the component and event for implementation details and examples.


text:
Q: Using 1d CNN for time series classification of patchy time series I would like to apply 1d CNN like models for the patchy time series classification. For a LSTM like model, my plan to deal with the patchiness problem is to add a time column for the data. However, it not clear to me how to add this into the 1d CNN as the convolution should attempt to pre-process signals for the data, but I wouldn't expect it to do this for time.
Has anyone tried this before, any idea of how to input time into a 1d CNN?

A: Yes, people have tried this before. Please have a look at the following papers (I suggest in that order):

*

*Time Series Classification from Scratch with Deep Neural Networks: A Strong Baseline (https://arxiv.org/abs/1611.06455) [source code: https://github.com/cauchyturing/UCR_Time_Series_Classification_Deep_Learning_Baseline]

*Deep learning for time series classification: a review (https://arxiv.org/abs/1809.04356) [source code: https://github.com/hfawaz/dl-4-tsc]

More advanced methods (like transfer learning) on top of 1-D CNNs are discussed in the following papers:
3.) Timage -- A Robust Time Series Classification Pipeline (https://arxiv.org/abs/1909.09149) [source code: https://github.com/patientzero/timage-icann2019]
4.) InceptionTime: Finding AlexNet for time series classification (https://link.springer.com/article/10.1007/s10618-020-00710-y) [source code: https://github.com/hfawaz/InceptionTime]
Please also have a look at the corresponding repositories containing the source code for each approach.


text:
Q: How can I change the Glossed app icon? Before iOS 7 on the iPhone, there was an option in settings to turn off the gloss on apps, how can I do so on iOS 7?

A: If you're talking about the icons on your home screen, as a user there is no option to remove the gloss. This is a developer feature. As a developer you uploaded a raw icon and (by default) apple would add the gloss. You could turn this off if you wanted to add your own gloss (to add your own other effects), or if you just didn't want the gloss at all.
I've noticed that since going to iOS7, that MOST of the apps that had gloss, no longer do have gloss, but the occasional one does. This is obviously because the developer chose to add the gloss themselves and set the flag to have apple NOT add it. In this case, apple can't remove it.
Seems like apple thought ahead in this regard and it was simply a matter of turning this off to remove all glossed effects to match their new iOS.
However, in the case that any developer added it manually, there will be no way for you to remove it short of changing the icon which just isn't possible.


text:
Q: XSD import from file We are in the process of putting a wso2esb server in between our webservices and our customers. I'am having problems with imports and includes in the wsdl-files.
To make the migration simple, we thought we'd copy all the wsdl and xsd files we've got on to a directory on the esb server (but outside of the wso2esb software). In creating the services in the esb, I now refer to the wsdl-files using 'specify source WSDL'.
This does show a wsdl, but not (exactly) the one we've created. So we're using 'useOriginalwsdl=true', 'modifyUserWSDLPortAddress=true', 'showAbsoluteSchemaURL=true'.
In one of our wsdl we'ver got this piece of code:
<xs:schema targetNamespace="http: //www.egem.nl/StUF/wsdl/zkn0201.wsdl">
<xs:import schemaLocation="xsd/stuf0204.xsd" namespace="http://www.egem.nl/StUF/StUF0204"/>
<xs:import schemaLocation="xsd/zkn0201.msg.xsd" namespace="http://www.egem.nl/StUF/sector/zkn/0201"/>
</xs:schema>

with the above parameters set, this shows in the wsdl of the service as:
<xs:schema targetNamespace="http://www.egem.nl/StUF/wsdl/zkn0201.wsdl">
<xs:import namespace="http://www.egem.nl/StUF/StUF0204" schemaLocation="HAEM_TEST?xsd=xsd/stuf0204.xsd"/>
<xs:import namespace="http://www.egem.nl/StUF/sector/zkn/0201" schemaLocation="HAEM_TEST?xsd=xsd/zkn0201.msg.xsd"/>
 </xs:schema>

But when I query the wsdl with "http:// ...../sevices/HAEM_TEST?xsd=xsd/zkn0201.msg.xsd", it does not return the content of the xsd. Even though the xsd's are presenton disk relative to the actual wsdl used by the service:
On disk:
$ ls -lR /some/path/to/my/resource
 .:
  drwx------. 2 wnproesb01 wnproesb01  4096 Apr 17 23:15 xsd
  -rwx------. 1 wnproesb01 wnproesb01  9498 Apr 16 18:31 zkn0201.wsdl

./xsd:
   -rwx------. 1 wnproesb01 wnproesb01  13885 Apr 16 18:31 stuf0204.xsd
   -rwx------. 1 wnproesb01 wnproesb01  63982 Apr 16 18:31 zkn0201.msg.xsd

These xsd-files may have imports or includes themselves, given by a relative path compared to themselves.
The big question: what do I need to do, to make this wsdl a valid, working wsdl as presented by the wso2esb? Including all the included/imported xsd's.

A: You can use Registry to store WSDLs and then refer from there. Which is far more convenient than storing in file system.
http://madhukaudantha.blogspot.nl/2012/07/wso2-esb-proxy-from-registry.html
and also refer this on how to define the schema location for WSDL imports correctly.
WSO2 ESB 4.5.0 fails to create proxy service from governance registry


text:
Q: Mixed content warnings after changing site adress from HTTP to HTTPS I changed my site address from HTTP to HTTPS by simply changing the URL in Settings -> General (Wordpress address and Website address.) Absolutely no issue in the admin area, anything works fine.
What happens in the public facing portion of the website: there's a lot of "mixed content", so that Firefox complains the website isn't secure. I noticed (view source) almost any image that I have uploaded to the media gallery still is "rendered" with HTTP instead of HTTPS.
What can I do to serve the images, fonts, etc. with an HTTPS URL?
[UPDATE] I found a couple of issues can be fixed by editing two theme files with hardcoded "http://". Problem is with the images, if you don't want to alter the database there's apparently no solution

A: This is happening because WordPress saves URLs in content absolutely by default (meaning that it's actually got your urls saved as http://example.com in the database). So to fix this you'll want to run a search and replace in your database to fix those errors.
I like to use the plugin Better Search Replace because it has a nice feature to let you try out your search/replace as a dry run to test. There are lots of other search/replace methods, and you could also make the changes in PhpMyAdmin, but I'll just put instructions for using the Better Search Replace plugin.
Assuming you are using Better Search Replace:

*

*BACK UP YOUR DATABASE! Always always always. Use whatever tool you want to do this (UpdraftPlus, or dump (NOT DROP) it from PhpMyAdmin or straight from MySQL are all options).

*Head to tools > Better Search Replace

*Add the non SSL version of your website to the search field http (eg. http://example.com) and the SSL version of your website to the replace field

*Select the tables you want to update. Most likely all you'll need is the wp_posts and wp_postmeta table but you can add them all if you like. Just know that it could take longer and time out depending on your server specs.

*Do a dry run to make sure that it works

*If it works, then uncheck the dry run option and run it for real.

*Check your website to verify the errors have been fixed. If they have, awesome!

Note: Any time you search/replace there's a chance you could cause massive problems to your website. Hence step one, back up your website. If something goes wrong, you have a way to restore your data.

A: You will have to need to redirect all your traffics from HTTP to HTTPS. A rewrite rule can do this for you. Use this code instead of  WordPress's original rewrite rule (if you are not using cache) in your .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

There are plugins that can do this for you too, such as Easy HTTPS Rediction.

A: I used Better Search Replace and Really Simple SSL and the winner is:
Really Simple SSL
Just do this:

*

*Install it

*Activate it

*Allow SSL

Done
It also fixed all the problems with image redirection

A: Install this plugin: https://wordpress.org/plugins/http-https-remover/
Despite the name - HTTP / HTTPS Remover - the latest version will force all http to https, and your mixed content warnings will be gone.

A: I just moved my company site to the secure only version last Friday. I used the Really Simple SSL Plugin and then added a 301 redirect into my .htaccess file.
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Don't forget to also verify the HTTPS version of your site in Search Console / Webmaster Tools


text:
Q: Using a convert function within a case statement SQL Server I am trying to create SQL query to generate a report from my database.
Every five minutes or more a new entry is added to my DB, the length of that entry the time it had been taken and the shift when it was taken.
Formerly had this code:
SELECT
    SUM(DataEntry.Length) AS Length,
    COUNT(DISTINCT MicrotecDataEntry.DateTime) AS NumberTimeEntry,
    Shift,
    CONVERT(DATE, DATEADD(mi, -360, DateTime)) AS Expr1
FROM
    DataEntry
WHERE
    (DateTime > DATEADD(d, - 28, DATEADD(mi, 390, CONVERT(datetime, CONVERT(date, DATEADD(mi, - 390, GETDATE()))))))
    AND (DateTime < DATEADD(d, - 0, DATEADD(mi, 390, CONVERT(datetime, CONVERT(date, DATEADD(mi, - 390, GETDATE()))))))
GROUP BY  Shift,
    CONVERT(date, DATEADD(mi, - 360, MicrotecDataEntry.DateTime))

Our night shift is on two different days so to  keep it in one production day we remove 6 hours from that date so the night shift begins at 00:00 AM from that day.
But now for some reasons I must remove 12 hours for the night shift and 6 hours for the other shifts. So I would like to do something like :
SELECT
    SUM(ataEntry.Length) AS Length,
    COUNT(DISTINCT DateTime) AS NumberTimeEntry,
    MicrotecTimeQuarter.Shift,
    CASE
       WHEN MicrotecTimeQuarter.Shift = 'shift 2'
          THEN CONVERT(DATE, DATEADD(mi, -720, DateTime))
          ELSE CONVERT(DATE, DATEADD(mi, -360, DateTime))
    END AS Expr1
FROM
   DataEntry
MicrotecTimeQuarter.Id
WHERE
    (DateTime > DATEADD(d, - 7, DATEADD(mi, 390, CONVERT(datetime, CONVERT(date, DATEADD(mi, - 390, GETDATE()))))))
    AND (DateTime < DATEADD(d, - 0, DATEADD(mi, 390, CONVERT(datetime, CONVERT(date, DATEADD(mi, - 390, GETDATE()))))))

GROUP BY Shift,
    CASE
       WHEN Shift = 'shift 2'
          THEN CONVERT(DATE, DATEADD(mi, -720, DateTime))
          ELSE CONVERT(DATE, DATEADD(mi, -360, DateTime))
   END

But it seems the syntax is not correct and I get the message

MicrotechDataEntry.DateTime is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause

I'm new to SQL so I don't know where is the problem. Do have any idea about what causes the issue and how I can solve it? Thanks!

A: You can't use the DateTime field in your case statement as it is not part of the grouping. One solution is to get your calculated field in a subquery and the group at a higher level.
SELECT
    SUM(X.Length) AS Length,
    COUNT(DISTINCT MDE.DateTime) AS NumberTimeEntry,
    MTQ.Shift,
    Expr1
FROM
(
    SELECT
        MDE.DateTime,
        MDE.Length,
        MQT.Shift,
        Expr1 = CASE WHEN MTQ.Shift='shift 2'then    CONVERT(date, DATEADD(MINUTE, -    720, MDE.DateTime)) ELSE CONVERT(date, DATEADD(MINUTE, - 360, MDE.DateTime)) END
    FROM
        MicrotecDataEntry MDE
        INNER JOIN MicrotecTimeQuarter MTQ ON MDE.MicrotecTimeQuarterId = MTQ.Id
    WHERE
        (MDE.DateTime > DATEADD(d, - 7, DATEADD(mi, 390, CONVERT(datetime, CONVERT(date, DATEADD(mi, - 390, GETDATE()))))))
        AND
        (MDE.DateTime < DATEADD(d, - 0, DATEADD(mi, 390, CONVERT(datetime, CONVERT(date, DATEADD(mi, - 390, GETDATE()))))))
        AND
        (MDE.MicrotecProductId <> 4)
)AS X
GROUP BY
    Shift,
    Expr1


text:
Q: Searching serialized data, using active record I'm trying to do a simple query of a serialized column, how do you do this?
serialize :mycode, Array

1.9.3p125 :026 > MyModel.find(104).mycode
  MyModel Load (0.6ms)  SELECT `mymodels`.* FROM `mymodels` WHERE `mymodels`.`id` = 104 LIMIT 1
 => [43565, 43402]
1.9.3p125 :027 > MyModel.find_all_by_mycode("[43402]")
  MyModel Load (0.7ms)  SELECT `mymodels`.* FROM `mymodels` WHERE `mymodels`.`mycode` = '[43402]'
 => []
1.9.3p125 :028 > MyModel.find_all_by_mycode(43402)
  MyModel Load (1.2ms)  SELECT `mymodels`.* FROM `mymodels` WHERE `mymodels`.`mycode` = 43402
 => []
1.9.3p125 :029 > MyModel.find_all_by_mycode([43565, 43402])
  MyModel Load (1.1ms)  SELECT `mymodels`.* FROM `mymodels` WHERE `mymodels`.`mycode` IN (43565, 43402)
 => []

A: You can query the serialized column with a sql LIKE statement.
 MyModel.where("mycode LIKE '%?%'", 43402)

This is quicker than using include?, however, you cannot use an array as the parameter.

A: Good news! If you're using PostgreSQL with hstore (which is super easy with Rails 4), you can now totally search serialized data. This is a handy guide, and here's the syntax documentation from PG.
In my case I have a dictionary stored as a hash in an hstore column called amenities. I want to check for a couple queried amenities that have a value of 1 in the hash, I just do
House.where("amenities @> 'wifi => 1' AND amenities @> 'pool => 1'")

Hooray for improvements!

A: It's just a trick to not slow your application. You have to use .to_yaml.
exact result:
MyModel.where("mycode = ?", [43565, 43402].to_yaml)
#=> [#<MyModel id:...]

Tested only for MySQL.

A: Basically, you can't. The downside of #serialize is that you're bypassing your database's native abstractions. You're pretty much limited to loading and saving the data.
That said, one very good way to slow your application to a crawl could be:
MyModel.all.select { |m| m.mycode.include? 43402 }

Moral of the story: don't use #serialize for any data you need to query on.

A: Serialized array is stored in database in particular fashion eg:
[1, 2, 3, 4]
in
1\n 2\n 3\n etc

hence the query would be
MyModel.where("mycode like ?", "% 2\n%")

put space between % and 2.

A: There's a blog post from 2009 from FriendFeed that describes how to use serialized data within MySQL.
What you can do is create tables that function as indexes for any data that you want to search.
Create a model that contains the searchable values/fields
In your example, the models would look something like this:
class MyModel < ApplicationRecord
  # id, name, other fields...
  serialize :mycode, Array
end

class Item < ApplicationRecord
  # id, value...
  belongs_to :my_model
end

Creating an "index" table for searchable fields
When you save MyModel, you can do something like this to create the index:
Item.where(my_model: self).destroy
self.mycode.each do |mycode_item|
  Item.create(my_model: self, value: mycode_item)
end

Querying and Searching
Then when you want to query and search just do:
Item.where(value: [43565, 43402]).all.map(&:my_model)
Item.where(value: 43402).all.map(&:my_model)

You can add a method to MyModel to make that simpler:
def find_by_mycode(value_or_values)
  Item.where(value: value_or_values).all.map(&my_model)
end

MyModel.find_by_mycode([43565, 43402])
MyModel.find_by_mycode(43402)

To speed things up, you will want to create a SQL index for that table.

A: Noodl's answer is right, but not entirely correct.
It really depends on the database/ORM adapter you are using: for instance PostgreSQL can now store and search hashes/json - check out hstore. I remember reading that ActiveRecord adapter for PostgreSQl now handles it properly. And if you are using mongoid or something like that - then you are using unstructured data (i.e. json) on a database level everywhere.
However if you are using a db  that can't really handle hashes - like MySQL / ActiveRecord combination - then the only reason you would use serialized field is for somet data that you can create / write in some background process and display / output on demand  - the only two uses that I found in my experience are some reports ( like a stat field on a Product model - where I need to store some averages and medians for a product), and user options ( like their preferred template color -I really don't need to query on that) - however user information - like their subscription for a mailing list - needs to be searchable for email blasts.

PostgreSQL hstore ActiveRecord Example:
MyModel.where("mycode @> 'KEY=>\"#{VALUE}\"'")

UPDATE
As of 2017 both MariaDB and MySQL support JSON field types.

A: Using the following comments in this post
https://stackoverflow.com/a/14555151/936494
https://stackoverflow.com/a/15287674/936494
I was successfully able to query a serialized Hash in my model
class Model < ApplicationRecord
  serialize :column_name, Hash
end

When column_name holds a Hash like
{ my_data: [ { data_type: 'MyType', data_id: 113 } ] }

we can query it in following manner
Model.where("column_name = ?", hash.to_yaml)

That generates a SQL query like
Model Load (0.3ms)  SELECT "models".* FROM "models" WHERE (column_name = '---
:my_data:
- :data_type: MyType
  :data_id: 113
')

In case anybody is interested in executing the generated query in SQL terminal it should work, however care should be taken that value is in exact format stored in DB. However there is another easy way I found at PostgreSQL newline character to use a raw string containing newline characters
select * from table_name where column_name = E'---\n:my_data:\n- :data_type: MyType\n  :data_id: 113\n'

The most important part in above query is E.
Note: The database on which I executed above is PostgreSQL.

A: To search serialized list you need to prefix and postfix the data with unique characters.
Example:
Rather than something like:
2345,12345,1234567 which would cause issues you tried to search for 2345 instead, you do something like <2345>,<12345>,<1234567> and search for <2345> (the search query get's transformed) instead. Of course choice of prefix/postfix characters depends on the valid data that will be stored. You might instead use something like ||| if you expect < to be used and potentially| to be used. Of course that increases the data the field uses and could cause performance issues.
Using a trigrams index or something would avoid potential performance issues.
You can serialize it like data.map { |d| "<#{d}>" }.join(',') and deserialize it via data.gsub('<').gsub('>','').split(','). A serializer class would do the job quite well to load/extract tha data.
The way you do this is by setting the database field to text and using rail's serialize model method with a custom lib class. The lib class needs to implement two methods:
def self.dump(obj) # (returns string to be saved to database)
def self.load(text) # (returns object)
Example with duration. Extracted from the article so link rot wouldn't get it, please visit the article for more information. The example uses a single value, but it's fairly straightforward to serialize a list of values and deserialize the list using the methods mentioned above.
class Duration
  # Used for `serialize` method in ActiveRecord
  class << self
    def load(duration)
      self.new(duration || 0)
    end

    def dump(obj)
      unless obj.is_a?(self)
        raise ::ActiveRecord::SerializationTypeMismatch,
          "Attribute was supposed to be a #{self}, but was a #{obj.class}. -- #{obj.inspect}"
      end

      obj.length
    end
  end

  attr_accessor :minutes, :seconds

  def initialize(duration)
    @minutes = duration / 60
    @seconds = duration % 60
  end

  def length
    (minutes.to_i * 60) + seconds.to_i
  end
end

A: If you have serialized json column and you want to apply like query on that. do it like that
YourModel.where("hashcolumn like ?", "%#{search}%")


text:
Q: Excel: Count how many last days of the month are between & including two dates - datedif isn't consistent I need to be able to count how many last days of the month there are between & including two dates:
e.g. 31/08/2021 to 15/10/2021 would be two (August and September).
31/08/2021 to 31/10/2021 would be three (August, September, October).
I've tried datedif+1, using months as the counting unit, but it isn't consistent, If the second date is the end of a month it will only count that month if its one that has a 31st in it.
31/08/2021 to 30/09/2021 = 1 (should be 2)
31/08/2021 to 31/10/2021 = 3 (correct)
30/08/2021 to 30/11/2021 = 3 (should be 4)
30/08/2021 to 31/12/2021 = 5 (correct)
Can anyone think of another way?

A: I was curious and found this link: https://exceljet.net/formula/get-months-between-dates - it explains that DATEDIF works with whole months only - the suggestion to add 15 days to the end date doesn't work for your case.
But subtracting 16 days from start date and adding 16 days to end date results in the diff you want.
Furthermore the formula first calculates the end date: if it is not an "end of month", previous end of month will be calculated.
=LET(trueEOM,IF(B2=EOMONTH(B2,0),B2,EOMONTH(B2,-1)),
DATEDIF(A2-16,trueEOM+16,"m"))


text:
Q: Why the boundary of the manifold $[0,1]$ is $\{0\}, \{ 1 \}$ Well, I have an example of a manifold with boundary that is $[0,1]$. Its boundary is $\{ 0 \}, \{ 1 \}$ but I don't know why.
Because if I use the definition of boundary in manifolds I can create a parametrization between a open interval in $\mathbb{R}$ and a open set in $[0,1]$. Be $\phi : (1/4,3/4) \subset [0,1] \longrightarrow (-1/2, 1/2)$ as $\phi(x) = x - 1/2$. So with this $\phi$ the boundary will be the point x with $\phi(x) = 0$. So in this case $x = 1/2$. But $1/2$ is not in the boundary.
Why this happens?

A: Well, the thing is, that parametrization does not describe the whole of $[0,1]$.
The actual definition is: a manifold with boundary is a space such that around every point, you can find a neighbourhood which is homeomorphic to $\mathbb{R}^n$, or the "upper-half space".
So in our case $n = 1$, for some $M$ to be a dimension $1$ manifold with boundary, you need to show that every point in $M$ has a neighbourhood homeomorphic to $\mathbb{R}$, or to $\mathbb{R}_+ := \{ x \in \mathbb{R} : x \geq 0\}$.
Here, $M = [0,1]$. Notice that if you pick any $p \in M$ which is not $0$ or $1$, then it has a neighbourhood which is homeomorphic to $\mathbb{R}$ (by just choosing a really small open interval around it which contains neither $0$ nor $1$). In terms of parametrization, it would be similar to the one you just described. So if $p \ne 0,1$, it's not a boundary point.
However, say you pick $p = 0$. Then, no matter how you look at it, there is no way to find a neighbourhood of $p$ homeomorphic to $\mathbb{R}$. Because indeed, a neighbourhood of $p$ in M would be a half-interval $[0, \varepsilon)$, since you can't take anything on the left of $0$. And there is no way to turn that interval homeomorphically into $\mathbb{R}$. So $0$ is a boundary point. The same reasoning holds for $1$.


text:
Q: C++: How to convert 32bit data into Signed Integers In my personal C++ library, I code to handle working on different endian systems (little or big) by working with individual bytes. For example, I calculate a 16bit unsigned integer as follows by using a pointer, that points to the beginning of the uint16 data, as a parameter for my function:
constexpr uint16_t decode16(const uint8_t* x) {
    return uint16_t(x[1] + x[0] * 0x100);
}

As it is, this function doesn't work for a 16bit signed integer's byte data, and so 0xFF is decoded into -257. Can somebody please teach me how to write a similar function for signed integers that works? 0xFF should get decoded into -1.
Edit: This is my temporary solution which is a workaround for a little endian system, but won't be transportable onto a big endian system. What I'm looking for is how to code for both.
int16_t decode16(const int8_t* x) {
    int8_t temp8[2];
    temp8[0] = x[1];
    temp8[1] = x[0];
    int16_t temp16 = *(uint16_t *)&temp8[0];
    return temp16;
}

A: Alright guys, so this is how I ended up doing it. Hope it helps anyone who likes to take a similar approach. Basically, bit by bit:
int16_t decode16(const int8_t* x) {
    std::bitset<8> firstbyte(x[0]);
    if (firstbyte[7] == 0) { // if positive integer, than treat as normal
        return int16_t(x[1] + x[0] * 0x100);
    } else { // if negative integer, I assumed it's in Signed 2's Complement form (http://www.cs.umd.edu/~meesh/cmsc411/local-notes/numbers/node5.html)
        std::bitset<8> secondbyte(x[1]);
        std::bitset<16> tempset;
        // first copy all the bytes into a 16bit long bitset
        for (int i = 0; i < 16; i++) {
            if (i < 8) {
                tempset[i] = secondbyte[i];
            } else {
                tempset[i] = firstbyte[i-8];
            }
        }
        tempset.flip(); // then flip all bits

        // then add 1
        for (int i = 0; i < 16; i++) {
            if (tempset[i] == 0) {
                tempset[i] = 1;
                for (int j = (i-1); j>=0; j--) {
                    tempset[j] = 0;
                }
                break;
            }
        }

        int16_t answer = 0;
        for (int i = 0; i < 16; i++) {
            int16_t multiplier = 1;
            for (int j = 0; j<i; j++) {
                multiplier = multiplier*2;
            }
            answer = answer + tempset[i]*multiplier;
        }
        return answer*(-1);
    }
}


text:
Q: How to further my playing of Jungle Lee Sin? My main and favorite role in League of Legends is Jungle Lee Sin. Lee Sin is an amazing champion with amazing mobility, great ganks, and amazing jungle clear.
I usually start red and then gank top immediately. I build assassin Lee Sin and build full AD, with the occasional tanky item. After Hunter's Machete and 5 pots, I occasionally build to Madreds Razors.  Afterwards I build towards Sightstone, Bloodthirsters, upgrade to Maw, get Ravenous Hydra.
My masteries are 21/9/0 with points in AD and Armor Penetration and in reduced creep damage. My runes are Flat AD Quints, Flat AD Reds, Flat Armor Yellows, and Scaling Magic Resist Blues.  I smartcast all abilities except my ult. I don't smartcast any items but slot 3 which is for the sightstone.
To get to the point, I play very well in a normal game and usually have a positive k/d ratio. I play strong and am able to ward jump proficiently to make a clean escape or occasionally chase, I make my skillshots 9/10 times, so I don't know what the problem is when I play ranked. I usually do okay but sometimes my team just can't play (sadly I am stuck in Bronze 5) or when I play against the enemy team, they play super passively and because of that, I can't gank them because they can get under their turret very quickly. I feel I can't do anything late game in team fights either. At a point I just backdoor, but the opposing team usually sees me and ganks me, leaving me dead to watch my team lose. I can never get my items unless I take all of my teams laning kills. I can't farm because the laners get upset if I take their CS. I can't manage well in time when ganking and jungling. I do not think I am a bad player, despite bronze 5, honestly play with me and you'll see. But I know I rely too much on enemy play style, and I want to know how to better play Lee Sin so I can be a good ranked player.
How can I become a better Lee Sin Jungler?
Being a better player means I need to know:
- How do I get proper gold?
- How do I play against passive players?
- How do I improve my late game?

A: As a jungle I can see some mistake in your speech ... and Iwill point it out so you can see where you can improve in my opinion :

I usually start red and then gank top immediately

you can't just do that all the time you have to adapt your route to your team, the other team and the other jungler
Solutions :

*

*Identify the lane that you think /will be pushed fast/is strong early/could snowball/ and try to finish your route near this lane (lvl 3) and gank this lane.

*Think of what route the opposite jungler will take and /couter jungle/Counter gank/ him (Lee sin is very effective for that)

*...

I build assassin Lee Sin and build full AD, with the occasional tanky item.

*

*Adapt your build to the enemy team and the needs of your team

even if you prefer building AD you can just no brain build.

usually have a positive k/d ratio

It doesn't matter not your job ;-)

I can't gank them because they can get under their turret very quickly.

If they are under their tower they should be dominated
You could try going in their back ward jump Q > R > Q
so you get them out of their tower and you follow them out of turret range with the resonating strike (just an idea)
If you can get them out of their tower tank 3 tower shot and leave your laner take the kill it would be a very good play

I feel I can't do anything late game in team fights either

Your role as a Lee Sin in team fight could be :

*

*Engage and kick 1 carry out of their team and then instant kill him

*Kick someone anoying away from your carries (the most important)

*Slow the peoples that chase your carries

*Shield your carries

*CC the other carries to help yours kill them

At a point I just backdoor, but the opposing team usually sees me and ganks me, leaving me dead to watch my team lose.

Stop dooing that... stay with your team.

I can never get my items unless I take all of my teams laning kills.

Stop thinking like that and imagine what your carries could do with this gold if you had give them the kill(s)
To conclude, as a jungle your role is not to carry your team ... It's to carry your carries so they can carry the team ;-)
Most of the champion are a lot more gold efficient than lee sin... So I think you should try to play FOR your team or change your position to Lee Sin Mid.

A: So your question is basically how to be effective with Lee Sin in Bronze Division.
I would have to say that many people who are stuck in Bronze are sometimes not worth being bronze in terms of playstyle. But for various reasons you just can't get out of it. I've never experienced it since my ranking matches got me to Silver immediately and I kept going up from there.
BUT I can make some speculations and give some general advice.

*

*For me the jungler is a very special role. He can be a key role to winning the game BUT he can rely a lot on teammates. If you do well as a jungler but your team is a mess in lanes then you can't do much to help. And like you said as Lee Sin you will fall off late game which means that your fate is pretty much sealed.
So first advice is the most radical one. If you are solo queue and stuck in bronze try another role (not jungler). If you think you are better than the rest of your teammates most of the times, try a more late game role like ADC or AP caster.

*Never let your teammates know that you are better than them. The fact that you are bronze 5 and that you think it's entirely not your fault can be frustrating sometimes and you might find yourself giving up early in the game or not trying as much or blaming teammates a lot. Don't do that. Especially to low elo players, because all you will achieve is them complaining and not focusing, at best.

*Snowballing is much more efficient in low elo games. So champions who are dominant early can give a huge boost to the team. Lee Sin "can be" one of those champions. If you get early game kills try to push your advantage as much as possible don't just lay back and farm. Winning games in 20 minutes should be your goal. I've noticed this by playing in the european server with a new account and with friends that are in Bronze. It would be nice for example if you could pick last or trade with the last pick of your team so you can get the best pubstopming champion you can get without the other team countering you.

I'll only give you those 2 advice since I wanna focus on them. The second one is really underrated so try and make your teammates feel better and trust me you will see a LOT of improvement.

A: Okay I main Lee Sin Jungle and so far this season I have a consistant 24/7 W:L in Diamond 5.Now i am not writing a book on the how to pro lee sin, because although I consider myself a good lee sin player, there are many better players out there than me but I will give 1 or 2 tips just for you stuck lower in elo.
Don't go glass cannon, you can be 100/0 but as just AD and some defence, a small amount of cc and you are dead. For me there are 2 ways you can play lee sin, Tank and Hybrid, Tank is mainly so you can peel and soak damgae for your team at a genrally lower cost thatn if you were to buy full AD, hybrid is for fairly confident Lee Sin players that know how to take use of an advantage.
Secondly, Share your kills, honestly I don't care about K/D at all, 0/3/9 Is much better than if you were 3/0/2, If you give the laners more kills, they will snowball better into mid/late game, and trust me, It also makes them feel better about themselves, which means they have a higher morale, and momentum. Which Ultimately means you will win more games, Good luck :)
P-S I will answer any questions you ask since, I have plenty of time on my hands :)

A: Lee Sin is considered as must-know-how-to-play by best junglers in the world. Yes he is strong early but falls late.
You don't have proper direct question so I will give you some resources that will help you with your jungle LoL carrier ;)

*

*Lolking Lee Sin Builds with tips and maps how to jungle

*LoL Pro Lee Sin 7 page guide

*General LoL Pro how to jungle

*For example YouTube video with gameplay of 2500 elo/Diamond I Lee Sin jungle
Ah! And most important thing - play him as often as possible!
Good luck.


text:
Q: Need help for Assignment! API usage for the first time on Ionic So i'm using https://github.com/surhud004/Foodish to reference as the api, all i wanted to do is get the random image to appear on screen.
So i'm actually not sure how or why to do it, and need someone to correct me where i'm wrong or teach me my mistakes, as i'm relatively new on implementing api
i have created a food.service , so in my food.service.ts , my code will be
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Injectable({
  providedIn: 'root'
})
export class FoodService {

  constructor(private http: HttpClient) { }

    getAll() { // Calls when app loads - to display all countries
      return this.http.get("https://foodish-api.herokuapp.com/api");
      }
}

And my app.module.ts , i have imported
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

import { HttpClientModule, HttpClient } from '@angular/common/http';

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, HttpClientModule],
  providers: [
    HttpClient,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
  bootstrap: [AppComponent],
})
export class AppModule {}

So i'm trying to implement first without creating the button on home page
so my home.page.ts
export class HomePage {

  ngOnInit(){
    this.loadData();
}

  results: any = [];
  constructor(private http: HttpClient, private foodService : FoodService, private activatedRoute: ActivatedRoute)
  {
    this.foodService.getAll().subscribe((data) => {this.results = data});
    console.log(this.results)
  }

  loadData() {
    this.http.get("https://foodish-api.herokuapp.com/api").subscribe(
     data=>{
       console.log(data);
       this.results = data;

     }, err=>{
       console.log(err);
     }
   );
 }
}

and my home.page.html
<ion-header [translucent]="true">
  <ion-toolbar>
  <ion-title>
     Food
  </ion-title>
  </ion-toolbar>
 </ion-header>
 <ion-content [fullscreen]="true">
  <ion-item button *ngFor="let result of results.images" >

    <p>{{ result.image }}</p>
  </ion-item>
 </ion-content>

However im not sure why i cant retrieve the image to show, for example , click the image to see

A: foodservice should be:

//IN THE FOOD SERVICE

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Injectable({
  providedIn: 'root'
})
export class FoodService {

  constructor(private http: HttpClient) { }

    getRandomImage() { // this link just return 1 object with 1 image
      return this.http.get("https://foodish-api.herokuapp.com/api");
      }
}

Then in home.page.ts

export class HomePage {
  randomImage: string = ''; // since you are just using 1 image you can use an string instead of an array
  constructor(private http: HttpClient, private foodService : FoodService, private activatedRoute: ActivatedRoute)
  {
    //add data type "any" to eliminate the error: "Property 'image' does not exist on type Object
    this.foodService.getAll().subscribe((data:any) => {
      console.log(data)
      // the data arrives with the image link in a property called image so you should do this
      this.randomImage = data.image
     });
  }
}

Finally in the home.page.html

<ion-header [translucent]="true">
  <ion-toolbar>
  <ion-title>
     Food
  </ion-title>
  </ion-toolbar>
 </ion-header>
 <ion-content [fullscreen]="true">
  <ion-item >
    // display the image from the component property randomImage
    <img [src]="randomImage">
  </ion-item>
 </ion-content>


text:
Q: Getting PL/SQL procedure result into a variable I want to assign the result of PL/SQL procedure into a variable aa_idstu and use this variable in Oracle Forms pre-block trigger.
myprocedure:
select id_stu
into aa_idstu
from k_student
where id_stu=30

I want to use aa_idstu into Oracle Forms Builder version 6.0.8.26.0

A: You've already got everything - just put that code into PRE-BLOCK trigger. You'll need to DECLARE the variable first, though:
-- PRE-BLOCK trigger
declare
  aa_idstu k_student.id_stu%type;
begin
  select id_stu
  into aa_idstu
  from k_student
  where id_stu = 30;
end;

I don't know what you'll do with the variable once you got its value, but I suppose you do.
Also, pay attention to possible NO_DATA_FOUND and TOO_MANY_ROWS - if the WHERE condition doesn't return a single value, that SELECT will fail so you'll have to handle it, somehow.


text:
Q: Get Tuple of all adjacent elements in List I want to find all consecutive elements which satisfy the condition a < X <= b, and then store them in pairs (a,b).
So far, this finds all b:
Tuple<Vector2, Vector2> getPointsWithinInterval(double X)
{
    var points = List<Vector2> {...};

    var list_of_b = Points.Skip(1).Where((p, i) =>
        points[i].X < X  &&  X <= p.X                // condition
    );
}

EDIT: Based off @MattBurland's suggestion, I came up with the somewhat inelegant solution
var ranges = Points
    .Skip(1)
    .Where((p, i) =>
        Points[i].X < X && X <= p.X)
    .Select((p, i) => new Tuple<Vector2, Vector2>(Points[i - 1], Points[i]));

Example:
X = 2

(1, 0)
(3, 0)
(1, 0)
(5, 0)
(6, 0)

Returns:
(1, 0) , (3, 0)
(1, 0) , (5, 0)

A: This is solution for abstract points.
It can be extended for Vector2.
var pairs = points
    .Take(points.Count - 1)
    .Zip(points.Skip(1), Tuple.Create)
    .Where(pair => pair.Item1.X < x && x <= pair.Item2.X)

A: If I'm understanding you correctly, would something like this work:
var pairs = list_of_b.Select((pair,idx) =>
    new Tuple<Vector2,Vector2>(points[idx-1], points[idx]);

Edit, actually, because of the Where (and the Skip actually) that might filter out some items, the indexes in your Select would be incorrect. You need to select those indexes from the start. Something like:
var ranges = Points
    .Select((p,i) => new { p, i })   // now i will always match the indexes in Points
    .Skip(1)
    .Where(p =>
        Points[p.i].X < X && X <= p.p.X)
    .Select((p) => new Tuple<Vector2, Vector2>(Points[p.i - 1], Points[p.i]));

But this does feel awfully inelegant.


text:
Q: sales_order_save_before etc/frontend/events.xml not working properly I've used the sales_order_save_before event scope is etc/events.xml - This is working fine but,
etc/frontend/events.xml not working properly.
sales_order_save_before event not support frontend scope?

A: The class which is reponsible for dispatching sales_order_save_before event is the model of order Magento\Sales\Model\Order. In order to get to the dispatch statement, you need to look for the beforeSave method into inheritance heirarchy of this model. If you do so, you will end up in Magento\Framework\Model\AbstractModel class which contains the save, beforeSave and afterSave methods.
public function beforeSave()
{
     if (!$this->getId()) {
         $this->isObjectNew(true);
     }
     $this->_eventManager->dispatch('model_save_before', ['object' => $this]);
     $this->_eventManager->dispatch($this->_eventPrefix . '_save_before', $this->_getEventData());
     return $this;
 }

A: And also In case you do not want to listen to the "sales_order_save_before" is  global event , so it is use in etc/events.xml


text:
Q: Change position of data labels in BarChart3D What would be the easiest way to manipulate the position of the chart labels in "Grid" layout in a BarChart3D?
For example:
BarChart3D[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}, ChartLayout -> "Grid", ChartLabels -> {Range[4], {a, b, c,}}, ViewPoint -> {3.33, -8.26, 5.36}, ColorFunction -> "TemperatureMap", BarSpacing -> {1, 1}, BaseStyle -> {FontSize -> 25}]

I would like to move the "a", "b" and "c" labels to the other side of the axis, as it should be and is actually done automatically for the vertical one. I've tried using "Placed" with coordinates
ChartLabels -> Placed[{"a", "b", "c"}, {{1, 1, 1}, {0,0}}]

but this inserts a label onto EVERY SINGLE bar, not only near the axis.
A similar effect is obtained with "LabelingFunction":

Just for clarification of what I want to do, note that this results in three undesired features for me:
 * the labels are the values of the bars,
 * the bars are squeezed to the back instead of pushing the labels outside the plot area and
 * I can't use this to move the labels on both x and y axes, because ultimately I want to put the "1,2,3,4" also on the other side of the axis.


text:
Q: Is a subset of a Borel set of measure zero always Borel? I'm pretty sure that a subset of a Borel set (in $\mathbb{R}$) of measure zero may not be Borel, but I don't know how to show it.
I do know that there are more Lebesgue-measurable sets than Borel sets.
I also know that every subset of a Borel set of measure zero is Lebesgue-measurable.
I would prefer a general argument (for example, using cardinality) over a counterexample.

A: If $A$ is a subset of $\Bbb R$ of measure $0$, then all its subsets, $2^{|A|}$ many of them, are measure $0$ (and so Lebesgue measurable, Borel or not). Any subspace of a separable metric space is itself separable metrisable and so has at most $\mathfrak{c} = |\Bbb R|$ many Borel subsets.
So whenever $2^{|A|} > \mathfrak{c}$, $A$ has a Lebesgue measurable subset that is not Borel in $A$. This is the case for the standard Cantor middle third set e.g.

A: This answer is inspired by Henno Brandsma's answer, and perhaps easier:
Any set of measure zero is contained in a Borel set of measure zero (since any Lebesgue-measurable set can be approximated from outside by a Borel set), so it suffices to show that there is a set of measure zero which is not Borel.
The Cantor set has measure zero and cardinality $\mathfrak{c}$, so it has $2^{\mathfrak{c}}$ subsets of measure zero. There are $\mathfrak{c}$ Borel sets, so there must be some set of measure zero which is not Borel.


text:
Q: How can I make Protractor NOT wait for $timeout? I'm testing my angular application with Protractor.
Once the user is logged in to my app, I set a $timeout to do some job in one hour (so if the user was logged-in in 13:00, the $timeout will run at 14:00).
I keep getting these failures:
"Timed out waiting for Protractor to synchronize with the page after 20 seconds. Please see https://github.com/angular/protractor/blob/master/docs/faq.md. The following tasks were pending: - $timeout: function onTimeoutDone(){....."

I've read this timeouts page: https://github.com/angular/protractor/blob/master/docs/timeouts.md
so I understand Protractor waits till the page is fully loaded which means he's waiting for the $timeout to complete...
How can I make Protractor NOT wait for that $timeout?
I don't want to use:
browser.ignoreSynchronization = true;

Because then my tests will fail for other reasons (other angular components still needs the time to load...)

A: The solution will be to flush active timeouts (as @MBielski mentioned it in comments), but original flush method itself is available only in anuglar-mocks. To use angular-mocks directly you will have to include it on the page as a <script> tag and also you'll have to deal with all overrides it creates, it produces a lot of side effects. I was able to re-create flush without using angular-mocks by listening to any timeouts that get created and then reseting them on demand.
For example, if you have a timeout in your Angular app:
$timeout(function () {
    alert('Hello World');
}, 10000); // say hello in 10 sec

The test will look like:
it('should reset timeouts', function () {

    browser.addMockModule('e2eFlushTimeouts', function () {

        angular
        .module('e2eFlushTimeouts', [])
        .run(function ($browser) {

            // store all created timeouts
            var timeouts = [];

            // listen to all timeouts created by overriding
            // a method responsible for that
            var originalDefer = $browser.defer;

            $browser.defer = function (fn, delay) {
                // originally it returns timeout id
                var timeoutId = originalDefer.apply($browser, arguments);
                // store it to be able to remove it later
                timeouts.push({ id: timeoutId, delay: delay });
                // preserve original behavior
                return timeoutId;
            };

            // compatibility with original method
            $browser.defer.cancel = originalDefer.cancel;

            // create a global method to flush timeouts greater than @delay
            // call it using browser.executeScript()
            window.e2eFlushTimeouts = function (delay) {
                timeouts.forEach(function (timeout) {
                    if (timeout.delay >= delay) {
                        $browser.defer.cancel(timeout.id);
                    }
                });
            };

        });

    });

    browser.get('example.com');

    // do test stuff

    browser.executeScript(function () {
        // flush everything that has a delay more that 6 sec
        window.e2eFlushTimeouts(6000);
    });

    expect(something).toBe(true);
});

It's kinda experimental, I am not sure if it will work for your case. This code can also be simplified by moving browser.addMockModule to a separate node.js module. Also there may be problems if you'd want to remove short timeouts (like 100ms), it can cancel currently running Angular processes, therefore the test will break.

A: The solution is to use interceptors and modify the http request which is getting timeout and set custom timeout to some milliseconds(your desired) to that http request so that after sometime long running http request will get closed(because of new timeout) and then you can test immediate response.
This is working well and promising.


text:
Q: How to hide the Dock icon of some java applications run by AppleScript in OSX? I write some AppleScript to launch my java applications like Minecraft. But there are some problems with it. If I use do shell script "java -jar ~/Library/Application\\ Support/minecraft/launcher.jar" to launch Minecraft with AppleScript(save as app), there will be 3 icons on the dock, The AppleScript App's icon, the Minecraft Launcher's icon and the icon of Minecraft.
How can I hide other icons except of the AppleScript Apps icon on the Dock?

A: I don't know if you can do that when activating the launcher.jar but if you tell the app to launch with "tell" you could temp hide the app, you can use the following code i wipped up
do shell script "defaults write /Applications/Minecraft.app/Contents/Info.plist LSUIElement 1"
delay 1
tell application "Minecraft" to activate
do shell script "defaults write /Applications/Minecraft.app/Contents/Info.plist LSUIElement 0"
tell application "Minecraft" to run

As for the Main Game, I don't think you can hide that :(
(make sure minecraft is in the Application Folder)


text:
Q: Is it possible to customize dropbox with chooser API with JavaScript? I am uploading file to drop-box using java Script chooser. But I unable to customize the view of pop up window (hide some buttons). Is there any way to manage drop-box UI....?
my jsp code is below.

A: The Chooser is not for uploading files to Dropbox. It's used to gain access to files already in Dropbox.
That code doesn't appear to be JSP (JavaServer Pages). It appears to be HTML and JavaScript.
No, there's no way to customize the UI for the Chooser.


text:
Q: Data Factory - Foreach activity: run in parallel but sequentially I'm creating a ADF pipeline and I'm using a for each activity to run multiple databricks notebook.
My problem is that two notebooks have dependencies on each other.
That is, a notebook has to run before the other, because it has dependency. I know that the for each activity can be executed sequentially and by batch. But the problem is that when running sequentially it will run one by one, that is, as I have partitions, it will take a long time.
What I wanted is to run sequentially but by batch. In other words, I have a notebook that will run with ES, UK, DK partitions, and I wanted it to run in parallel these partitions of this notebook and to wait for the total execution of this notebook and only then would it start to run the other notebook by the same partitions. If I put it by batch, it doesn't wait for full execution, it starts running the other notebook randomly.
The part of the order of notebooks I get through a config table, in which I specify which order they should run and then I have a notebook that defines my final json with that order.
Config Table:

sPath
TableSource
TableDest
order

path1
dbo.table1
dbo.table1
1

path2
dbo.table2
dbo.table2
2

This is my pipeline:

and the execution I wanted by batch and sequentially but it is not possible to select by sequential and batch count at the same time.
Can anyone please help me in achieving this?
Thank you!

A: I have tried to reproduce this. For running for-each sequentially and batchwise, we need to have two pipelines- one nested inside the other pipeline. Outer pipeline is used for running sequentially and inner pipeline is for running batchwise. Below are the steps

*

*Took a sample config file as in below image.

*

*Pipeline 1 is considered as the outer pipeline. In that Lookup activity is used to select only sortorder field data in increasing order. Sortorder value will be passed as a parameter to child pipeline sequentially.

select distinct sortorder from config_table order by sortorder

*

*For each activity is added after the lookup activity. We use this for sequential run. Thus, Sequential is checked and in items text box, output of lookup activity is given.

@activity('Lookup1').output.value

-Inside foreach activity, pipeline2 is invoked with execute pipeline activity. pipeline parameter pp_sortorder is added in child pipeline pipeline2

*

*In pipeline2, Lookup activity is added with dataset referring the config table with sortorder value got from pipeline1

select * from config_table where sortorder=
@{pipeline().parameters.pp_sortorder}

-Next to Lookup, Foreach is added and in items, lookup activity output is given and Batch count of 5 is given here (Batch count can be increased as per requirement)

*

*Stored Procedure activity is added inside for each activity for checking parallel processing.

After setting up all these, **Pipeline 1 ** is executed. Execute pipeline activity of pipeline1 is run sequentially and Execute stored procedure activity of pipeline 2 has run simultaneously.
pipeline1 Output status
second execute pipeline is started once first activity is ended

pipeline2 Output status
All Stored procedure activity has started to execute simultaneously


text:
Q: AntiXSS JavaScriptEncode gets HTML encoded? I've just started using AntiXSS (4.3.0), mostly to use @Encoder.JavaScriptEncode as described here.
I installed AntiXSS from Nuget, then added encoderType="Microsoft.Security.Application.AntiXssEncoder, AntiXssLibrary" to <httpRuntime in my Web.config.
In my view, I have the following line (within <script> tags):
var userId = @Encoder.JavaScriptEncode(User.Identity.GetUserId());

Which I would expect to output
var userId = 'user-id';

but instead outputs:
var userId = 'user-id';

I assume this is happening because Razor is trying to sanitize the HTML, and thus encoding the singe quotes as '.
The solution then would be to just wrap it in Html.Raw(), but in the post I was following he never does that (instead wrapping the whole thing in single quotes within the Javascript).
My question is - are you supposed to need to call @Html.Raw(Encoder.JavaScriptEncode(data)), or is there something wrong with my setup?
Thanks!

A: Your assumption about razor encoding is correct. I'd also say the post you were following is also correct (I may be wrong, I haven't read the entire post though).
Instead of
var userId = @Encoder.JavaScriptEncode(User.Identity.GetUserId());

try
var userId = '@Encoder.JavaScriptEncode(User.Identity.GetUserId(), emitQuotes: false)';
//optionally surround with '' if your userId needs to be a string

or just
var userId = @Encoder.JavaScriptEncode(User.Identity.GetUserId(), emitQuotes: false);
// Visual Studio gives you a red squiggly syntax error after the semi-colon though.
// From your example, if it is a number, then no quotes are required

or go ahead with Html.Raw() like
var userId = Html.Raw(@Encoder.JavaScriptEncode(User.Identity.GetUserId());

Opionated: I prefer emitQuotes: false because that option is there, and because it eliminates the needs for another function call Html.Raw(). The default for emitQuotes is true. Are you missing the emitQuotes parameter or is that intentional?


text:
Q: I am trying to display the video in python using moviepy library but the video doesn't play code and output
From Command prompt
I've tried many times to display the video using moviepy but it doesn't work I also tried to display it using command prompt but still the same problem..
So what should I do or what I am missing ?? help me please as this is a part of my graduation project and thank you.
this is the code
from moviepy.editor import *

myvideo =  VideoFileClip('C:/Users/Sohayla/Desktop/PythonSourceCode/road_lane_line_detection-master/challenge.MP4').rotate(180)
myvideo.ipython_display()

A: As shown in the documentation of moviepy:

So, in your code:
from moviepy.editor import *
myvideo = videoFileClip('C:/Users/Sohayla/Desktop/PythonSourceCode/road_lane_line_detection-master/challenge.MP4').rotate(180)
ipython_display(myvideo)

Should work..
Better would be:
from moviepy.editor import videoFileClip
myvideo = videoFileClip('C:/Users/Sohayla/Desktop/PythonSourceCode/road_lane_line_detection-master/challenge.MP4').rotate(180)
ipython_display(myvideo)

A: Instead of using the ipython_display you can use resize() function as video.resize() to change its height or width.
Video.resize(width=300) It will work fine.


text:
Q: How to create/delete a HomeGroup in Windows 8? I never used homegroups. Now, when I enter HomeGroup control panel page, I see that somebody has created homegroup on the network. User name and computer name displayed. I don't know who is this. I don't know such a computer. I am at home and I know all computers here. No one has this name.
How to create my own homegroup?
How to delete this parasitic homegroup? Windows manual says that everybody should leave a group then it will disappear. In my case there is no one in the group (mystic person only). How to delete a group?
UPDATE
Also I can't join this group. System asks a password from me. But I don't know it. And I can't ask it from that person because he does not exist.
UPDATE 2
I have no Create a homegroup button. It is replaced with Join Now button, since group is treated as existing.

UPDATE 3
This is probably notebook I was taking from my friend long time ago. Notebook is already gone and no access to it. Most probably it was connected to my home WiFi.
Probably I clickded "create home group" on that notebook. So what? It infected my network forever?
SOLVED
My fault. This was a computer from VPN I participating. Anyway it is strange that computer can participate multiple LANs while homegroup can be only one.

A: Homegroups are kept up only while at least one machine is still active in the group. Some Windows 7/8 machine in your network is still a member of that homegroup.
The only way to remove a homegroup is to log on the PC that is a member and remove them from that group. The password for the homegroup will be stored on a member PC should you want to access it.
If you are running a router with an open WiFi it's possible that a neighbor could be on your network and you are detecting them. You can check who is on your WiFi by checking the DHCP lease table on your router.
Creating a homegroup is extremely easy. Follow this tutorial. As per Microsoft:
To create a homegroup

1. Open HomeGroup by clicking the Start button , clicking Control Panel, typing
homegroup in the search box, and then clicking HomeGroup.

2. On the Share with other home computers running Windows 7 page, click Create
a homegroup, and then follow the instructions.

A: Had the same problem. I was about to try the suggested solution posted here (which looks promising) when I stumbled on an easier solution.
Go to: Control Panel -> Network and Sharing Center. Look at the link next to the "HomeGroup:" field (upper-right of window). When I did this, it said "Create" and allowed me to create a new one. (After doing so, I also changed the password to one I could remember so I wouldn't run into this problem again.)


text:
Q: undefined method `primary_key' for StatusesController:Class Model

Controller

Error

Application Trace
app/controllers/statuses_controller.rb:35:in `update'

Schema

A: Change your status_params method to add:
params.require(:comment).permit(:user, :comment)

and then change all the places you try to update comments to include (status_params) at the end.