text:
Q: Как создать цикл на php что бы тот проводил проверку каждую секунду? Как создать цикл что бы тот проверял каждую секунду действие?
Условно мне нужно что бы скрипт каждую сайт каждую секунду проверял это:
if ( goal() == true) {
echo "goal";
}

Как это реализовать без использования cron?


text:
Q: Generic way to get modified (add, delete, modify) entries in LDAP I need Generic way to get all modified (add, delete, modify) entries in any LDAP servers
i.e.

*

*Active Directory

*OpenLdap

*Apache Directory

*and many others

as given in this question There are a number of ways to accomplish this.
we can using one of following control
1. com.unboundid.ldap.sdk.controls.ContentSyncRequestControl
2. com.unboundid.ldap.sdk.controls.PersistentSearchRequestControl
3. com.unboundid.ldap.sdk.experimental.ActiveDirectoryDirSyncControl
4. com.unboundid.ldap.sdk.ChangeLogEntry

but problem is that some LDAP server support ContentSyncRequestControl control
some support ActiveDirectoryDirSyncControl and some server does not support any control.
now I have to find a generalized way to find the modified entries in any LDAP.
According to last point in question

If all else fails, you may be able to use range searches targeting the createTimestamp and/or modifyTimestamp attributes to identify entries created and/or updated after a specified time.

I can get get added and modified entries by there createTimestamp and modifyTimestamp attributes but I can not able to get deleted users using this approach.
Also I have not get way to search entries using com.unboundid.ldap.sdk.ChangeLogEntry class
Can any one help me on this?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is a ValueList() a string? I am trying to convert the results of a query into an array
this.arLibrary  = ValueList(qryLibrary.ID).ListToArray();

And I get the following error

Detail A script statement must end with ";".The CFML compiler was
  processing:
*
*A script statement beginning with
  this.arLibrary on line 43, column 9.
*A cfscript tag
  beginning on line 21, column 2.   KnownColumn -1   KnownLine -1
  KnownText <unknown>   Line 43   Message Invalid construct.
  Snippet this.arLibrary =
  ValueList(qryLibrary.ID).
  StackTrace

This does work
temp    = ValueList(qryLibrary.ID);
this.arMetricLibActive  = temp.ListToArray();

It makes me wonder if ValueList() is a string

A: Yes, it's a string.  The error is a parsing issue in the CFML engine.  The same syntax works fine in Lucee.  File a bug like Henry suggested.
Here's an example in the CommandBox REPL
CFSCRIPT-REPL: foo = queryNew('bar')
{
    "COLUMNS":[
        "BAR"
    ],
    "DATA":[

    ]
}
CFSCRIPT-REPL: valueList( foo.bar ).listToArray()
[

]

A: James, it'd be useful if you read error messages when they are presented to you: they generally contain pertinent information. I don't mean this in a "stating the obvious" sort of way, but rather that it's actually a very important part of troubleshooting problems. You are faced with an error message from the compiler, which means the error occurred when the source code was being compiled. However you are asking a question about data types, which - in a loosely and dynamically typed language like CFML - is a runtime consideration. "Runtime" implies "when the code is being run" which is intrinsically after the code is compiled. If the code can't compile: it won't be run.
So the issue is not whether valueList() returns a string or anything like that.
The issue here is that there is a bug in ColdFusion's CFML parser, and it is not able to interpret this expression:
ValueList(qryLibrary.ID).ListToArray()

I don't know why there's a problem with this: there should be no problem with parsing the calling of a method on another function call's return value; and indeed it seems to be a peculiarity of using valueList() like this, as opposed to built-in functions in general.
File a bug.
As for what to do about it in your code in the meantime, I think Dan is right: generally one can use a query column as an array anyhow, provided one uses bracket notation to reference the column, eg: qryLibrary["ID"]. Brad draws attention to this not working on Lucee, but... this is neither here nor there, and just something that Lucee needs to deal with. There was a bug raised for this in Railo - https://issues.jboss.org/browse/RAILO-641 - but they declined to address it, with only semi-valid reasoning.

A: Epilog:
This works on ColdFusion 2016 and above
<cfscript>
qryLibrary = QueryNew("ID", "varchar");

qryLibrary.addrow({"id" : "cat"});
qryLibrary.addrow({"id" : "dog"});
qryLibrary.addrow({"id" : "fish"});

writedump(qryLibrary);

arLibrary  = ValueList(qryLibrary.ID).ListToArray();

writedump(arLibrary);
</cfscript>

https://cffiddle.org/app/file?filepath=6588296c-5e4d-49a4-894b-4986513e9e30/0ecde857-6d28-4e43-88a7-7830c109ab11/84cd7e81-16f8-43d7-b4c9-5490b1b5d007.cfm


text:
Q: Time taken to hit the ground I came across these two statements, please explain to me how the second statement is correct. I think it's incorrect.

*

*The time taken to hit the ground is independent of mass, size and shape of a body in vacuum.

*But, in air, if two bodies of the same mass and a different size fall, then the body having more volume will take more time.

A: This is simply because air exerts a viscous force. A body moving in vacuum have an acceleration independent of it's mass as gravity is the only force acting. However in air, a bigger object experiences more air resistance. Additionally in air a bigger object has more buoyancy.


text:
Q: Are Cookies Becoming Obsolete? Cookies vs. Browser Data Stores I've been playing around with HTML5 and Javascript a lot lately and have been really impressed with the functionality of LocalStorage as well as SessionStorage. It got me to thinking - with the advent of these elements, is there really any discernible advantage to cookies anymore?
I am able to create both persistent as well as session dependent data (both lightweight as well as unhealthily robust objects) with these two data stores. What benefits, if any, do cookies provide over these? Is this the end of the road for our favorite web "treat"?

A:
...with the advent of these elements, is there really any discernible advantage to cookies anymore?

Yes: They get sent to the server with every request. That's what they were originally for, and that's their current purpose (well, and being a fallback for browsers that don't have web storage, but there are very few of those left). If you don't need the information sent to the server with every request (session identifiers, etc.), web storage or similar is your better choice.
Cookies were never a good choice for purely client-side data, because they add to the weight of requests and responses. They were just the only choice for a while. Now we have better client-side-only data storage choices, and we have cookies for the small set of use cases where you actually want information automatically sent to the server with every request.


text:
Q: How to get rid of OEM partition on my netbook I need to reinstall Win 7 Starter on my Acer netbook. I prepared a USB stick with the installation, and I want to wipe out all the junk on the hard drive and start from scratch.
I definitely want to get rid of McAfee.
Can I wipe out everything, including OEM partition and SYSTEM RESERVED partition?
What do I need to do to accomplish that?
I am assuming I have to install in safe mode, correct?

A: The OEM partition will most likely contain system recovery/factory restore data. Assuming you don't want to restore the device back to factory settings at any time it's fine to wipe the OEM partition though normally not something I'd recommend as you never know when you might want to restore to factory setup.
the System reserved partition is a small partition required by Windows 7 to boot but it will recreate that partition when reinstalling.
Just boot from the USB stick and reinstall from that unless you want to go through the upgrade process in which case launch the installer from within Windows. It does NOT need to be in Safe mode to do this as far as I know.

A: To delete OEM partions

1) hit the start and R buttons at the
  same time and you will get the run
  window
2) type diskpart and press enter
3) type list disk and press enter
4) select the main disk(usually the
  largest one)...so if your main disk is
  disk 0, type "select disk 0"
5) Once the disk is selected, type
  "list partition" and hit enter
6) Your "hidden" paritition will be
  around 4400MB to about 5000MB. In my
  case it was partition 1.
7) type "select partition 1" and hit
  enter
8) type "delete partition 1 override"
  and hit enter
You can then do whatever you want with
  this space, you can turn it into
  another primary parition, you can use
  acronis and merge partitions, etc
The disk and partition numbers
  I used were for my system, please be
  careful as the info on your system
  could differ.

Resource from  here
If you just want to uninstall pre-installed softwares then use  Revo Uninstaller  or this  Total Uninstaller

A: Barring phone calls about how you "voided" the warranty by reinstalling Windows (as if) and other such loss of niceties, you just install over the old partition. You're not giving the hard drive away, so you have no need to do a real wipe. Just format the partition.


text:
Q: em.merge doesn't generate update statement I'm using JPA 2.0 and hibernate in the project and faced the problem:
em.merge() doesn't generate the update statement.
The detail situation is:
I have an entity, which is successfully persisted. It has a foreign key on other entity, mapped like:
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "ENTITY2_ID", referencedColumnName = "ID")
@ForeignKey(name = "FK_ENTITY2_PS")
private Entity2 entity2;

It is created a bit later and persisted too. After that I make
entity1.setEntity2(entity2);
em.merge(entity1);

and see the log: hibernate doesn't generate the update statement for that and my application crashes with constraint violation. Is this a bug? Or am I doing something wrong?
UPD
The logging is turned on and I see inserts there.
The method where em.merge() occurs is inside @Stateless bean, which methods have TransactionalAttribute.REQUIRED by default.

A: There are a couple of things that could be going wrong, but you would need to check/show us the logs of whats going on to be sure.  If you havent already, you should turn your logging up to debug (something like this in log4j.properties):
log4j.logger.net.sf.hibernate=debug
log4j.logger.net.sf.hibernate.SQL=debug

and turn on show sql (In the persistence unit in persistence.xml):
<property name="hibernate.show.sql" value="true" />

Also, we would need to see the context of the merge - I assume it is being dones inside a Spring managed bean? Also, have you marked the method that calls em.merge() as @Transactional? if you are not inside a valid transaction it will probably fail to persist it pretty silently

UPDATED:
Where is the method that contains em.merge() being called from?
The annotation TransactionalAttribute.REQUIRED does not create a new Transaction, so this will not work unless you are already in a Transaction (e.g. the calling method is annotated @Transactional).
Try anotating the method with @Transactional or you could use TransactionalAttribute.REQUIRES_NEW - although you should think that through as it means it will always create a new transaction whatever

A: I think you're missing cascade settings.. try -
@ManyToOne(fetch = FetchType.LAZY, optional = false, cascade = CascadeType.ALL)


text:
Q: How to specify the order results with a SQL UNION? I'm trying to run the following query:
select * from (select * from customquestionbank where questionid=6 or secondquestionid=6
union select * from customquestionbank where questionid=5 or secondquestionid=5
union select * from customquestionbank where questionid=10 or secondquestionid=10
union select * from customquestionbank where questionid=11 or secondquestionid=11) Tabled

Being new to this site I cannot post images yet, but here is what the result look like:
questionid -> 5,6 ,10,11

However, I want the result to be displayed in the same order as my select statements above. In other words, questionid=6 returned first, then 5, and so on.

A: You don't need all the unions, just make it like this:
SELECT DISTINCT *
FROM   customquestionbank
WHERE  questionid IN ( 6, 5, 10, 11 )
        OR secondquestionid IN ( 6, 5, 10, 11 )
ORDER  BY CASE
            WHEN 6 IN ( questionid, secondquestionid ) THEN 0
            WHEN 5 IN ( questionid, secondquestionid ) THEN 1
            WHEN 10 IN ( questionid, secondquestionid ) THEN 2
            WHEN 11 IN ( questionid, secondquestionid ) THEN 3
          END

A: Remove the super select that you are using
Write the query as
Select * from query1 union
Select * from query2 union
Select * from query3;

