text:
Q: How to use customer token to access my account Query or Mutation in GraphQl I am using magetno 2.3.x and I want to access my account queries provided by  Magento_CustomerGraphQl module.
I have installed ChromeiQl to execute GraphQl.
I set Site Endpoint as per syntax provided by magento devdocs.
I have generated the customer token using provided type Mutation
type Mutation {
    generateCustomerToken(email: String!, password: String!)
    {
      token
    }
}

But I did not get any way to use this token in ChromiQL as authorization Header.

A: Please try this:
Step 1: Get a bearer token:
You can get a token by executing the signup mutation in the playground to create a new user. This is the signup mutation I ran:
Request:

mutation {
      generateCustomerToken(email: "customer@example.com", password: "password") {
      token
  }
}

Response:

 {
  "data": {
     "generateCustomerToken": {
     "token": "hoyz7k697ubsdsdfsdfsdfsdfv5hcpq92yrtx39i7x"
     }
   }
 }

Step 2: Include the bearer token in your request
Notice there is a text area called HTTP HEADERS at the bottom of the playground. Paste the following code into HTTP HEADERS, replacing your-token-goes-here with the bearer token returned by the server in step 1:
{
   "Authorization": "Bearer zcnj8wd03u19s5fw1yvkprs23du7tfkh"
}

Step 3: Run the post mutation
Now that you are including a bearer token in your request you can run the post mutation.
Please check and let me know if you are able to get the response.

A: The resulting token should be used in subsequent requests in the Authorization header as a Bearer token ex:
Authorization: Bearer {{resultFromGenerateCustomerToken}}
I don't think ChromeQL allows the setting request Headers. If you are on OSX you can use this electron app which give you access to set the headers. https://github.com/skevy/graphiql-app
Additionally, the graphiql included in the PWA Studio includes the same functionality https://github.com/magento-research/pwa-studio


text:
Q: Is it possible for a CentOS system on EC2 to not have a bootloader? I'm attempting to look for grub:
[root /]# find / -iname "*grub*"
/sbin/grubby
/usr/share/man/man8/grubby.8.gz
/usr/share/vim/vim70/syntax/grub.vim
/usr/share/vim/vim70/ftplugin/grub.vim
/usr/lib/pm-utils/sleep.d/01grub

Now I'm attempting to look for lilo:
[root /]# find / -iname "*lilo*"
/usr/share/doc/syslinux-3.11/keytab-lilo.doc
/usr/share/vim/vim70/syntax/lilo.vim
/usr/lib/syslinux/keytab-lilo.pl

I thought perhaps it was somehow being hidden with SELinux so I tried to turn that off (temporarily):
[root@ /]# setenforce 0
setenforce: SELinux is disabled

Hmm, look like it was already off. What about turning that on?
[root@ /]# setenforce 1
setenforce: SELinux is disabled

Ok, now I have no clue why I can't find any bootloader files. I re-run the find commands and get the same thing.
Next I had read the bootloader section in the Linux Administration Handbook and it didn't mention not being able to find bootloader configuration files.
This is an box on Amazon EC2: CentOS release 5.4 final selinux
Is this normal to not have these files? I also don't seem to have any /etc/sysconfig/selinux or /etc/selinux/config files.... Hmmm....
Update - Why am I asking?
This article (among others) mentions using boot flags to enable or disable selinux in the grub.conf file. Without a boot loader how do you specify boot flags?

A: Yes, it is. A boot loader is not necessary at all. The kernel can load itself, given that the flexibility that a boot manager like grub provides, is not necessary. The bzImage contains all the code needed to boot:

Source: Wikipedia
For the linux kernel from 3.3 onwards this also works for UEFI systems. This special boot loader is called efi stub. Fedora is one of the few distributions that ship a kernel configured with EFI_STUB=y.
I do neither know EC2, nor CentOS and cannot tell how they are set up. But if one does not need to boot several kernels or operating systems, there's no need to install a dedicated boot manager.

A: Amazon AMIs boot from an amazon kernel in their EC2 virtual machines, so they don't strictly need a bootloader.  You can boot a paravirtualized kernel, as described in their documentation.

redpajama_set_name: RedPajamaStackExchange


text:
Q: jQuery Mobile addClass does not affect styles Im using the addClass function with jQuery Mobile. I can see in the code that the class is added but its style that should be applied to it is ignored.
If I add the class to the html and refresh the page then the class is styled. So it seems to me that it might be something to with how JQM renders the page.
    $('.slider1').click(function(){
        $('.sliders').addClass('.slidersPosTwo');
    });

A: After modifying JQM content programmatically you usually need to refresh the enhancement.
This can be done for instance with $(".slider").slider("refresh");.
Additionally, enhanced elements have a radically different structure after enhancement (many new DOM elements are added for a single slider for instance). it might be the case that you are not adding your class to the proper DOM element (cannot verify this unless you set up a jsfiddle or similar).

A: Check-out the documentation for .addClass(): http://api.jquery.com/addClass/
Notice how the examples omit the period (.) at the beginning of the class name. If you leave the period then it will be added as part of the class name, which should only be used as a selector.
Your code will work if you make this change:
...
$('.sliders').addClass('slidersPosTwo');//notice, no period before the class name
...

A: Replace :
    $('.sliders').addClass('.slidersPosTwo');

with:
    $('.sliders').addClass('slidersPosTwo');

Even better, here you can find a live jsFiddle example how to modify every slider element. For example:
// Slider label
$('div[data-role="fieldcontain"] label#slider-label').addClass('custom-slider-label');
// Slider text box
$('div[data-role="fieldcontain"] input#slider').addClass('custom-slider');
// Slider element
$('div[data-role="fieldcontain"] div[role="application"]').addClass('custom-slider-element');
// Slider button
$('div[data-role="fieldcontain"] div[role="application"] a span').addClass('custom-slider-button');


text:
Q: ssh-add prompting for PEM pass phrase for unknown reason So some background: I have a collection of systems I use to access a server, which authenticate with a fingerprint key over ssh. On my other systems (android, windows 10, centos 7) I have no issues using a script to add the keys to the ssh keychain when they're needed.
However, on one windows 10 instance, the key asks for a PEM passphrase and fails with <private key location> is not a key file. before prompting for a passphrase. Below are the two prompts to illustrate what I'm talking about:
Enter PEM pass phrase:
Enter passphrase for <private key location>:
Now, the key is the same, and does work as expected once the first key input fails and the second succeeds, but why is it even prompting for the PEM passphrase when my other systems don't bother? And how can I get rid of that prompt?
Other details that may be relevant:

*

*error occurs using git bash for windows (installed pre-WSL), but works on another machine's implementation (same git version installed).

*windows versions are the same across implementations

A: So after much frustration I figured out that there was nothing actually wrong with the key file, script, or utilities.
The problem was a missing public key file that the ssh-keygen utility apparently required. The specific code segment causing the problem was ssh-keygen -lf /path/to/key/file.
After replacing the missing public key, it no longer asks for a PEM pass phrase, and instead just prompts for the key's passphrase as expected.


text:
Q: Rails - How to authorise user with third party api I'm setting up some authentication in my rails application. Only thing is I want to log in a user based on their credentials with another API.
The application will have to send a POST request with their username and password in the body to the API and if the request is successful then the user authorised.
I'm having trouble trying to do this with devise, I'm just looking for tips you guys have in order to implement this.
Thanks!

A: Devise allows you to define custom strategies for authentication. You can therefore create a new strategy to handle it. Database Authentication is one of the strategy already defined at Devise. You can check the source here
A rough idea of your strategy could like this.
    Create a file at config/initializers/external_authenticatable.rb and define the strategy
    require 'devise/strategies/database_authenticatable'

    module Devise
      module Strategies
          class ExternalAuthenticatable < DatabaseAuthenticatable
            def authenticate!
              resource  = password.present? && mapping.to.find_for_database_authentication(authentication_hash)

              if validate(resource){ valid_credentials?(resource) }
                remember_me(resource)
                resource.after_database_authentication
                success!(resource)
              end

              fail(:not_found_in_database) unless resource
            end

            def valid_credentials?(resource)
              request_params = { email: resource.email, password: password }
              # Make your post request here and return true false using authentication_hash
            end
          end
      end
    end

Now we need to inform devise that we want to use this strategy first before any other defaults. This can be done by editing /config/initializers/devise.rb
config.warden do |manager|
  manager.strategies.add(:external, Devise::Strategies::ExternalAuthenticatable)
  manager.default_strategies(:scope => :user).unshift :external
end

Restart your Rails application and you are done.


text:
Q: Changing color of a beamer presentation (Szeged-dove) I am working on beamer presentation, Szeged theme and dove colortheme.
Basically, I'd like to change the color of all the dove-colored lines and the text that's between them to a  RGB value set with \definecolor without changing anything else.
Thanks very much in advance for any help!

A: The colour of the lines is controlled by separation line colour. You can change this colour to whatever colour you have defined:
\documentclass{beamer}

\definecolor{mycolor}{RGB}{255,0,0}

\usetheme{Szeged}
\usecolortheme{dove}

\setbeamercolor{separation line}{bg=mycolor}

\setbeamercolor{title in head/foot}{fg=mycolor}
\setbeamercolor{institute in head/foot}{fg=mycolor}
\setbeamercolor{section in head/foot}{fg=mycolor}

\title{text}
\author{names}
\institute{institute}

\begin{document}

\section{title}
\begin{frame}
    \frametitle{title}
    abc
\end{frame}

\end{document}


text:
Q: a codeigniters helper function in a controllers function is not executing this is a call to a controllers function :
function downloadFile(fn,con)
        {
            var loadUrl = "/Fast-Docs/index.php/Docs/downloadFile";
                alert('hi');
        $.post(
            loadUrl,
            {content: con, filename: fn});
        }

controllers function :
public function downloadFile()
{
    $this->load->helper('download');
    $content=$this->input->post('content');
    $fn=$this->input->post('filename');
    return force_download($fn,$content);
}

but file is not downloading.
i know the reason why its not working but i dnt know how to fix it. so whats the solution. you need some more info , feel free to ask.

A: I don't completely understand what you are trying to do. Anyway, there is a fundamental problem in your code.
You are doing an ajax request to the "/Fast-Docs/index.php/Docs/downloadFile" URL, but you are ignoring the response.
My suggestion is: forget about ajax and use a simple link.
Download file

Then in the controller:
public function downloadFile($filename)
{
    //Validate file name
    if($filename != 'validFileName') die('Invalid file name');

    //Set headers
    $this->load->helper('download');
    $content = file_get_contents('/images/' . $filename);
    force_download($filename, $content);
}

