text:
Q: Hover text image I have a regular horizontal menu bar. I was wondering if it would be possible to have an image overlap the text upon hovering with the mouse ? I have a horror site that I'm working on, and I think it would be cool to have a bloody handprint appear over the links on the menu bar when hovered over. I know it's possible, because I've seen something similar before, but I need help pulling it off. Thanks in advance.
The first link to the homepage is the image I want to overlay over the texts upon hover.

Random Page

Characters

 Timeline

 Gallery

 Videos

Regal Family Tree

A: As smdsgn commented on your question, without code you've already tried, it is difficult for others to completely understand what you're trying to accomplish. Regardless, presuming I understand your question correctly I can provide you a couple of pointers.
If you simply want to add an image to your menu bar link when it's hovered over, utilize CSS' :hover selector with the background attribute (or the background-image attribute, if you prefer) as I've done in this jsfiddle.
nav ul li:hover {
  background: #someColour url(yourImage.file) no-repeat left;
  background-size: 50px;
  cursor: pointer;
}

If you want more customization, such as hiding the link text when it's hovered over, you can implement some jQuery as I've done in this jsfiddle.
var hiddenText;

$('li').hover(function() {
  hiddenText = $(this).text();
  $(this).css({'background': '#someColour url(yourImage.file) no-repeat center','background-size': '50px'})
  $(this).text('');
}, function() {
  $(this).css({'background': '#someOtherColour'})
  $(this).text(hiddenText);
})

If neither of these pointers provide a solution for you, please add more detail to your question, as well as code you've tried.

A: Okay I've figured it out on my own. Using a z index in css, I got this html to work how I wanted, so that the "logo" image would fade in and out upon hover.

Home

Random Page

Characters

 Timeline

 Gallery

 Videos

Regal Family Tree


text:
Q: How to Display an HTTP Response Body Content-type: application/pdf in a HTML page I am getting a HTTP response of the PDF file and I can see the PDF file when I run the API in Postman.

How to display this response body in a HTML page or download the PDF from HTML Page?
HTML
<iframe src="" id="dispwill" frameborder="0"></iframe>

JavaScript:
request.onreadystatechange = () => {
                console.log(request.response);
                if (request.readyState == 4 && request.status === 200) {
                    console.log(request.getResponseHeader('etag'));
                    console.log(request.responseType);
                    console.log(request.responseURL);
                    const pdfsource = new Blob([request.response],{type: 'application/pdf'});
                    document.getElementById("dispwill").src = pdfsource;

                  }

I am trying to get the PDF file itself and display it in a iframe tag but it is not working that way.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Accessing variables of an object of a particular class through a different class within the constructor of latter class In the code below, I've added two lines that print output. The first line prints junk as usual, but surprisingly the second one gives me a compilation error. Why?
class Student {

  private String name;

  public Student(String name){
         this.name = name;
  }
  public String getName(){
         return name;
  }
}

class StudentServer {

   public StudentServer(){

          Student[] s = new Student[30];
          s[0] = new Student("Nick");

          // LINE 01: This compiles, although prints junk
          System.out.println(s[0]);

          // LINE 02: I get a error called cannot find symbol
          System.out.println(s[0].getName());
   }

  public static void main(){
         new StudentServer();
  }
}

A: try this:
public static void main(String[] args)

A: The issue with main method not being a proper application entry point aside, this code should compile and run just fine. The problem seems to lie elsewhere, and there's not enough information at the moment to identify the source.
Related questions

*

* Java Beginner question about String[] args in the main method

* Exception in thread "main" java.lang.NoSuchMethodError: main

On toString()
The reason why printing s[0] "prints junk as usual" is because you didn't @Override the toString() method inherited from Object.
If you had just added this method:
@Override public String toString() {
   return "Student : " + name;
}

then printing s[0] wouldn't print "junk"; it would print whatever the above toString() returns (which in this case, is something reasonably "not junk").
Related questions

*

*toString() in Java

* Is toString() only useful for debugging?

* when to use toString() method


text:
Q: Docker: there is insufficient memory for the Java Runtime Environment to continue I am trying to launch a docker container ; the container exits with status code 1, indicating an error. It looks like a memory error ; however, the requested memory (~900Mo) is lower than the available memory (~8Go). docker logs yields the following error:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000ca660000, 899284992, 0) failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 899284992 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid1.log

My docker info is as such:
Containers: 5
 Running: 0
 Paused: 0
 Stopped: 5
Images: 32
Server Version: 18.09.2
Storage Driver: windowsfilter (windows) lcow (linux)
 Windows:
 LCOW:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: ics l2bridge l2tunnel nat null overlay transparent
 Log: awslogs etwlogs fluentd gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 17134 (17134.1.amd64fre.rs4_release.180410-1804)
Operating System: Windows 10 Pro Version 1803 (OS Build 17134.829)
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 7.813GiB
Name: DESKTOP-OB3P5AU
ID: AYR7:F43F:MI7W:4JSM:EA5V:VXNB:T3HP:ZTL2:AZ2F:KFCM:463Q:RXJG
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: -1
 Goroutines: 26
 System Time: 2019-06-24T22:41:43.3487574+02:00
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Do you know how I can solve this?
For info, my Dockerfile is as such, and there was no problem when building the image.
FROM python:3.6-alpine

RUN adduser -D microblog

WORKDIR /home/microblog

COPY requirements.txt requirements.txt
RUN python -m venv venv
RUN apk add --no-cache --virtual .pynacl_deps build-base python3-dev libffi-dev
RUN venv/bin/pip install -r requirements.txt
RUN venv/bin/pip install gunicorn
RUN venv/bin/pip install gunicorn 'pymysql<0.9'

COPY app app
COPY migrations migrations
COPY microblog.py config.py boot.sh ./
RUN chmod +x boot.sh

ENV FLASK_APP microblog.py

RUN chown -R microblog:microblog ./
USER microblog

EXPOSE 5000
ENTRYPOINT ["./boot.sh"]

A: I had the same problem when running the docker on AWS. But you can solve this by increasing the memory available for java to run the application by passing the parameter below to the docker:
-e ES_JAVA_OPTS = "- Xms108m -Xmx108m"
Hope this helps! Vlw!


text:
Q: XML parsing issue in Python using xml.etree or Dom API I have following simple code that is parsing a XML file.
The issue is if in XML file the name space contains ":" i get an error. Not having  it, no issue.  It happens when i have ":" between "Junos and Style" when i remove the ":" from XML it works perfectly.
Please advise.
Fail with this:
<interface-information xmlns="http://xml.juniper.net/junos/12.1X47/junos-interface" **junos:style**="brief">

Works with This:
<interface-information xmlns="http://xml.juniper.net/junos/12.1X47/junos-interface" **junosstyle**="brief">

Python Script:
from xml.dom.minidom import parse
import xml.dom.minidom

DOMTree = xml.dom.minidom.parse("test.xml")
collection = DOMTree.documentElement
if collection.hasAttribute("xmlns"):
   print "Root element : %s" % collection.getAttribute("xmlns")

Interfaces = collection.getElementsByTagName("logical-interface")

for rname in Interfaces:
   print "*****Interface*****"
   rtype = rname.getElementsByTagName('name')[0]
   print "Type: %s" % rtype.childNodes[0].data

Here is the error:
Traceback (most recent call last):
  File "test.py", line 48, in <module>
    DOMTree = xml.dom.minidom.parse("test.xml")
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/minidom.py", line 1921, in parse
    return expatbuilder.parse(file)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: unbound prefix: line 2, column 0

It works not having ":" in XML between "Junos and Style"
Here is complete XML:
<?xml version="1.0"?>
<interface-information xmlns="http://xml.juniper.net/junos/12.1X47/junos-interface" junos:style="brief">
<logical-interface>
<name>reth4.10</name>
<description>
Test description
</description>
<if-config-flags>
<iff-snmp-traps/>
<internal-flags>
0x0
</internal-flags>
</if-config-flags>
<encapsulation>
ENET2
</encapsulation>
<filter-information>
</filter-information>
<logical-interface-zone-name>
Test2
</logical-interface-zone-name>
<allowed-host-inbound-traffic>
<inbound-ping/>
</allowed-host-inbound-traffic>
<address-family>
<address-family-name>
inet
</address-family-name>
<interface-address>
</interface-address>
</address-family>
<address-family>
<address-family-name>
multiservice
</address-family-name>
</address-family>
</logical-interface>
</interface-information>

A: Just found what the issue is.
I had to define xmlns:junos in XML.

Don't know why but somehow i had omitted this line in my XML. I think it happened while i was copy pasting the XML.
Thanks for reply.

A: Adding the definition for junos apparently resolves the parsing issue.
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.1X47/junos">

I have used the following working sample for reference.


text:
Q: C# program that dumps the entire HKLM registry tree to the console? I'm trying to write a simple console app that dumps the contents of HKLM to the console. The output should look something like:
HKEY_LOCAL_MACHINE
HKEY_LOCAL_MACHINE\BCD00000000
  HKEY_LOCAL_MACHINE\BCD00000000\Description
    KeyName: BCD00000000
    System: 1
    TreatAsSystem: 1
    GuidCache: System.Byte[]
  HKEY_LOCAL_MACHINE\BCD00000000\Objects
    HKEY_LOCAL_MACHINE\BCD00000000\Objects\{0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9}
      HKEY_LOCAL_MACHINE\BCD00000000\Objects\{0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9}\Description
        Type: 537919488
      HKEY_LOCAL_MACHINE\BCD00000000\Objects\{0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9}\Elements
        HKEY_LOCAL_MACHINE\BCD00000000\Objects\{0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9}\Elements\16000020
          Element: System.Byte[]

I haven't had much luck researching how to do this. Any help would be greatly appreciated.

A: You know there's already an app that dumps registry contents, right?
REG EXPORT HKLM hklm.reg

Fun part is, it exports the keys in a text format, but that text file can be imported using either REG or the registry editor.

A: cHao way is the safiest approach to your question. In the meanwhile, I was bored on this sunday night and wrote something. Just change the Console.WriteLine or add a few other Console.WriteLine to suit your need, whatever need there is.
class Program
{
    static void Main(string[] args)
    {
        Registry.CurrentUser.GetSubKeyNames()
            .Select(x => Registry.CurrentUser.OpenSubKey(x))
            .Traverse(key =>
            {
                if (key != null)
                {
                    // You will most likely hit some security exception
                    return key.GetSubKeyNames().Select(subKey => key.OpenSubKey(subKey));
                }

                return null;
            })
            .ForEach(key =>
            {
                key.GetValueNames()
                    .ForEach(valueName => Console.WriteLine("{0}\\{1}:{2} ({3})", key, valueName, key.GetValue(valueName), key.GetValueKind(valueName)));
            });

        Console.ReadLine();
    }
}

public static class Extensions
{
    public static IEnumerable<T> Traverse<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> fnRecurse)
    {
        foreach (T item in source)
        {
            yield return item;

            IEnumerable<T> seqRecurse = fnRecurse(item);

            if (seqRecurse != null)
            {
                foreach (T itemRecurse in Traverse(seqRecurse, fnRecurse))
                {
                    yield return itemRecurse;
                }
            }
        }
    }

    public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
    {
        foreach (var item in source)
        {
            action(item);
        }
    }
}

A: thanks for the answer Pierre-Alain Vigeant, i like ur solution. for the most part it worked with a couple of minor alterations for the text formatting,  but i still couldnt deal with the security exception that was being thrown. turns out linq is not so great for this because it does alot of behind the scenes stuff. the following solution is a basic idea of how to do it
class Program
{
    static void Main(string[] args)
    {
        RegistryKey key = Registry.LocalMachine;

        Traverse(key, 0);

        key.Close();
        Console.Read();

    }