This will bring your result as needed
Else try this
Select col1,col2 from( Select 1,q1.* from query1 q1 union
Select 2,q2.* from query2 q2 union
Select 3,q1.* from query3 q3)

select only the required columns in the super query

A: If your RDBMS supports the VALUES constructor
SELECT questionid, secondquestionid
FROM   (VALUES(6,1),
              (5, 2),
              (10, 3),
              (11, 4)) V(q, ord)
       JOIN customquestionbank
         ON q IN ( questionid, secondquestionid )
GROUP BY questionid, secondquestionid
ORDER  BY MIN(ord)

A: if your RDBMS is mysql, I think you can try ORDER BY FIELD like this:
SELECT *
FROM customquestionbank
WHERE
  questionid IN(6, 5, 10, 11)
  OR secondquestionid IN(6, 5, 10, 11)
ORDER BY FIELD(questionid, 6) ASC

A: Replace Union with Union ALL
create table #t
(
    id int
)
insert into #t(id)values(5)
insert into #t(id)values(2)
insert into #t(id)values(4)
insert into #t(id)values(3)

Select * from
(
    Select * from #t where id = 5
    uNION All
    Select * from #t where id = 2
    uNION All
    Select * from #t where id = 4
    uNION All
    Select * from #t where id = 3
)K

DROP TABLE #t


text:
Q: Make a scrollable window go to the top of a page if the centered div extents past the top of the screen I am trying to center a div on my website and it now works but when the window is too small you can't scroll all of the ways to the top of the div. Ideally, if the page's content is larger than the window it si viewed in, it should have a scroll bar that allows scrolling all the way to the top of the aqua box.
I belive that this has to do with the styling in either the body or test classes
the webpage is viewable here:
https://htmltest.duelcraft.pages.dev/

  <meta charset="utf-8">
  <title>DuelCraft</title>
  <link rel="stylesheet" href="styles.css">
  <link rel="icon" type="image/x-icon" href="images/icon.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

DuelCraft

DuelCraft Minecraft Server

How do I join?

Connect to play.duelcraft.games

Email user@example.com for help!

 ©2022 DuelCraft

h1 {
  text-align: center;
  font-size: 64px;
}

p {
  text-align: center;
}

h2 {
  text-align: center;
}

iframe {
  display: block;
  border-style: none;
}

html {
  height: 100%;
}

body {
  font: normal 16px verdana, arial, sans-serif;
  background-position: top;
  height: 100%;
  margin: 0;
}

.test {
  width: 500px;
  border: 2px solid black;
  padding: 50px;
  margin: auto;
  background-color: #9FE7FF;

}

.body{

    margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

}

.email-part {
  font-weight: bold;
}
.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 50%;
}
.copyright{
 color:white;

}
@media screen and (max-width: 600px) {
  * {
    box-sizing: border-box;
  }
  body {
    padding: 1rem;
  }
  .test,
  iframe {
    width: 100%;
  }
  h1 {
    font-size: 12vw;
  }
}

A: @ICE_Plane, the trick here is since you are using position absolute ( getting out of the flux )
You need to specify a max height to your .body class, like a max-height: 100vh.
You could as well add a overflow-y: auto to make sure it shows the scrollbar when overflowing
Here is the example you provided working:

Let me know if that helped, or if you need more info


text:
Q: JNDI lookup for EJB and storing for future calls I went through the link
https://docs.jboss.org/author/display/AS71/JNDI+Reference
When we do Traditional JNDI lookup we first get a stub object of the remote interface and then make another network call to make the actual EJB call. This has been listed as 2 network calls.
I am trying to figure out is there something by which we can keep a singleton store of the stub object fetched only once and then just use it to make subsequent calls? I am not an expert in details of the RMI but as long as the stub is available we should be able to use it..isnt it?
Basically looking for any Spring option where on startup the Spring bit makes the JNDI EJB lookup and stores that in a singleton object which will be avaialble over the context for future use as long as the application is running?

A: You can lookup the bean using the following and use it for subsequent calls:
<jee:local-slsb id="myComponent" jndi-name="ejb/myBean"
      business-interface="com.mycom.MyComponent"/>

or in case of remote EJB:
<jee:remote-slsb id="myComponent" jndi-name="ejb/myBean"
      business-interface="com.mycom.MyComponent"/>


text: Q: I have question about transformer When we describe the working principle of the transformer, we say that we want to minimize the loss of electrical energy, therefore we reduce the current Q=I^2Rt, so heat reduces as well, but to keep the same power we increase the voltage, but Q=U^2/R *t. so why voltage doesn't give us the heat effect.


text:
Q: Update PHP variable without refresh I am new in JSON and PHP programming. I am making a web page that allows to view data from file.py, those data will be linked in a gauge and updated second by second.
  var gauge1;
  var x = <?php echo python /home/usr/Desktop/file.py ?> ;

    setInterval(function() {
      gauge1.refresh(x);
    }, 1000);
  };

I can make the gauge shows just the first reading from "file.py" but is stuck there, the only way to update the gauge is refreshing the page and the new reading is shown in the gauge.
I think the problem is in:

gauge1.refresh(x);

because when I write:

gauge1.refresh(getRandomInt(0,50));

The gauge always show random data, updating a new random data between 0 and 50.
Is there any solution to make the gauge always shows automatically data from file.py without refresh the page?

A: You can use ajax to execute a backend script in a time interval like this .
var x=null;
setInterval(retriveData, 300000);
function retriveData() {
   $.ajax({url: "pyData.php", success: function(data){
      x=data;
   }});
}

And your Php code like this (pyData.php)
<?php
 $command = escapeshellcmd('/home/usr/Desktop/file.py');
 $output = shell_exec($command);
 echo $output;
 ?>

You can execute like this


text:
Q: Taylor expansion of $x^x-1$ around 1 How do I find Taylor expansion of(around 1):
$$f(x)=x^x-1$$
The answer should be:
$$(x-1)+(x-1)^2+\frac 12(x-1)^3+\cdots$$
How the answer was obtained?

A: Using the power series for $\log(1+x)$, we get
$$
\begin{align}
(1+x)\log(1+x)
&=(1+x)\left(x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+\dots\right)\\
&=x+\frac{x^2}{2}-\frac{x^3}{6}+\frac{x^4}{12}-\frac{x^5}{20}+\frac{x^6}{30}-\dots\tag{1}
\end{align}
$$
Plugging $(1)$ into the power series for $e^x$ yields
$$
(1+x)^{1+x}=1+x+x^2+\frac{x^3}{2}+\frac{x^4}{3}+\frac{x^5}{12}+\frac{3x^6}{40}-\frac{x^7}{120}+\dots\tag{2}
$$

Alternatively, use the binomial theorem to get
$$
(1+x)^{x+1}=1+\tfrac{x+1}{1}x+\tfrac{(x+1)x}{2}x^2+\tfrac{(x+1)x(x-1)}{6}x^3+\dots\tag{3}
$$
which also produces $(2)$.

Plug $x-1$ into $(2)$ and subract $1$ to get the Taylor Series for $x^x-1$ at $x=1$:
$$
x^x-1=(x-1)+(x-1)^2+\frac{(x-1)^3}{2}+\frac{(x-1)^4}{3}+\frac{(x-1)^5}{12}+\dots\tag{4}
$$

A: Use the fact that the derivative of $x^x$ is $(\ln x + 1)x^x$, and expand around $x=1$:
$$y(x) = x^x,\ y'(x) =(\ln x + 1)x^x,\ y''(x)=\left((\ln x + 1)^2+\frac{1}{x}\right)x^x$$
$$y(1) = 1,\ y'(1) = 1,\ y''(x)=2$$
$$y(x) \sim 0 + (x-1)+(x-1)^2+...$$

A: Another approach
$$\begin{align*}f(x):=x^x-1&,\;\;\;f(1)=0\\f'(x)=x^x(\log x+1)&,\;\;f'(1)=1\\f''(x)=x^x\left((\log x+1)^2+\frac{1}{x}\right)&,\;\;f''(1)=2\ldots\,\,etc.\end{align*}$$
Thus, the Taylor expansion around $\,x=1\,$ is
$$f(x)=(x-1)+\frac{2(x-1)^2}{2!}+\frac{3(x-1)^3}{3!}\ldots=(x-1)+(x-1)^2+\frac{(x-1)^3}{2}+\ldots$$
Note: Try to find, perhaps inductively, an expression for the $\,n-$th derivative of the function...

A: With $z:=x-1$, thus $x=z+1$, use Taylor expansions for $e^z$ and $\ln(z+1)$:
$$f(x)+1=x^x=(z+1)^{z+1}=(z+1)\cdot e^{z\ln(z+1)}=\\
= (z+1)\cdot\sum_{n\ge 0}\frac{(z\cdot\ln(z+1))^n}{n!} = \\
=(z+1)\cdot\sum_{n\ge 0}\frac1{n!}z^n\left(z-\frac12z^2+\frac13z^3\mp\dots\right)^n$$
Well, it seems a bit ugly, but perhaps
 you can calculate the coefficient of each $z^n$ from that, using binomial and factorial tricks...


text:
Q: Possible values of VerifierFlags I've enabled application verifier on my application, and it created a registry value VerifierFlags with value 0x80000000
Where do I find a list of possible VerifierFlags values? I tried to lookup online, the only thing I found is about drives.
Does anyone know?


text:
Q: Not sure what's going on here So I have a SharedPreference I'm calling logged_in. I get the preference and check if it's 1, if it is it's supposed to start the new activity, otherwise I want it to display to me what it actually is. Here's the code:
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

        prefs = getSharedPreferences("preferences", MODE_PRIVATE);

        // Check if the user is logged in
        String loggedIn = prefs.getString("logged_in", null);

        if(loggedIn != "1") {
            setContentView(R.layout.main);
            TextView textView = (TextView) findViewById(R.id.login_status);
            textView.setText(prefs.getString("logged_in", null));
        }

        else {
            startActivity(new Intent(this, LoggedInActivity.class));
        }
    }

What's really weird is that it will load the main view instead of starting the LoggedIn Activity, but then it displays the logged_in preference as being a 1. So according to what I'm seeing, it should be starting the new activity, but it's not. I'm really confused on this. Any help is greatly appreciated.

A: You are comparing references instead of string values. That is, you are saying do these two references point to the same object instead of are the content of this two objects the same. You should do instead:
if( !loggedIn.equals("1") )

Note however that if loggedIn is null, that code will raise a NullPointerException. So this would be more appropriate:
if( loggedIn == null || !loggedIn.equals("1") )

That said, in this particular case you would be better off by using an int preference.


text:
Q: 'clicking' in cells containing hyperlinks to generate mailto I am throwing together a quick VBA application in Excel for an office secret santa activity.  I have code that will take a list of names in column A, copy them and randomize them in column B and repeat until there are no matches where the participant is paired with themselves.  In addition, I have the cells in column F containing a hyperlink as follows:
(example from cell F10)
=HYPERLINK("mailto:" & A10 & "?subject=Shhhhh… Secret Santa" & "&body=The name of your receipient is:  " &B10, "Email")

So now I want a subroutine to simply roll down column F and 'click' on each hyperlink.
I have tried a few things that I found online but none of them matched exactly what I needed. I suspect my syntax blew so I'm not even going to provide the amusement to you. I've been away from coding for awhile :)
This 'should' just be a simple loop but I need the magic line in the middle:
Sub Generate_Emails()
Dim lastsanta
lastsanta = ActiveSheet.UsedRange.Rows.Count
cur = 0
Do Until cur = lastsanta
------  Magic line that clicks Cells(cur, 6)
cur = cur + 1
Loop
End Sub