If for some reason you can't use a link, you can redirect to the download page (by setting window.location).
If you really need to use ajax, give a look at this.


text:
Q: What are hs_err_pid.log files generated when Tomcat crashes? Are any specific settings required on the Java tab of Tomcat configuration tool in order to generate a hs_err_pid.log file?
What is the default location of the hs_err_pid.log file? Can this location be changed?

A: A very very good document regarding this topic is Troubleshooting Guide for Java from (originally) Sun. See the chapter "Troubleshooting System Crashes" for information about hs_err_pid* Files.
See Appendix C - Fatal Error Log
Per the guide, by default the file will be created in the working directory of the process if possible, or in the system temporary directory otherwise. A specific location can be chosen by passing in the -XX:ErrorFile product flag.  It says:

If the -XX:ErrorFile= file flag is not specified, the system attempts to create the file in the working directory of the process. In the event that the file cannot be created in the working directory (insufficient space, permission problem, or other issue), the file is created in the temporary directory for the operating system.


text:
Q: Loading external picture in javascript In html this works:

But that picture doesn't show up if i then try to draw it on the canvas.
If i download the picture and have a local link it works fine, but then i can't save the canvas to file due to a corrupted canvas error.
If I try:
$v2Img.attr("src","https://drive.google.com/uc?export=view&id=1oDTwDBuAM-IIuJi3iDE5BJlEDHolD68w");

In my script file the picture doesn't load at all.
I tried with pictures hosted on dropbox as well, same problem there.
Any suggestions?
Edit: here's the core of my code
HTML:

Grafik

        <canvas id="canvas-1"></canvas>
        Spara canvas

and graphics.js:
$(document).ready(function(){
var $canvas1 = $("#canvas-1");
var canvas1 = $canvas1[0];
var ctx = canvas1.getContext("2d");

ctx.drawImage(vpic,0,0,300,150);

var dt = canvas1.toDataURL("image/jpeg");
$("#saveCanvas").attr("href",dt);

});

var $vpic = $("#invisImg");
var vpic = $vpic[0];

The image doesnt show in the canvas if stored on another server, and if it is stored locally the canvas cant be saved. I also tried to upload it to my webhotel, to see if it only was a local problem, but that didnt matter you can see it here with some extra fluff.

A: You can do something like that by creating an image using Javascript :

const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
var img = new Image();
img.src = "https://drive.google.com/uc?export=view&id=1oDTwDBuAM-IIuJi3iDE5BJlEDHolD68w";
img.onload = function() {
 ctx.drawImage(img, 0, 0, 240, 297);
};
 <canvas id="canvas"></canvas>

A: There's a CORS security policy by which "tainted" pixels (coming from different origins) cannot be handled freely. This is meant to protect users from attacks which eavesdrop on user pixel data.
You have to allow cross-origin when you start your browser to get around this security boundary.
Here is some more about canvas and pixel data.


text:
Q: Curve minus point isomorphic to Curve? Let $X$ be a curve and $x\in X$ be a closed point. Is it possible that $X$ and $X-x$ are (abstractly) isomorphic? I wouldn't be surprised if the answer is yes. But what about the classical case, say $X$ a smooth curve over an algebraically closed field?

A: Although your question has been answered several times over, the following simple argument also works in quite some generality: since the (compactly supported) Euler characteristic satisfies the scissor relation $\chi(X) = \chi(X \setminus Z) + \chi(Z)$ whenever Z is a closed subscheme of X, removing a point (or any subscheme whose Euler characteristic is nonzero) will produce a variety with different Euler characteristic.
By allowing the Euler characteristic to take more "exotic" values, e.g. in the Grothendieck ring of Galois representations, you can rule out almost all cases where Z has Euler characteristic zero, too.

A: I don't think this is possible, for the following reasons.
In the case you have, say, a smooth proper curve $C$ of genus $g$ over $\mathbb C$ minus finitely many points, then you can read the number of "missing" points from the fundamental group of the Riemann surface $C(\mathbb C)$.
In the case of an arbitrary (wlog. algebraically closed) base field, the etale fundamental group will do the same trick.

A: The answer is no.  Let me restrict to regular integral curves for simplicity.  This perhaps follows most naturally from Zariski's perspective of the "complete Riemann surface" of a function field $k(C)/k$ as the set of all discrete valuations on $k(C)$ which are trivial on $k$.  A projective curve is not isomorphic to an affine curve, and if you have an affine curve, you can use this valuation theory to "see what points you're missing".
Also Xandi Tuni's answer of using the etale fundamental group works in every case except for comparing $\mathbb{P}^1$ to $\mathbb{A}^1$ in characteristic $0$, but these curves are obviously not isomorphic for any number of other reasons.

A: I don't think that any algebraic variety can be isomorphic to a proper open subset. Over a finite field this follows immediately from counting points over extensions. In the general case one reduces to this by spreading over a finitely generated ring.


text:
Q: Incorrect results from multiple joins in Linq2SQL I've been tasked with converting some crusty old SQL to Linq2SQL and I know this shouldnt be the first choice however it needs to be done.
Problem
I'm stuck attempting to force specific joins to replicate the desired output and the following is a simplified version of the SQL with one parameter variant shown followed by a simplified version of my attempt in Linq2SQL. Several alternative fields may be queried in Table1 hence the use q and q2 in the converted code though the actual parameters are not relevant to the issue.
Aim
The query needs to retrieve relevant rows from Table1, the latest related row from Table2 and additional data from Table2's parent table Table3, preferably in a single pass.
There may be 0-n matches in Table1, Table1 has a 1:n relationship with Table2 with 0-n rows, there is a 1:n relationship between Table3 and Table2.
Regardless of how I structure the expressions, the linq generates an INNER JOIN onto Table2 excluding rows in Table1, how can I structure the linq query to achieve the desired result?
SELECT      [...]
FROM        Table1 t1
LEFT JOIN   (
                SELECT      MAX(id) AS id, parent_id
                FROM        Table2
                GROUP BY    parent_id
            ) x2 ON t1.id = x2.parent_id
LEFT JOIN   Table2  t2  ON x2.id = t2.id
LEFT JOIN   Table3  t3  ON t2.table3_id = t3.id
WHERE       t1.id = row_id

var q = dc.Table1.AsQueryable();

    q = from r in q where r.id == row_id select r;

var q2 = from r in (q)
    join x2 in (from r in dc.Table2.DefaultIfEmpty() group r by r.parent_id into maxt2 let max_id = maxt2.Max(f => f.id) select new { maxt2.Key, max_id }) on r.id equals wx.Key
    join t2 in dc.Table2.DefaultIfEmpty() on x2.max_id equals t2.id
    join t3 in dc.Table3.DefaultIfEmpty() on t2.table3_id equals t3.id
    select
    {
        [...]
    };

A: Here is my translation using my recipe rules:
var Q1 = from t2 in dc.Table2
         group t2 by t2.parent_id into t2g
         select new { parent_id = t2g.Key, id = t2g.Max(t2 => t2.id) };

var Q2 = from t1 in Table1
         where t1.id == row_id
         join q1 in Q1 on t1.id equals q1.parent_id into q1j
         from q1 in q1j.DefaultIfEmpty()
         join t2 in dc.Table2 on q1.id equals t2.id into t2j
         from t2 in t2j.DefaultIfEmpty()
         join t3 in dc.Table3 on t2.table3_id equals t3.id into t3j
         from t3 in t3j.DefaultIfEmpty()
         select new { t1, t2, t3 };


text:
Q: What is ComposeViewAdapter used for in Jetpack Compose? I have a simple composable function in com.example.Example.kt:
@Preview
@Composable fun ExampleComposable() {
    Text("Hello")
}

I tried to use ComposeViewAdapter like below:
<androidx.compose.ui.tooling.ComposeViewAdapter
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:composableName="com.example.ExampleKt" />

Android Studio does not show any preview of the composable in the design pane.
Also, how is ComposeViewAdapter different from androidx.compose.ui.platform.ComposeView?

A: Example.kt file can have many composables, you need to specify the composable name:
<androidx.compose.ui.tooling.ComposeViewAdapter
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:composableName="com.example.ExampleKt.ExampleComposable" />


text:
Q: How to configure middleware in DI in Slim 3 I want to configure several middleware in Dependency Container in Slim, so that I can set several constants in a same place and add middleware in a ease.
E.G.
$configuration = [
    'settings' => [
        'displayErrorDetails' => true,
    ],
    'auth_settings' => [
        'serect' => 'garyAPIserver',
    ],
];
$container = new Slim\Container($configuration);
$container['auth'] = function ($c) {
    return new AuthMiddleware($c['auth_settings']);
};
$app = new Slim\App($container);

And I try to invoke the middleware in DI:
$app->add($app->get('auth'));

And I got the warning message print by php:

Warning: Missing argument 2 for Slim\App::get(), called in E:\www\slimServer-3.0\index.php on line 12 and defined in E:\www\slimServer-3.0\vendor\slim\slim\Slim\App.php on line 146

And the error message print by Slim:
Type: RuntimeException
Message: is not resolvable
File: E:\www\slimServer-3.0\vendor\slim\slim\Slim\CallableResolver.php
Line: 82

I am new in Slim, there it possible to set middleware in DI? Is there any guides with the similar scenario?

A: You can do it using the $container variable:
$app->add($container->get('auth'));

Then you can use it in your router functions using:
$auth = $this->get('auth');

Take a look here for more information.


text:
Q: How do I hide the English language from the language bar? My operating system is in English.
I have two keyboards: Spanish and Japanese. I speak Spanish natively, and I'm learning Japanese, but to write in English I just use the Spanish keyboard.
The problem is that in the language bar I see three keyboard layouts, and so pressing Alt+Shift changes the languages between those three: Spanish, Japanese and English.
Is there any way to disable this? Or am I doomed because I use the OS in English?
Here is an image explaining the situation:

A: Simply add it in Text services and input languages, apply the changes and then remove it again will make it disappear from the language bar.

A: In order to remove English from the language bar, you need to do the following:

*

*Open Control Panel and under the heading Clock, Language, and Region, select Change keyboards or other input methods.

*On the Keyboards and Languages tab, click Change keyboards....

*On the General tab, select the language you wish to remove and click Remove.

*(optional) If you want to change the keyboard shortcut used to swap between languages, you can do so by going to the Advanced Key Settings tab, changing the appropriate settings.