    private static void Traverse(RegistryKey key, int indent)
    {
        Console.WriteLine(key.Name);
        string[] names = key.GetSubKeyNames();

        foreach (var subkeyname in names)
        {

            try
            {
                string[] valnames = key.GetValueNames();
                foreach (string valname in valnames)
                {
                    Console.WriteLine(returnIndentions(indent)+valname + ":" + key.GetValue(valname));

                }
                Traverse(key.OpenSubKey(subkeyname),indent++);
            }
            catch {
            //do nothing
            }
        }
    }

    private static string returnIndentions(int indent)
    {
        string indentions = "";
        for (int i = 0; i < indent; i++) {
            indentions += " ";
        }
        return indentions;
    }

}

A: using System;
using System.Text;
using Microsoft.Win32;

class Program
{
    static void Main(string[] args)
    {
        using RegistryKey key = Registry.LocalMachine;
        string keyName = args[0]; // eg @"SOFTWARE\Microsoft\Speech\Voices"

        var sb = new StringBuilder();
        var subKey = key.OpenSubKey(keyName);
        Traverse(subKey);

        void Traverse(RegistryKey key, int indent = 0)
        {
            sb.AppendLine(new string(' ', Math.Max(0, indent - 2)) + key.Name);

            indent++;
            string[] valnames = key.GetValueNames();
            foreach (string valname in valnames)
            {
                sb.AppendLine(new string(' ', indent) + valname + " : " + key.GetValue(valname));
            }

            string[] names = key.GetSubKeyNames();

            foreach (var subkeyname in names)
            {
                Traverse(key.OpenSubKey(subkeyname), indent + 2);
            }
        }

        Console.WriteLine(sb.ToString());
    }
}


text:
Q: PHP query for updating table with same session_id I used session_id as the ID column in my db.There is one more column named Sections where added the whole xml. The xml contains section names and the amount of time user spent there. I want to update the Sections column for same session_ids. How can I do that? Right now it adds a new row for every record. Here is my php code
$id=$_SESSION["id"];
$totaltime=$_POST['total'];
$HomeTime=$_POST['home'];
$ProductTime=$_POST['products'];
$ProcessTime=$_POST['process'];
$DevTime=$_POST['dev'];
$ContactTime=$_POST['contact'];

$xmlObject = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<item>

        <name>Home</name>
        <time>$HomeTime</time>

        <name>Product</name>
        <time>$ProductTime</time>

        <name>Process</name>
        <time>$ProcessTime</time>

        <name>Development</name>
        <time>$DevTime</time>

        <name>Contact</name>
        <time>$ContactTime</time>

    </item>
XML;

    $sql = "INSERT INTO user_time (ID, Sections) VALUES ('$id', '$xmlObject')";

    if ($conn->query($sql) === TRUE) {
        echo "New record created successfully";
    } else {
        echo "Error: " . $sql . "
" . $conn->error;
    }

A: First fetch existing XML data from db using the session id it exists, and store to variable $xmlFromDB and proceed with following steps. Otherwise insert to db.
if(session id exisits in db){
    //Fetch the table row or corresponding session id.
    //Extract times from XML using this code.

    $arr = [];
    $times = new SimpleXMLElement($xmlFromDB);
    foreach($times->section as $sec){
        $arr[$sec->name.""] = $sec->time;
    }
    extract($arr);

    //This will add previous value to new value.
    $HomeTime += $Home;
    $ProductTime += $Product;
    $ProcessTime += $Process;
    $DevTime += $Development;
    $ContactTime += $Contact;
}

//Now generate xml using your method.

$xmlObject = <<<XML
    <?xml version="1.0" encoding="UTF-8"?>
    <item>

            <name>Home</name>
            <time>$HomeTime</time>

            <name>Product</name>
            <time>$ProductTime</time>

            <name>Process</name>
            <time>$ProcessTime</time>

            <name>Development</name>
            <time>$DevTime</time>

            <name>Contact</name>
            <time>$ContactTime</time>

        </item>
XML;

if(session id exists){
    //Then update the same row using the UPDATE  query.
    $sql = "UPDATE user_time SET Sections = '$xmlObject' where = '$id'";
}else{
    $sql = "INSERT INTO user_time (ID, Sections) VALUES ('$id', '$xmlObject')";
}

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "
" . $conn->error;
}


text:
Q: Google Play services out of date. Requires 10084000 but found 8703430 I can not get fairebase notification token in android studio
error: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
and
Google Play services out of date.  Requires 10084000 but found 8703430
i use dependencies
compile "com.google.android.gms:play-services-gcm:10.0.1"


text:
Q: Successful GET of a RESTful resource with Warning My REST service needs to return a warning along with an XML representation of the Resource on a GET invocation. Is there any way to represent the warning other than using a Wrapper XML Node to encapsulate the Resource and the Warning?

A: It exists a dedicated header for warnings described in the HTTP specification:

The Warning general-header field is used to carry additional information about the status or transformation of a message which might not be reflected in the message. This information is typically used to warn about a possible lack of semantic transparency from caching operations or transformations applied to the entity body of the message.

Something like that:
HTTP/1.1 400 Bad Request
Warning: 299 ServiceName "Invalid input error: X is unrecognized parameter name."

According to your use case, it's something you could consider...
The only other place I see is the response payload...
Hope it helps you,
Thierry


text:
Q: Spring Boot 2.1.0 and Flyway 4.2.0 - Tests I need to use Flyway 4.2.0 in my project because of old Oracle DB. With Spring Boot 2.1.0 the Flyway is included in Spring Core, so I need to create the Flyway Bean programatically.
@Bean(initMethod = "migrate")
Flyway flyway() {
    Flyway flyway = new Flyway();
    flyway.setBaselineOnMigrate(true);
    flyway.setDataSource(baseUrl, username, password);
    return flyway;
}

The problem is how to do that in Tests? I would like to run the tests against the in-memmory database, so I include teh application.yml in test/resources. But then the Flyway bean is not found. When I remove application.yml from test/resources, then it runs fine, but the properties are read from application.yml from main/resources. I tried to change the test not to be @SpringBootTest, I can create the Flyway bean manually, but after putting the @TestConfiguration I need to create all the beans manually, not just Flyway. Ho to do it, just to create Flyway bean manually and all the rest leave to Spring Injection?
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class SomeTest {
  @Autowired
  private SomeService someService;
  @Test
  public void test(){
    String helloString = someService.hello();
}}

The demo project can be found here: https://github.com/troger19/demo.git

A: You could use the flyway-test-extensions which is a library from Flyway designed to allow testing in Spring against Flyway-managed DBs,
You can have a look at the project's doc here, along with some usage examples.


text:
Q: Start jmeter distributed testing from clouds I want to run distributed load testing by jmeter, where servers(linux) are in the cloud and I have ability to start test from my local pc.
Is it even possible or client and servers should be in same subnet?
And in case its possible, may you provide me step by step guide how to achive this goal?
I have tired
https://jmeter.apache.org/usermanual/remote-test.html
https://cloud.google.com/community/tutorials/ssh-port-forwarding-set-up-load-testing-on-compute-engine?hl=ja
but I got error after error.
Before I disabled ssl verification, next error appeared:
error during JRMP connection establishment; nested exception is:
        javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake

With disabled ssl verification I have next error:
Error in rconfigure() method java.rmi.MarshalException: error marshalling argume
nts; nested exception is:
        java.net.SocketException: Connection reset by peer: socket write error

I have feeligs, like I making smth wrong with setting ip, port or firewall, but cant understand what

A: It is definitely possible to starts load agents (jmeter-server) from your local system. The only condition is that the traffic should not be blocked by firewall.
Based on your error, it looks like jmeter process is not having permission to open a port, port is already open (although there is a specific exception for this)
You can also try allowing all incoming traffic to your slaves (cloud linux boxes) and try running the test again.

A: According to the manual you mentioned all you need to do is just to take the following steps:

*

*On your local machine set up the SSH tunnel:
ssh -L 24000:127.0.0.1:24000 -R 25000:127.0.0.1:25000 -L 26000:127.0.0.1:26000 username@hostname_of_cloud_machine

*On the cloud machine launch the JMeter slave
./jmeter -s -Jserver.rmi.ssl.disable=true -Jserver_port=24000 -Jserver.rmi.localhostname=127.0.0.1 -Jserver.rmi.localport=26000 -j jmeter.log

*Again on the local machine launch the JMeter master:
./jmeter -Jserver.rmi.ssl.disable=true -Jremote_hosts=127.0.0.1:24000 -Jclient.rmi.localport=25000 -Jmode=Statistical -n -t test.jmx -l result.jtl

You don't need to configure any firewalls as all the communication is happening over the SSH tunnel
More information:

*

*Remote hosts and RMI configuration

*Apache JMeter Properties Customization Guide


text:
Q: Inserting a variable within a double quoted string Please forgive the newbie Golang question, I am coming at this having basic Python expereince:
I am trying to workout how to insert a string variable, within a variable named body, which is used within an AMQP library further on in my program.
body expects a string value which is enclosed within double quotes. For example:
body := "This messages contains,variable1"

In my program I am creating a variable as an int64 data type and converting it to a string.
    ...
    TimeNow := currentEpochTime()     // Sets TimeNow to an int64 epoch timestamp
    variable1:= string(TimeNow)       // Converts TimeNow to a string

I am trying to insert variable1 after "This messages contains, -
        and then enclose it with " - so that something like the below is passed to the AMQP library via the body variable.
    body := "Timestamp,1513011846048"

Can you give any pointers on how to do this - this may also be useful for other Go newbies going forward...

A: Use the fmt package: body := fmt.Sprintf("Timestamp,%d", TimeNow)
The string() conversion converts an integer to a string, but not in the way you think.
See Effective Go for an introduction to formatting and printing strings.


text:
Q: Whatsapp Web in Lockdown Mode When turning on the Lockdown Mode feature, new in macOS Ventura, it seems some web applications are not working using Safari.
Especially, I saw that the Whatsapp Web application is not working. It's not showing the Login QR code at the beginning.
What's the specific feature that Lockdown Mode disabled, making this application not working? And, is it possible to turn it on (eg via the Develop menu of Safari), yet keeping the Lockdown Mode enabled? What are the approaches to debug this case?


text:
Q: Не добавляется манифест в jar из командной строки День добрый! Из командной строки запускаю след. команду:
jar cvfm classes.jar mymanifest build/mypackage/MyClass.class

и в результате в jar манифест не попадает, а создается системой автоматически, где Main-Class не указан, mymanifest лежит в той-же папке откуда запускаю командную строку. Что я не так делаю?


text:
Q: Difference in Converting Byte() to String let us say I converted a photo to array of bytes by the following lines :
Dim Bytes() As Byte
Bytes = IO.File.ReadAllBytes("C:\DT.jpg")

Now, the Bytes() could be converted to text and displayed in textbox via the code
TextBox1.Text = System.Convert.ToBase64String(Bytes)

the above line will print something like :
9j/4AAQSkZJRgABAQEAYABgAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2ODAp ...etc.
but
when using the a function like
TextBox1.Text = System.Text.Encoding.ASCII.GetString(Bytes)
the result is just : ???? (four question marks)
I worked around and made a loop
For i As Integer = 0 To Bytes.Length - 1
    TextBox1.Text = TextBox1.Text & Chr(bytes(I))
Next

and the textbox1 displayed something like : #3RðbrÑ $4á%ñ&'()*56789 ..etc
which is exactly the ASCII representation of each byte in the bytes().
my question is :
why it failed to return the ASCII, UTF8,UTF7, ANSI, etc representation of the Bytes using functions under namespace System.Text.Encoding. ? is there anyway to get the representation not by using the loop ?