The end result, when run, should popup a buttload of email windows already filled in with destination a nd content so all I need to do is click send in each window (still looking at how to make that happen automatically but I think outlook won't allow it so people don't robo-spam)
Help please.

A: For a = 1 To 10

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    With OutMail
        .to = Cells(a, 1).Value
        .Subject = "Secret Santa 2"
        .Body = "Secret Santa info from another cell"
        .Send
    End With
Next

Set OutMail = Nothing
Set OutApp = Nothing


text:
Q: Write permission on file is NOT granted when used by postfix I have to change my working platform from Ubuntu to Centos7.
My script is working fine on Ubuntu but not yet on Centos.
My script is supposed to update the /tmp/CheckAccessRight.log file, when the script is executed manually the   "Write permission" is granted to the file.
test -w /tmp/CheckAccessRight.log

If the script is called via postfix,  the "Write permission" is NOT granted to the file.
# cat /etc/aliases
check:  "|/home/owner/bin/CheckAccessRight.sh"

$ ls -l /etc/aliases*
-rw-r--r--. 1 root root  5730 Nov 10 11:53 /etc/aliases
-rw-r--r--. 1 root root 12288 Nov 10 11:53 /etc/aliases.db

$ ls -l /tmp/CheckAccessRight.log
-rw-rw-r--. 1 owner owner 7843 Nov 10 12:26 /tmp/CheckAccessRight.log

/etc/postfix/main.cf:default_privs = owner
Any idea ?
$ sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31

A: I checked the audit log:
*grep CheckAccessRight.log  /var/log/audit/audit.log*

type=AVC msg=audit(1541841282.927:466): avc:  denied  { write } for  pid=10383 comm="vismail-dispatc" name="CheckAccessRight.log" dev="dm-0" ino=16777285 scontext=system_u:system_r:postfix_local_t:s0 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=file

*semanage permissive -a postfix_local_t*
*semodule -l | grep permissive*

permissive_postfix_local_t      (null)
permissivedomains       (null)

I am progressing, "Write permission" on file is NOW granted when used by postfix!
Seems to be Ok !


text:
Q: ReactJs ContextApi I am not able to render my state present in Parent Component(App.js) in Child Component(Guest.js) in ReactJs.
I am not sure whether  at line number 11 {this.props.children} should exist or not.
App.js
1. import React, { Component } from 'react';

2. export const MyContext = React.createContext();

3. export default class App extends Component {
4.  state = {
5.   name: "Rahul",
6.    age: "29"
7.  }
8.  render() {
9.    return (
10.      <MyContext.Provider value={this.state.name}>
11.        {this.props.children}
12.      </MyContext.Provider>
13.    )
14.  }
15.}

Guest.js
import React, { Component } from 'react';
import { MyContext } from "./App";
class Guest extends Component {
  render() {
    return (

Guest Component

        <MyContext.Consumer>
          {value =>
{value}
}
        </MyContext.Consumer>

    )
  }
}
export default Guest;

A: You have to render the Guest component in App.js in order for the child component to render.
Inline number 11 you are trying to render the children in of App component where you render this App.
 For example:
render(){
  return(
    <App>

hello

    </App>
  )
}

Solution:
import React, { Component } from 'react';
import Guest from './Guest';
export const MyContext = React.createContext();

export default class App extends Component {
  state = {
   name: "Rahul",
    age: "29"
  }
  render() {
    return (
      <MyContext.Provider value={this.state.name}>
        <Guest/>
      </MyContext.Provider>
    )
  }
}

A: For the state variable to be available in the Guest component Guest component needs to be children of the ContextProvider. Because the logic for the App can become complicated overtime, it is better to create a separate Provider component which will render the Guest component as children.
For example,
Provider component
export const MyContext = React.createContext();

class NameProvider extends Component {
  state = {
    name: "Rahul",
    age: "29"
  };
  render() {
    return (
      <MyContext.Provider value={this.state.name}>
        {this.props.children}
      </MyContext.Provider>
    );
  }
}

Guest component
class Guest extends Component {
  render() {
    return (

Guest Component

        <MyContext.Consumer>{value =>
{value}
}</MyContext.Consumer>

    );
  }
}

App component
export default class App extends Component {
  render() {
    return (
      <NameProvider>
        <Guest />
      </NameProvider>
    );
  }
}

Codesandbox demo codesandbox

A: You can render to the DOM with Guest as a child of App.
ReactDOM.render(<App><Guest /></App>, document.getElementById('app'))

I am not sure whether at line number 11 {this.props.children} should exist or not.

You may not(see other answers above).
The Guest component will be available to App component as this.props.children. see https://reactjs.org/docs/glossary.html#propschildren

A: THERE ARE TWO WAY OF SOLVING THIS
1. TO CREATE A GLOBAL STATE MANAGEMENT
2. USE INSIDE THE CLASS AS A CONTEXT
I AM USING THE GLOBAL STATE MANAGEMENT
CHECK THIS OUT....!!!
Context.js
    import React, { Component } from "react";

const MyContext = React.createContext();

export default class Context extends Component {
    state = {
        name: "Krsnadil",
        value: 10,
        onClick: this.value + 1
    }
    render() {
        return (
            <MyContext.Provider value={this.state}>
                {this.props.children}
            </MyContext.Provider>
        );
    }
}
export const Consumer = MyContext.Consumer;

Guest.js
import React, { Component } from 'react'
import { Consumer } from "./Context";

class Guest extends Component {
  render() {
    return (
      <Consumer>
        {value => value.name}
      </Consumer>
    );
  }
}
export default Guest;

App.js
import React, { Component } from 'react';
import Guest from "./Guest";
import Context from "./Context";

export default class App extends Component {
  render() {
    return (
      <Context>
        <Guest />
      </Context>
    )
  }
}


text:
Q: FFT welch with lorentzian curve fit So I have this lorentzian curve fit for my data, but I have noticed weird little thing and I'm looking for the answer. Maybe you can help.
This is my data, as you can see I took scaling='density', but when I take spectrum my code does some weird stuff.
for dataset in [Bxfft]:
    dataset = np.asarray(dataset)
    freqs, psd = signal.welch(dataset, fs=266336/300, window='hamming', nperseg=16192, scaling='density')
    plt.semilogy(freqs[30:-7000], psd[30:-7000]/dataset.size**0, color='r', label='Bx')
    x = freqs[100:-7900]
    y = psd[100:-7900]

Here is my model for curve fitting:
So this code goes of the first black line (curved one):
model = Model(lorentzian)
params = model.make_params(amp=6, cen=5, sig=1)
result = model.fit(y, params, x=x)
final_fit = result.best_fit
print(result.fit_report(min_correl=0.25))
plt.plot(x, final_fit, 'k-', linewidth=2)

And this goes for the second black line (upper graph curved, lower graph straight line):
# 14 Hz
x2 = freqs[200:-7800]
y2 = psd[200:-7800]

model2 = Model(lorentzian)
pars2 = model2.make_params(amp=6, cen=5, sig=1)
pars2['amp'].value = 6
result2 = model2.fit(y2, pars2, x=x2)
final_fit2 = result2.best_fit
print(result2.fit_report(min_correl=0.25))
plt.plot(x2, final_fit2, 'k-', linewidth=2)

Check out the plot. Do you have any ideas?
Summarizing my question, do you have any idea why everything is fine (upper graph) when I use density, and why when I use spectrum some of my data is cracked?

A: As the amplitudes are different, maybe it is due to the initial parameter values. Note that spectrum and density should have different units (see documentation)...is you data too noisy to make a simple windowed fft?


text:
Q: If $\lim x_{n+1}/x_n = L$ then $\lim x_n^{1/n} = L$ Im trying to prove the following, and I think I am on the right track just not sure about a couple of things. Any help would be great!

If $x_n$ is real, positive sequence and $\lim_{n \rightarrow \infty} \frac{x_{n+1}}{x_n} = L$ then  $\lim_{n \rightarrow \infty} x_{n}^\frac{1}{n} = L$

Since $\lim_{n \rightarrow \infty} \frac{x_{n+1}}{x_n} = L$ then for every $\epsilon >0, \exists N$ s.t. $\forall n \geq N$:
$|\frac{x_{n}}{x_{n-11}} - L| < \epsilon \implies L - \epsilon < \frac{x_{n}}{x_{n-1}} < L + \epsilon$
Let $C_N = x_1\left(\frac{x_2}{x_1}\right) \dots \left(\frac{x_{N-1}}{x_{N-2}}\right). $
We know from the above inequality that $(L - \epsilon)^{n-N} < \left(\frac{x_N}{x_{N-1}}\right)\dots\left(\frac{x_n}{x_{n-1}}\right) <(L + \epsilon)^{n-N}$
Multiplying by $C_N$, which is a product of positive reals gives:
$C_N(L - \epsilon)^{n-N} < x_1\left(\frac{x_2}{x_{1}}\right) \dots \left(\frac{x_{N-1}}{x_{N-2}}\right) \left(\frac{x_N}{x_{N-1}}\right)\dots\left(\frac{x_n}{x_n-1}\right) <C_N(L + \epsilon)^{n-N}$
$C_N(L - \epsilon)^{n-N} < x_n <C_N(L + \epsilon)^{n-N}$
I feel like it's practically done, not sure how to make the jump to $L - \epsilon <x_n^\frac{1}{n}< L + \epsilon$
Given some suggestions and thinking and help from comments, this is my completion of the proof.
Let $A = C_N^{1/n}(L-\epsilon)^{-N}, B =C_N^{1/n}(L+\epsilon)^{-N}$. Note that $A, B$ are positive (if we restrict $\epsilon$ to be small) Then it follows that:
$A^{1/n}(L - \epsilon) < x_n^{1/n} <B^{1/n}(L + \epsilon)$.
Taking the limit as $n \rightarrow \infty$:
$L-\epsilon < \lim_{n\rightarrow \infty}x_n^{1/n} < L + \epsilon$.
$|\lim_{n \rightarrow \infty} x_n^{1/n} - L| < \epsilon$. Since this is true for any $\epsilon > 0$ then $\lim_{n \rightarrow \infty} x_n^{1/n} = L$.

A: From $(L - \epsilon)^{n-N} < \left(\frac{x_N}{x_{N-1}}\right)\dots\left(\frac{x_n}{x_{n-1}}\right) <(L + \epsilon)^{n-N}$
we have
$L - \epsilon < \sqrt[n-N]{ \frac{x_n}{x_{N-1}} } <L + \epsilon$.
Note that $\lim_{n \to \infty} \sqrt[n]{x_{N-1}} = 1$.


text:
Q: collect function keyword arguments in dict in julia How can I get the keyword arguments and their default values of a function in a dict in Julia?
E.g:
function foo(x; a = 1, b = 2, c= 3)
  # How do I get a dict of keyword arguments: Dict(a=>1, b=>2,c=3) ??,
  # so I can pass this Dict easily to another generic function taking v
  # variable keyword arguments for further processing
end

A: You can use the splat ... operator:
function foo(x; kwargs...)
   Dict(kwargs)
end

or if you just want to pass it:
function foo(x; kwargs...)
   innerfunction(x; kwargs...)
end