text:
Q: Google App Engine Blobs If I am right, using the Blobstore API (http://code.google.com/appengine/docs/quotas.html#Blobstore) requires apps to have billing enabled. However, do application need to have billing enabled to use db.BlobProperty() ?
http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#Blob
If I understand this correctly, then I only need billing enabled when using the Blobstore, but I can store binary data with BlobProperty() without having to use the Blobstore.

A: Yes, you can use BlobProperty without having billing enabled. But note that BlobProperty can store much smaller amounts than the Blobstore.


text:
Q: DTO from json in kotlin I have the following JSON structure that I getting from the server:
{
    "a": {
        "something": "something",
        "something2": {
            "test": "12345",
            "test2": "1234",
         },
        "something3": "something3"
    },
    "b": {
         "something": "something",
        "something2": {
            "test": "12365",
            "test2": "12",
         },
        "something3": "something3"
    }
 }

I can get more objects than "a" and "b".
I need to create DTO in Kotlin, I tried this DTO:
data class Root(
  val root: Map<String, Something>
)
data class Something(
  val something: String,
  val something3: String,
  val something2: Something2
)

data class Something2(
  val test: String,
  val test2: String
)

I use Retrofit library, it automatically parse JSON data to kotlin data class
I always get null from this DTO, how to write DTO for this JSON structure correctly?


text:
Q: String Interpolation in Groovy with Jenkins Pipeline file not working So I have a Jenkins Pipeline which reads a text file (JSON) using the readFile method provided by Jenkins Pipeline. The text file app.JSON has multiple variables which are already defined in the Jenkins Pipeline.
While the readFile does read the file and convert into string it does not interpolate these variables. What are my options to interpolate these variables besides a simple string replace (Which I want to avoid)
I know I can use the readJSON or JSON parser but I want the output in string so it makes it easier for me to just read it as string and pass it along.
I have tried using Gstrings, ${-> variable} and .toString() method. Nothing worked for me.
Jenkins Pipeline Code
appServerName = 'gaga'
def appMachine = readFile file: 'util-silo-create-v2/app.json'
println appMachine

app.json
{
   "name":"${appServerName}",
   "fqdn":"${appServerName}"
}

There are more than one variable in both the pipeline and app.json that I want to substitute
The issue is with the readFile method provided by Jenkins Pipeline. Although it is very neat and easy to use it does not interpolate strings.
I expect below output
println appMachine
{
   "name":"gaga",
   "fqdn":"gaga"
}

Output I am getting
{
   "name":"${appServerName}",
   "fqdn":"${appServerName}"
}

A: Your assumption that readFile step (or any other method that reads content from a text file) should bind the variables from the current scope and interpolate variables placeholders in the raw text is wrong. However, you can use Groovy template engine to invoke something similar to GString variables interpolation. Consider the following example:
import groovy.text.SimpleTemplateEngine

def jsonText = '''{
   "name":"${appServerName}",
   "fqdn":"${appServerName}"
}'''

@NonCPS
def parseJsonWithVariables(String json, Map variables) {
    def template = new SimpleTemplateEngine()
    return template.createTemplate(json).make(variables.withDefault { it -> "\${$it}" }).toString()
}

node {
    stage("Test") {
        def parsed =  parseJsonWithVariables(jsonText, [
            appServerName: "gaga"
        ])

        echo parsed
    }
}

The method parseJsonWithVariables does what you expect to get. It is critical to make this method @NonCPS, because the SimpleTemplateEngine, as well as map  created using withDefault() are not serializable. It takes a JSON read previously from a file (in this example I use a variable instead for simplicity) and a map of parameters. It converts this map to a map with a default value (the part variables.withDefault { ... } is responsible for that) so the template engine does not complain that there is no property with a given name. In this case the default method returns a variable "as is", but you can return an empty string or a null value instead. Whatever works for you better.
When you run it you will something like this:
[Pipeline] Start of Pipeline (hide)
[Pipeline] node
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo
{
   "name":"gaga",
   "fqdn":"gaga"
}
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS


text:
Q: How to load python modules on CentOS 7?
Hello. I am using CentOS-7. As you all, know CentOS-7's default installed python is 2.7.5. So I've installed python 3.4 by yum from epel repository. Now in terminal, "python" runs python 2.7.5 and "python3.4" runs python 3.4.
This is good. But the problem is...Today I've downloaded mysql connector for python from here, and installed using yum. After that, When I try to import module in python 3.4, below error had occurred.
Import Error: No module named 'mysql'

But in python 2.7.5, that module import properly.
What should I do to import that module in python 3.4?

A: When you install via pip, it's installing for the specific/default Python version. So when you installed mysql, it installed to 2.7.5. Use pip3.4 or pip3 to also install it for Py3.x.
Edit: Since you're not doing it via pip, the module you're downloading - you need to download and install again for the correct Python version. They have different installers listed per platform, by bitness (or source which is platform independent) & Pyversion.

A: The module you install from yum depends on the current python version.
So first download virtualenv which contains your required python version (in your case https://virtualenv.readthedocs.org/en/latest/ ).
After that activate this virtualenvironment like this -
Go to the folder where you installed virtualenv from terminal.
Type source virtualenv/bin/activate.
After this run yum install command for your desired mysql connector.
This will download the mysql connector which is compatible with python 3.4.

A: You don't. You reinstall it again either from a package (not the same package, a different one) or by building it from source for 3.4.

A: *

*download virtualenv and set the python3.4 environment

*download related module in this isolated environment


text:
Q: Class Design (UML Class Diagram) Could somebody please give their input into the following scenario:
I have an Administrator class and a Technician class (both extending a User class but that is besides the point). I also have a RepairJob class which represents an item through its varying stages of being repaired {received|being repaired|waiting for part, etc.}.
Only administrator users will be able to add a new repair job to the system and will also be able to view the status of all the repair jobs currently ongoing.
Technicians will need to be able to accept repair jobs from a view of the list of any repair jobs which have not yet been accepted by other technicians. Technician uses will also have to be able to update the status of a repair job accepted by themselves until it's ready to be returned to the Customer (another class).
An administrator will be able to accept any repair job in the system, even those already accepted by a Technician at which point they will no longer be able to update the status of the repair job. (To take account of employees being off work)
My Question
Could somebody give me an insight into how you would collect together the RepairJob instances. I had thought at first that since the administrator user would be adding these instances that it would be a good idea to model the collection inside the Administrator class however the Technician class will also have to be able to access a limited collection of repair jobs. I had also though of creating a RepairJobs class which had the list and was available to either class but I'm not sure if this would be a good design.

A: I think it ought to be separate from Admin and Tech classes.  RepairJob is for a single task; what you're describing sounds like a RepairJobManager that maintains a collection of RepairJobs and tracks their status.  It executes your rules according to the Role of the particular User that interacts with it.
package model;

public class RepairJobManager
{
    private Map<String, RepairJob> jobs;

    public void add(RepairJob job, Role role)
    {
        // Only allow Admin to do certain things.
    }

    public void update(RepairJob job, Status status, Role role)
    {
        // Only allow Admin to do certain things.
    }

}

A: My DDD view: You need a RepairJobRepository which holds a collection of RepairJobs. Also you need a RepairService with operations like
 - create(RepairJob jobSpec)  (add the created job to the repository)
 - assign(RepairJob job, Role role)
RepairJob need a method like  updateStatus(Status newStatus, Person p)
You need to get p's role to validate if he could update the status.


text:
Q: When to use "confirm" and when to use "continue" and when to use "proceed"? I have a software program, where the user should confirm an action, which might be dangerous. Which text should I display on that button: Confirm, Continue or Proceed?

A: "Confirm" has a specific meaning that the user has asked you to do that something, and you want them to to specify it again (to be sure that they really did mean it). You ask them to press "Confirm" when they mean "yes, I am sure i want to do that'.
Both "Proceed" and "Continue" mean simply "go ahead to the next step".


text:
Q: C# to php translator Is there a C# to php translator (capable of dealing with byte operations, TCPSockets)?

A: your language to another language is never extremely hard to achieve, assuming that both are Turing-complete. The real problem comes from your framework to another framework. The .NET Framework is much more capable than the PHP library. For instance, if your C# application uses threads, your PHP port is doomed.
So, no, there is no C# to PHP translator available, except real people. At least, as far as I know.
There are, however, TCP sockets in PHP, available through fsockopen or the socket extension. For byte operations, they work the same in PHP and C#.

A: Whilst I wouldn't deem it wise to attempt this, in the interest of answering your question I'd like to nevertheless direct you to this question. You might also find use in this site too. Good luck :)

A: Before i'm started searching in Google "c# to php converter online" - i know already that i will find nothing... So really, its not possible convert between frameworks. Only hand job.


text:
Q: Angular touched/changed status of a form I need to make my form to be touched: false dirty: false after I save its values and assign in proper places new IDs.
The form has a multilevel structure and has approximate next structure:
FormGroup
-- FormControl
-- FormControl
-- FormArray
  -- FormGroup
...

I run my save recursively due to unstable shape of a form.
After I save one FormGroup from FormArray I make group.markAsUntouched({ onlySelf: !hasChildren }) and group.markAsPristine({ onlySelf: !hasChildren }).
However, after that I get "changed" "dirty" FormArray of "pristine" "unchanged" FormGroups.
I've tried also make .parent unchanged and untouch but that led to "unchanged" "pristine" FormArray in "changed" "dirty" FormGroup (the parent).
I never know how deep I am and if I can mark parent as untouched and pristine, because I save only those FormGroups which are "dirty" and "changed". Also I check if a root FormGroup is changed and dirty before card close, so it's vital to keep a real values.
In docs it's said that markAsUntouched and markAsPristine recalculate corresponding values of AbstractControl's parent however it's not happening.

A: you can specify current value in the reset method
https://angular.io/api/forms/FormGroup#reset

A: Reset the form by calling reset method.
form.reset();


text:
Q: Second derivative operator closed on $AC^2[0,1]$ Consider the Hilbert space $\mathcal H=L^2(0,1)$ and let $D:=AC^2[0,1]$ be the space of functions $f\in C^1[0,1]$ such that $f'$ is absolutely continuous and the weak derivative $f''$ is in $ L^{2}(0,1)$. Define the operator $$T:D\to \mathcal H; \, T= -\frac{d^2}{dx^2}.$$
I want to prove that $T$ is closed, i.e. the graph of $T, \Gamma(T)$ is closed. To that end, let $(\varphi, \psi) \in \overline{\Gamma(T)}$ and $(\varphi_n)_{n\in \mathbb N}$ such that $\varphi_n \stackrel{n\to \infty}{\longrightarrow} \varphi$ and $T\varphi_n  \stackrel{n\to \infty}{\longrightarrow} \psi$ in $L^2$. I need to prove $\varphi \in D$ and $T\varphi = \psi$. Here I am stuck. I tried a lot playing with integration by parts and other stuff. I am also not sure what I can say about the first derivative of $\varphi$. Any help appreciated!

A: The operator $Tf = -f''$ subject to $f(0)=f(1)=0$ has an inverse given by
$$
           Sf=(1-x)\int_{0}^{x}f(t)tdt+x\int_{x}^{1}f(t)(1-t)dt.
$$
To see this, note that, for all $f \in L^2$, the Lebesgue differentiation theorem shows that $Sf$ is absolutely continuous on $[0,1]$, vanishes at $x=0,1$, and satisfies the following a.e.:
\begin{align}
         (Sf)' &= (1-x)f(x)x-\int_0^xf(t)tdt-xf(x)(1-x)+\int_x^1f(t)(1-t)dt \\
   &= -\int_0^x f(t)tdt+\int_x^1f(t)(1-t)dt.
\end{align}
Therefore, $(Sf)'$ is absolutely continuous with $(Sf)'\in L^2$ and
$$
   (Sf)'' = -f(x)x-f(x)(1-x)=-f(x) \;\;\; a.e..
$$
Therefore $Sf\in\mathcal{D}(T)$ for all $f\in L^2$, and $TSf=f$ a.e., which means that $T$ is a left inverse of $S$. And it can be directly shown that $STf=f$ for all $f\in \mathcal{D}(T)$. So $S=T^{-1}$. And $S : L^2[0,1]\rightarrow AC^2[0,1]$ is bounded on $L^2[0,1]$, which implies that $S$ is closed. So $T=S^{-1}$ is also closed because of how the graphs of $S$ and $T$ are related.
Consider $T_ef=-f''$ on the domain of $T$ except without the endpoint condition requirements. The point evaluations $E_0 f=f(0)$ and $E_1 f=f(1)$ are continuous linear functionals on the graph of $T_e$. For example, consider
\begin{align}
       \langle T_e f,g\rangle -\langle f,T_e g\rangle &= -\int_0^1 (f''g-fg'')dx \\
 & = -(f'g-fg')|_{0}^{1}.
\end{align}
By choosing $g$ carefully, you can represent point evaluations of $f,f'$ at $0$ or $1$ as continuous linear functionals on the graph of $T_e$. So $E_0,E_1$ are continuous on the graph of $T_e$. Then, for $f\in\mathcal{D}(T_e)$, one has
$$
         f-E_0(f)x-E_1(f)(1-x) \in\mathcal{D}(T)
$$
and
\begin{align}
       T_e f = T(f- &E_0(f)x-E_1(f)(1-x))\\
             +&E_0(f)T_e x+E_1(f)T_e(1-x) \\
   = S^{-1}(f- &E_0(f)x-E_1(f)(1-x)) \\
   +&E_0(f)T_e x+E_1(f)T_e(1-x)
\end{align}
Hence $T_e$ is closed because $S^{-1}$ is closed and $E_0,E_1$ are bounded on the graph of $T_e$.


text:
Q: is console.log(i) inside a loop counts as operation in big O I'm trying to understand Big O notation but i don't know if i have the following code:
function(n){
    for(let i = 0; i <n i++){
         console.log(i);
    }
}

is console.log(i) we consider it as an operation when we count or not
so it's an O(n) inside a loop which is also O(n) so this function is O(n^2)

A: console.log(i) is just outputting a single number, not (for instance) every number up to the specified "i". So that single command is just O(1).
For an "n" that is three times as high, the whole loop needs to do three times as much work, not 3² times as much, so this function is O(n).


text:
Q: Equation of pair of lines Prove that the pair of lines $6x^2+5xy-4y^2+7x+13y-3=0$ form a parallelogram with the pair of lines $6x^2+5xy-4y^2=0$. Find its area.
My attempt/
I factorized the second equation to get the two lines represented by it:
$$6x^2+5xy-4y^2=0$$
$$6x^2+8xy-3xy-4y^2=0$$
$$(3x+4y)(2x-y)=0$$.
No what should I should next to complete.?

A: The other pair would simplify to $(3x+4y+k)(2x-y-l)=0; $
Now area of the parallelogram is $$k*l\over{\sqrt{(3^2+4^2)(2^2+1^2)}}$$
Just find k and l from substitution.
Distance between $(3x+4y+k=0) and (3x+4y=0)$ = $k\over{\sqrt{3^2+4^2}}$
Distance between $(2x-y+l=0) and (2x-y=0)$ = $l\over{\sqrt{2^2+1^2}}$
Area of parallelogram = Product of the distances.


text:
Q: PowerShell New-ItemProperty to run only if property doesn't exist I'm trying to enable the Allow active content to run in file on My Computer with a powershell script. What I found is that PCs where this was never enabled, the registry for this setting was never created. What I want the script to do is check if it exists in the registry, if its not there... then to create it. If it does exist, then to just enable it.
Here is my attempt...
Creation
New-ItemProperty -path "HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN" -Name iexplore.exe -Value "0" -PropertyType DWord

Enabling
Set-ItemProperty -path "HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN" -Name iexplore.exe -Value "0" -PropertyType DWord

Using the above code... i tried using IF Else statement but just can't seem to get it right...
If(get-ItemProperty -path "HKCU:\SOFTWARE\Microsoft\Internet
Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN" -Name iexplore.exe){
New-ItemProperty -path "HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN" -Name iexplore.exe -Value "0" -PropertyType DWord -Force | Out-Null
Write-Host 'added Registry value' -f red
}
Else{
set-ItemProperty -path "HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN" -Name iexplore.exe -Value "0"
Write-Host "Active Content is set"

Instead I get this error as well as the creation of the registry but not the correct type... which I need in DWord.
get-ItemProperty : Property iexplore.exe does not exist at path HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN.
At line:2 char:4
+ If(get-ItemProperty -path "HKCU:\SOFTWARE\Microsoft\Internet Explorer ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (iexplore.exe:String) [Get-ItemProperty], PSArgumentException
    + FullyQualifiedErrorId : System.Management.Automation.PSArgumentException,Microsoft.PowerShell.Commands.GetItemPropertyCommand

Active Content is set

Any kind of help is much appreciated

A: It look like you are doing it backward ? You do If(get-ItemProperty... THEN New-Item ELSE SET but this should be the other way around. Here's something that should work.
$RegItem = @{
    Path = 'HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN'
    Name = 'iexplore.exe'
}

# Create path if missing
$Path = Get-Item -Path $RegItem.Path -ErrorAction SilentlyContinue
if ($null -eq $Path) { New-Item -Path $RegItem.Path }

if ($null -eq (Get-ItemProperty @RegItem -ErrorAction SilentlyContinue)) {
    New-ItemProperty @RegItem -Value "0" -PropertyType DWord -Force | Out-Null
    Write-Host 'added Registry value' -f red
} else {
    set-ItemProperty @RegItem -Value "0"
    Write-Host "Active Content is set"
}

Additional note
I added a section to create the FEATURE_LOCALMACHINE_LOCKDOWN if it is missing and also cleaned your code by removing all the repeat instance of the path / name.


text:
Q: How to hand over variables to a function? With an array or variables? When I try to refactor my functions, for new needs, I stumble from time to time about the crucial question:
Shall I add another variable with a default value? Or shall I use only one array, where I´m able to add an additional variable without breaking the API?

A: Unless you need to support a flexible number of variables, I think it's best to explicitly identify each parameter.  In most cases you can add an overloaded method that has a different signature to support the extra parameter while still supporting the original method signature.  If you use an array for passing variables it just makes it too confusing for users of your API.  Obviously there are some inputs that lend themselves to an array (a list of points in a polygon, a list of account IDs you wish to perform an action on, etc.) but if it's not a variable that you would reasonably expect to be an array or list, you should pass it into the method as a separate parameter.

A: Just like many questions in programming, the right answer is "it depends".
To take Javascript/jQuery as an example, one good rule of thumb is whether the parameter will be required each time the function is called or whether it is optional. For example, the main jQuery function itself requires an expression to determine what element(s) the operation will affect:
jQuery(expresssion)

It makes no sense to try to pass this parameter as part of an array as it will be required every time this function is called.
On the other hand, many jQuery plugins require several miscellaneous parameters that may be optional. By convention, these are passed as parameters via an 'options' array. As you said, this provides a nice interface as new parameters can be added without affecting the existing API. This makes the API clean as well since the user can ignore those options that are not applicable.
In general, when several parameters are involved, passing them as an array is a nice convention as many of them are certainly going to be optional. This would have helped clean up many WIN32 API's, although it is more difficult to deal with arrays in C/C++ than in Javascript.

A: It depends on the programming language used.
If you have a run-of-the-mill OO language, you should use an object that you can easily extend, if you are really concerned about API consistency.
If that doesn't matter that much, there is the option of changing the method signature and overloading the method with more / different parameters.
If your language doesn't support either and you want the API to be binary stable, use an array.

A: There are several considerations that must be made.

*

*Where is the function used? - Only in code you created? One place or hundreds of places? The amount of work that will need to be done to maintain existing code is important. Remember to include the amount of time it will take to communicate to other programmers that may currently be using your function.

*How critical is the new parameter? - Do you want to require it to be used? If it has a default value, will that default value break existing use of the function in any subtle ways?

*Ease of comprehension - How many parameters are already passed into the function? The larger the number, the more confusing and error prone it will be. Code Complete recommends that you restrict the number of parameters to 7 or less. If you need more than that, you should try to abstract some or all of the related parameters into one object.

*Other special considerations - Do you want to optimize your efforts for any special conditions such as code speed or size? Are there any special considerations that must be taken into account for your execution environment? Keep in mind your goals for the project and make sure you aren't working against them with whatever design choice you make.

A: In his book Code Complete, Steve McConnell decrees that a function should never have more than 7 arguments, and rarely even that many. He presents compelling arguments - that I can't cite from memory, alas.
Clean Code, more recently, advocates even fewer arguments.
So unless the number of things to pass is really small, they should be passed in an enveloping structure. If they're homogenous, an array. If not, then a reasonably lightweight object should be built for the purpose.

A: You should do neither. Just add the parameter and change all callers to supply the proper default value. The reason is that parameters with default values can only be at the end, and will not be able to add any more required parameters anywhere in the parameters list, without having a risk of misinterpretation.
These are the critical steps to disaster:
1. add one or two parameters with defaults
2. some callers will supply it, and some will rely on defaults.
[half a year passed]
3. add a required parameter (before them)
4. change all callers to accept the required parameter
5. get a phone call, or other event which will make you forget to change one of the instances in part#2
6. now your program compiles perfectly, but is invalid.
Unfortunately, in function call semantics we usually don't have a chance to say, by name, which value goes where.
Array is also not a proper solution. Array should be used as a connection of similar objects, upon which there's a uniform activity performed. As they say here, if it's worth refactoring, it's worth refactoring now.


text:
Q: using string methods to count characters I'm trying to count the number of non-blank characters in a string.
It works fine when there are no leading blank spaces, but when I add 3 spaces in from, it doubles the number of non-blank characters.
This is my code:
import java.io.*;
import java.util.*;

public class countCharacters
{

public static void main(String[] args) throws Exception
{
  String str1;
  int count;
  count = 0;

  BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a string: ");
  str1 = dataIn.readLine();
while(str1.length() > 0)
      {

  System.out.println("The String ''" + str1 + "''");
  System.out.println("has " + str1.length() + " Characters, including all blanks.");
  for(int i=0; i < str1.length(); ++i)
    if(str1.charAt(i) !=' ')
    count++;
  str1 = str1.trim();
   System.out.println("and " + str1.length() + " Characters, trimmed of leading and trailing blanks.");
   System.out.println("and " + count + " non-blank characters.");
System.out.println("");

System.out.print("Enter a string: ");
  str1 = dataIn.readLine();
   }

  System.out.println("Program complete.");

}
}

A: Are you sure that it doubles the count every time?  Maybe this only happens on the second time through the main loop?
You should be resetting count when you enter a new string.  Otherwise, you're just adding to the count from the previous time through the main loop.  Add a line like count = 0; before the System.out.print("Enter a string: "); at the bottom of the main loop, or declare and initialise count inside the loop, rather than before the loop.

A: You could simply do
String temp = str1.replaceAll("\\s+","");

temp.length() will give you the answer.
You can get rid of temp variable if modifying str1 is an option

A: A much cleaner way to do this would be to just make a copy without any spaces and compare the lengths:
    String str1 = "  the quick brown fox  ";
    String spaceless = str1.replace(" ", "");
    System.out.println("Number of spaces: "+(str1.length() - spaceless.length()));

A: Have you tried using the static method:
Character.isWhitespace(char ch);

For example,
if(!Character.isWhitespace(str1.charAt(i)))
    count++;


text:
Q: Is YAHOO.widget.DS_XHR able to load data cross-domain? I am trying to build an autocomplete script. The dictionary is on a separate domain and that seems to break the autocomplete.
I am use YAHOO.widget.DS_XHR to load the datasource, is it possible to use this function to load data cross-domain? If not is there another method I should be using?

A: No, because this functionality depends on the browsers restriction setting.

A: I had to use YAHOO.widget.DS_ScriptNode() instead.


text:
Q: Fetch attachments from gmail using imap I am trying to fetch attachments from my gmail account.
Code is
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'chrisvoges@gmail.com';
$password = 'abcdefghi';
$inbox = imap_open("{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX",
$username, $password, NULL, 1,array('DISABLE_AUTHENTICATOR' => 'PLAIN')) or
die(var_dump(imap_errors()));

I have also allowed imap via gmail settings
Error
array(2) { [0]=> string(107) "[ALERT] Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)" [1]=> string(23) "Too many login failures" }

Whats wrong. Moreover does this process requires ssl certificate?


text:
Q: Page not found when navigating to a numeric page url (blog date folder) in Umbraco 4.7.2 Here is my content structure:
Root node
- Page
- Blog
- - 2012
- - - 09
- - - - Blog post

The root node hostname is test.local, Blog folder hostame is blog.test.local
Web.config: umbracoUseDirectoryUrls=true, umbracoHideTopLevelNodeFromPath=true
umbracoSettings.config: useDomainPrefixes=true, addTrailingSlash=true
When navigating to blog.test.local/2012/ it gives "Page Not Found" error page. However when I go to test.local/blog/2012/ the page is rendering properly. I understand that Umbraco is trying to load page by ID when getting /2012/ request, but why the node url doesn't have priority? Did I miss enything in configuration?
P.S. If I set umbracoUseDirectoryUrls=false blog.test.local/2012.aspx is not working either.
umbraco v 4.7.2 (Assembly version: 1.0.4500.21031)

A: This is a bug in Umbraco. I have submitted a bug report here:
http://issues.umbraco.org/issue/U4-634
Give it a vote!
And the bug is discussed here:
http://our.umbraco.org/forum/ourumb-dev-forum/bugs/31454-472-breaks-all-URL-paths-that-parse-to-a-number,-like-2012-for-example


text:
Q: change attribute name in Mysql this is my original table.
+----------+---------------------+--------+------------+-------+
| lab_code | test_name           | sample | time_taken | price |
+----------+---------------------+--------+------------+-------+
| FBS      | Fasting blood Suagr | Blood  | 01:15:00   |   400 |
| STLC     | Stool Culture       | Stool  | 48:00:00   |   700 |
| UA       | Urinalysis          | Urine  | 02:30:00   |   425 |
| UDS      | Urine drug screen   | Urine  | 06:00:00   |   550 |
+----------+---------------------+--------+------------+-------+

i want to display
+----------+
| Hospital |
+----------+
| FBS      |
| STLC     |
| UA       |
| UDS      |
+----------+

i want to change attibute name when data Quering.(without changing original table)
plz help.

A: Give ALIAS name to specific column
SELECT lab_code AS Hospital
From tableA

A: What about
SELECT lab_code AS Hospital FROM <table_name>;

The use of AS is an ALIAS that can be used for the column name; it does not mean that the table's column name changes, but rather, when the SELECT query is executed, that becomes the column name or alias for the current column name present in the table.

A: Try this
SELECT lab_code AS Hospital From original_table

it will work with and without AS
SELECT lab_code Hospital From original_table

A: Try like this
aliases are used to temporarily rename a column name (or table name in other cases)
SELECT lab_code AS Hospital FROM Table

A: SELECT lab_code AS Hospital

FROM Original_Table

A: Try this:
SELECT "lab_code" AS "Hospital" FROM "table";

A: If lab_code  isn't primary key use this query
SELECT DISTINCT lab_code AS Hospital
FROM myTable


text:
Q: Ubuntu stucked on splash screen (Can't able to enter on user/password, desktop screen) I am stuck on how to load completely the OS and the login/password screen, the PC stops on the Ubuntu black screen and stuck on it:

This is the situation from my HDD in GParted, which seems that everything is ok:

And the situation of my disks:
Disk /dev/loop0: 2.13 GiB, 2285019136 bytes, 4462928 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop1: 4 KiB, 4096 bytes, 8 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop2: 61.93 MiB, 64917504 bytes, 126792 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop3: 65.22 MiB, 68378624 bytes, 133552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop4: 54.24 MiB, 56872960 bytes, 111080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop5: 248.78 MiB, 260841472 bytes, 509456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop6: 43.6 MiB, 45703168 bytes, 89264 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 596.18 GiB, 640135028736 bytes, 1250263728 sectors
Disk model: ST640LM001 HN-M6
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 4D164AE1-B36F-4F3F-8525-11EFE9BC7156

Device       Start        End    Sectors   Size Type
/dev/sda1     2048    1050623    1048576   512M EFI System
/dev/sda2  1050624 1250263039 1249212416 595.7G Linux filesystem

Disk /dev/sdb: 14.96 GiB, 16039018496 bytes, 31326208 sectors
Disk model: v165w
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1693364d

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdb1  *          0  6599743  6599744  3.2G  0 Empty
/dev/sdb2       5930192  5938191     8000  3.9M ef EFI (FAT-12/16/32)
/dev/sdb3       6602752 31326207 24723456 11.8G 83 Linux

Is there any idea in how to get the OS back?? I have opened a post before where I removed all the badblocks, now only the OS isn't loading.


text:
Q: Check Service is running from a DLL I have registered a COM Context menu DLL (to display Explorer Context Menus) in a Windows7 machine. In the DLL, I have checked whether a service is running in my system. The service is running under 'Local System Account'.
I have checked the service status by OpenSCManager and QueryServiceStatus. It seems to work in XP without any issue. But in Windows7, sometimes I get 'Access Denied' error and some times I get the wrong result... (eg, Service is running but it shows status as service is stopped.) I am not sure how to check this in Windows7.
I have also checked whether my exe is running by
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, aProcesses[i]);

but this is also not working in Windows7 when I am running as Service.
Could anyone update me how to check whether the Service is running through DLL?
Note: The DLL is loaded by Explorer.

A: You may be running into the UAC (http://en.wikipedia.org/wiki/User_Account_Control), which may limit your access to services from a non-administrative context. Does your application work when you run Explorer as an Administrator?


text:
Q: Target message to match with regex I have to check csv files live and match some expression to get data.
These files can have different type of message so different matching expression.
The message can be something like that

GuiPrinter.ProcessPrint of 116806 25374 K356 S Black Face.png 229 at 1
  table

And I want to get  116806 25374 K356 S Black Face.png
. So the regex associate to this kind of file would be something like (GuiPrinter.ProcessPrint of )(.*)([.][png|jpg|jpeg|PNG|JPG|JPEG]*) and I can return $result[2]
But the message and the regex can change, so I need a common function that can return the string that I want based on the regex, the function would have message and regex parameters. Maybe for another file the string that I want would be on first position so my $result[2] won't work.
How can I ensure to always return the string that I want to match ?

A: Use
\preg_match('/GuiPrinter.ProcessPrint of(.*?)\.(gif|png|bmp|jpe?g)/', $str, $match);
print_r($match[1]);

A: You could match the text GuiPrinter.ProcessPrint and then use \K to reset the starting point of the reported match.
Match any character zero or more times non greedy .*?, then match a dot \. and any of the image extensions in a non capturing group (?:gif|png|bmp|jpe?g) followed by a word boundary \b
GuiPrinter\.ProcessPrint of \K.*?\.(?:gif|png|bmp|jpe?g)\b
Note that to match the dot literally you have to escape it \.
For example to return 1 match using preg_match:
$str = 'GuiPrinter.ProcessPrint of 116806 25374 K356 S Black Face.png 229 at 1 table';
$re = '/GuiPrinter\.ProcessPrint of \K.*?\.(?:gif|png|bmp|jpe?g)\b/';

function findMatch($message, $regex) {
    preg_match($regex, $message, $matches);
    return array_shift($matches);
}

$result = findMatch($str, $re);

if ($result) {
    echo "Found: $result";
} else {
    echo "No match.";
}

Demo


text:
Q: Qt Creator failed to run on project names containing "update" My Qt Creator shows up a very strange behavior: I cannot run projects if there name contains "update".
I have created a completly new Qt widget project "treeviewupdate". When I want to run the app (either in release or in debug), I get this message:
Starting D:\build-untitledupdate-Desktop_Qt_5_9_1_MinGW_32bit-Debug\debug\untitledupdate.exe...
Failed to start program. Path or permissions wrong?

I checked the path settings, permissions, all seams ok. As first I guessed the failure in a too long path name, so I created a second project in the root of my filesystem (D:). But this doesn't help.
I figured out, that all projects works just fine, if they have a different name.
Tests
My test names and run reslts are:

*

*treeviewupdate  [FAIL]

*untitled        [OK  ]

*untitled2       [OK]

*untitledupdate  [FAIL]

*untitledupdat   [OK]

*untitledupdatx  [OK]

*untitledupdatex [FAIL]

*treeviewupdat  [OK]

*treeviewupdatx  [OK]

Question
Did I something wrong? Can somebody confirm this behavior?
Notes:
Qt Creator 4.4.1
Based on Qt 5.9.2 (MSVC 2015, 32 bit)
Built on Oct 4 2017 04:12:53
From revision 6afdb8bdf9
All projects are empty "MainWindow"-projects.

A: This is caused by Windows UAC. Windows thinks that you need administrator access when your application name contains words like Setup or Update. this process is called Installer Detection Technology and was introduced alongside UAC with Windows Vista.
You need to set requestedExecutionLevel into your app manifest to avoid this behavior.


text:
Q: Sql Server 2008 Cross-database table linking (relationships) I have a bit of an issue, and to be honest I don't think there's an answer, but I'll give it a try anyway.
So I have two databases [A]->Company and [B]->Product. Both databases have a Country table which is then linked to other tables in each individual database. The problem is that the data between the two Country tables is a complete duplicate. So, I essentially have to duplicate some of the relationships in each database, and maintenance on top of that is just difficult...
So, I'm curious is there a way to create a cross-database relationship between tables so I can have only one set of Country+Helper tables that govern both databases?
Thanks in advance!

A: You can't have physical relationships that span multiple databases, to enforce FK constraints.
You can still have the core lookup/helper tables in one database, but you'd just have to have an inferred FK constraint on to it from the tables in the other databases - a logical assumption, rather than something physically constrained.

A: Well you might want to think about having one transaction database, and two databases for data persistence?  Lots of work, but it seems like the best viable option -- every transaction in the write would trigger a write to each of the "read" databases?  I'm not sure I'm understanding the question completely, maybe?

A: You can't do this with foreign key contraints. You could enforce the relationship it with triggers, but it's a bit of a pain.

A: Keep in 1st database table & create a view from this table in 2nd database

A: Yes. Keep Country table in the 1st database and create a view of country table of database1  to the database2. No physical data is there only view so no need to panic.


text:
Q: table header not getting aligned with table contents while using scrollX = true I've a dataTable where I have to display the contents fetched from the database. But the problem is , I have to display the contents inside a div. While using "scrollX": true, the table header does not align with the table contents.
It gets displayed like this:
| S.No | Name | Reg. No. | Course |
|  1   | Balamurugan   | 211311106078  | BE. Electronics and Communication |
|  2   | Sai Krishna S | 211311107098  |      BE. Computer Science         |

But it should be like this:
 | S.No | Name          | Reg. No.      |                Course            |
 |  1   | Balamurugan   | 211311106078  | BE. Electronics and Communication|
 |  2   | Sai Krishna S | 211311107098  |      BE. Computer Science        |

This is how I tried:
<?php
    include("includes/config.php");
    $report = $_GET["report"];
    $title = $_GET["title"];
    $pagetitle = $title;
?>

<!DOCTYPE html>

    <?php include("includes/inc-head.php"); ?>

    <?php include("includes/inc-header.php"); ?>

                <?php echo $title; ?>
                <input type="hidden" id="input_report" name="input_report" value="<?php echo $report; ?>">

                    <button id="full_view" name="full_view" type="button" class="btn btn-info btn-sm" onclick="window.open('fullview-for-dashboard.php');">
                    Full View
                    </button>

                            Total Mark
                            Total Percentage
                            Name of the Student

                            S. No
                            Name
                            Reg. No.
                            Chain Name
                            Course

What should I add along with this, so that the table will be displayed properly?

A: I had the same issue. Seems like it's caused by the way how resizing is handled in the product.
I was able to fix by triggering resize event:
$(window).trigger('resize');

In the source of DataTables you can find the code:
var bindResize = function () {
    $(window).bind('resize.DT-'+oSettings.sInstance, _fnThrottle( function () {
        _fnAdjustColumnSizing( oSettings );
} ) );

It binds _fnAdjustColumnSizing to resize, but sometime resize isn't triggered.
Update:
Try to set a table width in scrollX parameter:
$('#table').dataTable({
  ...
  scrollX: '100%',
  ...
});

A: You need a reference to the DataTable:
var table = $('#table').DataTable();

Then, you need some combination of this:
table.draw();
table.columns.adjust();
table.scroller.measure();

You may need to defer the code for reasons...
setTimeout(function() {
    table.draw();
    table.columns.adjust();
    table.scroller.measure();
}, 1);


text:
Q: apexcharts bar chart selection shading on click I am looking to disable or at least find how to modify Apexchart's bar chart "selection shader" when you click on a bar chart. you can see in the image that the bar selected will turn darker than the rest. i want to build on this (make it darker or lighter).. I searched through the ApexCharts documentation and tried implementing selection and a few others, but no luck:

A: options = {
  states: {
    active: {
      filter: {
        type: 'none' /* none, lighten, darken */
      }
    }
  }
}

Docs: https://apexcharts.com/docs/options/states/#active


text:
Q: The Singleton Bound is blocking my path let's assume I'd like to print 28 bits of Information on a sheet of paper. To make it easy-to-read by humans, let's convert this into 7 hex digits.
Now I can add two more hex digits to produce an error-correcting code. This code has length $n=9$ and dimension $k=7$ over the field $\mathbb F_{16}$. Due to the singleton bound I can correct at most
 $$\left\lfloor{\dfrac{(n-k+1)-1}2}\right\rfloor=1$$ errors. This can be achieved by means of a MDS code, e.g. Reed-Solomon.
Now one can add more and more of these check digits. But the next improvement, i.e. being able to correct two errors, needs four check digits.
My question is: if I'd want to print my 7 hex digits plus only three more digits:
$$1234567ABC$$
can I somehow correct 2 errors? Maybe by rearranging the digits?
I already know that making the alphabet larger would make it easy to squeeze the 28 bits into 6 letters/digits. Then one would end up with a code like $123456ABCD$.

A:
can I somehow correct 2 errors? Maybe by rearranging the digits?

I though I understood the first question, but the second one is so puzzling that it makes me doubt...
First, do we agree that the amount of "errors" here refer to the elements of $\mathbb F_{16}$ (hexadeximal digits, if you prefer to call them so), no? It's not the amount of bit errors.
Now, if you are asking if we can construct a linear block code over block $\mathbb F_{16}$ with $n=10$ and $k=7$ that can correct 2 errors...
Such a code would require $t=2$, $d=5$. The Hamming bound tells us that the maximum size of the codebook is
$$A_{16}(10,5)\le \frac{16^{10}}{\binom{10}{0} + \binom{10}{1} 15 + \binom{10}{2}15^2}=\frac{16^{10}}{1+ 150 + 10125} \approx 107 \times 10^6$$
But $16^7\approx 268.4 \times 10^6$
Hence, no, (if I understood you question) you can't.

A: Maybe I'm misunderstanding you, but if you need print $28 + 4\times 4 = 44$ bits (all the $2^{44}$ numbers are possible), this requires exactly $11$ hexadecimal digits.
Using for example [0-9],[A-Z],[a-z] (62 different characters) the 44 bits fit in 8 characters because
$$62^8 = 218340105584896 > 17592186044416 = 2^{44}.$$


text:
Q: i have a bug in the recycler view while deleting item's items are getting deleted"i have no problem with that"
but the problem is check animation
when item get's deleted the check animation of items below the deleted item is getting unchecked (if its checked)
is this because of the position of item getting miss organized

idk what happening
I am new to java
this is my removeitem func
 public void removeAt(int position) {
    dbhelper.deletecoloumn(listTask.get(position).getID());
    dbhelper.deleteallitem(listTask.get(position).getID());
    listTask.remove(position);
    notifyItemRangeChanged(position, getItemCount());
    notifyItemRemoved(position);
}

checkanim func
  private void Check(TaskHolder holder,int position){
    if (listTask.get(position).getComplete().equals("0")){
        Log.d(TAG, "Check: equals 0");
        holder.uncheckeditem.setVisibility(View.VISIBLE);
        holder.checked.setVisibility(View.GONE);
        holder.textViewName.setTextColor(mContext.getResources().getColor(R.color.black));
        holder.textViewName.setPaintFlags(holder. textViewName.getPaintFlags() & (~ Paint.STRIKE_THRU_TEXT_FLAG));
    }else if (listTask.get(position).getComplete().equals("1")){
        holder.uncheckeditem.setVisibility(View.GONE);
        Log.d(TAG, "Check: equals 1");
        holder.checked.setVisibility(View.VISIBLE);
        holder.textViewName.setPaintFlags( holder.textViewName.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        holder.textViewName.setTextColor(mContext.getResources().getColor(R.color.text_grey));
    }
}


text:
Q: Possible to make setSystemUiVisibility() affect the entire system, rather than just your app? I was hoping to make an app which dimmed the soft buttons to dots on the Galaxy Nexus, using the code from this answer. For completeness, this is the code:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);

Here's the question, is it possible for the app to make this setting system-wide rather than just while the app has focus? So ideally the app would run in the background and would keep View.SYSTEM_UI_FLAG_LOW_PROFILE as the default as long as it's running, for any and every app that you open (unless that app specifically overrides it, I suppose). Is this possible or does this fall outside the realm of what an Android app has permission to do?
A sample use case is this: I use the "Screen Filter" app to reduce brightness a lot for nighttime ebook reading or misc app usage, but the soft buttons are still very bright and distracting, so I wanted to make an app that would dim the soft buttons system-wide while running (like how "Screen Brightness" reduces screen brightness system-wide while running) so this wouldn't be a problem.

A:
is it possible for the app to make this setting system-wide rather than just while the app has focus?

No.

A: As CommonsWare states, it's not possible for an application to change this setting. It's an Activity based setting, that must be set for every single Activity, if you want to make it fullscreen, hide the soft keys, etc.
It's also worth pointing out that you should probably refrain from using it in all your application activities. It's really only meant for games, video players and other applications that need to enter this "low profile" state.
Feel free to accept CommonsWare's answer - I just thought I'd give you a bit of background info on the subject.


text:
Q: How can I access the child nodes? DOM XML How can I get the value/text of the child-node "description" and "created-at"?
I have had this working before a year ago but now I can't get it to work again. Please help.
    xmlPath := "C:\Script\doc.xml"
    xmlDoc := ComObjCreate("MSXML2.DOMDocument.6.0")
    xmlDoc.async := false
    xmlDoc.load(xmlPath)

    for item in xmlDoc.getElementsByTagName("ticket") {
        string := item.text
        stringDesc := item.getAttribute("description").text
        stringTime := item.getAttribute("created-at").text

        FileAppend, %string%, C:\Script\htmlversion.html
        FileAppend, %stringDesc%, C:\Script\htmlversion.html
        FileAppend, %stringTime%, C:\Script\htmlversion.html
    }

    XML:
    <ticket>
    <id type="integer">31</id>
    <description> This is some text I want to access. </description>
    <created-at type="dateTime">2018-02-14T11:27:52+01:00</created-at>
    </ticket>

The first one works:
    string := item.text

But not the other two:
    stringDesc := item.getAttribute("description").text
    stringTime := item.getAttribute("created-at").text

A: description and created-at aren't attribute in your example case.
You should try:
for item in xmlDoc.getElementsByTagName("ticket") {
    string := item.text
}

for item in xmlDoc.getElementsByTagName("description") {
    stringDesc := item.text
}

for item in xmlDoc.getElementsByTagName("created-at") {
    stringTime := item.text
}


text:
Q: DNS redirect based on local or remote network connection I have a domain name mysite.com pointed to my dedicated server (debian 7).
Authenticated users will be behind OpenVPN with local addresses and masquerading.
What I want to do is send unauthenticated users to the server's remote ip and authenticated users to the local ip. To make things even more interesting, I have a reverse proxy setup to send a sub domain to a different port.
So far I have looked at iptables prerouting, and apache2 proxy.
The basic idea is if the user can reach 10.8.0.1 the domain mysite.com should resolve to 10.8.0.1 otherwise is should resolve to the remote ip. How can I achieve this?

A: openVPN allows you to specify a DNS server along with the VPN-IP address. if you control this DNS-server, you can easily create an ACL that will return 10.8.0.1 for queries originating from the VPN network, and the public IP address when the queries come from outside of this network.
in the openVPN config, you would add something like the following (assuming your DNS-server has the IP 10.8.0.53)
push "dhcp-option DNS 10.8.0.53"

how to configure your DNS-server will obviously depend on the actual server you are using (which you didn't mention).
in bind9 it would look similar to the following:
acl authenticated { 10.8.0.0/24; };

view "authenticated" {
   match-clients { authenticated; };
   zone "mysite.com" {
      type master;
      file "/etc/bind/db.authenticated";
   };
};
view "anonymous" {
   match-clients { any; }
   zone "mysite.com" {
      type master;
      file "/etc/bind/db.anonymous";
   };
}


text:
Q: runOnUiThread how to close/shutdown thread Q. I am using the code below to carry out a task which it is doing, however when the app ends I get an error which basically says the thread below was not shut down properly.
Does anyone know how to close down this kind of thread.
private Handler aHandler = new Handler();
private final Runnable r = new Runnable()
{
    @Override
    public void run()
    {
        updateProgress();
    }
};

private void updateProgress()
{
    if (scrubber != null)
        Log.d("TAG", ...);

    aHandler.postDelayed(r, 1000);
}

// IN THE ON CREATE METHOD I USE

runOnUiThread(new Runnable()
{
    public void run()
    {
        updateProgress();
    }
});

Thankyou for your help but I am still getting error as can be seen below:
10-01 14:26:29.978: I/SurfaceView(19852): updateWindow -- OnPreDrawListener, mHaveFrame = true
10-01 14:26:29.978: D/dalvikvm(19852): threadid=15: interp stack at 0x60be9000
10-01 14:26:29.979: D/AndroidRuntime(19852): Shutting down VM
10-01 14:26:29.979: W/dalvikvm(19852): threadid=1: thread exiting with uncaught exception      (group=0x41f76c98)
10-01 14:26:29.979: W/dalvikvm(19852): threadid=1: uncaught exception occurred
10-01 14:26:29.979: W/System.err(19852): java.lang.IllegalStateException
10-01 14:26:29.980: W/System.err(19852):    at android.media.MediaPlayer.isPlaying(Native Method)
10-01 14:26:29.980: W/System.err(19852):    at com.aviit.bluebox.MediaActivity.updateProgress(MediaActivity.java:162)
10-01 14:26:29.980: W/System.err(19852):    at com.aviit.bluebox.MediaActivity.access$0(MediaActivity.java:157)
10-01 14:26:29.980: W/System.err(19852):    at com.aviit.bluebox.MediaActivity$1.run(MediaActivity.java:153)
10-01 14:26:29.980: W/System.err(19852):    at android.os.Handler.handleCallback(Handler.java:808)
10-01 14:26:29.980: W/System.err(19852):    at android.os.Handler.dispatchMessage(Handler.java:103)
10-01 14:26:29.980: W/System.err(19852):    at android.os.Looper.loop(Looper.java:193)
10-01 14:26:29.980: W/System.err(19852):    at android.app.ActivityThread.main(ActivityThread.java:5292)
10-01 14:26:29.981: W/System.err(19852):    at java.lang.reflect.Method.invokeNative(Native Method)
10-01 14:26:29.981: W/System.err(19852):    at java.lang.reflect.Method.invoke(Method.java:515)
10-01 14:26:29.981: W/System.err(19852):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
10-01 14:26:29.981: W/System.err(19852):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
10-01 14:26:29.981: W/System.err(19852):    at dalvik.system.NativeStart.main(Native Method)
10-01 14:26:29.981: W/dalvikvm(19852): threadid=1: calling UncaughtExceptionHandler
10-01 14:26:29.982: E/AndroidRuntime(19852): FATAL EXCEPTION: main
10-01 14:26:29.982: E/AndroidRuntime(19852): Process: com.aviit.bluebox, PID: 19852
10-01 14:26:29.982: E/AndroidRuntime(19852): java.lang.IllegalStateException
10-01 14:26:29.982: E/AndroidRuntime(19852):    at android.media.MediaPlayer.isPlaying(Native Method)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at com.aviit.bluebox.MediaActivity.updateProgress(MediaActivity.java:162)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at com.aviit.bluebox.MediaActivity.access$0(MediaActivity.java:157)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at com.aviit.bluebox.MediaActivity$1.run(MediaActivity.java:153)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at android.os.Handler.handleCallback(Handler.java:808)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at android.os.Handler.dispatchMessage(Handler.java:103)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at android.os.Looper.loop(Looper.java:193)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at android.app.ActivityThread.main(ActivityThread.java:5292)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at java.lang.reflect.Method.invokeNative(Native Method)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at java.lang.reflect.Method.invoke(Method.java:515)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
10-01 14:26:29.982: E/AndroidRuntime(19852):    at dalvik.system.NativeStart.main(Native Method)
10-01 14:27:02.097: D/dalvikvm(19852): threadid=12: exiting
10-01 14:27:02.097: D/dalvikvm(19852): threadid=12: bye!

A: private Handler aHandler = new Handler();
private final Runnable r = new Runnable()
{
    @Override
    public void run()
    {

        if (scrubber != null)
            Log.d("TAG", ...);

        aHandler.postDelayed(this, 1000);
    }
};

add somewhere in the code:
  aHandler.post(r);

when it is done, you need to:
  aHandler.removeCallback(r);

A: If you want to finish this handler with clicking back button add this:
@Override
public void onBackPressed() {
   // stop Handler
   aHandler.removeCallbacks(r);
   // to stop anonymous runnable use aHandler.removeCallbacksAndMessages(null);
}

Or maybe you can solve that with adding this on your activities onDestroy() method:
@Override
protected void onDestroy() {
    // stop Handler
    aHandler.removeCallbacks(r);
    // to stop anonymous runnable use aHandler.removeCallbacksAndMessages(null);
    super.onDestroy();
}


text:
Q: Play 2.5 error - CompletionStage cannot be converted to F.Promise Hoping someone can help. I'm trying to upgrade from Play 2.4 to 2.5. After upgrading, I'm getting errors in the JavaController class. One of the errors show

[error] /Play-2-JS-2.5/app/controllers/JavaController.java:87:
  java.util.concurrent.CompletionStage cannot
  be converted to play.libs.F.Promise
  [error] WS.url("http://example.com").get()

It looks as though perhaps WSReponse might have been deprecated when going to 2.5. I tried to replace F.Promise with CompletionStage here on line 87 https://github.com/btgrant-76/Play-2-Java-Scala-Java-8-Async-Comparison/blob/6a85cf31cfb804ef20bacf8e14d30ce46cc9307c/app/controllers/JavaController.java#L87 but get the same error. I've been googling for quite sometime and found topics around Dependency Injection however, there aren't any examples. Any examples and/or where to go to from here would be wonderful.

A: If you replaced
final F.Promise<WSResponse> responsePromise = WS.url("http://example.com").get();

with
final CompletionStage<WSResponse> responsePromise = WS.url("http://example.com").get();

and still get the same error, then things to check include:

*

*Are you saving the source code before you recompile?  If F.Promise is mentioned in the error message but doesn't appear in the code, that's fishy.  In Play 2.5, WSResponse.get has the signature java.util.concurrent.CompletionStage<WSResponse> get() so F.Promise shouldn't be coming from there.  See the javadoc for reference.

*Check the versions of Play jars you have in your classpath.  If you're converting from 2.4 to 2.5, it's possible you still have dependencies which pull in Play 2.4 jars as transitive dependencies.  If you're not using an IDE, which should display the classpath for you, use a tool like this one to view dependencies.
EDIT
Based on the error message given in your comment, you're importing the wrong WSResponse class because you're mixing the Java and Scala APIs.  It looks like you're importing play.api.libs.ws.WSResponse instead of play.libs.ws.WSResponse (note the api part of the package, this denotes the Scala API).


text:
Q: CakePhp where() condition is not working on HasMany relation I have to table
1. Products
2. VendorsInventories

NB: Product may contain more than one VendorsInventories.
In Model/Table/VendorsInventories
    public function initialize(array $config)
    {
        parent::initialize($config);

        $this->setTable('vendors_inventories');
        $this->setDisplayField('id');
        $this->setPrimaryKey('id');

        $this->belongsTo('Products', [
            'foreignKey' => 'products_id',
            'joinType' => 'INNER'
        ]);
    }

And in: Model/Table/ProductsTable.php
    public function initialize(array $config)
    {
        parent::initialize($config);

        $this->setTable('products');
        $this->setDisplayField('name');
        $this->setPrimaryKey('id');
        $this->addBehavior('Timestamp');
        $this->hasMany('VendorsInventories',[
            'foreignKey' => 'products_id',
            'joinType' => 'INNER'
        ]);
    }

in query:
$products=$this->Products->find('all')->contain(['VendorsInventories']);

and the result is:

My main question is: How to seletct rows which contain Relation data.
N.B: belongsTo() is working fine, i have problem with hasToMany()

A: Check the CakePHP Conventions

Foreign keys in hasMany, belongsTo/hasOne relationships are recognized
  by default as the (singular) name of the related table followed by
  _id. So if Users hasMany Articles, the articles table will refer to the users table via a user_id foreign key. For a table like
  article_categories whose name contains multiple words, the foreign key
  would be article_category_id.

So, change
'foreignKey' => 'products_id',

to
'foreignKey' => 'product_id',


text:
Q: createPattern doesn't work with ImageBitmap in Safari? According to the documentation at https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern, ImageBitmap is a supported argument, and Safari is claimed to have full support.
However, trying to substitute a canvas element with ImageBitmap in the provided example, it fails with some mysterious TypeError on Safari, but works fine in other browsers.
I can't find anything on this issue, is it a browser bug or something is missing from the documentation?

// Create a pattern, offscreen
const patternCanvas = document.createElement("canvas");
const patternContext = patternCanvas.getContext("2d");

// Give the pattern a width and height of 50
patternCanvas.width = 50;
patternCanvas.height = 50;

// Give the pattern a background color and draw an arc
patternContext.fillStyle = "#fec";
patternContext.fillRect(0, 0, patternCanvas.width, patternCanvas.height);
patternContext.arc(0, 0, 50, 0, 0.5 * Math.PI);
patternContext.stroke();

const bmp = createImageBitmap(patternCanvas);

bmp.then(bmp => {
  // Create our primary canvas and fill it with the pattern
  const canvas = document.createElement("canvas");
  const ctx = canvas.getContext("2d");
  const pattern = ctx.createPattern(bmp, "repeat");
  ctx.fillStyle = pattern;
  ctx.fillRect(0, 0, canvas.width, canvas.height);

  // Add our primary canvas to the webpage
  document.body.appendChild(canvas);
 });


text:
Q: I can't post to an address different to "localhost" using Angular I am creating a easy web page, I use Angular for client and spring boot for server. First I have done tests using local host, example of my angular app:
This is my service.ts that communicates to java server:
url="http//localhost/demo";

login(u:user){
  return this.http.post<user>(this.url+'/login',u);
}

The code above works correctly, ok the problem starts when I try to use my domain name assigned to server, to use this app in production.
url="http//domain/demo";

login(u:user){
  return this.http.post<user>(this.url+'/login',u);
}

I don't know what's happening, I've done test using postman aplication and I can do the post corretly and recived the response using url(http//domain/demo), so the dns,port forwarding and java server are not the problem. I've used wireshark to capture the requests and responses, and I was surprised that not even the request message is generated, is like angular will block the request for not being a localhost url.
Thank you for your attention

A: Most likely you are hitting the limitations enforced by CORS. Only specific set of requests can be done without beeing block by CORS rules - those are called simple requests. For every other kind of request, host that you try to connect to must explicitly allow to access its resources from different domain. This is done with so called pre-flight request.
If pre-flight fails - request is blocked. Angular app (any js app) will not be even notified what caused the error. You will simply receive err code 0 (if I remember correctly). Pre-flight can fail if server response does not declare that request from your current domain is allowed (by explicitly mentioning it, or wildcarding it) or if the server didn't respond to the preflight at all.
CORS rules are enforced by the browsers themselves. Therfore you will be able to execute specific requests using eg Wget, CURL, Postman and any other http client and yet the exact same requests will be blocked by the browser. This obviously applies to XHR requests (simple speaking, requests done via JS)
CORS rules does not apply to localhost


text:
Q: Angular Material Nested Tree Can someone please help me with the simplest method of adding a new node to the angular material nested tree?
I searched everywhere and did not find a suitable method for the nested tree.
This is my cod so far :
TS:
export class FileNode {
  children!: FileNode[];
  fileName!: string;
  type: any;
}

    export class AppComponent {
      nestedDataSource= new MatTreeNestedDataSource<FileNode>();
      nestedTreeControl = new NestedTreeControl<FileNode>(node => node.children);

      constructor() {
        this.nestedDataSource.data=TREE_DATA;
       }

       hasChild = (nr: number, nodeData: FileNode) => { return !(nodeData.type); };
          }
HTML :
<mat-tree [dataSource]="nestedDataSource" [treeControl]="nestedTreeControl" class="example-tree">

  <mat-tree-node *matTreeNodeDef="let node">

          <button mat-icon-button disabled></button>
          {{node.fileName}}: {{node.type}}
          <button mat-icon-button><mat-icon>add</mat-icon></button>

  </mat-tree-node>

  <mat-nested-tree-node *matTreeNodeDef="let node; when: hasChild">

              <button mat-icon-button matTreeNodeToggle>
                  <mat-icon class="mat-icon-rtl-mirror">
                      {{nestedTreeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
                  </mat-icon>
              </button>
              {{node.fileName}}
              <button mat-icon-button><mat-icon>add</mat-icon></button>

              <ng-container matTreeNodeOutlet></ng-container>

  </mat-nested-tree-node>
</mat-tree>

A: The solution you're looking for is already available in their official documentation. Please check the https://material.angular.io/components/tree/examples#tree-checklist link and let me know if it doesn't solve your use case.


text:
Q: Group notation $\otimes$ and $\oplus$ used for representations of quarks and mesons I've been trying to figure out this statement from the PDG quark model summary (PDF).

Following $\mathrm{SU}(3)$, the nine possible $q\bar{q}′$ combinations containing the light $u$, $d$, and $s$ quarks are grouped into an octet and a singlet of light quark mesons:
$\mathbf{3} \otimes \mathbf{\bar{3}} = \mathbf{8} \oplus \mathbf{1}$

This looks like some very nice notation that comes up now and then, but unfortunately I don't have any idea what it's called and the introductory group theory material I've skimmed doesn't explain it. In particular I'm trying to figure out what the $\otimes$ and $\oplus$ mean.
Obviously this is a simple question to answer with Google, but that's a bit hard without knowing what this is called. What do I have to google to find out more about this?

A: In physicist jargon, we talk about group representations of $\mathrm{SU}(2)$ and $\mathrm{SU}(3)$ by denoting an irreducible representation whose representation vector space has dimension $N$ by $\mathbf{N}$.
Hence, the statement $\mathbf{3} \otimes \bar{\mathbf{3}} = \mathbf{1} \oplus \mathbf{8}$ is the statement that the tensor product of the three-dimensional representation of $\mathrm{SU}(3)$ (also called its fundamental representation, as it is the smallest non-trivial one) and its conjugate representation decomposes as the direct sum of the eight-dimensional (the adjoint representation) and the trivial representation.
The notation works for $\mathrm{SU}(3)$ because there are only two irreducible representations with a given dimension, and they are conjugates of each other, so $\mathbf{N}$ and $\bar{\mathbf{N}}$ are sufficient to denote all possible (finite-dimensional) representations


text:
Q: java robot ввод данных Как разбить переменную String на символы так, чтобы можно было ввести их в текстовое поле посредством класса Robot()? Просто, чтобы ввести данные, их нужно добавлять в код по одной букве, и в таком виде, насколько я понял:
    r.keyPress('K');
    r.keyRelease('K');
    r.keyPress('E');
    r.keyRelease('E');
    r.keyPress(KeyEvent.VK_SHIFT);
    r.keyPress('Y');
    r.keyRelease('Y');

При этом вводятся строчные буквы, хотя в коде они заглавные.
Проблема заключается в том, что мне хотелось бы вводить строку в JTextArea, и чтобы Robot ее вводил многократно.
Как заставить этот класс распознавать строки и вводить их?

A: Для того, чтобы тебе вводить строку целиком, необходимо cоздать ассоциацию буквы из строки ( char) с соответствующим полем класса java.awt.KeyEvent. ( ну на самом деле там просто интовые значения, но все равно удобно).
Например, 'a' - это KeyEvent.VK_A. 'b' - KeyEvent.VK_B.
Код будет таким :
robot.pressKey(KeyEvent.VK_A);
robot.releaseKey(KeyEvent.VK_A);

Если необходимо ввести большую букву, необходимо сначала зажать shift, ввести маленькую букву, и отжать shift. Соответственно, код будет следующим:
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
roboy.keyRelease(KeyEvent.VK_SHIFT);


text:
Q: Check if text contains URL How can I check if text in PHP contains a link in it's text?
I have a database table format as follow.
+------------------+
| id | posts | tag |
+------------------+
| 1  | text 1|  0  | //no links
| 2  | text 2|  1  | //contains links

Basically, I want to verify that the submitted entry contains a link, if it does,
the tag column will have a value of 1.
Can someone help me to properly code the above sample? Currently this is my PHP:
include 'function.php';

$text= $_POST['text'];

//if $text contains a url then do this function
postEntryWithUrl($text);

//else here
postEntry($text);

A: You can use stristr()
$has_link = stristr($string, 'http://') ?: stristr($string, 'https://');

http://php.net/manual/en/function.stristr.php
Or preg_match()
preg_match('/(http|ftp|mailto)/', $string, $matches);
var_dump($matches);

https://www.php.net/manual/en/function.preg-match.php

A: $text = (string) $_POST['text'];

$bHasLink = strpos($text, 'http') !== false || strpos($text, 'www.') !== false;

if($bHasLink){
    postEntryWithUrl($text);
}else{
    postEntry($text);
}


text:
Q: Child, with min-height set to 100%, does not take up parent's height I currently have this setup

          This has content

However, the green div is not taking up all the space of its orange parent.

I'm absolutely breaking my head over it, does anyone have any clue of why this is happening?
Do note, setting height to 100vh is not a solution, it's a dirty hack.
You can find the working example at https://codesandbox.io/s/wizardly-hoover-23y8v?file=/src/App.js:67-333