A: Try something like this instead:
Public Function ImageToBase64(image As Image, format As System.Drawing.Imaging.ImageFormat) As String
    Using ms As New MemoryStream()
        ' Convert Image to byte[]
        image.Save(ms, format)
        Dim imageBytes As Byte() = ms.ToArray()

        ' Convert byte[] to Base64 String
        Dim base64String As String = Convert.ToBase64String(imageBytes)
        Return base64String
    End Using
End Function

and:
Public Function Base64ToImage(base64String As String) As Image
    ' Convert Base64 String to byte[]
    Dim imageBytes As Byte() = Convert.FromBase64String(base64String)
    Dim ms As New MemoryStream(imageBytes, 0, imageBytes.Length)

    ' Convert byte[] to Image
    ms.Write(imageBytes, 0, imageBytes.Length)
    Dim image__1 As Image = Image.FromStream(ms, True)
    Return image__1
End Function

Code stolen from here and converted to vb.net
http://www.dailycoding.com/posts/convert_image_to_base64_string_and_base64_string_to_image.aspx


text:
Q: Comparing 2 questions about Riesz representation theorem. I am trying to answer this question (#8 on page.404 in Royden and Fitzpatrick "Real Analysis") it is for general measure space and for Riesz representation theorem for the dual of $L^q$:
Give an example of a measure space $(X, \mathfrak{M}, \mu)$ for which the Riesz Representation Theorem does extend to the case $p=\infty.$
But, I have found this question here:
riesz representation theorem for the case when p is infinity for the case of lebesgue measure
Does this means that my question is wrong? If not, is there any hint for solving it?

A: Read the exercise, and the linked question, more carefully.
The linked question shows that the statement is not true in general; that there exist measure spaces for which it fails.  That does not mean that it fails for every measure space; there could still be other measure spaces $(X,\mu)$ for which the dual of $L^\infty(X,\mu)$ is indeed $L^1(X,\mu)$.  All we know from the linked question is that $X=\mathbb{N}$ (with $\mu$ being counting measure) won't work.
There is nothing wrong with the question in Royden. Such spaces do exist, and in fact some extremely simple examples will work...


text:
Q: Laptop won't start with ACPI error I recently bought an HP pavilion aero 13 laptop and installed Ubuntu 20.04 on it. Everything seems to be installed, but there is a problem. When I turn on my laptop, I get this error:
[0.6146781] ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - \_PR_.P000 (20210738/dspkginit-438)

[1.062788] pcie_mp2_amd 0000:03:00.7: amd_sfh_hid_client_init failed

/dev/nvme0n1p2: recovering journal
/dev/nvme0n1p2: clean, 176580/31227904 files, 4413085/124895488 blocks

Then it quickly disappears, then more text appears, quickly disappears and the Ubuntu boot screen appears.
After that, there are two options. First - the system does not boot for a very long time. The second one loads, but at some point it freezes while working and I turn off the laptop by long pressing the power button.
Can you please tell me what could be causing this and how to fix it?
If possible, then I need the fastest way, since I have an urgent job. Thank you!


text:
Q: Algorithm to sort the elements in a way that allows drawing non-crossing dendrograms out of Hierarchical Clustering I have written from scratch (with Fortran) my own implementation of the Ward algorithm to perform HC. The output of the program consists of two elements: a vector with the distance after each step, and a square matrix in which each row shows the list of indices that indicates to which cluster the element belongs (when two clusters merge, all elements are labelled with the number of the lower label). For instance, the first row is 1, 2, 3, ... N, and the last one is 1, 1, ... 1.
Now, the algorithm seems to work so far, but I'd like to plot also the dendrogram. As I'm using basic tools that basically allow me to draw lines, my idea is to create an additional output file containing the coordinates of the N-1 lines that make up the tree. Obtaining the coordinates is rather easy once you know the right order of elements that lead to non-crossing trees and the distances. But what I miss is how to obtain such order.
I though this should be explained somewhere, as it seems a basic part of every HC method, but surprisingly Google just took me to webs where they explain how to read dendrograms, not how to build them. To be 100% honest, I found this link, but unfortunately I can not rebuild the algorithm from the code they post.
Can anyone help me to find a suitable algorithm to build the dendrogram?


text:
Q: useState Object not updating properly When we try to update useState object properties simultaneously. its not updating.
const [stateData, setStatedata] = useState({
id: 0,
name: '',
address: '',
street: '',
city: '',
country: '',
property1: '',
property2: ''
etc...
});

When I try to update property1 on a text change event
const test = () => {
if(case == 1){
setStatedata({
 ...stateData,
 property1: '123'
});
}
else{
// Do something
}
setStatedata({
 ...stateData,
 property2: '654'
});
}

In this case property1 value will not be set to 123.
But its not waiting for property1 value to be updated. The previously updated value isn't always there.
If I need 20 or more state properties, which is better solution?

*

*Object

*A single state for each property

A: You should update the state value in the following way:
setStatedata(state=> ({
   ...state,
   property2: '65554'
}));

In addition, you can use a custom hook from my lib that implements a deep state manager (Live Demo):
import React from "react";
import { useAsyncDeepState } from "use-async-effect2";

function TestComponent(props) {
  const [state, setState] = useAsyncDeepState({
    x: 123,
    y: 456
  });

  const incX = () => {
    setState(({ x }) => ({ x: x + 1 }));
  };

  const incY = () => {
    setState(({ y }) => ({ y: y + 1 }));
  };

  return (

useAsyncDeepState demo

state.x : {state.x}

state.y : {state.y}

      <button onClick={() => incX()}>Inc X</button>
      <button onClick={() => incY()}>Inc Y</button>

  );
}

If using in the context of async code and you need to wait for updates Live Demo
import React, { useCallback, useEffect } from "react";
import { useAsyncDeepState } from "use-async-effect2";

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

function TestComponent(props) {
  const [state, setState] = useAsyncDeepState({
    counter: 0,
    computedCounter: 0
  });

  useEffect(() => {
    setState(({ counter }) => ({
      computedCounter: counter * 2
    }));
  }, [state.counter]);

  const inc = useCallback(() => {
    (async () => {
      await delay(1000);
      await setState(({ counter }) => ({ counter: counter + 1 }));
      console.log("computedCounter=", state.computedCounter);
    })();
  });

  return (<button onClick={inc}>Inc</button>);
}

A: i try this code work for me you can try this:
codesandbox
 const [stateData, setStatedata] = useState({
    id: 0,
    name: '',
    address: '',
    street: '',
    city: '',
    country: '',
    property1: '',
    property2: ''
    });

   const test = () => {
    setStatedata({
      ...stateData,
      property1: '123'
     });

   }
   const test2 = () => {

     setStatedata({
      ...stateData,
      property2: '65554'
     });
   }
   console.log(stateData)
  return (

 test()}>Click Here

 test2()}>Click Here2

  );

A: You should pass two parameter text change event click.

*

*Object property name that you want to change in state object. ex:- property1

*Value that you want to set for that Object property.ex:- Any value(text event value)

And your test function like this
const test = (key,value) => {
    setStatedata({...stateData,[key]:value})
}

Now you don't need to create multiple functions to change object values.


text:
Q: Can I run oc commands in openshift pod terminals? Is there any way that I can run the oc commands on pod terminals? What I am trying to do is let the user login using
oc login

Then run the command to get the token.
oc whoami -t

And then use that token to call the REST APIs of openshift. This way works on local environment but on openshift, there are some permission issues as I guess openshift doesn't give the root permissions to the user. it says permission denied.
EDIT
So basically i want to be able to get that BEARER token I can send in the HEADERS of the REST APIs to create pods, services, routes etc. And i want that token before any pod is made because i am going to use that token to create pods. It might sound silly I know but that's what I want to know if it is possible, the way we do it using command line using oc commands, is it possible on openshift.
The other possible way could be to call an API that gives me a token and then use that token in other API calls.
@gshipley It does sound like a chiken egg problem to me. But if i were to explain you what I do on my local machine, all i would want is to replicate that on openshift if it is possible. I run the oc commands on nodejs, oc.exe file is there in my repository. I run oc login and oc whoami -t. I read the token i get and store it. Then I send that token as BEARER  in API headers. Thats what works on my local machine. I just want to replicate this scenario on openshift. Is it possible?

A: As a cluster admin create new Role as e.g. role.yml
apiVersion: authorization.openshift.io/v1
kind: ClusterRole
metadata:
  name: mysudoer
rules:
  apiGroups: [''],
  resources: ['users']
  verbs: ['impersonate']
  resourceNames: ["<your user name>"]

and run
oc create -f role.yml

or instead of creating raw role.yml file, use:
oc create clusterrole mysudoer --verb impersonate --resource users --resource-name "<your user name>"

then give your ServiceAccount the new role
oc adm policy add-cluster-role-to-user mysudoer system:serviceaccount:<project>:default

download the oc tool into your container. Now whenever you execute a command you need to add --as=<user name>, or to hide that, create a shell alias inside your container
alias oc="oc --as=<user name>"

the oc should now behave exactly as on your machine, including the exact same privileges as the ServiceAccount only functions as an entry point to the API, but the real tasks are done as your user.

In case you want something simpler, just add the proper permissions to your ServiceAccount, e.g.
oc policy add-role-to-user admin -z default --namespace=<your project>

if you run the command, any container in your project that has oc will be able to auto-magically do tasks inside the project. However, this way, the permissions are not inherited from the user as in the first step, so it's always required to manually add them to the service account as needed.

Explanation, there is always ServiceAccount in your project called default. It has no privileges a thus can not do anything, however all necessary credentials for authenticating the ServiceAccount are by default in every single container. The cool thing is that oc, if you do not provide any credentials, and just run it inside a container in OpenShift, it will automatically try to login using this account. The steps above simply show, how to get the proper permissions to the account, so that the oc can use it to do something meaningful.

In case you simply want access the RESt API, use the token provided in
/var/run/secrets/kubernetes.io/serviceaccount/token

and set up the permissions for the ServiceAccount as described above. With that, you will not even need the oc command line tool.


text:
Q: ANTLR4: How can Java execute Python files? I am using ANTLR to generate a Python lexer/parser (a.k.a. Python target).
The official ANTLR page says: use Java to generate .py files:
set CLASSPATH=.;antlr-complete.jar;%CLASSPATH%

java org.antlr.v4.Tool -Dlanguage=Python2 HelloWorld.g4

Okay, that worked fine. A bunch of .py files were generated: HelloWorldLexer.py, HelloWorldParser.py, etc.
The ANTLR page then says: a graphic of the parse tree can be generated by applying Java to the .py files:
set CLASSPATH=.;antlr-complete.jar;%CLASSPATH%

java org.antlr.v4.gui.TestRig HelloWorld message -gui < input.txt

That doesn't work, it generates this error: Can't load HelloWorld as lexer or parser
Aside from the small problem that it doesn't work (for me), how in the world can Java execute .py files? Somehow Java must be firing up and using the Python interpreter? Perhaps if I got a better idea how Java is applied to Python files, I can figure out why I am getting the above error message. Any insights you can provide would be greatly appreciated. This is a related SO post: ANTRL4: Can't get Python ANTLR to generate a graphic of the parse tree
P.S. I installed the ANTLR Python runtime (antlr4-python2-runtime-4.5.tar.gz) prior to doing the above.


text:
Q: Extract Members of Bagging Regressor Ensemble I have used the BaggingRegressor class in order to build the best model with the following parameters:
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import BaggingRegressor
Reg_ensemble=BaggingRegressor(base_estimator=DecisionTreeRegressor(max_depth=3),n_estimators=10,random_state=0).fit(feature,target)