A: Just create a Dict like so:
function foo(x; a = 1, b = 2, c= 3)
  Dict(:a => a, :b => b, :c => c)
end


text:
Q: using flags MSG_TRUNC , MSG_CTRUNC in UDP socket i want a full example in C to using flags MSG_TRUNC , MSG_CTRUNC in UDP socket
and some explanation to these flags
recvmsg(udpSocket, &msg, flags);
if (msg.msg_flags & MSG_TRUNC)
printf("MSG_TRUNC\n");

thanks

A: MSG_TRUNC indicates that the buffer space provided for receiving was insufficient, so that some of the packet data were lost.
This flag is used when you want to discover how much data was truncated. The recvmsg function will set this flag (msg_flags) for the structure msghdr (used for sending UDP packets)
struct msghdr {
       void                  *msg_name;
       int                   msg_namelen;
       struct iovec          *msg_iov;
       __kernel_size_t       msg_iovlen;
       void                  *msg_control;
       __kernel_size_t       msg_controllen;
       unsigned              msg_flags;
};

You need to add this structs to your code:
struct msghdr msg;
struct iovec iov;

And a your receiving buffer:
char buffer[BUFFER_SIZE];

Init all this stuff:
iov.iov_base = buffer;
iov.iov_len = sizeof(buffer);

msg.msg_iov = iov;

With the maximum size of the buffer set and the flag MSG_TRUNC set, when you call:
recvmsg(udpSocket, &msg, flags);

The struct header will be populated after this call, and you can check if your received buffer was truncated or not with this:
if (msg.msg_flags & MSG_TRUNC)
printf("MSG_TRUNC\n");

EDIT : Using recvfrom
This is a sample on how to use recvfrom with flags:
char *buffer[BUFFER_MAX_SIZE];
struct sockaddr from;
socklen_t from_len;
int available_data;
int socket;

socket = socket(AF_INET, SOCK_DGRAM, 0);

available_data = recvfrom(socket, (char*)buffer,0, MSG_TRUNC, &from, &fromlen);
if(available_data > 0)
{
    if (available_data > BUFFER_MAX_SIZE)
    {
        fprintf(stderr, "UDP Packet is bigger than expected\n");

        exit(EXIT_FAILURE);
    }

    else
    {
        /* Process receiving data */
    }
}
else
{
    /* Handle error */
}


text:
Q: Classpath for taskdef? I am defining a new task in Ant.
I exported it as a jar and added to my buildfile:
<taskdef classname="X" classpath="Y.jar"/>

The problem is that this fails at runtime.
It tells me it didn't find the class.
By adding the jar to the classpath, it is corrected.
My question is: Is there a way that I can refer to my jar from the Ant buildfile, without changing the classpath?

A: If you know the path of your jar, inside ant script you can define the classpath for your own task.
<taskdef name="myTaskName" classname="com.myorg.myclass">
  <classpath>
    <pathelement location="pathToMyJar.jar"/>
  </classpath>
</taskdef>

A: Yes. I'm assuming that you looked at the doc for taskdef, which just shows the task name and implementing class. However, taskdef subclasses typedef, and if you look at the doc for the latter you'll see that there's also a classpath attribute.
HOWEVER, using this attribute means that your ant scripts are tied to a particular environment; they aren't very portable. A far better approach is to pass the classpath into Ant, using the -lib invocation option.


text:
Q: How to get div class from html page? I have this portion of html code:

Niccolò Campriani

Full name: Niccolò Campriani

Nickname(s): Nicco

Gender: Male

Height: 5-9.5 (177 cm)

Weight: 176 lbs (80 kg)

Born: November 6, 1987 in Sesto Fiorentino, Firenze, Italy

I'm using this (portion of) php code with no success:
foreach($html2->find($tagname_td) as $tag2) {

              if(strpos($athlete_link = $tag2->href,'athletes') == true){

                    $url_athlete='https://www.sports-reference.com' . $athlete_link;

                    $html3 = file_get_html($url_athlete,true);

              }

                           $dom = new DOMDocument();
                           $dom->loadHTML($html3);

                           $xpath = new DOMXPath($dom);
                           $div = $xpath->query('//div[@class="clear_left"]');
                           $div = $div->item(0);
                           $result = $dom->saveXML($div);
                           echo $result;

 }

I put echo $result only to see what it stamps, but what I want is to get this information e store them in variables, i.e.:
Name = Niccolò
Surname= Campriani
Gender= male
birth = 1987-11-06
City = Sesto Fiorentino, Firenze

How can I do?

A: To get a class element using javascript :
document.getElementsByClassName('clear_left');

To get a class element using jquery :
$('div .clear_left')


text:
Q: Windows Form TextBox User input I'm new to windows forms and have never tried it before, i mainly do razorpages and stuff along those lines.
I'm making a form that is suppose to create an account. i have a Class account with a bunch of properties already, the problem is that i can't seem to figure out how i make whatever is written in the textboxes = my Account properties.
I've tried making properties in the form and initializing them to my account properties liek this Firstname = Account.FirstName; but i just get "object reference not set to an instance of an object" error when i run it.
public partial class AddAccountDialog : Form
{
#region Properties

        public Account Account { get; set; }
        public string Id { get; set; }
        public string Firstname { get;
            set; }
        public string Lastname { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
        private bool Accepted { get; set; }

        #endregion
        public AddAccountDialog()
        {
            #region Applying Properties

            Id = Account.UserID;
            Firstname = Account.FirstName;
            Lastname = Account.LastName;
            Username = Account.Username;

            Accepted = false;

            #endregion

            #region Setup Methods
            InitializeComponent();
            SetupForm();
            ShowDialog();
            #endregion
        }

        private void SetupForm()
        {

        }

        private void textBox_user_id_TextChanged(object sender, EventArgs e)
        {
            Id = textBox_user_id.Text;
        }

        private void textBox_firstname_TextChanged(object sender, EventArgs e)
        {
            Firstname = textBox_firstname.Text;
        }

        private void textBox_lastname_TextChanged(object sender, EventArgs e)
        {
            Lastname = textBox_lastname.Text;
        }

        private void textBox_username_TextChanged(object sender, EventArgs e)
        {
            Username = textBox_username.Text;
        }

        private void textBox_password_TextChanged(object sender, EventArgs e)
        {
            Password = textBox_password.Text;
        }

        private void button_accept_changes_Click(object sender, EventArgs e)
        {
            Accepted = true;

            if (textBox_firstname.Text == "" ||
                    textBox_lastname.Text == "" ||
                        textBox_username.Text == "" ||
                            textBox_password.Text == "") { MessageBox.Show("Udfyld alle kasser"); }
            else
            {
                //Account.FirstName = textBox_firstname.Text;
                //Account.LastName = textBox_lastname.Text;
                //Account.Username = textBox_username.Text;
                //Account.UserID = textBox_user_id.Text;

                Account = new Account();

                Account.ToString();
                //Close();
            }

        }
        public Account GetResponse()
        {
            Close();

            if (Accepted) return Account;
            else return null;

            Dispose();
        }
    }

Account class
 public class Account
    {

        #region Properties

        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string FullName { get { return $"{FirstName} {LastName}"; } }
        public string Username { get; set; }
        public string UserID { get; set; }
        public string[] AllowedPermissionIDS { get; set; }
        public bool IsAdmin { get; set; }
        #endregion
        /// <summary>
        ///
        /// </summary>

        public Account(string firstName, string lastName, string username, string userId, string[] allowedPermissionIds, bool isAdmin)
        {
            FirstName = firstName;
            LastName = lastName;
            Username = username;
            UserID = userId;
            AllowedPermissionIDS = allowedPermissionIds;
            IsAdmin = isAdmin;
        }
        public Account()
        {

        }

A: Have you tried this in the button_accept_changes_Click event? It is unclear why the code is commented out, but it should go something like…
Account = new Account();

Account.FirstName = textBox_firstname.Text;
Account.LastName = textBox_lastname.Text;
Account.Username = textBox_username.Text;
Account.UserID = textBox_user_id.Text;


text:
Q: Using exponential family to find the derivate of the partition function Distributions that follow the exponential family have the following form
\begin{equation}
p(x) = h(x)\exp \left[\theta^T T(x) - H(\theta)\right]
\end{equation}
and $\frac{\partial}{\partial \theta}H(\theta) = \mathbb E_p[T(X)]$.
I have the following function
\begin{equation}
H(\theta) = \log \int_z \exp \left[\log P(y|z) - \frac{z^2}{2v} + \frac{mz}{2v}\right]
\end{equation}
I want to find $\frac{\partial}{\partial m}H(\theta)$. For this define $T(z) = \begin{bmatrix} 1 & z/v & z^2 \end{bmatrix}^T$ and $\theta = \begin{bmatrix} \log P(y|z) & m & -1/2v \end{bmatrix}^T$. Is it correct that $\frac{\partial}{\partial m}H(\theta) = \mathbb E[T_2(z)|\theta] = \mathbb E[\frac{z}{v}|\theta]$?

A: It sounds like
$$
H(\theta) = \log \int \exp \left[\log P(y|z) - \frac{z^2}{2v} + \frac{mz}{2v}\right]dz
$$
where the integration is over a range in which $z$ is defined. Let's write this more shortly as
$$
H(\theta) = \log G(\theta)
$$
with an obvious definition of $G(\theta)$.
The answer to your question is
\begin{align}
\frac{\partial}{\partial m}H(\theta)&=\frac{\frac{\partial}{\partial m}G(\theta)}{G(\theta)}\,.
\end{align}
Since
\begin{align}
\frac{\partial}{\partial m}G(\theta)&=\int\frac{\partial}{\partial m}\exp \left[\log P(y|z) - \frac{z^2}{2v} + \frac{mz}{2v}\right]dz\\
&=G(\theta)\int \frac{z}{2v}dz
\end{align}
we get
$$
\frac{\partial}{\partial m}H(\theta)=\int \frac{z}{2v}dz.
$$


text:
Q: How do I lazy load 100+ pages in a UIScrollView with paging enabled? I'm creating a comicbook-like application. I'm using a UIScrollView with paging enabled to display the hi-res full-screen images (the app works similar to Photos.app but with zooming disabled). The final product will have nearly 200 images that need to be paged through by the user. How do I go about setting up the UIScrollView for such a large number of pages?
This would be fairly easy to accomplish with just straight UIViews, but the "feel" of the UIScrollView is just so much nicer with the bounce, etc that I think it adds more value to my app. How should I approach making it work?

A: Checkout Apple's sample code for PageControl.  It shows you how to use a UIScrollView and UIPageControl to cycle through view controllers (just like the photo app).  Each page is loaded only as needed.
Basically to achieve lazy loading you start off with an array of empty view controllers.  Then as you scroll you load only the current page's view controller as well as the previous and next ones so that scrolling appears smooth.  Just look over the sample project, it's fairly short and simple to follow.  It should at least get you started.  The UIScrollView will tell the appropriate controller when to load itself.  It is then the controller's responsibility to load its content (in your case an image).
Good luck.


text:
Q: What exactly is ecriptfs? (14.04) My computer has been telling me "file system '/' has `200mb available."
I figured, after 5 years of constant downloading, my hard drive was full. So I go to the store and get another external hard drive to move everything onto. The problem hasn't changed at all. After having it analyzed, it says over 200gb of my hard drive is being taken up by my home directory. When looking further into that it's about 100gb from home and 100gb from ecriptfs. What is ecriptfs? Is it just encrypted copies of all my old files? Can I just wipe the entire thing and free up the space I need?

A:
eCryptfs is a POSIX-compliant enterprise cryptographic stacked
  filesystem for Linux. eCryptfs stores cryptographic metadata in the
  header of each file, so that encrypted files can be copied between
  hosts; the file will be decrypted with the proper key in the Linux
  kernel keyring. There is no need to keep track of any additional
  information aside from what is already in the encrypted file itself.
  You may think of eCryptfs as a sort of "gnupg as a filesystem".
eCryptfs is widely used, as the basis for Ubuntu's Encrypted Home
  Directory, natively within Google's ChromeOS, and transparently
  embedded in several network attached storage (NAS) devices.eCryptfs

More information can be found at Ubuntu Help


text:
Q: Сортировка элементов jQuery Всем привет. Такая проблемка: Есть  такой пример с сайта jQuery:
<!DOCTYPE html>