with above setting, it will create 10 trees. I want to extract and access to each member of ensemble regression(each tree)separately and then fit a test sample on each of them. Is it possible to access each model?

A: The estimators_ attribute of the fitted model provides a list with the ensemble estimators; here is an example with dummy data and n_estimators=3 for brevity:
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import BaggingRegressor
from sklearn.datasets import make_regression

X, y = make_regression(n_samples=100, n_features=4,
                    n_informative=2, n_targets=1,
                    random_state=0, shuffle=False)
regr = BaggingRegressor(base_estimator=DecisionTreeRegressor(max_depth=3),
                        n_estimators=3, random_state=0)
regr.fit(X, y)

regr.estimators_
# result:
[DecisionTreeRegressor(ccp_alpha=0.0, criterion='mse', max_depth=3,
                       max_features=None, max_leaf_nodes=None,
                       min_impurity_decrease=0.0, min_impurity_split=None,
                       min_samples_leaf=1, min_samples_split=2,
                       min_weight_fraction_leaf=0.0, presort='deprecated',
                       random_state=2087557356, splitter='best'),
 DecisionTreeRegressor(ccp_alpha=0.0, criterion='mse', max_depth=3,
                       max_features=None, max_leaf_nodes=None,
                       min_impurity_decrease=0.0, min_impurity_split=None,
                       min_samples_leaf=1, min_samples_split=2,
                       min_weight_fraction_leaf=0.0, presort='deprecated',
                       random_state=132990059, splitter='best'),
 DecisionTreeRegressor(ccp_alpha=0.0, criterion='mse', max_depth=3,
                       max_features=None, max_leaf_nodes=None,
                       min_impurity_decrease=0.0, min_impurity_split=None,
                       min_samples_leaf=1, min_samples_split=2,
                       min_weight_fraction_leaf=0.0, presort='deprecated',
                       random_state=1109697837, splitter='best')]

After you have fitted the BaggingRegressor (the base estimators do not exist before fitting), you can access the base estimators for fitting with data Xs, ys simply as:
for model in regr.estimators_:
    model.fit(Xs, Ys)


text:
Q: New projects not being built in a solution We have a solution under which there are many class library projects. The previous developer created some class library projects in the solution. Later I started adding some new projects. The problem is, when I build the solution locally everything works as expected. But when I deploy the solution to development servers, the build does not include any new projects included in the solution. All the previously added projects seem to get deployed appropriately.
I did check the configuration manager to make sure all the projects are being included in both Debug and Release mode, but I still have the issue.
Can someone point where I am going wrong?
Thanks.


text:
Q: What are some fun nonstandard models to explore? I juts got introduced to my first nonstandard model of arithmetic, which has elements in its domain that are bigger than any natural number. I really liked it, so I'm interested to hear some more examples of such fascinating models. Thank you.

A: Peano arithmetic and even more real analysis are the standard application of non standard models. But even more interesting are the application in measure theory and combinatorics.
Google Loeb measure or have a look to Nonstandard Methods in Ramsey Theory and Combinatorial Number Theory for an introduction.
If you understand "non standard models" in a broader sense, any result of (applied) model theory is an application of "non standard models".

A: Amazing question! The first non-standard model that I recommend viewing is the one of $\mathbf{PA}$, which is also the ultrapower of the standard model of $\mathbf{PA}$. You can delve into nonstandard analysis and prove the properties of the reals, their order, and their completeness through a nonstandard fashion. It also becomes apparent how important Los's theorem is and how important the compactness theorem is which is usually mentioned in textbooks very early on while it is perhaps one of the few ways that can prove consistency.

I'll give a glimpse by showing some consequences of non-standard models of the reals, and the rest you can delve into on your own, and I'll leave some book recommendations at the end.
Given a standard model of the reals, $\mathbb{R}$, then the nonstandard model can be given through an ultrapower with respect to a non-trivial ultrafilter $\mathcal{U} \subseteq \wp(\omega)$. Our ground model is $\mathbb{R}$ which so happens to be our domain also. The nonstandard model will be $\mathbb{R}^{*}$, which domain will be denoted in the same way, and the natural numbers for the ground model (standard model), and the nonstandard one will both be the same notation-wise. We say that $\overline{\mathbb{R}}$ is the set of all reals $r^{*} \in \mathbb{R}^{*}$, with $r^{*} \in [x_1, x_2]$ which belong to the ground model ($x_1, x_2 \in \mathbb{R}$). We say that an $\epsilon$ is an infinitesimal such that it is equal to ${1\over \delta}$, with $\delta \in \mathbb{N}^{*}{\setminus}\mathbb{N}$. In the ground model, $\epsilon$ is smaller than any $1 \over n$ (for $n \in \mathbb{N}$) which means it does not exist in for it but in the nonstandard model it is a positive rational, and the nonstandard counterparts of $x_1$ and $x_2$ ($x_{1}^*$ and $x_{2}^*$) are said to be infinitely close. Meaning that $x_{1}^* - x_{2}^*$ is an infinitesimal. There also exists an equivalence relation on the nonstandard model that could denote the property of being infinitely close. This relation also applies to unique reals in the ground model (standard model) $x_{1}^* \equiv x$, with $x \in \mathbb{R}$. (This is called a nonstandard projection)

Book recommendations: Nonstandard Analysis, Axiomatically by Kanovei, Nonstandard Models of Arithmetic and Set Theory by Kossak R.
Hope this helped. :)


text:
Q: I can't populate a dictionary inside a list I am trying to populate the key value pairs in my dictionary which is inside a list. the list I am trying to populate looks like:
item_table = [
    for i in range(jsonData.length) :
        {
        'item_no' : str(item_no[i]),
        'part_no' : str(part_no[i]),
        'description' : str(description[i]),
        'quantity' : str(quantity[i]),
        'unit_price' : str(unit_price[i]),
        'total_price' : str(total_price[i])
    },
]

As you see here I am trying to use a for loop inside the list but that gives me an error.
I get the values I am trying to insert from:
 for i in range(jsonData.length) :
    unit_market_price[i] = jsonData[i]['unit_market_price']
    unit_market_price[i] = float(unit_market_price)
    markup_percentage[i] = jsonData[i]['markup_percentage']
    markup_percentage[i] = float(markup_percentage)
    unit_price[i] = calculateUitPrice(unit_market_price[i], markup_percentage[i])
    item_no[i] = jsonData[i]['item_no']
    part_no[i] = jsonData[i]['part_no']
    description[i] = jsonData[i]['description']
    quantity[i] = jsonData[i]['quantity']

the jsonData is  a JSON object as the name suggests.
Thank you in advance.

A: You were close.  Just use list comprehension and create a dictionary each time with the loop
item_table = [
    {
        'item_no' : data['item_no'],
        'part_no' : data['part_no'],
        'description' : data['description'],
        'quantity' : data['quantity'],
        'unit_price' : calculateUitPrice(
            float(data['unit_market_price']),
            float(data['markup_percentage'])
        ),
        'total_price' : str(total_price[i])  # <-- !! remember to change this part as your code doesn't currently have a definition on total_price
    }
    for data in jsonData
]

A: What you have attempted is invalid syntax. If you need to use list comprehensions, I'll provide a snippet below.
However, for readability's sake, you should consider simply instantiating an empty list and then appending new elements to it in a loop:
item_table = []
for i in range(jsonData.length):
    item = {
        'item_no': str(item_no[i]),
        'part_no' : str(part_no[i]),
        'description' : str(description[i]),
        'quantity' : str(quantity[i]),
        'unit_price' : str(unit_price[i]),
        'total_price' : str(total_price[i])
    }
    item_table.append(item)

I will also mention that the len() function is used in Python to get the length of a list.
As promised in the first paragraph, here is the list comprehension version of the code above:
item_table = [
    {
        'item_no': str(item_no[i]),
        'part_no' : str(part_no[i]),
        'description' : str(description[i]),
        'quantity' : str(quantity[i]),
        'unit_price' : str(unit_price[i]),
        'total_price' : str(total_price[i])
    }
    for i in range(jsonData.length)
]


text:
Q: Is aircrack-ng compatible with Intel pro/wireless 3945abg I just want to know if I install aircrack-ng if it will work on my Intel pro/wireless 3945abg computer.

A: Yes, the intel 3945 card uses the iwl3945 driver that is included into kernel and it supports packet injection and monitoring mode that is used by aircrack-ng.
If you (somehow) don't have that driver installed run sudo apt-get install --reinstall linux-firmware


text:
Q: unable to run RTSP link through Vitamio on Android I have used different RTSP links so far to run on Vitamio player in Android. I am using latest Version f Vitamio..I am using Sample application of Vitmaio. Only HTTP, MMS and RTMP links are working..
following is the code..
VideoView.java
public class VideoViewDemo extends Activity {

    /**
     * TODO: Set the path variable to a streaming video URL or a local media
     * file path.
     */
    private String path = "RTSP Link here";
    private VideoView mVideoView;

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        if (!LibsChecker.checkVitamioLibs(this))
            return;
        setContentView(R.layout.videoview);
        mVideoView = (VideoView) findViewById(R.id.surface_view);

        if (path == "") {
            // Tell the user to provide a media file URL/path.
            Toast.makeText(
                    VideoViewDemo.this,
                    "Please edit VideoViewDemo Activity, and set path"
                            + " variable to your media file URL/path",
                    Toast.LENGTH_LONG).show();
            return;
        } else {
            /*
             * Alternatively,for streaming media you can use
             * mVideoView.setVideoURI(Uri.parse(URLstring));
             */
            mVideoView.setVideoPath(path);
            mVideoView.setBufferSize(2048);
            mVideoView.setVideoQuality(16);
            mVideoView.setMediaController(new MediaController(this));
            mVideoView.requestFocus();
            // this.myVideoView.setOnBufferingUpdateListener(this.mBufferingUpdateListener);

            mVideoView
                    .setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                        @Override
                        public void onPrepared(MediaPlayer mediaPlayer) {
                            // optional need Vitamio 4.0
                            mediaPlayer.setPlaybackSpeed(1.0f);
                        }
                    });
        }

    }
}