  <link type="text/css" href="/ui/jqueryui.custom.css" rel="stylesheet" />

Перенеси в группу

Элемент 1

Элемент 2

Элемент 3

Элемент 4

Элемент 5

Помогите плиз, сделать так, чтобы список из этого примера отображался горизонтально и функциональность сохранилась, но не вертикально, а горизонтально.
Спасибо =)
A: Для тега li добавьте свойство float со значение left.
Результат смотри тут.


text:
Q: adjust a div's height based on another div by CSS I have two DIVs (one is a sidebar and the other one is a content part) that I need to have the same height but I have a problem. The sidebar includes some lis. I want the height of the sidebar to be the same as the content part but when I use flex, the height of the sidebar can be longer than the content part (because both parts are dynamic). So I need the sidebar to be scrolled when the height is longer than the content part.

My CSS code:
.container {
    display: flex;
}
.sidebar,.content {
    flex: 1 0 auto;
}

I even used JQuery but we see the wrong height because images are being loaded slowly in the content part.
My JQuery code:
jQuery(document).ready(function($) {

    $(".sidebar").height($(".content").height());

});

I even used the following code but nothing happens:
jQuery( window ).load(function($) {

    $(".sidebar").height($(".content").height());

});

I do not want to use position:absolute because... You can see my page in this link: https://end-eng.com/landing-grammar/

A: What you have is very close! If you instead set the flex properties on the parent, you will have two equal-height divs. I added some colours to illustrate:

.container {
    display: flex;
    flex: 1 0 auto;
}
.sidebar {
    background: red;
}

.content {
  background: lime;
}

hello content

Here's some reading on the flex shorthand you're using: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow
If you need the sidebar to be scrolled when the height is longer than the content, then you can use jQuery to match the elements' heights on a resize event (to keep it consistent) like so:

$(document).ready(function() {
  var a = '.content';
  var b = '.sidebar'
  matchHeight(a, b); // set at beginning
  $(window).resize(function() {
    matchHeight(a, b); // reset on window resize
  })
});

// set height of one element to another
// target: height to match
// el: element to match to target height
function matchHeight(target, el) {
  var targetHeight = $(target).height();
  $(el).css('height', targetHeight);
}
.container {
  display: flex;
  flex: 1 0 auto;
}

.sidebar {
  background: red;
  overflow-y: scroll;
  min-width: 50px;
}

.sub-container {
  background: lime;
}

      Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up
      one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source.

A: Here is your code it's very simple way to achieve sidebar and main content using flexbox; Codepen example goes here
Html goes here...

list item

list item

list item

list item

content goes here...

css goes here
body{
  margin:0px;
  padding:0px;
}
.container{
  display:flex;
}
.sidebar{
  height:100vh;
  width:200px;
  background:#ccc;
  overflow:auto; // overflow:auto; will scroll when your content reach 100vh height
}

A: as I told above, I wanted sidebar to be scrolled when the sidebar is longer than content. so I solved it by pure CSS:
my new HTML code:

my new CSS code:
.container {
    display: flex;
}
.sidebar , .content {
    flex: 1 0 auto;
}
.sidebardiv {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    overflow: auto;
    padding: 0 8px 0 8px;
}


text:
Q: Loop through array in search for elements with certain attributes - with as short/concise code as possible My check_processors method should go through an array of processors (provided by the processor_list argument) and output a new array, containing the same processors.
The processor_list argument is either nil or an array of processors, e.g.:
    [
      <Processor _id: 5158713883c336812100007f, _type: nil, created_at: 2013-03-31 17:24:08 UTC, updated_at: 2013-03-31 17:24:08 UTC, name: "my_mapping_processor", value: {"something"=>{"something_else"}}, type: "mapping", order: 0>,
      <Processor _id: 5158713883c3368121000080, _type: nil, created_at: 2013-03-31 17:24:08 UTC, updated_at: 2013-03-31 17:24:08 UTC, name: "my_presentation_processor", value: {"something"=>{"something_else"}}, type: "presentation", order: 1>,
      <Processor _id: 5348143r83c93641210d0080, _ty...
    ]

The check_processors method should verify that 2 specific processors (recognized by the type attribute of a processor) exists. If no processor with type == "mapping" is found, create_mapping_processor should it. Or if no processor with type == "presentation" is found, create_presentation_processor should create it.
The code below works, but the job it is doing is so simple that it must be achievable with less code.
    def check_processors(processor_list = nil)

      processors = []

      if processor_list == nil
        mapping_processor = create_mapping_processor
        presentation_processor = create_presentation_processor
        processors.push(mapping_processor)
        processors.push(presentation_processor)
      else
        mapping_processor_exists = false
        presentation_processor_exists = false
        processor_list.each do |processor|
          processors.push(processor)
          mapping_processor_exists = true if processor.type == "mapping"
          presentation_processor_exists = true if processor.type == "presentation"
        end

        if mapping_processor_exists == false
          mapping_processor = create_mapping_processor
          processors.push(mapping_processor)
        end

        if presentation_processor_exists == false
          presentation_processor = create_presentation_processor
          processors.push(presentation_processor)
        end
      end
      processors #=> [<Processor _id: 5158713883c336812100007f, _type: nil, created_at: 2013-03-31 17:24:08 UTC, updated_at: 2013-03-31 17:24:08 UTC, name: "my_mapping_processor", value: {"something"=>{"something_else"}}, type: "mapping", order: 0>, <Processor _id: 5158713883c3368121000080, _type: nil, created_at: 2013-03-31 17:24:08 UTC, updated_at: 2013-03-31 17:24:08 UTC, name: "my_presentation_processor", value: {"something"=>{"something_else"}}, type: "presentation", order: 1>, <Processor _id: 5348143r83c93641210d0080, _ty...]
    end

    def create_mapping_processor
      mapping_processor = Processor.new(:name => "my_mapping_processor", :value => {"something"=>{"something_else"}}, :type => "mapping", :order => 0)
      mapping_processor
    end

    def create_presentation_processor
      presentation_processor = Processor.new(:name => "my_presentation_processor", :value => {"something"=>{"something_else"}}, :type => "presentation", :order => 1)
      presentation_processor
    end


text:
Q: Ошибка "Plugin ... was not found" в Android Stidio Bumblebee | 2021.1.1 Patch 2 Всем привет!
Установил Android Stidio Bumblebee | 2021.1.1 Patch 2.
Создаю новый пустой проект и сразу же получаю ошибку:
Plugin [id: 'com.android.library', version: '7.1.2', apply: false] was not found in any of the following sources:
build.gradle выглядит так:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Кто сталкивался? Что делать?


text:
Q: Issue in Adding Custom Notification Ringer Sound in Flutter App for Background Notification Triggered by Backend I am trying to add custom sound for the notifications that are being triggered, however, so far I haven't achieved any success.
Here is what I am doing, I added alarm.mp3 file in the raw folder.

This is how the backend team is sending the notification:
{
 "to" : "my_device_token",
 "collapse_key" : "type_a",
 "priority" : "high",
 "notification" : {
     "body" : "Test Notification body for custom sound {{datestamp}}",
     "title": "Custom sound alert.mp3",
     "sound": "alert.mp3"
 }
}

Can you please guide me how can I achieve the custom sound of the notification, both in the background and in the foreground. Thank you.
Here is what I am doing, I added alarm.mp3 file in the raw folder.


text:
Q: Is it possible to compile a class on the fly in Java without using external libraries? It seems to me that the Java Compiler API allows to compile at runtime a class, writing its output (the .class file) to the file system. However, in-memory compilation is not supported. Is this correct ? or is possible to use this API to compile a class in memory (from a String) and instantiating such class afterwards ?
(I know I can compile the class to the file system and load it afterwards with a custom class loader, but I am wondering if I can compile it in memory, without passing by the file system).
Is there another alternative mechanism to do such in memory compilation using the J2SE only?
BeanShell (I library that can do what I want) mentions in its web page that it may be included in the J2SE at "some point in the future", however, the status of its JSR is "Dormant" (whatever does it mean).
Update:
Ideally, I would like to know if this can be done with the J2SE only (or if there are any expected enhancements to J2SE that will allow me to do this in, for example, Java 8). However, tips about how to do that requirying the JDK to be installed are also appreciated (thanks Evgeniy).

A: It is possible if you have JDK, java complier is in tools.jar which comes with JDK only. See http://docs.oracle.com/javase/7/docs/api/javax/tools/package-summary.html

A:
Java Compiler API .. in-memory compilation is not supported. Is this correct?

No. The STBC uses the JavaCompiler to do exactly that.

..and instantiating such class afterwards?

The STBC does not go as far as trying to load/run the class, but I believe it should be possible.  I imagine it might require a custom 'in memory' class loader though.

..the JavaCompiler API can do that independently if the JDK is installed or not?

From the page..

System Requirements
STBC will run on any computer with a version 1.6+ Java Plug-In* JDK (AKA SDK).
* The API that STBC uses is merely a public interface to the compiler in the tools.jar that is distributed only with JDKs (though the 'public JRE' of the JDK also seems to acquire a tools.jar). ..


text:
Q: Using Swagger for Express alongside normal routes I'm interested in using something like swagger-node-express to build the API for the project I'm working on. However, some parts of the app are non-api based (serving HTML instead). Has anyone got any ideas as to how I would use Swagger alongside normal routes?

A: You'll just need to make sure that your routes don't conflict with the Swagger routes, and your other routes will processed as usual. One easy way would be to make Swagger live under a subpath. Take a look at the docs on that score:
https://github.com/wordnik/swagger-node-express
var app = express();
var subpath = express();

app.use(express.bodyParser());
app.use("/v1", subpath);

swagger.setAppHandler(subpath);

Otherwise, you could just keep an eye out to make sure that none of the other URLs you are using in your application conflict with the Swagger URLs, and you should be able to define your routes and handlers normally. E.g. you can use Swagger to serve up docs under http://localhost:8002/api-docs.json/pet but have http://localhost:8002/foo/ do something else just by adding the route in the normal way:
app.get(/foo/, function(req, res, next) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Foo\n');
})

Using the subpath configuration is probably the cleanest approach but you could also just keep track of the routes yourself and make sure that the Swagger routes aren't conflicting with the routes in the rest of your app.


text:
Q: Typescript Angular NGRX/Effects actions$.pipe() undefined Hello I have issue with ngrx/effects - pipe undefined. Below I attached sample code which is correct along compilator but browser shows undefined pipe error.
constructor(
    private actions$: Actions,
    private ethereumService: EthereumService
) { }

loadUser$ = createEffect(() =>
    this.actions$.pipe(
        ofType(loadAccountState),
        mergeMap(() => this.ethereumService.getAccountDetails()
            .pipe(
                map(setAccountStateCompleted),
                catchError(() => EMPTY)
            )
        )
    )
);

AppModule:
StoreModule.forRoot(reducers),
EffectsModule.forRoot([AccountEffects]),

EDIT: Even this sample has same error -_-
logActions$ = createEffect(() =>
    this.actions$.pipe(
        ofType(AccountActions.loadAccountState),
        tap(action => console.log(action))
    ), { dispatch: false });

PS2. I am using ActionReducerMap which is main reducer file imported to Root as reducers
import {
  createSelector,
  createFeatureSelector,
  ActionReducerMap,
} from '@ngrx/store';

import * as fromAccount from './account.reducer';

export interface State {
  account: fromAccount.State;
}

export const reducers: ActionReducerMap<State> = {
  account: fromAccount.updateAccountReducer,
};

export const selectAccountState = createFeatureSelector<fromAccount.State>('account');

//Account Selectors
export const selectCurrentUser = createSelector(
  selectAccountState,
  fromAccount.selectActiveAccount
);

What is wrong with my code, please for help

A: Depending how the $actions is declared the geneated code might change when you set target ES2022 or newer.
Quick fix - add this to your tsconfig.json:
"compilerOptions": {
  {
    // ...
    "useDefineForClassFields": false
    // ...
  }
}

More info: https://www.typescriptlang.org/tsconfig#useDefineForClassFields

A: I fixed this problem by updating my tsconfig.json file to reference ES2020 instead of ESNEXT.
tsconfig keys
After this update, in my effects file, I have my createEffect methods outside the constructor and it's working for me.


text:
Q: Why I cannot get my donationId's value from stub's GetState function Currently, I am learning hyperledger/fabric and trying to write the chaincode. Below is the invoke function and customized function I created.
type Donation struct {
    Id string `json:"id"`
    Who string `json:"who"`
    Rid string  `json:"rid"`
    Money int   `json:"money"`
}

type Request struct {
    Id string `json:"id"`
    Name string  `json:"name"`
    Description string `json:"description"`
    ExpectedMoney int `json:"expectedMoney"`
    CurrentMoney int  `json:"currentMoney"`
    DonationList []string `json:"donationList"`
}