LogCat..
10-06 02:41:00.638: D/Vitamio[Player](30388): [udp @ 0x53de8b00] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
10-06 02:41:00.638: D/Vitamio[Player](30388): [udp @ 0x52467ef0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
10-06 02:41:00.958: D/Vitamio[Player](30388): [udp @ 0x54d603a0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
10-06 02:41:00.958: D/Vitamio[Player](30388): [udp @ 0x53cc9960] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
10-06 02:41:07.563: D/Vitamio[Player](30388): Input #0, rtsp, from 'rtsp://dawnstream.hostingmadeeasy.com/dawn':
10-06 02:41:07.563: D/Vitamio[Player](30388):   Metadata:
10-06 02:41:07.563: D/Vitamio[Player](30388):     title           :
10-06 02:41:07.563: D/Vitamio[Player](30388): DawnNews TV(dawn.tvpakistan.com)
10-06 02:41:07.563: D/Vitamio[Player](30388):     WMFSDKNeeded    :
10-06 02:41:07.563: D/Vitamio[Player](30388): 0.0.0.0000
10-06 02:41:07.563: D/Vitamio[Player](30388):     DeviceConformanceTemplate:
10-06 02:41:07.563: D/Vitamio[Player](30388): MP@LL
10-06 02:41:07.563: D/Vitamio[Player](30388):     WMFSDKVersion   :
10-06 02:41:07.563: D/Vitamio[Player](30388): 9.00.00.3272
10-06 02:41:07.563: D/Vitamio[Player](30388):     IsVBR           :
10-06 02:41:07.563: D/Vitamio[Player](30388): 0
10-06 02:41:07.563: D/Vitamio[Player](30388):   Duration:
10-06 02:41:07.563: D/Vitamio[Player](30388): 00:00:00.00
10-06 02:41:07.563: D/Vitamio[Player](30388): , start:
10-06 02:41:07.563: D/Vitamio[Player](30388): 310903.847000
10-06 02:41:07.563: D/Vitamio[Player](30388): , bitrate:
10-06 02:41:07.563: D/Vitamio[Player](30388): N/A
10-06 02:41:07.568: D/Vitamio[Player](30388):     Stream #0:0
10-06 02:41:07.568: D/Vitamio[Player](30388): : Audio: wmav2 (a[1][0][0] / 0x0161), 32000 Hz, 2 channels, fltp, 40 kb/s
10-06 02:41:07.573: D/Vitamio[Player](30388):     Stream #0:1
10-06 02:41:07.573: D/Vitamio[Player](30388): : Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 320x240, 65 kb/s
10-06 02:41:07.573: D/Vitamio[Player](30388): , 25 tbr
10-06 02:41:07.573: D/Vitamio[Player](30388): , 1k tbn
10-06 02:41:07.573: D/Vitamio[Player](30388): , 1k tbc
10-06 02:41:07.578: I/Vitamio[Player](30388): METADATA: DawnNews TV(dawn.tvpakistan.com)0.0.0.0000MP@LL9.00.00.32720
10-06 02:41:07.583: I/Vitamio[Player](30388): META AUDIO: 0, META SUBTITLE:
10-06 02:41:07.583: D/Vitamio[Player](30388): FIND CODEC_ID 86024
10-06 02:41:07.583: I/Vitamio[Player](30388): WOW: BRILLIANT C COUNT 4
10-06 02:41:07.593: D/Vitamio[Player](30388): OPEN CODEC wmav2
10-06 02:41:07.593: I/Vitamio[Player](30388): OPEN STREAM AUDIO BEGIN
10-06 02:41:07.593: I/Vitamio[Player](30388): Copyright (c) YIXIA (http://yixia.com).
10-06 02:41:07.593: I/Vitamio[Player](30388): THIS SOFTWARE (Vitamio) IS WORK OF YIXIA (http://yixia.com)
10-06 02:41:07.593: I/Vitamio[Player](30388): Application package name: io.vov.vitamio.demo
10-06 02:41:07.593: I/Vitamio[Player](30388): 2, 32000, 0
10-06 02:41:07.593: D/Vitamio[Player](30388): THREAD AUDIO_DECODE START
10-06 02:41:07.628: D/Vitamio[Player](30388): THREAD AUDIO_OUTPUT START
10-06 02:41:07.643: I/Vitamio[Player](30388): OPEN STREAM AUDIO END
10-06 02:41:07.643: I/Vitamio[Player](30388): Copyright (c) YIXIA (http://yixia.com).
10-06 02:41:07.643: I/Vitamio[Player](30388): THIS SOFTWARE (Vitamio) IS WORK OF YIXIA (http://yixia.com)
10-06 02:41:07.643: I/Vitamio[Player](30388): Application package name: io.vov.vitamio.demo
10-06 02:41:07.643: D/Vitamio[Player](30388): SURFACE INIT OK
10-06 02:41:07.643: D/Vitamio[Player](30388): FIND CODEC_ID 72
10-06 02:41:07.643: I/Vitamio[Player](30388): WOW: BRILLIANT C COUNT 4
10-06 02:41:07.663: D/Vitamio[Player](30388): OPEN CODEC wmv3
10-06 02:41:07.663: I/Vitamio[Player](30388): OPEN STREAM VIDEO BEGIN
10-06 02:41:07.663: D/Vitamio[Player](30388): New video size 320 x 240
10-06 02:41:07.668: D/Vitamio[Player](30388): onVideoSizeChanged: (320x240)
10-06 02:41:07.673: I/Vitamio[Player](30388): OPEN STREAM VIDEO END
10-06 02:41:07.673: D/Vitamio[Player](30388): CLEAN START
10-06 02:41:07.673: D/Vitamio[Player](30388): prepared
10-06 02:41:07.673: D/Vitamio[Player](30388): CLEAN END
10-06 02:41:07.673: I/Vitamio[Player](30388): THREAD PREPARE DETTACHED
10-06 02:41:07.673: I/Vitamio[Player](30388): THREAD PREPARE END
10-06 02:41:07.673: D/Vitamio[Player](30388): VIDEO: 320x240x1.333333, Surface: 320x240, LP: 720x540, Window: 720x1280x0.562500
10-06 02:41:07.683: I/Vitamio[Player](30388): THREAD ANALYTICS START
10-06 02:41:07.688: D/Vitamio[Player](30388): GET CPU FATURE: V5TE V6 VFP V7A VFPV3 NEON
10-06 02:41:07.688: D/Vitamio[Player](30388): THREAD DEMUX START
10-06 02:41:07.693: D/Vitamio[Player](30388): THREAD VIDEO_DECODE START
10-06 02:41:07.698: I/Vitamio[Player](30388): CC: ARMYUV420 0
10-06 02:41:07.698: D/Vitamio[Player](30388): THREAD VIDEO_DISPLAY START
10-06 02:41:07.728: D/Vitamio[Player](30388): New video size 320 x 240
10-06 02:41:07.733: D/Vitamio[Player](30388): New video size 320 x 240
10-06 02:41:07.753: D/Vitamio[Player](30388): onPrepared
10-06 02:41:07.753: A/libc(30388): Fatal signal 11 (SIGSEGV) at 0x00000058 (code=1), thread 30388 (ov.vitamio.demo)
10-06 02:41:08.508: D/Vitamio[Player](30830): CPU implementer:0x41
10-06 02:41:08.508: D/Vitamio[Player](30830): Serial:0000000000000000
10-06 02:41:08.508: D/Vitamio[Player](30830): CPU architecture:7
10-06 02:41:08.508: D/Vitamio[Player](30830): Hardware:endeavoru
10-06 02:41:08.508: D/Vitamio[Player](30830): CPU revision:9
10-06 02:41:08.508: D/Vitamio[Player](30830): CPU variant:0x2
10-06 02:41:08.508: D/Vitamio[Player](30830): CPU part:0xc09
10-06 02:41:08.508: D/Vitamio[Player](30830): Revision:0000
10-06 02:41:08.508: D/Vitamio[Player](30830): BogoMIPS:1992.29
10-06 02:41:08.508: D/Vitamio[Player](30830): processor:3
10-06 02:41:08.508: D/Vitamio[Player](30830): Features:swp half thumb fastmult vfp edsp neon vfpv3 tls
10-06 02:41:08.508: D/Vitamio[Player](30830): Processor:ARMv7 Processor rev 9 (v7l)
10-06 02:41:08.508: D/Vitamio[Player](30830): CPU architecture: 7
10-06 02:41:08.508: D/Vitamio[Player](30830): GET CPU FATURE: V5TE V6 VFP V7A VFPV3 NEON
10-06 02:41:08.513: I/Vitamio[Player](30830): isNativeLibsInited, APP VERSION: 2, Vitamio Library version: 2
10-06 02:41:08.603: E/(30830): file /data/data/com.nvidia.NvCPLSvc/files/driverlist.txt: not found!
10-06 02:41:08.603: I/(30830): Attempting to load EGL implementation /system/lib//egl/libEGL_tegra_impl
10-06 02:41:08.608: I/(30830): Loaded EGL implementation /system/lib//egl/libEGL_tegra_impl
10-06 02:41:08.638: I/(30830): Loading GLESv2 implementation /system/lib//egl/libGLESv2_tegra_impl

but streams with HTTP Protocols are working fine..
Update
Android is throwing this error on every RTSP link
Fatal signal 11 (SIGSEGV) at 0x00000058 (code=1), thread 26050 (ov.vitamio.demo)
Now if any one can help me sort this problem out. Thanks.

A: I have the same problem, I found that if I comment the code
mMediaPlayer.getMetadata();

in source file MediaPlayerDemo_Video.java, the demo will runs OK.
I think maybe there is something wrong about get metadata from live stream in Vitamio's lib.
Hope this info may help u.

A: Open VideoView.java file
And replace this code
  Metadata data = mp.getMetadata();

  if (data != null) {
      mCanPause = !data.has(Metadata.PAUSE_AVAILABLE)
              || data.getBoolean(Metadata.PAUSE_AVAILABLE);
      mCanSeekBack = !data.has(Metadata.SEEK_BACKWARD_AVAILABLE)
              || data.getBoolean(Metadata.SEEK_BACKWARD_AVAILABLE);
      mCanSeekForward = !data.has(Metadata.SEEK_FORWARD_AVAILABLE)
              || data.getBoolean(Metadata.SEEK_FORWARD_AVAILABLE);
  } else {
      mCanPause = mCanSeekBack = mCanSeekForward = true;
  }

By this
  mCanPause = mCanSeekBack = mCanSeekForward = true;


text:
Q: Reverse order in evaluated list I solve the following set of ODE and plot solution of S1 vs k2 (Figure 1).
k1 = 1;
k3 = 5;
n = 3;
c = 1;
v0 = 15.0;
dk = -0.0005;
s = NDSolve[{
    S1'[t] == v0 - k2[t]*S1[t]*(1 + c*S2[t]^n) - k1*S1[t],
    S2'[t] == k2[t]*S1[t]*(1 + c*S2[t]^n) - k3*S2[t],
    k2'[t] == dk,
    S1[0] == 1,
    S2[0] == 1,
    k2[0] == 0.5}, {S1, S2, k2}, {t, 2100}];

ParametricPlot[Evaluate[{k2[t], S1[t]} /. s], {t, 300, 450},
AspectRatio -> 0.5, PlotStyle -> Black, AxesLabel -> {k2, S1},
AxesOrigin -> {0.275, 0.0}]

I would like k2 to be displayed from high to low values (basically, to revere X-axis, like in Figure 2). I tried Reverse and Sort, but did not manage them to work with Evaluate.

A: Well, it is not clear whether or not you like to shift the x-axis too, to make it appear in almost the same place, but here is a start:
ParametricPlot[Evaluate[{0.625 - k2[t], S1[t]} /. s], {t, 300, 450},
 AspectRatio -> 0.5, PlotStyle -> Black, AxesLabel -> {k2, S1},
 AxesOrigin -> {0.275, 0.0}]

If you like to have correct ticks that match your original function, then you need to manually adjust them too. Basically, you the same thing to your ticks that you did to the function: you negate it. I supply two lists of ticks, because I want to have smaller sub-ticks that don't have a label too.
ticks[min_, max_] := Join[
   Table[{i, NumberForm[-i, 2], {-0.01, 0}}, {i, min, max, 0.01}],
   Table[{i, , {-0.005, 0}}, {i, min, max, 0.0025}]];

ParametricPlot[Evaluate[{-k2[t], S1[t]} /. s], {t, 300, 450},
 AspectRatio -> 0.5, PlotStyle -> Black, AxesLabel -> {k2, S1},
 Ticks -> {ticks, Automatic}]


text:
Q: Printed Table within a Table's cells not lining up I'm making a localhost website that keeps track of my family's medications as well as has weekly print out sheets that we use to make sure all the meds to in all the proper containers, and if any are missing, we know what to pick up at the pharmacy...
I am using @media print { @page {size: letter}...} to make sure the printed pages are set the right direction (vs. landscape).
The problem I'm running in to is aesthetics...
Since not every pill is taken at every "time" of the day, I have the forms only list the rows (designated in the picture below as "AM NOON PM BED PRN NOTES") that need to be used for that specific med. Originally I did this with using rowspan='$rows' which calculated out great and worked fine - until I printed it. It would break the rows at PM or Bed because according to the system, it was a new
 and could page-break-after.
I've since started using a table inside the main table
echo "

$patient

Drug Names	Prescriber	Dose/Pill	Directions	Rx Number
TOD	M	Tu	W	Th
F	Sa	Su	Next Fill

";

echo ""; /**THIS IS THE CONTAINING  FOR THE TABLE IN THE TABLE**/

echo "
";
if ($tod['am'] == 1) {
    echo "
am

";
    $tod['am'] = 0;
}
if ($tod['noon'] == 1) {
    echo "
noon

";
    $tod['noon'] = 0;
}
if ($tod['pm'] == 1) {
    echo "
pm

";
    $tod['pm'] = 0;
}
if ($tod['bed'] == 1) {
    echo "
bed

";
    $tod['bed'] = 0;
}
if ($tod['prn'] == 1) {
    echo "
prn

";
    $tod['prn'] = 0;
}
echo "
Notes	$notes
";

echo "
";

With CSS
@media print {
    @page {
        size: letter;
    }

    body {
        -webkit-print-color-adjust: exact !important;
        width: 8.5in;
    }

    .menubar,
    h1.viewable,
    #pagewrapper,
    #footer,
    .subbar,
    #screenblock {
        display: none !important;
    }

    #pp {
        display: block !important;
    }

    body {
        background-color: white;
        color: black;
        font: 8pt Georgia, "Times New Roman", Times, serif;
    }

    /*************BASIC TABLE STUFF*************/

    table {
        max-width: 8.5in;
        max-height: 11in;
        margin: 0.25in;
        border-collapse: collapse;
    }

    table * {
        text-align: center;
        vertical-align: middle;
        border-spacing: 0;
    }

    table>tr * {
        page-break-inside: avoid;
        border: 1px solid black;
    }

    table>tr {
        break-inside: avoid;
    }

    td,
    th {
        border: 1px solid black;
        border-collapse: collapse;
        padding: 10px;
        white-space: nowrap
    }

    th {
        font-variant: small-caps;
        padding: 5pt;
    }

    /*************CLASS TABLE STUFF*************/

    #printRxTable {
        width: 8in;
        height: 10.5in;
        margin: 0.25in;
    }

    td.noPad {
        padding: 0px !important;
        margin: 0px !important;
    }

    #tIt {
        width: 100%;
        border-collapse: collapse;
        margin: 0px;
        padding: 0px;
        display: table;
    }

    table#tIt * {
        border-collapse: collapse;
        padding: 0px;
        margin: 0px;
        height: 8mm;
        width: 8mm;
    }

    .tinyBoxes,
    .tinyBoxes1,
    .tinyBoxes2 {
        font-weight: bold;
        vertical-align: middle;
        padding: 0mm 1mm;
        font-variant: small-caps;
    }

    .tinyBoxes1 {
        border-left: none !important;
    }

    .tinyBoxes2 {
        border-right: none !important;
    }

    #tIt>tbody>tr:first-child>td {
        border-top: none !important;
    }

    #tIt>tbody>tr>td.other {
        border: none;
        word-wrap: normal !important;
    }

    #tIt>tbody>tr>td.tinyBoxes1.other {
        border-right: 1px solid black;
    }

    .prime {
        font-weight: bold;
        margin: 0px;
        padding: 5px;
        text-align: center;
    }

    .smallBean {
        font-weight: normal !important;
        font-style: italic;
        margin: 0px;
        padding: 0px;
        text-align: center;
        font-size: 8pt;
        border: none !important;
    }

    .nf::after {
        font-size: smaller;
        font-style: italic;
        margin: 0px;
        padding: 0px;
        text-align: center;
        content: "\A or \A Refil Needed";
        white-space: pre;
    }

    .onePage {
        page-break-before: always !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
    }

    .patientHeader {
        font-size: 0.3in;
        font-variant: small-caps;
    }