type Person struct {
    Id string `json:"id"`
    Name string `json:"name"`
    MyRequests []string `json:"myRequests"`
    MyDonations []string `json:"myDonations"`
}
func (t *SimpleChaincode) Invoke(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {

     if function == "createDonation" {
        return t.createDonation(stub, args)
     }
     return nil, errors.New("Received unknown function invocation")
}
func (t *SimpleChaincode) createDonation(stub *shim.ChaincodeStub, args []string) ([]byte, error) {
     var from, toRid string
     var money int
     var err error

     if len(args) != 3 {
         return nil, errors.New("My createDonation. Incorrect number of arguments. Expecting 3")
     }
     from = args[0]
     toRid = args[1]
     money, err = strconv.Atoi(args[2])
     if err != nil {
        return nil, errors.New("money cannot convert to number")
     }

     var donation Donation
     donation = Donation{Id: "donationid", Rid: toRid, Who: from, Money: money}
     djson, err := json.Marshal(&donation)
     if err != nil {
        return nil, err
     }
     var a = donation.Id
     stub.PutState(a, djson)

     personByte, err := stub.GetState(from + "")
     fmt.Println(personByte)
     return nil, nil

}

func (t *SimpleChaincode) read(stub *shim.ChaincodeStub, args []string) ([]byte, error) {
    log.Println("Get into read function")

    var key, jsonResp string
    var err error

    key = args[0]
    valAsbytes, err := stub.GetState(key)
    if err != nil {
        jsonResp = "{\"Error\":\"Failed to get state for " + key + "\"}"
        return nil, errors.New(jsonResp)
    }
    if valAsbytes == nil {
        return []byte("cannot find the key's value of the chaincode"), nil
    }

    return valAsbytes, nil
}

However, When I tried to use swagger UI to invoke and retrieve the "donationid"'s value, it is empty. Is there anything wrong about my code? Thanks in advance.
Invoke
{
    "jsonrpc": "2.0",
    "method": "invoke",
    "params": {
        "type": 1,
        "chaincodeID": {
            "name": "92d975f9301f9b72c7b148e65dcc835a971be55b2555a45c41d6d2eed04ecfd6b1974245cfb77d002e244e9e581e4042747e9f4d6a46b59e9d7e8a7419476296"
        },
        "ctorMsg": {
            "function": "createDonation",
            "args": [
                "Simon",
                "requestid",
                "300"
            ]
        },
        "secureContext": "user_type1_XXXXXXX"
    },
    "id": 3
}

query
{
    "jsonrpc": "2.0",
    "method": "query",
    "params": {
        "type": 1,
        "chaincodeID": {
            "name": "92d975f9301f9b72c7b148e65dcc835a971be55b2555a45c41d6d2eed04ecfd6b1974245cfb77d002e244e9e581e4042747e9f4d6a46b59e9d7e8a7419476296"
        },
        "ctorMsg": {
            "function": "read",
            "args": [
                "donationid"
            ]
        },
        "secureContext": "user_type1_xxxxxx"
    },
    "id": 2
}


text:
Q: Which variable of Counter-Strike 1.6 controlled the "Voice Transmit/Send Volume"? I know that voice_scale controlls voice receive volume, but which one is for voice transmit volume?

A: I think I got the answer.
It's the Microphone Volume in Control Panel controlls the voice transmit volume.
But they are not synchonized. When adjusting one volume, the other one does not changed at the same time.

*

*When adjusting from Control Panel, you need re-open CS option dialog to see the new voice transmit volumne.

*When adjusting from CS, the new volume will synchronized to Control Panel only after click "OK" in the CS option dialog.


text:
Q: C# Error on multithreading webrequests i am trying to make webrequests with multiple threads but if i try with more than 2 i get error
Index was outside the bonds of the array

on this line:
string username = ScrapeBox1.Lines[NamesCounter].ToString();

Here's the code:
while (working)
{
    while (usernamescount > NamesCounter)
    {
        string username = ScrapeBox1.Lines[NamesCounter].ToString();
        string url = "http://www.someforum.com/members/" + username + ".html";
        var request = (HttpWebRequest)(WebRequest.Create(url));
        var response = request.GetResponse();
        request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0";

        using (var responseStream = response.GetResponseStream())
        {
            using (var responseStreamReader = new StreamReader(responseStream))
            {

                var serverResponse = responseStreamReader.ReadToEnd();
                int startpoint = serverResponse.IndexOf("Contact Info");
                try
                {
                    string strippedResponse = serverResponse.Remove(0, startpoint);
                    ExtractEmails(strippedResponse);

                }
                catch { }

            }
        }
        NamesCounter++;
        textBox1.Text = NamesCounter.ToString();
    }

}

A: This code is not thread safe.
You need the code for performing an HttpWebRequest to be atomic and outside the context of looping through the collection.
For example
public void MakeHttpWebRequest(string userName)
{
    string url = "http://www.someforum.com/members/" + userName + ".html";
    var request = (HttpWebRequest)(WebRequest.Create(url));
    var response = request.GetResponse();
    request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0";

    using (var responseStream = response.GetResponseStream())
    {
        using (var responseStreamReader = new StreamReader(responseStream))
        {

            var serverResponse = responseStreamReader.ReadToEnd();
            int startpoint = serverResponse.IndexOf("Contact Info");
            try
            {
                string strippedResponse = serverResponse.Remove(0, startpoint);
                ExtractEmails(strippedResponse);

            }
            catch { }

        }
    }
}

Assuming ScrapeBox.Lines implements IEnumerable, I would reccomend using Parallel.ForEach and passing the ScrapeBox.Lines as the IEnumerable over which to iterate.
Now, there is one additional problem, the code for reading the response from the HttpWebRequest still needs to write its output to a shared location.  To accomplish that in a thread safe manner.  A common way to do this is with a semaphore.  You need a object accessible to each thread instance. A class level private variable private object sharedMutex = new object(); would work.  Then the code ExtractEmails(strippedResponse); should be changed to
lock(sharedMutex)
{
    ExtractEmails(strippedResponse);
}
Without having the code for the ExtractEmails(<string>) method, I can't provide a thread safe implementation for that, so that part of the solution may still cause a problem.


text:
Q: What is the best method for storing test cases that your xunit tests load from? This is a "design/architecture" question and so you don't need to provide me technical details.
I can find examples on the internet all day long that show how to run a xunit unit test, log test results, and how to show if it succeeds or fails but every example on the internet is hard coded and nobody shows examples of how you store your test cases (nunit or junit) efficiently in a way that makes it possible to build hundreds or thousands of tests  and load them into your test engine.
I assume this would be done using an XML file or a database table.   Can any of you share what you think is the best method for storing tests that will be loaded by test code?   I need to be able to write a testing framework that will ultimately have thousands of tests for a typical web workflow app, and I want to do it the right way.
Maybe describe your answer in the context of doing unit tests of the "Google Advanced Search" page, which has many options, and hundreds of variations, etc.

A: I agree that the important thing here is to keep it simple, and let it grow 'naturally'. Tests are as important as your other code, and should be refactored just as vigorously.
If what you're talking about is actual unit tests (as opposed to integration tests where you test the whole stack from the UI through to the database) it is very important that you keep everything necessary to run them in your solution, so that developers will always have the newest stuff when updating their source files. Also, you should aim at a no-thrills setup scenario, where new developers can just get the source files from the version control system and run the tests with no setup required.
The RowTest feature is really good for simple scenarios, but if you're dealing with complex scenarios you should look into the Test Data Builder pattern that lets you define default scenarios and then variations of these.
I like to keep my test data as close to the tests as possible, thus allowing me to really see what is going on in the tests. Therefore I don't think the question is whether you should use XML or a database, they're just different formats for representing data, but whether you really want to separate your test data from your tests?

A: If you're getting at "data driven tests", then you should take a look at the RowTest approach and equivalents. NUnit borrowed this from MBUnit. xUnit seems to have a even more extensible solution to this via the Theory and PropertyData, where you don't have to specify the inputs in code ; you could generate the inputs from an arbitrary function, spreadsheet or SQL Server database.
I've never had the need for anything over the Rowtest method (which is also rare).. so can't warn you of any dragons. Alternatively you could even use Fit/Fitnesse to do this if you can't do the above approaches ; although not technically an acceptance test.
As for the 'testing framework', maybe YAGNI maybe you do. Get started, start small, keep it simple, grow the test design with time.


text:
Q: How to find properties of an object? How can I find what properties object $a has in the following?
$a = 1
$a.length
$a | Get-Member

Get-Member does not seem to produce any properties for object $a? Is length a property of object $a?

A: $a is an Integer, it doesn't have a length property. Using Get-member is the right way to find object properties.

A: You can also pipe a sample object to Select-Object to see all properties and their values.
get-process | select -first 1 -prop *


text:
Q: Print every few lines as a column I have a script that gets information about servers and stores it in a variable.
➜ echo $report
 Hostname : or-05-arm
 CheckDate: 11:47 27-10-2022
 CPU Usage: [..........] 0%  [0.00/2]
 RAM Usage: [###.......] 31% [1.8G/5.8G]
 HDD Avail: 26G
 Uptime   : up 19 weeks

 Hostname : contabo-3
 CheckDate: 14:47 27-10-2022
 CPU Usage: [#####.....] 50% [3.01/6]
 RAM Usage: [###.......] 30% [4.7G/15.6G]
 HDD Avail: 136G
 Uptime   : up 1 week

 Hostname : contabo-2
 CheckDate: 14:47 27-10-2022
 CPU Usage: [#####.....] 53% [3.16/6]
 RAM Usage: [##........] 25% [3.9G/15.6G]
 HDD Avail: 176G
 Uptime   : up 1 week

Using awk and a column, I display the contents of the report variable on the screen in three columns.
➜ echo $report | awk '{a[NR%7] = a[NR%7] (NR<=7 ? "" : ",") $0} END{for (i = 1; i <= 7; i++) print a[i%7]}' | column -t -s ','

 Hostname : or-05-arm                      Hostname : contabo-3                       Hostname : contabo-2
 CheckDate: 11:47 27-10-2022               CheckDate: 14:47 27-10-2022                CheckDate: 14:47 27-10-2022
 CPU Usage: [..........] 0%  [0.00/2]      CPU Usage: [#####.....] 50% [3.01/6]       CPU Usage: [#####.....] 53% [3.16/6]
 RAM Usage: [###.......] 31% [1.8G/5.8G]   RAM Usage: [###.......] 30% [4.7G/15.6G]   RAM Usage: [##........] 25% [3.9G/15.6G]
 HDD Avail: 26G                            HDD Avail: 136G                            HDD Avail: 176G
 Uptime   : up 19 weeks                    Uptime   : up 1 week                       Uptime   : up 1 week

This works as long as no more than three servers are stored in the variable.
If there are more than three servers, then the output does not fit on the screen.
How to make 3 servers appear on the screen, then three more on the next line, and so on?

A: You can use fold to break the output into lines of a given length.
echo $report | awk '{a[NR%7] = a[NR%7] (NR<=7 ? "" : ",") $0} END{for (i = 1; i <= 7; i++) print a[i%7]}' | column -t -s ',' | fold -w 80

A: Assumptions:

*

*each block of text contains exactly 6 lines (not counting blank lines)

*the last line of each block of text includes the string Uptime

*Uptime does not show up in any other lines

Setup (7 blocks of data):
$ cat report.dat
 Hostname : or-05-arm
 CheckDate: 11:47 27-10-2022
 CPU Usage: [..........] 0%  [0.00/2]
 RAM Usage: [###.......] 31% [1.8G/5.8G]
 HDD Avail: 26G
 Uptime   : up 19 weeks

 Hostname : contabo-3
 CheckDate: 14:47 27-10-2022
 CPU Usage: [#####.....] 50% [3.01/6]
 RAM Usage: [###.......] 30% [4.7G/15.6G]
 HDD Avail: 136G
 Uptime   : up 1 week

 Hostname : contabo-2
 CheckDate: 14:47 27-10-2022
 CPU Usage: [#####.....] 53% [3.16/6]
 RAM Usage: [##........] 25% [3.9G/15.6G]
 HDD Avail: 176G
 Uptime   : up 1 week

 Hostname : or-05-arm
 CheckDate: 11:47 27-10-2022
 CPU Usage: [..........] 0%  [0.00/2]
 RAM Usage: [###.......] 31% [1.8G/5.8G]
 HDD Avail: 26G
 Uptime   : up 19 weeks

 Hostname : contabo-3
 CheckDate: 14:47 27-10-2022
 CPU Usage: [#####.....] 50% [3.01/6]
 RAM Usage: [###.......] 30% [4.7G/15.6G]
 HDD Avail: 136G
 Uptime   : up 1 week

 Hostname : contabo-2
 CheckDate: 14:47 27-10-2022
 CPU Usage: [#####.....] 53% [3.16/6]
 RAM Usage: [##........] 25% [3.9G/15.6G]
 HDD Avail: 176G
 Uptime   : up 1 week

 Hostname : or-05-arm
 CheckDate: 11:47 27-10-2022
 CPU Usage: [..........] 0%  [0.00/2]
 RAM Usage: [###.......] 31% [1.8G/5.8G]
 HDD Avail: 26G
 Uptime   : up 19 weeks

Adding a couple counters and a function (to print 3x blocks at a time) to OP's current awk code:
awk '

function print_block() {
    for (i = 1; i <= 7; i++)
        print a[i%7]
    print ","                           # column will convert this to a blank line
    delete a                            # clear array
    upcount=linecount=0                 # reset counters
}

! NF       { next }                     # skip blank lines
           { linecount++ }
           { a[linecount % 7] = a[linecount % 7] (linecount <= 7 ? "" : ",") $0 }

/Uptime/   { upcount++ }
upcount>=3 { print_block() }            # dump array to stdout for each 3rd occurrence of "Uptime"
END        { print_block() }            # flush anything still in array once all input has been processed

' report.dat | column -t -s,

This generates:
 Hostname : or-05-arm                      CheckDate: 14:47 27-10-2022                CPU Usage: [#####.....] 53% [3.16/6]
 CheckDate: 11:47 27-10-2022               CPU Usage: [#####.....] 50% [3.01/6]       RAM Usage: [##........] 25% [3.9G/15.6G]
 CPU Usage: [..........] 0%  [0.00/2]      RAM Usage: [###.......] 30% [4.7G/15.6G]   HDD Avail: 176G
 RAM Usage: [###.......] 31% [1.8G/5.8G]   HDD Avail: 136G                            Uptime   : up 1 week
 HDD Avail: 26G                            Uptime   : up 1 week
 Uptime   : up 19 weeks                    Hostname : contabo-2
 Hostname : contabo-3                      CheckDate: 14:47 27-10-2022

 Hostname : or-05-arm                      CheckDate: 14:47 27-10-2022                CPU Usage: [#####.....] 53% [3.16/6]
 CheckDate: 11:47 27-10-2022               CPU Usage: [#####.....] 50% [3.01/6]       RAM Usage: [##........] 25% [3.9G/15.6G]
 CPU Usage: [..........] 0%  [0.00/2]      RAM Usage: [###.......] 30% [4.7G/15.6G]   HDD Avail: 176G
 RAM Usage: [###.......] 31% [1.8G/5.8G]   HDD Avail: 136G                            Uptime   : up 1 week
 HDD Avail: 26G                            Uptime   : up 1 week
 Uptime   : up 19 weeks                    Hostname : contabo-2
 Hostname : contabo-3                      CheckDate: 14:47 27-10-2022

 Hostname : or-05-arm
 CheckDate: 11:47 27-10-2022
 CPU Usage: [..........] 0%  [0.00/2]
 RAM Usage: [###.......] 31% [1.8G/5.8G]
 HDD Avail: 26G
 Uptime   : up 19 weeks

If OP has pre-loaded all of the data into a variable then there a couple options:
echo "${report}" | awk '... see code from above ...'                 | column -t -s,

# or
                   awk '... see code from above ...' <<< "${report}" | column -t -s,

NOTE: ${report} must be wrapped in double quotes


text:
Q: Ionic infinite scroll dont stop I build hybrid app through Intel xdk (version 3759) using Ionic framework (version 1.0.0-beta.14) and i have a problem with infinite scroll. The 'on-infinite' directive calls function on the app loads, and don't stop.
My app pages is on unique html file (sub_pages).
In my scenario i need load all tickets, for this reason a use 'limitTo' to restrict tickets in page.
Piece of html

  <ion-scroll>

      <ion-list class="widget uib_w_81 d-margins" data-uib="ionic/list" data-ver="0">

      </ion-list>

      <ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="loadMore()" distance="10%"></ion-infinite-scroll>

  </ion-scroll>

Piece of controller
angular
  .module('myApp')
  .controller("TicketsController", ['Ticket', 'baseHost', 'baseCall', 'User', '$scope', '$rootScope', '$interval', '$timeout', '$ionicScrollDelegate',
      function(Ticket, baseHost, baseCall, User, $scope, $rootScope, $interval, $timeout, $ionicScrollDelegate) {

        var self = this;
        $scope.numberDisplay = 5;
        $scope.noMoreItemsAvailable = false;

        $scope.loadMore = function() {

          $scope.numberDisplay += 5;

          if ($scope.numberDisplay >= self.count)
            $scope.noMoreItemsAvailable = true;

          $scope.$broadcast('scroll.infiniteScrollComplete');

        };

        $scope.$on('$stateChangeSuccess', function() {

          $scope.loadMore();
        });


text:
Q: select json output from Micros Database Has anyone who uses the "old" Micros database platform found a way to select the results of a query as json content?  Meaning select a from tablea and have it returned at {"a", "somevalue"}
This not a question about the mainstream Oracle database but, rather, the other database platform called Micros


text:
Q: Mapear tabelas para guardar histórico de acesso Possuo um aplicativo, no qual preciso guardar ao menos uma vez no dia, a data e o horário que usuário acessou o aplicativo/sistema. Pois cobramos ao final do mês pelo número de dias que esse utilizou o app/software.
Qual a melhor forma de mapear essa tabela?

A: Acredito que para isso você possa criar uma tabela bem simples com as colunas:

*

*ID do usuário que esta acessando

*data e hora.

Em algumas aplicações que crio costumo separar a coluna de data em duas colunas, uma somente com a data e outra com horas e minutos, pois assim acaba facilitando em algumas consultas.
Não existe uma 'melhor forma" de mapear uma tabela mas sim uma melhor forma que atenderá sua aplicação.


text:
Q: Accessing right click with three.js Been looking for how to do this everywhere and there is almost no documentation on three.js. Does anyone know how I can access a right click on the mouse? This is what I have now:
function onDocumentMouseDown(event)
{
    mouseDown = true;
    event.preventDefault();

    mouseX = event.clientX - windowHalfX;
    mouseY = event.clientY - windowHalfY;

    document.addEventListener('mousemove', onDocumentMouseMove, false);
    document.addEventListener('mouseup', onDocumentMouseUp, false);
    document.addEventListener('mouseout', onDocumentMouseOut, false);
}

And this is working great for what I am using it for but this event is for left click, middle click and right click. How do I isolate a right click event so that left click and right click can have different effects?

A: The event has the property button. You can handle it like this:
switch ( event.button ) {
    case 0: // left
        break;
    case 1: // middle
        break;
    case 2: // right
        break;
}

A: since r120, OrbitControls uses Pointer Events. Try pointerdown:
document.onpointerdown = function(event) {
    switch ( event.button ) {
        case 0: console.log("Left Button is down.");
            break;
        case 1: console.log("Middle Button is down.");
        //Beware this work not on mac with magic mouse!
            break;
        case 2: console.log("Right Button is down.");
            break;
    }
}

Cheers


text:
Q: Read File stored on some URL using HTML5 File API I'm using HTML5 file API to upload files to my web application.
I have an input element on my web page using which I read files and call upload function
<input type="file">

$('input[type="file"]').on("change",function(e){
      console.log(this.files);
      // upload each file in this.files
});

This works perfectly for native files on os. I want to now upload remote files e.g., example.com/blah/file1.jpg My question is how do I read this file using File API? Is there a way to do it?

A: You can download remote files over XMLHttpRequest, and process them as Blob. Then upload it to another server. The upload has to be over XMLHttpRequest. It relies on the browser's implementation of XHR Level 2. This link contains the code snippets you will need:
http://www.html5rocks.com/en/tutorials/file/xhr2/
It has both snippets for downloading remote file as a Blob and uploading a Blob to a server.


text:
Q: Input on multiple lines I try to write a short program which takes multiple pdf files and merges them into one file. The whole thing should operate over a command line.
I use the argparse-package from python. The program works when I call it and give exactly two files to merge. But I want it to be more flexible. Concrete, what I want to do is calling the program, give the first file and hit enter. Then it should ask for the second file: I give it and hit enter, and so on until I hit enter without inserting any file. Like this, the program should know that all files are given.
Every time I hit enter, the program executes and I don't have any chance to do anything else. I searched for a workaround but didn't find any.

A: You can use input:
files = []
file = input("Your file: ").strip()
while file:
    files.append(file)
    file = input("Your file: ").strip()

print(f"Files to process: {files}")


text:
Q: jQuery AJAX: load HTML into DIV element after click i would like to load (or be visible) an HTML/ASP.NET email form after the user clicked in a link/button. I have used this code but it doesn't work:
<script type="text/javascript">
    $(document).ready(function () {
        $("#imgMail").click(function (htm) {
            $.get("mailform.html"),
                $("#mailForm").append(htm)); //i have tryed also with .html() function.
        });
    });
</script>

where #imgMail is the ID of the link/button and the #mailForm is the ID of the DIV element into load the content.
How can i resolve this problem?
P.S. The elements are not into a form tag.
Thanks.

A: Use this..
<script type="text/javascript">
    $(document).ready(function () {
        $("#imgMail").click(function() {
            $.get("mailform.html",function(data){
                $("#mailForm").append(data);
            });
        });
    });
</script>


text:
Q: How can I remove the items form grub boot list
Possible Duplicate:
How to remove dual boot menu?

This my grub boot loader and it show that I have two OS and I want other lines to remove it specially under line because it make anyone can edit it and make trouble for boot systems
So how can remove it or change?

A: You can remove the memtest by removing the "memtest86+" package from your computer, followed by a "update-grub2".
The other lines (at the bottom) can't be removed as far as I know.

A: You can do it with Grub Customizer software by Daniel Richter.
Run the following code in terminal:
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer

then open the application(with Unity Dash or with grub-customizer command in Terminal).Delete lines whatever you want.


text:
Q: Smooth approximations to the ramp function I am looking for $C^1$ and $C^2$ continuous approximations to the ramp function, f(x), that satisfy the condition $f(x)=0$, $x\leq0$ (essentially smoothing out the discontinuity in the first derivative at $x=0$).
Any help in this regard is appreciated.
Edit: The ramp function should be linear away from $x=0$ (essentially smoothing out the kink in the neighborhood of $x=0$.

A: A simple smooth approximation could be to use the bump function
$$b(x) = \begin{cases} 0 & x \le 0\\ e^{-1/{ax}} & x > 0 \end{cases} $$
with $ a> 0$ to approximate the step function and then you can just take $xb(x)$. Letting $ a\to\infty$ will give progressively better approximations.


text:
Q: Amitsur cohomology and limits Let $R \longrightarrow S$ be a faithfully flat ring extension and $\{ G_\alpha\}$ an inverse system of affine group schemes. I would like to know if there is some hope for a bijection like
$$
H^1(S/R, \underleftarrow{\lim} G_\alpha )  =  \underleftarrow{\lim} H^1(S/R, G_\alpha) \ .
$$
Here $H^1$ denotes the Amitsur cohomology.
For instance, this is obviously true when you take a product of affine group schemes:
$$
H^1(S/R, F \times G )  =   H^1(S/R, F) \times H^1(S/R, G) \ .
$$
I think the obvious map $H^1(S/R, \underleftarrow{\lim} G_\alpha )  \longrightarrow  \underleftarrow{\lim} H^1(S/R, G_\alpha)$ is always injective but doesn't look surjective to me, in general.
Is that true? Are there sufficient conditions to make it surjective? For instance, I would have no problem if the $G_\alpha$'s need to be algebraic.
Actually, the case $\mathbf{k} \longrightarrow \overline{\mathbf{k}}$, where $\mathbf{k}$ is a field (of zero characteristic, if this helps) and $\overline{\mathbf{k}}$ its algebraic closure, so that $\overline{\mathbf{k}} / \mathbf{k}$ is a finite Galois extension would be enough for me.
Hence, in this case, I'm asking if there is a bijection between Galois cohomologies:
$$
H^1(\Gamma, \underleftarrow{\lim} G_\alpha(\overline{\mathbf{k}}) )  =  \underleftarrow{\lim} H^1(\Gamma, G_\alpha (\overline{\mathbf{k}}) ) \ .
$$
Here, $\Gamma $ is the Galois group of the extension $\overline{\mathbf{k}} / \mathbf{k}$.
Any hints or references will be much appreciated.


text:
Q: Can haskell-src-meta be installed to be used with GHC 7.10.1? I tried, but I got this error:
https://gist.github.com/Wizek/a3e02b93b9f672a91f54
I remember trying with GHC 7.8.4 too, and AFAIR that also failed similarly.
Misc
I've used a new & empty cabal sandbox
cabal-install version 1.22.2.0

A: Looks like your happy executable needs to be upgraded. You can install the new version with cabal-install. Alternatively, using stack will automatically install the correct version of happy.


text:
Q: VirtualBox 6.0.14: shared folder doesn't appear in "/media" In VirtualBox 6.0.14 with an Ubuntu Linux guest (Guest Additions installed ...), this shared folder does not show up in /media as advertised.  (The only thing that's there is /media/cdrom.)
Why doesn't my share show up?

A: Well, I answered my own question with a little searching here in StackExchange:  the virtualbox guest additions kernel modules were not installed.  And the VB documentation really didn't point that out.  So, here's what solved the problem:

*

*On the Devices menu of the running virtual machine, click "Insert Guest Additions CD Image."

*If necessary, sudo mkdir /mnt/cdrom to make a mount-point.  (You can of course use any directory as a mount-point ...)

*sudo mount /dev/cdrom /mnt/cdrom to mount the CD there.

*cd /mnt/cdrom to go inside.

*sudo ./VBoxLinuxAdditions.run

*... wait for it to do its thing ... it will compile and install the modules, but they won't be loaded yet.

*sudo reboot
Now, mount | grep vboxsf will show that there now is a mounted filesystem. (This is because I specified "auto-mount" as you see in the original post.  If you don't do that, you'll have to fiddle with /etc/fstab, which I won't go into here ...)
You might find, however, that you get Permission Denied when you try to look inside!  Now's a good time to remember that you must be a member of the vboxsf group.  (ls -l /mnt/* will show the group-name and permissions mask.)  Here's what to do:
sudo usermod -a -G vboxsf yourusername (Note: with a capital -G!)  Then, log off and log back on again so that the changes take effect.  Confirm this with the groups command, which will now list this group as one that you belong to.  (Of course, you can use fuzzy GUI tools to manage the user's group memberships if you prefer.)


text:
Q: Actionscript - Make TextArea component public and accessible I want to make a TextArea component public so it can be accessed from other frames.
For example, I want to be able to say that if this button is pressed change the TextArea text to "1" and go to the frame.
I have no idea how to do this, i've tried :
frameHome.textArea.text = "1";

to change the text but it doesn't work so i'm presumming that i'm a little off mark. Any suggestions would be greatly appreciated!

A: If the button is in a frame where the TextArea is not currently added to the Stage, there will be no way to access this TextArea. You can add the TextArea on the same frame as the button. Set visible to false and in the button pressed event listener set the text and visible to true. then go to the desired frame.


text:
Q: Is "connection.Close()" the best or safest way to close an SQL connection? I've been using
connection.Close();

But this is my first project in .NET and I'm not sure if I'm closing it correctly.
I don't want my website to instantly die after putting it out on real hosting.
Usually I do it this way:
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());

    SqlCommand cmd = new SqlCommand();

    cmd.Connection = conn;

    // <some code>

    conn.Open();
    / <some code>
    conn.Close();

A: You should place the connection in a using statement;
using(var connection = new SqlConnection)
{
  connection.Open();
  ...other code using it here.
}

The using statement ensures that the SqlConnection is disposed when you are done with it.  In your scenario (depending on where you put the close method), if an exception is closed, it will never reach the Close() method and the connection will stay open.
Even better is that since you are building a website.  There should be a method on the Request object (which should be available) called RegisterForDispose.  This will automatically Dispose of the connection (which closes it) when the request ends. You can use it like this:
var connection = new SqlConnection();
Request.RegisterForDispose(connection);

Both accomplish the same thing in the end, but the second allows for more flexibility.

A: Do what Kevin said and put your .Open() call inside the using block:
using(var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString()))
{
    var cmd = new SqlCommand("my sql command here", conn);

    conn.Open();

    cmd.(whatever method you are using)
}


text:
Q: Does `decltype` also perform evaluation of the expression? In this code, is a + b executed once or twice? What would be a good method to verify that?
double num3 = [](double a, double b)->decltype(a + b) { return a + b; }(1.2, 2.1);

A: To answer your question, the result of an expression inside a decltype declaration is not evaluated at runtime, but its type is evaluated at compile time.
So in the hypothetical statement:
double num3 = [](double a, double b)->decltype(a + b) { return a + b; }(1.2, 2.1);

the statement a + b is only evaluated once at runtime.
As explained in the comments, decltype() was not necessary at all in the above statement.  It is usually used to help the compiler in more complex cases, for example (in c++20):
// this would not compile without decltype()
auto special_add = [](auto a, auto b) -> decltype(a + b) {
    if (a == 0)
        return 0; // would default to int, but is explicitly declared as decltype(a + b)
                  // in the declaration
    return a + b;
};

As a general rule, avoiding unnecessary declarations helps keep code clutter down and makes the code more readable.  That's the reasoning behind many features new to c++11, 20 and 23.


text:
Q: variable in mathematics vs variable in statistics I was wondering about the difference between a variable in mathematics and a variable in statistics.
In mathematics, a variable is defined as a symbol that can represent different values.
Example: In the expression $x + 3$, $x$ is a variable. This means that $x$ is an empty symbol that doesn't mean anything. However, $x$ can be made to equal different numbers. When we say $x = 2$, we are asserting that $x$ symbolizes $2$. Consequently, $x + 3 = 5$.
In statistics, a variable is defined as a characteristic. I understand a characteristic as a label that we assign to a quantity. I understand a quantity as a number or a number with a unit.
Example: 3 feet is a quantity. Height is a label that we give to this quantity. Height is a characteristic. Height is also a variable.
In my mind, these definitions for variables seem different. Am I thinking about them wrong?

A: Here's the Merriam-Webster definition of variable:

1a: a quantity that may assume any one of a set of values
b: a symbol representing a variable

We can see that "variable" in mathematics and "variable" in statistics, in the way described in your question, actually correspond to different part of this definition. Height is a variable, in the sense that it is a quantity that can take several possible values. $x$ is a symbol representing a variable, and of course that variable could very well be a height.
But just to be clear, both parts of the definition are used in math and stats. In algebra, $x$ can be just a symbol, but in a particular problem it can represent a specific quantity. Similarly, in statistics, instead of talking of a specific variable such as height, we may want to be as general as possible and therefore represent it by a symbol such as $x$.