/** SOME OTHER STUFF NOT RELATED TO THIS HERE**/
}

For whatever reason, I cannot get the cells ( or 1 or 2) to all line up.
I've set their widths (both in the  and ) but they keep shifting whenever something is in notes AKA
Specific CSS to .other:
.tinyBoxes,
    .tinyBoxes1,
    .tinyBoxes2 {
    font-weight: bold;
    vertical-align: middle;
    padding: 0mm 1mm;
    font-variant: small-caps;
}

.tinyBoxes1 {
    border-left: none !important;
}
#tIt>tbody>tr>td.other {
    border: none;
    word-wrap: normal !important;
}

#tIt>tbody>tr>td.tinyBoxes1.other {
    border-right: 1px solid black;
}

Any help getting these to keep their alignment would be appreciated

I tried adding to the notes of one of the meds and here's what it does..

I added table-layout: fixed; and it comes close...
Every now and then a random row is 1px off at the TOD column

A: I ended up deleting the whole thing and starting from scratch - it actually worked though, so I guess we're good...
echo "

$patient

";
    echo "Drug Name
Alt Name
	Prov	Dose/Pill	Q/F	Rx Number	TOD	";
    echo "M	T	W	T	F	";
    echo "S	S	Next Fill

";

// SOME API DATA STUFF THAT'S NOT REALLY RELIVENT GOES HERE

echo "
";
            echo "
";
            echo "$rxPrimeName
$rxAltName
	";
            echo "$prescriber	";
            echo "$dpp $dppMetric	";
            echo "" . $frequency . "x $freqMetric	";
            echo "$rxID	";

            /*********TABLE IN TABLE*********/
            echo "
";
            if ($tod['am'] == 1) {
                echo "
am

";
                $tod['am'] = 0;
            }
            if ($tod['noon'] == 1) {
                echo "
noon

";
                $tod['noon'] = 0;
            }
            if ($tod['pm'] == 1) {
                echo "
pm

";
                $tod['pm'] = 0;
            }
            if ($tod['bed'] == 1) {
                echo "
bed

";
                $tod['bed'] = 0;
            }
            if ($tod['prn'] == 1) {
                echo "
prn

";
                $tod['prn'] = 0;
            }
            if ($other == 1) {
                echo "
Notes	$notes
";
            }
            echo "
";
            echo "
	";
            /*********END TABLE IN TABLE*********/
            echo "$nextFill	";
            echo "
";

            echo "
";
        }
        echo "
";

With CSS
table {
        max-width: 8.5in;
        margin: 0.25in;
        border-collapse: collapse;
    }

    table * {
        text-align: center;
        vertical-align: middle;
        border-spacing: 0;
        border-collapse: collapse;
        padding: 10px;
    }

    th {
        font-variant: small-caps;
        padding: 5pt;
    }

    /*************CLASS TABLE STUFF*************/
    /**************MAIN MEDS STUFF**************/

    table#mainMedList {
        break-inside: avoid !important;
        break-before: page !important;
        break-after: page !important;
    }

    table#mainMedList,
    table#tIt {
        margin: 0px;
        padding: 0px;
        height: 10mm;
        border: none;
        table-layout: fixed;
    }

    table#mainMedList *,
    table#tIt * {
        width: fit-content;
    }

    table#mainMedList td.tItHolder {
        padding: 0px;
        margin: 0px;
        width: 2.5in !important;
    }

    table#mainMedList th,
    table#mainMedList td,
    table#tIt th,
    table#tIt td {
        margin: 0px;
        padding: 2mm;
    }

    table#mainMedList th,
    table#mainMedList td {
        border: 1px solid black;
    }

    table#mainMedList th.rx,
    table#mainMedList td.rx {
        width: 1in !important;
        white-space: nowrap;
    }

    table#mainMedList>thead>tr>th.tiny {
        width: 0.34375in;
        padding: 2mm;
    }

    table#mainMedList>tbody>tr>td>table#tIt * {
        margin: 0px;
        padding: 0px;
        border: none;
    }

    table#mainMedList>tbody>tr>td>table#tIt>tbody>tr * {
        width: 0.34375in;
        padding: 2mm;
        font-variant: small-caps;
    }

    table#mainMedList>tbody>tr>td>table#tIt>tbody>tr>td {
        border: 1px solid black;
    }

    table#mainMedList>tbody>tr>td>table#tIt>tbody>tr:first-child * {
        border-top: none;
    }

    table#mainMedList>tbody>tr>td>table#tIt>tbody>tr:last-child * {
        border-bottom: none;
    }

    table#mainMedList>tbody>tr>td>table#tIt>tbody>tr>td:first-child {
        border-left: none;
    }

    table#mainMedList>tbody>tr>td>table#tIt>tbody>tr>td:last-child {
        border-right: none;
    }

    table#mainMedList th.nf::after {
        white-space: pre;
        content: "\A or \A Refil Needed";
        font-style: italic;
        font-size: smaller;
    }

    table#mainMedList th {
        font-variant: small-caps;
    }

    div.smallBean {
        font-style: italic;
        font-size: smaller;
        text-align: center !important;
        width: 100% !important;
        margin: 0px;
        padding: 0px;
    }

    tbody.trg {
        display: table-row-group;
    }

    td.notes {
        text-align: left;
        width: 100% !important;
    }


text:
Q: PHP function to preg_replace multi-line conditional comments I am trying to write a function in php that will loop through a mySQL database and delete all conditional comments.
The text I want to replace looks like this:

here is my code
$content = array('1' => $my_text_with_conditional_quotes)

foreach($content as $id => $v){
    print $v .'
';
    $str = addcslashes(preg_replace("/<!(--)?(?=\[)(?:(?!<!\[endif\]\1>).)*<!\[endif\]\1>/s",'',$v));
    print $str . '
';
    print $id . '
';
    exit;
}

it's not matching anything.  What am i missing?

A: Enclose your regex with single quotes '
'/<!(--)?(?=\[)(?:(?!<!\[endif\]\1>).)*<!\[endif\]\1>/s'

or double escape the \ to reference the capture group
"/<!(--)?(?=\[)(?:(?!<!\[endif\]\\1>).)*<!\[endif\]\\1>/s"

A: Move your wildcard period from here: 1>).)* to here: 1>)).*
Also, RegexPal is awesome for testing your regexes out live, to see what they match.

A: don't use regular expressions to parse xml.
You can solve this by using php string functions. It will be something like this:
while (1==1) {

    $openingTagOffset = strpos($field, "";
    $closingTagOffset = strpos($field, $closingTag, $openingTagOffset);
    $field = substr_replace($field, "", $openingTagOffset, $closingTagOffset - $openingTagOffset + strlen($closingTag));

}


text:
Q: Pure dephasing $\gamma_\phi$ in a master equation and noise power spectral densities In its simplest form, my question is regarding a two level system of transition frequency $\omega_0$ given by the Hamiltonian
\begin{equation}
H = \frac{\hbar \omega_0}{2}\sigma_z
\end{equation}
Often (or always?) this transition frequency is not actually fixed; it can be parameterized by some value $\phi(t) = \phi + \delta \phi(t)$ where $\phi$ is the working point value so to speak, and $\delta \phi(t)$ is a small time dependent fluctuation, or in essence a random variable governed by some stochastic process; noise if you will. Commonly it has a vanishing mean and is much smaller than the working point value. Also important in what follows is that I would assume it to be a classical random variable; take for example fluctuating magnetic fields in the environment of the system.
One can include such noise by for example doing a taylor expansion of the above Hamiltonian and find that it has an additional term proportional to $\frac{\partial\omega_0}{\partial\phi} \delta\phi(t) \sigma_z$ (as well as higher order terms); the noise thus couples to the $\sigma_z$ operator and as one can imagine this leads to dephasing.
Now, such dephasing is often encountered in the context of open quantum systems, and from what I know it is dealt with by writing down master equations of the form
\begin{equation}
\dot{\rho} = -i \left[H,\rho\right] + \frac{\gamma_\phi}{2}(\sigma_z \rho \sigma_z - \rho)
\end{equation}
where $H$ is as given above and $\gamma_\phi$ is the pure dephasing rate.
Here comes my question though. In the above, any time dependence of $\delta \phi(t)$ (or more customary, its power spectral density) is completely gone; one has a term $\gamma_\phi$ which is probably the result of some Ramsey or spin echo type analysis of the Hamiltonian, but when for example doing simulations one simply plugs in $\gamma_\phi$ and calculates with that. What I am wondering about is what the assumption is here; what kind of noise do you assume to be dealing with (in terms of power spectral density) when you write down a master equation in the form of the above? Do you assume it is white over all relevant frequencies?
Maybe I can motivate my question a bit further. Say you have two coupled two level systems with equal transition frequencies of around, say, 4 GHz, and a coupling of 100 MHz. A simple calculation then shows that they hybridize into two new modes of frequencies 4.1 and 3.9 GHz. Now, I can imagine that if one then subjected these two systems to a noisy environment (in terms of their transition frequency) with a noise power spectral density that is white up to, say, 400 MHz, that one could actually induce transitions between the two modes. If however the noise was simply up to 10 MHz and then dropped to zero, I would say that you just dephase the qubits and nothing especially interesting happens.
So my question kind of comes down to how the above difference would be reflected in a master equation. For both of them one could define a pure dephasing rate through Ramsey or spin echo experiments (or even with lineshape broadening), but in the end the underlying noise is completely different. One can cause transitions, the other can not. Some approximation made in the master equation in the above form neglects this difference, but what? And what can I do when I do not want to make this approximation? How does one write down the master equation assuming environmental noise with an arbitrary power spectral density, assuming such $\sigma_z$ coupling and classical noise?
As a final note, I know that things become more complicated when you have noise around the transition frequency; lets neglect this for now. The same goes for noise with quantum power spectral densities, although perhaps that is still relevant as the classical noise should be a limit of this; perhaps some bosonic bath.

A: $\def\ii{{\rm i}}
\def\dd{{\rm d}}
\def\ee{{\rm e}}
$
It turns out that the case of pure dephasing is exactly solvable, and one can obtain nice solutions under certain conditions. In particular, I will consider the case of Gaussian, stationary noise.
Exact solution
Let us define the noisy qubit Hamiltonian $(\hbar = 1)$
$$ \hat{H}(t) = \frac{1}{2}\left[\omega_0 + \delta \hat{\omega}(t) \right]\sigma^z, $$
where $\omega_0$ represents the fixed qubit resonance frequency and $\delta\hat{\omega}(t)$ is a zero-mean random variable describing the effect of some external fluctuating fields. (Hats indicate random variables). Because the Hamiltonian commutes with itself at all times, the time evolution operator can be calculated exactly:
$$ \hat{U}(t) = T\exp \left( -\ii \int_0^t\dd s\; \hat{H}(s) \right) = \exp \left( -\frac{\ii}{2}\left[\omega_0 t +\hat{\Phi}(t) \right]\sigma^z\right),$$
where we defined a new random variable $$\hat{\Phi}(t) = \int_0^t\dd s\;\delta\hat{\omega}(s). $$
The solution for the density matrix given some fixed initial condition $\rho(0)$ is of course $\hat{\rho}(t) = \hat{U}(t)\rho(0) \hat{U}^\dagger(t)$. The populations of $\hat{\rho}(t)$ in the eigenbasis of $\sigma^z$ are constant, while the off-diagonal elements $\hat{\rho}_{01}(t) = \hat{\rho}_{10}^*(t)$ are given by $$\hat{\rho}_{01}(t) = \ee^{\ii\omega_0 t}\ee^{\ii\hat{\Phi}(t)} \rho_{01}(0). $$
Given a realisation of the stochastic process $\delta\hat{\omega}(t)$, one can compute the corresponding coherence $\hat{\rho}_{01}(t)$ using the above. Note that $\hat{\rho}_{01}$ is also a random variable describing a typical evolution of a single qubit. More useful, however, is a description of the ensemble obtained by averaging over many identically prepared copies of the system, since this is what one actually does in the experiment. Thus, what we really want is
$$\left \langle \ee^{\ii\hat{\Phi}(t)} \right\rangle = \ee^{-\Gamma(t)},$$
where the angle brackets denote an average over many realisations of the noise, and the formal object $\Gamma(t)$ is called the decoherence function. It follows from the above that the ensemble-averaged density matrix $\rho(t) = \langle \hat{\rho}(t)\rangle$ obeys the exact, non-Markovian master equation
$$ \dot{\rho} = -\frac{\ii}{2}\left(\omega_0 - \Sigma(t)\right)[\sigma^z,\rho] + \frac{1}{2}\gamma(t)\left( \sigma^z \rho \sigma^z - \rho \right), $$
where the dot denotes a time derivative and we defined the energy shift $\Sigma(t) = {{\rm Im}}\left[\dot{\Gamma}\right]$ and the decoherence rate $\gamma(t) = {{\rm Re}}\left[\dot{\Gamma}\right]$.
Gaussian, stationary noise
In order to make progress, we need to make some assumptions about the noise. First, we recognise that the decoherence function is (up to a sign) equal to the cumulant-generating function of $\hat{\Phi}(t)$. Now, if we assume that $\hat{\Phi}(t)$ is Gaussian, then only its second cumulant is non-zero (the first cumulant vanishes because $\langle \delta\hat{\omega}(t)\rangle = 0$). It follows that the decoherence function is given by the autocorrelation function of the fluctuating frequency:
$$ \Gamma(t) = \frac{1}{2}\int_0^t\dd s\int_0^t\dd s'\; \langle \delta\hat{\omega}(s) \delta\hat{\omega}(s')\rangle.$$
Let us further assume that the noise statistics are stationary, i.e. invariant under time translations, which implies that $\langle \delta\hat{\omega}(s) \delta\hat{\omega}(s')\rangle = f(s-s')$, and therefore
$$\Gamma(t) = \frac{1}{2} \int_0^t \dd\tau\int_{-\tau}^\tau\dd\tau' f(\tau'),$$
where we changed variables to $\tau = s+s'$ and $\tau' = s-s'$. Clearly, $\Sigma(t) = 0$, while a few simple manipulations should convince you that
\begin{align} \gamma(t) & = \frac{1}{2} \int_{-t}^t \dd\tau\;f(\tau) \qquad \qquad (*)\\
& = \int_{-\infty}^{\infty} \dd \omega\; \frac{\sin(\omega t)}{\omega} S(\omega),
\end{align}
where we defined the noise power spectral density
$$ S(\omega) = \frac{1}{2\pi}\int_{-\infty}^{\infty} \dd \tau\; \ee^{-\ii \omega \tau} f(\tau).$$
Now, for almost any realistic noise source, the autocorrelation function $f(\tau)$ must eventually decay to zero when $|\tau|$ is greater than some time scale denoted $T$. For times longer than $T$, one may extend the integration limits to $\pm \infty$ in the equation marked $(*)$ above. This leads to an asymptotic decay rate $\gamma_\infty = \lim_{t\to \infty} \gamma(t) = \pi S(0)$.
The Markov approximation consists of the assumption that this time scale $T$ is much shorter than the typical time scale of the qubit's noisy evolution, which here is fixed by $\gamma(t)$ (or rather its inverse). This is equivalent to saying that the noise power spectral density varies slowly over a frequency scale $\sim\gamma(t)$. In this case, it is possible to immediately replace $\gamma(t)\to \gamma_\infty$ with negligible error, leading to simple exponential decoherence $\rho_{01}(t) \sim\ee^{-\gamma_\infty t}$. This is most easily illustrated with a simple example, as follows.
Example 1
Let us take a simple exponential form for the noise autocorrelation function
$$\langle \delta\hat{\omega}(s) \delta\hat{\omega}(s')\rangle = g^2\ee^{-\Omega|s-s'|},$$
This clearly falls to zero over a time scale $T =1/\Omega$. The decoherence rate is
$$ \gamma(t) = \frac{g^2}{\Omega} ( 1- \ee^{-\Omega t}),$$
and the noise power spectral density is
$$ S(\omega) = \frac{1}{\pi} \frac{g^2\Omega}{\omega^2 + \Omega^2},$$
implying an asymptotic decoherence rate $\gamma_\infty = \pi S(0) = g^2/\Omega$. The dynamics will be approximately Markovian if $\Omega \gg \gamma_\infty$, or in other words if $\Omega\gg g$. This means that the coupling of the qubit to its noisy environment ($g$) must be small in comparison to the bandwidth of the noise ($\Omega$).
The plots below show the exact evolution of (the absolute value of) the qubit coherence for two examples, with the Markov approximation included for comparison (dotted line). The first plot shows $\Omega = 2\gamma_\infty$, where the transient dynamics differs significantly from the simple Markov result. The second plot shows $\Omega = 100\gamma_\infty$, in which case the noise memory time is negligibly short and the Markov approximation is accurate for all practical purposes. Note, however, that there always exists a time regime $t\ll \Omega^{-1}$ where the dynamics is non-Markovian. Nevertheless, whenever the Markov assumption $\gamma_\infty\ll \Omega$ holds, the system barely evolves over such a short time and thus the non-Markovian aspects of the evolution are not seen.

Example 2
Just for fun, here's a more complex example. Consider the following spectral density
$$ S(\omega) = \frac{\alpha}{\Omega^2} \omega^3 \left[ 1 - \mathrm{sinc}\left( \frac{\omega}{\varpi}\right) \right] \ee^{-\omega^2/(2\Omega^2)}.$$
Such a spectral density can be realised with a qubit comprising two localised states of an atom in a double-well potential. If this atom is plunged into a cold bosonic gas forming a Bose-Einstein condensate, it decoheres by scattering atoms in the condensate and thus generating phonons. In particular, if the impurity atom (i.e. the one forming the qubit) is prepared in a delocalised state, i.e. a coherent superposition of being localised in the left well ($\lvert 0\rangle$) and the right well ($\lvert 1\rangle$), over time this coherence vanishes. The coupling $\alpha$ is proportional to the scattering cross-section for impurity-gas collisions, while $\Omega = c/\ell$ and $\varpi = c/L$, where $\ell$ is the width of the wave functions describing the localised states, $L$ is the separation between the double-well minima, and $c$ is the speed of sound in the gas. More details can be found in, for example, one of our papers here.
See below for a plot of the decoherence dynamics, for $\alpha = 1$ and $\Omega = 10\varpi$. Interestingly, the coherence does not asymptotically vanish, but reaches a constant, finite value. Even more interestingly, there are two periods where lost coherence is regained, i.e. the decoherence rate is negative, a signature of truly non-Markovian dynamics.
The second recoherence phase (occurring at $\Omega t = 10$) has a particularly pleasing physical interpretation: it always occurs at a time $t = \varpi^{-1} = L/c$, which is the time taken for the disturbance in the superfluid generated at one potential minimum to propagate to the other one. Thus some of the lost coherence is regained due to the fact that both localised states interact with a common superfluid reservoir. However, this only comes into effect after some time delay due to the finite speed of signal propagation in the superfluid.


text:
Q: Job batch as400 I'm currently trying to run a program in Batch via wrkjobscde.
the program starts normally but when I do a wrkactjob, I see it go into dspw and stay like this for hours before being interrupted by qsys.
however, when I launch it in interactive mode, it runs very well in a few minutes.
Do you please have any explanation to that please?
Thanks

A: DSPW means that a screen has popped up waiting for human interaction. Run the program interactively and if any screen pops up, you either can't run it in batch or you will have to modify the program so that it will run in batch. Without seeing the code, I can't help much more, but that is where I would start.


text:
Q: How are different types stored in memory I am currently writing a C program involving dealing with bytes. When it comes to bytes, I'm really confused about the following questions.

*

*Are characters stored in memory by their ascii codes? Say 'A' has anscii code 65. So it's stored in memory the same way as integer 65?

*If so, how does the machine distinguish a character and an integer?

*If characters are stored by ascii codes, an ascii code is an integer. An integer should occupy at least 2 bytes, how come a character only occupy 1 byte?

*The last one is about integers on different architectures. On a 16-bit machine, if 1 is stored as 000...0001, then on a 32-bit machine, is 1 still stored the same way just adding 0 at the front?

A: *

*Yes, ASCII characters are stored by their value. But storing 'A' (65 = 0x41) may be different than storing 65 itself, and how it is done depends on your machine architecture. A char can be stored with a single byte, while a int will be at least 2 bytes (more commonly 4 bytes in modern machines), and so these may be stored differently.

*It doesn't. We could have memory that equaled 0x41. The only way this is distinguished between 'A' and 65 is based on how you declared it to the compiler. In other words, if you declared the variable as an int, it will be treated as an int.

*There are so few ASCII values that you are able to represent all the possibilities with less than 8 bits. Thus, using 16 bits to represent this would be a waste of memory. In today's systems, this isn't as big of an issue anymore, but on memory limited systems, you might want to use that extra byte for something else instead of wasted space.

*More or less, yes. 1 will always be stored as 0000....1, so that the total number of binary digits there equals fills up the space for an int. So on an 8 bit system that will be a 00000000 and a 00000001 in two words, on a 16 bit system that will be 000000000000001 on one word.

A:
Are characters stored in memory by their ascii codes? Say 'A' has
  anscii code 65. So it's stored in memory the same way as integer 65?

Yes, but a char in C is a single byte, while an int depends on the machine architecture.

If so, how does the machine distinguish a character and an integer?

Machine code doesn't care what the bytes in the memory represent. It's the job of the compiler to translate your code into machine instructions that do what your program does.

If characters are stored by ascii codes, an ascii code is an integer.
  An integer should occupy at least 2 bytes, how come a character only
  occupy 1 byte?

ASCII can fit in a single byte (which is the size of a char). Dealing with non-ASCII text is more complicated in C. There's wchar_t which is non-portable and many people consider it broken. C11 introduces char16_t and char32_t, which can be used for UTF-16 and UTF-32 respectively.

The last one is about integers on different architectures. On a 16-bit
  machine, if 1 is stored as 000...0001, then on a 32-bit machine, is 1
  still stored the same way just adding 0 at the front?

This is mostly correct, but it also depends on the endianness of the architecture.


text:
Q: Beginner JavaScript for loop I was wondering if anyone knows the reason for [i-1] in the fourth line when you also have i++ in the second line? Thank you for any help! (It's from the book "JavaScript" by Vodnik and Gosselin.)
if (figureCount === 3) {

for (var i = 1; i < 4; i++) {
filename = "images/IMG_0" + photoOrder[i] + "sm.jpg";
currentFig = document.getElementsByTagName("img")[i - 1];
currentFig.src = filename;
}//end of for loop

A: It because document.getElementsByTagName returns an HTMLCollection(similar to array) hence. So accessing the 1st(and subsequent) img tag on the page are done through setting i-1

A: document.getElementsByTagName return a HTMLCollection which is not an array but an array like object. So to access any element from that collection you can pass the index.
document.getElementsByTagName("img")[i - 1] is creating a collection of all the img tags & it is accessing specific element in that collection by passing the index [i-1]
In the below example [1] is trying to access the second element from the collection

var getAllDiv = document.getElementsByTagName('div');
console.log(getAllDiv[1].innerHTML)

1

2

A: Some developers get confused with the for loop operators logic instead of doing it correctly:
for (var i = 0; i < 3; i++) {

they decided to add some extra processing to the mix ( which isn't that big of a deal ) but iv'e fired developers for less.
CurrentFig is using i - 1 because it appears there is a prepended img element so the developer also chose to select it as well instead of selecting the exact elements that he needs.


text:
Q: (Java SE/Android) cross platform logging I want this library I'm working on to have logging support, but Android and SE have their own ways of logging. In SE you can use System.out.println methods or the java.util.logging.Logger class. Android uses android.util.Log to log on logcat. At first I used reflection to check if android was usable, then reflectively call the log methods in Log.class; but that wasn't a good idea.
My solution is to have the developers using my library handle logs themselves. There will be a Handler interface they set and has an onLog method
public void onLog(int level, String tag, String msg);

The library will call the onLog method on the handlers in my custom Logger class. Is it a good idea to have developers handle the logs instead of the library itself? Seems to be the best solution so far and if I document it good then it should't be an issue.

A: I agree with you that logging should be delegated to clients, and your homegrown approach is indeed sensible.
IMO, the SLF4J facade would be ideal for your situation. Your library would include the slf4j-api jar and contain SLF4J logging statements. If clients wanted logging, they'd just drop in a logging backend (and an optional config file) into their application's classpath to capture/view your log statements.
The advantages to this approach are that it grants clients the most control with zero coding required to get logging; and that it allows the client to choose among many available backends.
I would use logback as the backend for J2SE apps and logback-android for Android.

A: You can try microlog
http://code.google.com/p/microlog4android/
It can help you use a consistent logging mechanism across android and java. If you use slf4j, it can be used as a wrapper both for microlog (in case of your android project) and log4j (for your java projects)


text:
Q: .htaccess redirect to subfolder (If domain name is base domain name) domain => subdomain.domain.com
target => subdomain.domain.com/Controller/Method

I will
IF %{HTTP_HOST} == base_url(subdomain.domain.com)

redirect to target (subdomain.domain.com/Controller/Method)
I have not fix base domain name

A: Try:
# Considering that base domain URL excludes index.html, index.php, welcome.html or something like that, we'll reduce matches to http(s)://base.subdomain/ and http(s)://base.subdomain
RewriteCond %{REQUEST_URI} ^\/?$
RewriteRule /Controller/Method

A: You can use the following rule :
RewriteEngine on

##IF host==subdomain.domain.com##
RewriteCond %{HTTP_HOST} ^sudomain\.domain\.com$
##And uri==/##
RewriteCond %{REQUEST_URI} ^/$
##redirect to http://subdomain.domain.com/Contreller/method##
RewriteRule ^ http://subdomain.domain.com/Controller/method [NC,L,R]


text:
Q: I/O statistics per user I have access to an academic supercomputer where there is an NFS filesystem where our lab keeps our data.
When I run iostats -nh I believe I am getting statistics for all users accessing all storage devices.  Is there a way to see my own I/O statistics on this particular NFS filesystem? i.e. see how much of the total load is mine?

A: Maybe. If there is any sort of scheduling manager (such as Moab, SGE, etc.) on the HPC, I would check with the administrators. These scheduling managers have accounting abilities that can give you detailed I/O statistics if configured correctly.
However, those statistics are only useful if all of the I/O to the NFS mount you performed was through the scheduler.
nfsiostat unfortunately only reports aggregate statistics for NFS mount points.

A: iotop can show which processes are using I/O on a system; it can also be set to show accumulated I/O instead of just bandwidth usage.  It requires Linux kernel 2.6.20 or later. It also needs to be run as root since it uses per process io accounting files in /proc.


text:
Q: Import  in react-router-dom v6 from subrepository - context error This is my project structure:
 -Project:
    -public
    -src
       - ...
       -index.tsx
       -views
          -App.tsx
          -Layout.tsx
       -components
          - ...
       -common <- submodule from github
          -src
             - ...
             -views
                -HomeView.tsx
                -SubView.tsx
                -WildCardView.tsx
             -router
                -SwitchRouter.tsx

index.tsx: (from Project folder)
const root = ReactDOMClient.createRoot(document.getElementById("root") as HTMLElement);
root.render(
  <React.StrictMode>
    <BrowserRouter>
      <App />
    </BrowserRouter>
  </React.StrictMode>);

App.tsx (from src/views):
import React from 'react';
...
import { SwitchRouter } from '../common/src/router/SwitchRouter'; // <- prepared component from gitHub repository
// import { SwitchRouter } from '../src/router/SwitchRouter'; // this will be working without errors :/

export function App () {
  return (
    <div>
      {/* Another components */}
      <SwitchRouter />
    </div>
  );
}

And SwitchRouter.tsx from src/common/src/router/SwitchRouter.tsx (github subrepo)
import React from 'react';
import { Route, Routes } from 'react-router-dom';
import { WildCardView } from '../views/WildCardView'; // (subrepoview)
import { HomeView } from '../views/HomeView'; // (subrepoview)
import { SubView } from '../views/SubView'; // (subrepoview)
import { routes } from './routes'; // (subrepo values)

export function SwitchRouter () {
  const { home, sub, wildcards } = routes;
  return (
    <Routes>
      <Route path={home} element={<HomeView />} />
      <Route path={sub} element={<SubView />} />
      <Route path={wildcards} element={<WildCardView />} />
    </Routes>
  );
}

With this configuration I get the logs:

*

*Uncaught TypeError: Cannot read properties of null (reading 'useContext')
The question is this:

*react.development.js:209 Warning: Invalid hook call. Hooks can only be called inside of the body of a function component

*The above error occurred in the  component:

When importing this SwitchRouter.tsx from subrepo, I get an error like the image below:
[error logs][1][1]: https://i.stack.imgur.com/umMTH.png
This error disappears when I move SwitchRouter.tsx to the 'src' folder in Project/src, which is kind of like the structure of the project itself.
What is the reason for this?
Is there any way around it? I would like all routing to be taken from SwitchRouter.tsx component in 'common' (i.e. subrepo)
For package.json in Project and Project/src/common/package.json
"dependencies": {
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-scripts": "5.0.0",
    "typescript": "^4.6.3",
    "web-vitals": "^2.1.4",
    "react-router-dom": "^6.2.2"
  },
...
"devDependencies": {
    "@testing-library/jest-dom": "^5.16.3",
    "@testing-library/react": "^12.1.4",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.4.1",
    "@types/node": "^16.11.26",
    "@types/react": "^17.0.43",
    "@types/react-dom": "^17.0.14",
    "@types/react-router-dom": "^5.3.3"
  }


text:
Q: how to migrate my huge website from hosting company to another one? i want to know what is the fastest way to migrate my site (larger than 70GB) (approx 700MB database) from one server to another i think ftp in this case is a joke what hosting companies uses in this case since i saw many scenarios where big websites transferred in 2 hours or 5 hours at most what did they used.

A: In my opinion the preferable solution (from my own experience) would be if:

*

*You have quick physical access to both your old and your new server.

*The hosting companies allows you to use persistance carriers (128 GB
USB Stick, 128 GB SSD, etc.)
Then you go to your old hosting provider, copy your (backed up) site from the old server to the USB Stick (or SSD), you go to your new hosting provider and then copy the backed up site to the new server.
You'll have to transfer your site twice, but the transfer speed would be sufficient enough, so you can quickly set up your site on the new server.

If you can do anything physically and the remote access is the only option you have, then you'll probably need to ensure a temporary direct connection between the two servers can be established so you can transfer your backed up site directly to the new server (FTP connections aren't necessarily slow, they could also allow big traffic throughputs).
Another solution would be to archive and compress your site, then back it up somewhere locally to you, upload it to the new server and finally uncompress it on that new server (so you'll have to transfer the site twice).