text:
Q: Is it possible to create and publish my own RSS-fed dynamic Windows 7 theme? A client has asked if I could develop a dynamic theme for Windows 7 for them. I see from the Windows 7 themes gallery that this sort of thing is possible, but I cannot see any documentation about creating these.
How is it done? If anyone knows how to get listed in the theme gallery as well, it would be appreciated.

A: As far as Microsoft themes go:
Microsoft quietly ends support for Windows 7 dynamic themes.

While dynamic themes are no longer available from Microsoft, Windows 7
  and 8 users can still get a new desktop background delivered to them
  every day by downloading and installing the company's Bing Desktop
  program. The application automatically updates the background with
  the same high resolution image that's put in place each day on the
  Bing.com homepage.

The Bing Desktop is also now available from Windows Update.
On the other hand :
Microsoft brings back retired dynamic theme photos in new Windows 8 themes.
But if you wish to develop your own dynamic RSS-fed theme, the article
Dynamic Desktop Wallpapers from RSS Feeds says:

if you want to make your own theme with pictures off the Internet,
  just copy the following text, paste it into Notepad, and change the 3
  areas delimited with "<<<<<" and ">>>>>" (the Display Name is what
  shows up in the Theme control panel as the name for the theme).  The
  RSS feed at the bottom must have  the pictures as enclosure.
; Copyright © <<<<<Microsoft Corp.>>>>>

[Theme]
; Windows 7 - IDS_THEME_DISPLAYNAME_AERO
DisplayName=<<<<<Bing Dynamic>>>>>

; Computer - SHIDI_SERVER
[CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon]
DefaultValue=%SystemRoot%\System32\imageres.dll,-109

; UsersFiles - SHIDI_USERFILES
[CLSID\{59031A47-3F72-44A7-89C5-5595FE6B30EE}\DefaultIcon]
DefaultValue=%SystemRoot%\System32\imageres.dll,-123

; Network - SHIDI_MYNETWORK
[CLSID\{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}\DefaultIcon]
DefaultValue=%SystemRoot%\System32\imageres.dll,-25

; Recycle Bin - SHIDI_RECYCLERFULL SHIDI_RECYCLER
[CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\DefaultIcon]
Full=%SystemRoot%\System32\imageres.dll,-54
Empty=%SystemRoot%\System32\imageres.dll,-55

[Control Panel\Cursors]
AppStarting=%SystemRoot%\cursors\aero_working.ani
Arrow=%SystemRoot%\cursors\aero_arrow.cur
Hand=%SystemRoot%\cursors\aero_link.cur
Help=%SystemRoot%\cursors\aero_helpsel.cur
No=%SystemRoot%\cursors\aero_unavail.cur
NWPen=%SystemRoot%\cursors\aero_pen.cur
SizeAll=%SystemRoot%\cursors\aero_move.cur
SizeNESW=%SystemRoot%\cursors\aero_nesw.cur
SizeNS=%SystemRoot%\cursors\aero_ns.cur
SizeNWSE=%SystemRoot%\cursors\aero_nwse.cur
SizeWE=%SystemRoot%\cursors\aero_ew.cur
UpArrow=%SystemRoot%\cursors\aero_up.cur
Wait=%SystemRoot%\cursors\aero_busy.ani
DefaultValue=Windows Aero

[Sounds]
; IDS_SCHEME_DEFAULT
SchemeName=Windows Default

[Control Panel\Desktop]
TileWallpaper=0
WallpaperStyle=10
Pattern=

[VisualStyles]
Path=%SystemRoot%\resources\themes\Aero\Aero.msstyles
ColorStyle=NormalColor
Size=NormalSize
ColorizationColor=0X45409EFE
Transparency=1
VisualStyleVersion=10
Composition=1

[MasterThemeSelector]
MTSM=DABJDKT

[Slideshow]
Interval=20000
Shuffle=1
RSSFeed=<<<<<http://themeserver.microsoft.com/default.aspx?p=Bing&c=Desktop&m=en-US>>>>>
[boot]
SCRNSAVE.EXE=

Save the file with an extension of .theme.  Double-click it,
  confirm that you want to download attachments, and it will install
  itself and start downloading pictures as your desktop background.

Once the pictures are downloaded, you can go in and choose how often
  they cycle, change how they are displayed (cropped, filled, stretched,
  etc)

For a similar approach that might have some more information, see :
How do I use RSS to create a dynamic Windows 7 desktop wallpaper slideshow.
This article uses the aero.theme file as the base file to edit.
For information about enclosures, see :
Why are images not working in my RSS campaign?
Wikipedia - RSS enclosure
Here is an example of a fictional RSS feed containing enclosures :
<rss version="2.0">
   <channel>
      <title>title here</title>
      <description>description here</title>
      <link>http://somwhere/somefeeds</link>
      <item>
         <title>title item 1</title>
         <description>description item 1</description>
         <enclosure url="http://somwhere/file1.jpg" length="23456" type="image/jpeg"/>
      </item>
      <item>
         <title>title item 2</title>
         <description>description item 2</description>
         <enclosure url="http://somwhere/file2.jpg" length="12345" type="image/jpeg"/>
      </item>
   </channel>
</rss>

A: There is an article here on the Microsoft website that explains how to create Themes, Save them and share them with friends and family, it says you need to save it as a .themepack file to allow sharing.
You can then save it on your network in a shared location for other people to use, but if you are meaning to put them on the web to be viewed globally then I'm unsure of how it works.


text:
Q: Select 2 jQuery Searching I am using this jQuery plugin http://ivaynberg.github.io/select2/ with a data source linked to my employe database. The "Term" being used is last name however the jSON response is the full name.
When the result is Smith, John and you type smith it shows fine but when you try to include the first name to narrow it down even more, it stops the search as the comma is not part of the term.
$("[name=manager]").select2({
    multiple: false,
    minimumInputLength: 3,
    placeHolder: 'Manager Last name',
    allowClear: true,
    ajax: {
        url: "jsonUser.php",
        dataType: 'json',
        data: function (term) {
            return {
                term: term, // search term
            };
        },
        results: function (data) { // parse the results into the format expected by Select2.
            return {results: data};
        }
    },
});

The jSON response looks like this:
[{"id":"12345","text":"Smith, John"}
Anyone know of a way to make is so the full response is searchable and not just the term?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Inequality between product of two numbers. $k,l\in N$ and  $k \ge l\ge2$ then prove $(k+1)^{k+1}(l-1)^{l-1}\ge k^kl^l$.
From examples it is ok but unable to proof I tried to proof in different ways e.g. by taking ration but all in vain.

A: Use the well-known inequalities
$$(1 + 1/n)^{n+1} > e,\\(1 - 1/n)^{n-1} > e^{-1}.$$
Then
$$\frac{(k+1)^{k+1}}{k^k}= k(1+1/k)^{k+1} > ke \geqslant le > l(1 - 1/l)^{1-l}= \frac{l^l}{(l-1)^{l-1}}\\ \implies(k+1)^{k+1}(l-1)^{l-1} \geqslant k^kl^l$$


text:
Q: how display sql query results using tbgridview in yii I want to display this sql query using tbgridview in yii.
this is my controller.
public function actionSVI(){
    $list = Workstation::model()->listSvi();
    $this->render('svi',array(
        'list'=>$list,
    ));
}

my model and sql query.
public function listSvi(){
    $svi = Yii::app()->db->createCommand()
                ->select('*')
                ->from('workstation')
                ->where('ws_company_id=:id',array(':id'=>1))
                ->queryAll();

    return $svi;;
}

I'm currently displaying my query using this code.
<?php
foreach($list as $each){
    $company = Workstation::model()->findByPK($each['ws_id']);
    echo  "
" . $company->companyName ."	". CHtml::link(CHtml::encode($company->ws_id), array('view','id'=>$company->ws_id))."	" .$company->branchName ."	","". $company->departmentName. "
	";
    }

?>
i just want to display it using this tbgridview.
<?php $this->widget('bootstrap.widgets.TbGridView', array(
'type'=>'striped',
'dataProvider'=>$dataProvider,
'template'=>"{items}",
'columns'=>array(
            'companyName',
        'branchName',
        'departmentName',
        'ws_id',
    array(
        'class'=>'bootstrap.widgets.TbButtonColumn',
        'template'=>'{view}',
        'buttons'=>array(
                'view'=>array('icon'=>'icon-search'),
            ),
    ),
),
)); ?>
<?php $this->endWidget();?>

A: I think that the easiest way to do what I think you want to do is by creating a CActiveDataProvider and use that as dataProvider for your widget. Also, if Workstation is an Active Record, you can do this:
$criteria = new CDbCriteria(
    array(
        'condition'=>"ws_company_id = '1'"
));

$dataProvider = new CActiveDataProvider('Workstation',array('criteria'=>$criteria));

Or something like that.
And then send that object to your view.

A: If you use your own data from SQL query, try CSqlDataProvider
$count=Yii::app()->db->createCommand('SELECT COUNT(*) FROM tbl_user')->queryScalar();
$sql='SELECT * FROM tbl_user';
$dataProvider=new CSqlDataProvider($sql, array(
    'totalItemCount'=>$count,
    'sort'=>array(
        'attributes'=>array(
             'id', 'username', 'email',
        ),
    ),
    'pagination'=>array(
        'pageSize'=>10,
    ),
));
// $dataProvider->getData() will return a list of arrays.


text:
Q: $I=\{a+ib\in\mathbb Z[i]:5|a,5|b\}$ forms a maximal ideal of $\mathbb Z[i].$ How to show that $I=\{a+ib\in\mathbb Z[i]:5|a,5|b\}$ forms a maximal ideal of $\mathbb Z[i].$
I tried to prove $\mathbb Z[i]\backslash I$ is a field could not prove it.

A: The two elements $x=1+2i$ and $y=1+3i$ are not in $I$, but their product $xy=-5+5i$ is. Hence $I$ doesn't even form a prime ideal of $\mathbb{Z}[i]$.


text:
Q: Admob interstitial ad in LibGDX shows banner? I am trying to display an interstitial in LibGDX after the title screen. I implemented the official github code: https://github.com/TheInvader360/tutorial-libgdx-google-ads/commit/0a5ea376d4eb92b8e87c13a03245adb40b53e811
The code is working fine but I think I'm missing something because whenever I call the showOrLoadInterstital() function, it displays a banner. I want to display a full screen ad instead.
In the code I see an adView being initialized with settings for a banner, but the mentioned function showOrLoadInterstital() uses the InterstitialAd, which is correct. As a beginning game developer (but not beginning developer in general), I am not getting the hang of this, especially those two different ad types together.
Could someone tell me what I am missing here? Should showOrLoadInterstital() just not show a full ad when I call it in my Game class?
Thanks.


text:
Q: Use stored procedure or function in SELECT statement I have a couple of questions about how to do what I want with this SELECT statement, but the main thing is how to use a function / stored procedure in the SELECT statement.
I have something like the example below.
While the Movement bit is small enough to work, the attributes (Strength, Armor, Will, Dexterity) are complex as there aren't restrictions on the order in which number-letter combinations can occur and it needs to be used for 4 different fields.  It makes sense to write a procedure and reuse that 4 times instead of repeating code.
I had attempted to write one for movement, but can't seem to do anything other than EXEC testProcedure, even PRINT( testProcedure 4 ) doesn't seem to work.
Is there a way use a user defined function / procedure on queried field?
SELECT DISTINCT
       Main.CardName, Main.CardType, Main.ProductSet, Main.Movement, Main.Actions,
       Main.Strength, Main.Armor, Main.Will, Main.Dexterity, Main.Health,
       Main.Potions,
(
    SELECT COUNT( DISTINCT KeywordName )
    FROM HeroesViewMultiLine
    WHERE CardIndex = Main.CardIndex
) AS KeywordCount,
(
    SELECT COUNT( DISTINCT AbilityName )
    FROM HeroesViewMultiLine
    WHERE CardIndex = Main.CardIndex and AbilityResource = 'Action'
) AS ActionCount,
(
    SELECT COUNT( DISTINCT AbilityName )
    FROM HeroesViewMultiLine
    WHERE CardIndex = Main.CardIndex and AbilityResource = 'Potion'
) AS SkillCount,
(
    --Movement
    (
        SELECT CASE
            WHEN Main.Movement = 5 THEN 1
            WHEN Main.Movement = 6 THEN 1
            WHEN Main.Movement = 7 THEN 3
            WHEN Main.Movement = 8 THEN 3
            WHEN Main.Movement = 9 THEN 6
            WHEN Main.Movement = 10 THEN 6
            ELSE 0
        END
    )
    --Actions
    +(Main.Actions),
    --STR
    +(
        SELECT CASE
            WHEN Main.Strength = 5 THEN 1

            ELSE 0
        END
    )
    --ARM
    +(SELECT CASE
        WHEN Main.Armor = 5 THEN 1
        ELSE 0
    END)
    --WILL
    +(SELECT CASE
        WHEN Main.Will = 5 THEN 1
        ELSE 0
    END)
    --DEX
    +(SELECT CASE
        WHEN Main.Dexterity = 5 THEN 1
        ELSE 0
    END)
    --Health
    +(Main.Health)
    --Potions
    +(Main.Potions)
    --KeywordCount
    +(SELECT COUNT( DISTINCT KeywordName )
    FROM HeroesViewMultiLine
    WHERE CardIndex = Main.CardIndex)
    --ActionCount
    +(SELECT COUNT( DISTINCT AbilityName )
    FROM HeroesViewMultiLine
    WHERE CardIndex = Main.CardIndex and AbilityResource = 'Action')
    --SkillCount
    +(SELECT COUNT( DISTINCT AbilityName )
    FROM HeroesViewMultiLine
    WHERE CardIndex = Main.CardIndex and AbilityResource = 'Potion' )
) AS BONUSES

FROM HeroesViewMultiLine Main

A: There are many different methods to get Stored Procedure's results in the SELECT statement, such as creating a temp table, creating a table variable, using functions, and many more. However, here is the easiest method to run the stored procedure in SELECT statement.
For example here is the SP which you want to execute:
EXEC [AdventureWorks].[dbo].[uspGetManagerEmployees] 5
GO

You can run the following SELECT statement with the help of OPENROWSET and execute the stored procedure.
SELECT *
FROM OPENROWSET('SQLNCLI',
'server=localhost;trusted_connection=yes;',
'EXEC [AdventureWorks].[dbo].[uspGetManagerEmployees] 5')
GO

Yes, indeed it is that easy. When you run the SELECT statement with OPENROWSET and if you get an error about ad hoc queries, you can run the following command to fix the error.
Msg 15281, Level 16, State 1
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', search for 'Ad Hoc Distributed Queries' in SQL Server Books Online.

sp_configure 'Show Advanced Options', 1
GO
RECONFIGURE
GO
sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE
GO


text:
Q: gsapi_init_with_args' is made -100 with long and Asian language in filename I'm using this function to "compress" PDF files. If the filename has Asian language (Japanese and Vietnamese) and the number of characters in filename is longer 15, the error "'gsapi_init_with_args' is made -100" will appear.
Example:

*

*Input Filename: "こんにちは、私の名前は.pdf" or "Xin chào, tôi tên là. Xin chào, tôi tên là.pdf"

*Output Filename: "こんにち.p" or "Xin cháo, tôi tơn lá". They're without extension in filename, zero size and incorrect filename.

*Expected Filename: "こんにちは、私の名前は.pdf" or "Xin chào, tôi tên là. Xin chào, tôi tên là.pdf" with smaller size.

If the filename has Asian language (Japanese and Vietnamese) and the number of characters in filename is shorter 15, it's OK to use.
My environment:

*

*Windows 11 English US 64-bit (Locale in Settings is Japanese)

*Ghostscript version: 9.55.0 32-bit

*Ghostscript.NET v1.2.3 (latest)
Please help me fix this. Thank you in advance.

try
            {
                string strFilePath = PDFFile.FullName;
                string strFileNameOnly = Path.GetFileNameWithoutExtension(PDFFile.Name);

                GhostscriptVersionInfo gvi = GhostscriptVersionInfo.GetLastInstalledVersion();
                string strFullnameOutput = Path.Combine(strOutput, strFileNameOnly) + ".pdf";
List<string> switches = new List<string>
                {
                    "-empty",
                    "-dQUIET",
                    "-dSAFER",
                    "-dBATCH",
                    "-dNOPAUSE",
                    "-dNOPROMPT",
                    "-sDEVICE=pdfwrite",
                    "-dCompatibilityLevel=2.0",
                    "-dPDFSETTINGS =/default",
                    "-sOutputFile=" + strFullnameOutput,
                    //"-dPrinted=false",
                    "-c",
                    "-f",
                    strFilePath,
                };

                using (GhostscriptProcessor gsProc = new GhostscriptProcessor())
                {
                    try
                    {
                        gsProc.StartProcessing(switches.ToArray(), null);
                        isDone = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        isDone = false;
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                isDone = false;
            }

I've tried to change another computer but same result.


text:
Q: How to disable all forms of local caching in KeyCloak? The official documentation specifies how to disable realm and user caching, but how do I disable other local caching mentioned in infinispan in standalone.xml, like sessions, clientSessions etc?
https://www.keycloak.org/docs/6.0/server_installation/#disabling-caching

A: Disabling caching for session is not a good idea since all types of sessions stored ONLY in infinispan cache. Afaik there was an option described in documentation (or maybe a topic in Keycloak mailing list) that allows you to also persist all sessions in DB, but that was discouraged because of great performance penalty.


text:
Q: Pandas: OLS regression does not output an intercept I have the following ouput from a Pandas pooled OLS regression. The only problem is that I'm not sure where the intercept is. In a regression there is always an intercept that is usually listed before the exogenous variables, i.e. Y = a + ßx1 + ßx2 + error_term I do not see it in my regression. I used the suggestion from ayhan X = add_constant(X) but somehow I get the feeling that I am messing something up (in an obvious way) with the syntax. I know that this is not rocket science. Can someone tell me what I am missing?
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
import statsmodels.formula.api as sm
from sklearn.linear_model import LinearRegression
import scipy, scipy.stats
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot')
from statsmodels.api import add_constant

 X = add_constant(X)
Y = df['billsum_support']

X = df[['direct_expenditures','indirect_expenditures', 'years_exp', 'leg_totalbills',\
    'log_diff_rgdp', 'unemployment',  'expendituresfor']]

result = sm.OLS( Y, X ).fit()
result.summary()

 OLS Regression Results Dep. Variable:  billsum_support     R-squared:  0.663
Model:  OLS     Adj. R-squared:     0.663
Method:     Least Squares   F-statistic:    3932.
Date:   Sun, 08 May 2016    Prob (F-statistic):     0.00
Time:   22:38:33    Log-Likelihood:     -12561.
No. Observations:   12008   AIC:    2.513e+04
Df Residuals:   12002   BIC:    2.518e+04
Df Model:   6
Covariance Type:    nonrobust
    coef    std err     t   P>|t|   [95.0% Conf. Int.]
direct_expenditures     4.575e-05   4.02e-06    11.377  0.000   3.79e-05 5.36e-05
indirect_expenditures   -2.147e-05  6.93e-06    -3.099  0.002   -3.5e-05 -7.89e-06
years_exp   0.0030  0.001   5.595   0.000   0.002 0.004
leg_totalbills  0.0052  0.000   11.160  0.000   0.004 0.006
log_diff_rgdp   1.0325  0.178   5.805   0.000   0.684 1.381
unemployment    0.1052  0.001   70.744  0.000   0.102 0.108
expendituresfor     2.428e-05   3.57e-06    6.797   0.000   1.73e-05 3.13e-05
Omnibus:    2994.033    Durbin-Watson:  0.837
Prob(Omnibus):  0.000   Jarque-Bera (JB):   19159.354
Skew:   1.042   Prob(JB):   0.00
Kurtosis:   8.827   Cond. No.   1.54e+16

A: You need to explicitly tell statsmodels to fit an intercept. Update your independent variables with statsmodels.api.add_constant:
from statsmodels.api import add_constant
Y = df['billsum_support']
X = df[['direct_expenditures','indirect_expenditures', 'years_exp', 'leg_totalbills',\
    'log_diff_rgdp', 'unemployment',  'expendituresfor']]
X = add_constant(X)
result = sm.OLS( Y, X ).fit()


text:
Q: Riemann hypothesis cannot be proved to be unprovable? I'm coming off the numberphile video: https://youtu.be/O4ndIDcDSGc
In the very end, they say that 'Proving that Riemann hypothesis is unprovable would be a proof of the truth of Riemann hypothesis'
The reasoning given is: Riemann hypothesis cannot be both unprovable and false. Because if it is false, then it is provably false because a computer could find the counter example to prove it false.
But this all means that we cannot prove that Riemann Hypothesis is unprovable because proving so would prove the non-existence of any counter-example and hence would prove Riemann Hypothesis itself.
P.S.  I'm not sure if I agree with their reasoning. 'Provability' is supposed to be 'provability from the axioms', right? If we just found a counter-example in the wild, then yeah, we've proven it to be false but we haven't done so from the axioms. I think it might be possible for a statement to be provable by counter-examples but unprovable by axioms, so that if we have proved that Riemann Hypothesis is unprovable from our axioms, we still haven't proved that we can't find a counter-example. Correct me if I'm wrong.


text:
Q: `names` pointing to `by` instead The following happened within one R session:
c("cyl", "mpg") %in% names(mtcars)

Error in by.data.frame(mtcars) :
argument "INDICES" is missing, with no default

Indeed, calling names showed by!
names
#function (data, INDICES, FUN, ..., simplify = TRUE)
#UseMethod("by")
#<bytecode: 0x475e718>
#<environment: namespace:base>

Calling base::names was fine: function (x)  .Primitive("names")
I restarted R session by clicking RStudio's menu option, but it didn't help. Closing RStudio did (i.e. names correctly displaying function (x)  .Primitive("names")) and I am no longer able to reproduce this.
How could this happen?
My session at that moment (Freya is a fork of Ubuntu 14.04):
sessionInfo()
# R version 3.3.2 (2016-10-31)
# Platform: x86_64-pc-linux-gnu (64-bit)
# Running under: elementary OS Freya
#
# locale:
# [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
# [3] LC_TIME=cs_CZ.UTF-8        LC_COLLATE=en_US.UTF-8
# [5] LC_MONETARY=cs_CZ.UTF-8    LC_MESSAGES=en_US.UTF-8
# [7] LC_PAPER=cs_CZ.UTF-8       LC_NAME=C
# [9] LC_ADDRESS=C               LC_TELEPHONE=C
# [11] LC_MEASUREMENT=cs_CZ.UTF-8 LC_IDENTIFICATION=C
#
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base
#
# other attached packages:
# [1] moodler_0.1 tidyr_0.6.0 dplyr_0.5.0
#
# loaded via a namespace (and not attached):
# [1] lazyeval_0.2.0 magrittr_1.5   R6_2.2.0       assertthat_0.1 DBI_0.5-1
# [6] tools_3.3.2    tibble_1.2     Rcpp_0.12.8    stringi_1.1.2  RMySQL_0.10.9
# [11] openxlsx_3.0.0

A: The most obvious way this would happen, and continue to be the case across a restart of the session in RStudio, is simply a names <- by assignment at some point in your code.
However since you are unable to reproduce, it is impossible to know whether the answer is this simple, or the assignment was the consequence of a more complicated operation.


text:
Q: How can I split "Firstname LastnameFirstname2 Lastname2" to "Firstname Lastname" "Firstname2 Lastname2"? I have an imported cell that has two names in it like this: "Firstname LastnameFirstname2 Lastname2". How can I split it with VBA to have one cell with "Firstname Lastname" and another cell with "Firstname2 Lastname2"? A specific example is this: split "Nick MartinezMackenzie Gore" into "Nick Martinez" and "Mackenzie Gore".

A: If I understand well you need to split those words(Names) which are considered as one text, then set them in the separate cells as you describe above.
If that was right try with the below code:
Sub SplitWords()
Dim TextStrng As String
Dim Result() As String

For i = 2 To 10

TextStrng = Cells(i, 1)
Result() = Split(TextStrng)
Cells(i, 2) = Result(0) & " " & Result(2)
Cells(i, 3) = Result(1)

Next i

result :

A: The codes below assumed that the Input string pattern is consistent : the first character of the firstname1, lastname1, firstname2, lastname2 is a capital letter.

So the logic behind to get fn1 ln1 separate with fn2 ln2 is : on the third capital letter found in the Input string.
Sub test()
Dim rg As Range: Dim cell As Range
Dim txt As String: Dim char As String
Dim cnt As Long: Dim pos As Long

With ActiveSheet
Set rg = .Range("A2", .Range("A2").End(xlDown))
End With

cnt = 0

For Each cell In rg
    txt = cell.Value
        For pos = 1 To Len(txt)
            char = Mid(txt, pos, 1)
            If char <> " " Then If UCase(char) = char Then cnt = cnt + 1

            If cnt = 3 Then
                cell.Offset(0, 1).Value = Left(txt, pos - 1)
                cell.Offset(0, 2).Value = Mid(txt, pos)
                Exit For
            End If
        Next pos
    cnt = 0
Next cell

End Sub

The process:
Create the rg variable of the input string in the active sheet column A.
Loop each row of the rg and have the value as txt variable
Then it loop to each character in txt, have the position of the char as pos variable and have the character as the value of char variable.
check, if the upper case of the char value is the same with char value itself then it create a counter in cnt variable
Once the cnt reach 3, then it means the pos(ition) is where the third char value with capital letter. So it takes the fn1 ln1 by using LEFT function and the fn2 ln2 by using the MID function.

A: This can also be accomplished using Power Query, available in Windows Excel 2010+ and Excel 365 (Windows or Mac)
To use Power Query

*

*Select some cell in your Data Table

*Data => Get&Transform => from Table/Range or from within sheet

*When the PQ Editor opens: Home => Advanced Editor

*Make note of the Table Name in Line 2

*Paste the M Code below in place of what you see

*Change the Table name in line 2 back to what was generated originally.

*Note that the "splitter" is just a single step -- Examine the Applied steps

M Code
let
    Source = Excel.CurrentWorkbook(){[Name="Table4"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Names", type text}}),
    #"Split Column by Character Transition" =
        Table.SplitColumn(#"Changed Type", "Names",
        Splitter.SplitTextByCharacterTransition({"a".."z"}, {"A".."Z"}), {"Names.1", "Names.2"})
in
    #"Split Column by Character Transition"

Original

Results

If you absolutely MUST use VBA, here is code that will return the splitted names as a 2 column range.  There is a Function which uses regular expressions to split the name; and a macro (Sub) which takes the values in Column A, and returns the splitted names in another area.  Edit to suit your particulars
Option Explicit
Function splitNames(ByVal S As String)
    Dim MC As Object
    Dim vTemp(1)

With CreateObject("vbscript.regexp")
    .ignorecase = False
    .Pattern = "([A-Z][A-Za-z\s]+[a-z])([A-Z][A-Za-z\s]+[a-z])"
    If .Test(S) = True Then
        Set MC = .Execute(S)
        vTemp(0) = MC(0).submatches(0)
        vTemp(1) = MC(0).submatches(1)
    End If
End With

splitNames = vTemp

End Function

Sub splitIt()
    Dim vSrc As Variant, vRes As Variant, rRes As Range, v As Variant
    Dim I As Long

With ThisWorkbook.Worksheets("Sheet2")
    vSrc = Range(.Cells(1, 1), .Cells(.Rows.Count, 1).End(xlUp))
    Set rRes = .Cells(1, 10) 'or set to original if you want to overwrite
End With

ReDim vRes(1 To UBound(vSrc, 1), 1 To 2)
vRes(1, 1) = "Name.1"
vRes(1, 2) = "Name.2"
For I = 2 To UBound(vSrc, 1)
    v = splitNames(vSrc(I, 1))
    vRes(I, 1) = v(0)
    vRes(I, 2) = v(1)
Next I

Set rRes = rRes.Resize(UBound(vRes, 1), UBound(vRes, 2))
With rRes
    .Clear
    .Value = vRes
    .EntireColumn.AutoFit
End With


text:
Q: read_table read all data to one column I got a file like this:
TCGA1 0 QWE
TCGA2 1 QWE
TCGA2 -2 RAF
TCGA3 2 KLS

and tried to read it into a dataframe using pandas.
In [16]: df = pd.read_table('TR.txt',header=None)

but the result showed like this:
In [17]: df
Out[17]:
          0
0   TCGA1 0 QWE
1   TCGA2 1 QWE
2  TCGA2 -2 RAF
3   TCGA3 2 KLS

Column names has been missed, and how could I solve that?
Thanks!

A: You have to add sep='s\+' for separator arbitrary whitespace in read_table.
It does not work as you expected, because default separator is ,, so all data are in one column.
import pandas as pd
import io

temp=u"""TCGA1 0 QWE
TCGA2 1 QWE
TCGA2 -2 RAF
TCGA3 2 KLS"""
#after testing replace io.StringIO(temp) to filename
df = pd.read_table(io.StringIO(temp), sep="\s+", header=None)
print df
       0  1    2
0  TCGA1  0  QWE
1  TCGA2  1  QWE
2  TCGA2 -2  RAF
3  TCGA3  2  KLS

Another solution with parameter delim_whitespace=True:
import pandas as pd
import io

temp=u"""TCGA1 0 QWE
TCGA2 1 QWE
TCGA2 -2 RAF
TCGA3 2 KLS"""
#after testing replace io.StringIO(temp) to filename
df = pd.read_table(io.StringIO(temp), delim_whitespace=True, header=None)
print df
       0  1    2
0  TCGA1  0  QWE
1  TCGA2  1  QWE
2  TCGA2 -2  RAF
3  TCGA3  2  KLS


text:
Q: Why does Ruby's hash method vary across runs? # pry / irb example #1
"abc".hash
=> -1883761119486508070
"abc".hash
=> -1883761119486508070

# pry / irb example #2
"abc".hash
=> -4309321811150053495
"abc".hash
=> -4309321811150053495

The hash value is constant for a particular invocation, but varies across invocations. Why? Is this by design? Is this considered a "good thing"?
I'm running ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0].

A: According to page 23 of http://patshaughnessy.net/Ruby-Under-a-Microscope-Rough-Draft-May.pdf

Here's how Ruby's hash function actually works ... [snip] ... For string and arrays it works differently. In this case, Ruby actually iterates through all
  of the characters
  in the string or elements in the array and calculates a cumulative hash value; this guarantees that the
  hash value will always be the same for any instance of a string or array, and will always change if any of
  the values in that string or array change.

And:

Also, Ruby 1.9 and Ruby 2.0 initialize MurmurHash using a random seed value which is
  reinitialized each time you restart Ruby. This means that if you stop and restart Ruby you'll
  get different hash values for the same input data. It also means if you try this yourself
  you'll get different values than I did above. However, the hash values will always be the
  same within the same Ruby process.


text:
Q: Varying column and row width in tikz-cd I have created the following diagram using tikz-cd
\begin{tikzcd}
S_E \arrow[dddd, bend right, two heads] \arrow[ddrrr, bend left, two heads, tail] & & & \\
&   E \arrow[dd, dash,swap, "G"] \arrow[dr, dash, "\langle\sigma\rangle"]   &   & \\
&   &   L \arrow[dl, dash] &    S_L\arrow[d, phantom, "{\cap}"]^\prime \\
&   K   & & S_L \\
S_K &   &   &
\end{tikzcd}

I would like the first and last columns and rows of the diagram to be narrower than the other columns and rows, so that, for example, the S_E appears directly above and to the left of E with only a small gap, but keeping the dimensions of the "inner" diagram unchanged.
Is there an easy way to do this with tikz-cd?

A: You can use all the power and flexibility of TikZ directly, but with the style from tikz-cd:
\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{positioning,calc}
\usepackage{amsmath}

\begin{document}

With \texttt{tikz-cd}:
\[
\begin{tikzcd}
S_E
  \arrow[dddd, bend right, two heads]
  \arrow[ddrrr, bend left, two heads, tail] & & & \\
 &  E \arrow[dd, dash,swap, "G"] \arrow[dr, dash, "\langle\sigma\rangle"]   &   & \\
&   &   L \arrow[dl, dash] &    S_L\arrow[d, phantom, "{\cap}"]^\prime \\
&   K   & & S_L \\
S_K &   &   &
\end{tikzcd}
\]
With \texttt{tikz} using the \texttt{tikz-cd} style:
\[
\begin{tikzpicture}[commutative diagrams/every diagram]
\matrix[
  matrix of math nodes,
  name=mat,
  commutative diagrams/every cell
]
{
E \\
& L \\
K \\
};
\path[commutative diagrams/.cd, every arrow, every label]
  (mat-1-1) edge[commutative diagrams/dash,swap,"$G$"] (mat-3-1)
  (mat-3-1) edge[commutative diagrams/dash] (mat-2-2)
  (mat-2-2) edge[commutative diagrams/dash,swap,"$\langle\sigma\rangle$"] (mat-1-1);
\node[above left= 5pt and 5pt of mat-1-1]
  (se)
  {$S_E$};
\node[below left= 5pt and 5pt of mat-3-1]
  (sk)
  {$S_K$};
\node[right= 5pt and 5pt of mat-2-2]
  (spl)
  {$S'_L$};
\node
  (sl)
  at (spl|-mat-3-1)
  {$S_L$};
\path[commutative diagrams/.cd, every arrow, every label]
  (se) edge[bend right,commutative diagrams/two heads] (sk);
\path[commutative diagrams/.cd, every arrow, every label]
  (se) edge[bend left,commutative diagrams/two heads,commutative diagrams/tail] (spl);
\node
  at ( $ (spl)!0.5!(sl) $ )
  {$\cap$};
\end{tikzpicture}
\]

\end{document}

A: As I have just learned from Symbol 1, you may modify each column or row separator manually. Just do like the following:
% arara: pdflatex

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}
    S_E \arrow[dddd, bend right, two heads] \arrow[ddrrr, bend left, two heads, tail] &[-25pt] & &[-25pt] \\[-15pt]
     & E \arrow[dd, dash,swap, "G"] \arrow[dr, dash, "\langle\sigma\rangle"] & & \\
     & &   L \arrow[dl, dash] & S_L\arrow[d, phantom, "{\cap}"]^\prime \\
     & K   & & S_L \\[-15pt]
    S_K & & &
\end{tikzcd}
\end{document}


text:
Q: DataTable Javascript does not add row I am trying to use this method https://datatables.net/examples/api/add_row.html, my table is consisting of several different HTML elements, they are of the type select and input. I have simplified it here to one input and one column only. My goal is to click the 'add row' button and add an exact row with all the elements to the table. But when I click the 'add row' button The number of entries gets incremented, in the console there is no error or warning, but still I do not see a new row being added to the table.

column header 1

column header 2

     <input id="color">

The JS part:
$(document).ready(function() {
    var t = $('#myTable').DataTable();
    $('#addRow').on('click', function(){
        var jRow = $('#myRow');
        jRow.id = "myRow2"; //I thought about changing the id but also not effective
        t.row.add(jRow).draw();

    });

});

A: There are a few problems with your HTML and your JavaScript.
The HTML is not properly formed-- you have two column headers that aren't defined as headers, and then only one data cell that isn't properly closed.
Try this:

        column header 1
        column header 2

            <input id="color" type="text"/>

<button id="addRow">Add Row</button>

And then your JS needs some changes also.  You can add a jQuery object as a row, for example like this:
$(document).ready(function() {
  var t = $('#myTable').DataTable();
  $('#addRow').on('click', function(){
    var jRow = $('
').append('Cell 1	','Cell 2	');
    jRow.attr('id', 'myRow2');
    t.row.add(jRow).draw();
  });
});

A: Their is a few issue with your HTML mark up. For example:

column header 1

column header 2

should be

Header 1	Header 2

 is the row and  is a row header.
Also make sure id="colorField you close these statements id="colorField" forget the (") at the end.
Here working example:

$(document).ready(function() {
  var $table = $('#table').DataTable(),
    counter = $('#table').find("tbody > tr").length; // get current number of rows
  $('.addRow').on('click', function() {
    var $row = $('.row0'), // find the default row
      newRow = $row.clone().attr("class", "row" + counter); // clone the row and change the class
    $table.row.add(newRow).draw(); // add to the table
    counter++; // increase counter
  });
});
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css"/>

      Header 1
      Header 2

      Enter a color:

        <input class="color">

<button class="addRow">Add Row</button>

At $row.clone().attr("class", "row" + counter); this line you don't need to change the class but makes it easier if you want to assign it any JavaScript events (but you do need to .clone() this remove association of the row with the table).


text:
Q: Elementary math notations per culture or country I cannot find a place listing the mathematical notations per country. The symbols listed in wikipedia refer to english notations. (Even the french page for instance, reproduces the english symbol for parallelism).
This question is very similar but the answers focus on maths at a university level, I am looking for elementary maths symbols only (from wikipedia: "topics frequently taught at the primary or secondary school levels").
As a complete answer might be too long, I suggest each answer to focus on one country and to only highlight the differences with english notations (but maybe there are more efficient, better ways to organize the answers, maybe a community wiki would be appropriate?).
I start with french and will update the answer when I find out more differing symbols.
Last note: this should not be limited to symbols used "in line" but can also list symbols used on figures (like, for instance, right angles that are not marked/decorated the same way by german people as by english or french people)

A: Russian mathematical notation or peculiarities of Russian notation in mathematics:
$English \;-\;Russian$
$3.14 \;-\;3,14\;\;$(in Russian, dots are not used for decimal fractions)
$1,000,000\;-\;1.000.000$
$\$100\;-\;100\$$
Point $A(1,2) \;-\; A(1;2)$
$tan\,x \;-\;tg\,x$
$cot\,x \;-\;ctg\,x$
$sinh\,x \;-\;sh\,x$
$cosh\,x \;-\;ch\,x$
$tanh\,x \;-\;th\,x$
$coth\,x \;-\;cth\,x$
$sin^{-1}\,x\;-\;arcsin\,x\;$ (and so on for other inverse trig functions but the general sign for inverse functions is exactly the same e.g., $f^{-1}.\;$Note that we also use $arcsin$ etc. in some UK/US books like those by Serge Lang. It's also used in other languages and universally understood). Yet something like $arch\,x$ may look arcane but it is not if you look a few lines above.
${{n}\choose{k}}\;-\;  C_n^k\;\;$ (it is backwards!)
$P_{n,k}\;-\;  A_n^k\;\;$ (backwards again)
(And $\;m!\;$ as permutations is the same in Russian: $P_m$)
In elementary algebra (not complex variables):
$log\,x\;-\;lg\,x\;\;$(common or decimal logarithm with base $10$)
In geometry everything seems to be the same (all symbols, denotations etc.) but area is never denoted by the letter A, it's denoted with the English letter S. Volume, however is similarly denoted by V.
Long division looks weard--google the Russian words 'деление столбиком' and see all the pictures! Also, note that letters A, B..., a,b,c... are pronounced like in Latin!
Although it looks like there is some significant difference in notation, it's not the case. Almost everything in all math branches looks exactly the same when compared with Russian texts. So much so that it is difficult for me to come up with some other differences. I can, at a push, say things like: In Russian books parabola is always $y^2=2px$ instead of $y^2=4px$ but you can come up with various subtleties from book to book. Simply put, notation may slightly differ in various Russian books as it may also differ in some English books. And there are even fewer differences in notation when it comes to higher branches of mathematics.

A: Notations differing in french:
\begin{array}{c|c|c}
  \textbf{Theme} & \textbf{French} & \textbf{English} \\
 \hline
  \textbf{Angles} & \widehat{ABC} & \angle ABC \\
 \hline
  \textbf{Distance} & AB & \overline {AB} \\
 \hline
  \textbf{Lines} & (AB) & AB \\
 \hline
  \textbf{Numbers} & 1,23 & 1.23 \\
 \hline
  \textbf{Parallel lines} & \newcommand{\frparallel}{\mathbin{/\negthickspace/}} (AB) \frparallel (CD) & AB \parallel CD \\
 \hline
  \textbf{Triangles} & ABC & \triangle ABC \\
\end{array}
EDIT: the source for french notations is myself, as I studied maths in France from school to university and am now a french maths teacher (in France). Nevertheless I can provide examples. There's an open source maths book for school where you will find these notations, like here for lines, the next page for parallel lines, and there on the left you'll find notations for angles.


text:
Q: How to prevent jquery mobile from handling post request with ajax in django I have trouble integrating jquery mobile for my django project. Especially the log-in functionality seems not to work out of the box with jquery mobile(JQM). JQM uses ajax for handling post requests, which i want to prevent. On this site http://blog.vrplumber.com/index.php?/archives/2511-Miscellaneous-jQuery-Mobile-+-Django-tips.html
i read that it is possible to prevent JQM from doing that by adding

data-json="false"

but where do i add that? In the template or in the view? I tried different variations with no effect.
Here is my login view:
def login(request):
    if request.method == 'POST':
        username = request.POST['u']
        password = request.POST['p']
        user = authenticate(username=username, password=password)
        if user is not None:
            if user.is_active:
                auth_login(request, user)
                msg.append("Hello %s your login was successful"% username)
        return HttpResponseRedirect('/profile/')
            else:
                msg.append("disabled account")
        else:
            msg.append("invalid login")

    return render_to_response('login.html')

the template looks like the following...
    {% block content %}

        <form action="" method="post">{% csrf_token %}
            Login:  <input type="text" name="u">

            Password:  <input type="password" name="p">
            <input  type="submit" value="Login">
        </form>
    {% if errors %}

            {% for error in errors %}

{{ error }}

            {% endfor %}

    {% endif %}
     Logout

{% endblock %}

A: okay figured it out by myself:
just add this javascript snippet into your template head:


text:
Q: Kruskal-Wallis test on multiple columns at once This maybe sounds a bit simple, but I cannot get the answer.
I have a dataset in R that has 26 samples in rows and many variables (>20) in columns. Some of them are categorical, so what I need to do is to carry out a Kruskal Wallis test for each numerical variable depending on each categorical one, so I do:
env_fact <- read.csv("environ_facts.csv")

kruskal.test(env_fact-1 ~ Categorical_var-1,  data=env_fact)

But with this I can only do the test to the numerical variables one by one, which is tiresome.
Is there any way to carry all the Kruskal-Wallis tests for all numerical variables at once?
I can repeat it by each categorical variable, since I only have 4, but for the numerical one I have more than 20!!
Thanks a lot

A: Since I do not have sample of the data set I can only answer "theoretically".
First, you need to recognize which are the numeric columns.
The way to do this is the following:
df = tibble(x = rnorm(10), y = rnorm(10), z = "a", w = rnorm(10))
NumericCols = sapply(df, function(x) is.numeric(x))
df_Numeric = df[, Types == TRUE]

Now you take the numeric part of df, df_Numeric, and apply your function blabla on each column at a time:
sapply(df_Numeric, function(x) blabla(x))

A: Thank you very much Omry.
Working with a colleague we reached an incomplete different solution to yours:
my.variables <- colnames(env_fact)
for(i in 1:length(my.variables)) {
    if(my.variables[i] == 'Categorical_var') {
        next
    } else {
        kruskal.test(env_fact[,i], env_fact$Categorical_var)
    }
}

However, we haven't been able to print on screen/get an output with the results for each of 'my.variables' by the 'Categorical_var' analyzed. We could only get a result for all the 'my.variables' as a whole.
Any idea??
Thank you very much
P.S.: My data looks like this:
Sample,Nunatak,Slope,Altitude,Depth,Fluoride,Acetate,Formiate,Chloride,Nitrate
m4,1,1,1,1,0.044,0.884,0.522,0.198,0.021
m6,1,1,1,2,0.059,0.852,0.733,0.664,0.038
m7,1,1,1,3,0.082,0.339,1.496,0.592,0.034
m8,1,1,2,1,0.112,0.812,2.709,0.357,0.014
m10,1,1,2,2,0.088,0.768,2.535,0.379,0
m11,1,1,3,1,0.101,0.336,4.504,0.229,0
m13,1,1,3,2,0.092,0.681,1.862,0.671,0.018
m14,1,2,2,1,0.12,1.055,3.018,0.771,0
m16,1,2,2,2,0.102,1.019,1.679,1.435,0
m17,1,2,2,3,0.26,0.631,0.505,0.574,0.008

Where Nunatak, Slope, Altitude and Depth are categorical and the rest are numerical. Hope this helps


text:
Q: Lable line points with geographical coordinates in QGIS I have a .shp file set of Congressional districts as lines.  Since the lines are composed of geographic coordinates, is it possible to label a point on a line and have the label automatically show the coordinates?

A: You have to make two virtual fields (x,y)

In style manager write this expression


text:
Q: Spring 3.0 annotation bean Component Scan How to do component-scan in spring 3.0? I use annotation like @Service, @Reponsity for both jar and project. It does not work. When the bean in project inject from the bean in jar.
In jar file
    com.java.spring.support

In project
    org.me.project

My configuration is
    <context:annotation-config/>
    <context:component-scan base-package="com.java.spring.support, org.me.project"/>

In Jar File
    package com.java.spring.support;

    @Service("CommonService")
    public class CommonService {
    }

In project
    package org.me.project;

    @Service(value = "OtherService")
    public class OtherService {
        @Resource(name = "CommonService")
        private CommonService service;
    }

I get error
    15:41:53,043 DEBUG [org.springframework.context.support.ClassPathXmlApplicationContext] Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.sprin
    gframework.context.support.DefaultLifecycleProcessor@510ebe18]
    15:41:53,044 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'lifecycleProcessor'
    Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'CommonService' is defined
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093)
        at org.ace.java.support.delete.Test.main(Test.java:13)

A: Use only <context:component-scan base-package="com.java.spring.support, org.me.project">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"/> should work.

A: <context:component-scan base-package="org.me.project"/>

You are using an exclude filter on repository annotations, remove it.


text:
Q: Get the mocha "end" event from gulp I'm using gulp-mocha with gulp and I'm trying to get a notification when the mocha tests get completed.
This is my gulpfile.js
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var notify = require("gulp-notify");

gulp.task('test', function () {
  return gulp.src(['test/**/*.js'], { read: false })
    .pipe( mocha({ reporter: 'nyan' }))
    .on("error", notify.onError({
      message: 'Error: <%= error.message %>'
    }))
    .on('end', function () {
      notify( "Tests passed" )
    });
});

gulp.task('watch-test', function () {
  gulp.watch(['./**'], ['test']);
});

gulp.task( 'default', [ 'test', 'watch-test'] );

I managed to see the notification on the "error" event, but I couldn't find a way to get the "end" event.
Any idea about how to get it?

A: gulp-notify works with streams (i.e. pipe(notify...), use node-notifier.
I'm doing it like this:
let gulp     = require('gulp');
let gulpeach = require('gulp-foreach');
let mocha    = require('gulp-mocha');
let notifier = require('node-notifier');

// Run tests.
gulp.task('test', function () {
  gulp.src(['test/test-*.js'])
    .pipe(gulpeach(function (stream, file) {
      return stream
        .pipe(mocha())
        .on('error', (error) => {
          notifier.notify({
            message: ('Command: ' + error.cmd),
          })
        })
      ;
    }))
    .on('finish', () => notifier.notify('Tests completed'))
  ;
});


text:
Q: How to call a class within other class? I'm quite new to OOP, and I have a quick question:
I have the following classes within my code:
Class DB {
//contains all my mysqli stuff
}

Class A {
All functions within this class will need a db connection
}

How can I create the connection inside the class without needing to create a new DB instance on every function?
Is this even possible?
Thanks in advance.

A: There's a bunch of answers here that technically answer the question, but they are all teaching the incorrect approach. A big part of good OOP design is to favor composition over inheritance.
If your A class is something like a model that needs to work with the database, it's a really bad idea to have that class extend DB. Instead, you'll simply want to pass DB to A's constructor:
class A {

   protected $db;

   function __construct(DB $db) {

       $this->db = $db;

   }

}

Now every method in A can access DB via $this->db.
This also solves the issue of having many database connections open for every instance of A (or in the future if you need a B or C class).
A itself should not create its own instance of DB, but this should instead get injected  by whatever constructs A. This is called dependency injection and another tenet of good OOP design.

A: For class DB, you can set your DB connection e.g. Open & Close. For class A you can set the class to inherit the methods of class DB by using extends. As you will not be needing access to your class from outside, I have changed the methods (functions in procedural) in class DB to protected as all methods are public by default in PHP.
I've also added the use of a Constructor (as mentioned in the comments) so your DB connection will open automatically when the object has been created from Class A. Personally, I would not open a DB connection in a constructor but that's just me being paranoid. Just make sure you close the connection in your method if you have doubts.
<?php

Class DB {

    protected function conDB() { //Protected can only be accessed by same class or inherited class

        echo "Open connection to DB";

    }

    protected function closeDB() { //Protected can only be accessed by same class or inherited class

        echo "Connection Closed";

    }

}

Class A extends DB { //Extends will use all methods from inherited class

    function __construct() { //Constructer will run on Object creation and open connection to DB

      $this->conDB();

    }

    public function selectDB() {

        echo "
";
        echo "Data Select Here!";
        echo "
";
        $this->closeDB(); //You will still need to close the DB Connection

    }

}

Create Object from Class A
$select = new A(); //Create Object
$select->selectDB();

Output calling Class A
Open connection to DB
Data Select Here!
Connection Closed

Reading Material:

*

*http://php.net/manual/en/language.oop5.decon.php

*http://php.net/manual/en/language.oop5.visibility.php

*http://php.net/manual/en/language.oop5.inheritance.php


text:
Q: Angular ui-router with parameter I try to use angular with ui-router. It works fine except in one case.
I've created a directive element which is the header of the page. This element has a menu with 4 links. These links depend on the id of the current user. This id is passed as an attribute when I call my directive.
ui.js
angular.module('app.ui',
[

]).directive('userHeader', function()
{
    return {
        restrict : 'E',
        templateUrl : '/scripts/directives/ui/userHeader.html',
        controller : function($scope)
        {

        },
        link : function(scope, element, attributes)
        {
            scope.uid = attributes.uid
        }
    };
});

userHeader.html
<md-list layout="row" class="md-whiteframe-z1 no-padding">
    <md-list-item class="has-link" layout-align="center center">
        <md-item-content md-ink-ripple layout="row" layout-align="center center" ui-sref="userInformations({ id : '{{ uid }}' })">

                <md-icon md-font-set="material-icons">person</md-icon>

            <md-tooltip hide-gt-sm>Informations</md-tooltip>

Informations

        </md-item-content>
    </md-list-item>
    <md-list-item class="has-link" layout-align="center center">
        <md-item-content md-ink-ripple layout="row" layout-align="center center" ui-sref="userEvents({ id : '{{ uid }}' })">

                <md-icon md-font-set="material-icons">event</md-icon>

            <md-tooltip hide-gt-sm>Événements</md-tooltip>

Événements

        </md-item-content>
    </md-list-item>
    <md-list-item class="has-link" layout-align="center center">
        <md-item-content md-ink-ripple layout="row" layout-align="center center" ui-sref="userGalleries({ id : '{{ uid }}' })">

                <md-icon md-font-set="material-icons">photo</md-icon>

            <md-tooltip hide-gt-sm>Galeries</md-tooltip>

Galeries

        </md-item-content>
    </md-list-item>
    <md-list-item class="has-link" layout-align="center center">
        <md-item-content md-ink-ripple layout="row" layout-align="center center" ui-sref="userFriends({ id : '{{ uid }}' })">

                <md-icon md-font-set="material-icons">group</md-icon>

            <md-tooltip hide-gt-sm>Amis</md-tooltip>

Amis

        </md-item-content>
    </md-list-item>
</md-list>

user.html
<user-header user-id="UserInformations.user.id"></user-header>

I don't know how to bind the user-id attribute to everu ui-sref attributes of my md-item-content so it can generate the correct link.
Thanks in advance for your help

A: If no data is passed into the directive is your problem
Change your code to this
<user-header user-id="{{UserInformations.user.id}}"></user-header>

link : function(scope, element, attributes)
{
    scope.uid = attributes.userId;

}

Also look at https://docs.angularjs.org/guide/directive on how to pass data to directive scope.


text:
Q: Set specific value to round corners of UIBezierPath I know there are some similar questions like this, but in my case, I want to set cornerRadius = 8 for my layer.

If I set:
shapeLayer.lineCap = CAShapeLayerLineCap.round

it shows like this:

-> Not match as the design.
My code:
import Foundation
import UIKit

final class OnboardingCell: UICollectionViewCell {
  @IBOutlet weak var boxView: UIView!
  @IBOutlet weak var continueButton: UIButton!
  @IBOutlet weak var progressView: UIView!

  var onTap: (() -> Void)?
  var levelProgress: CGFloat = 0.1 {
    didSet {
      fgLayer.strokeEnd = levelProgress
    }
  }

  let bgLayer = CAShapeLayer()
  let fgLayer = CAShapeLayer()

  override func awakeFromNib() {
    super.awakeFromNib()
    setup()
    configure()
  }

  override func layoutSubviews() {
    super.layoutSubviews()
    setupShapeLayer(shapeLayer: bgLayer)
    setupShapeLayer(shapeLayer: fgLayer)
  }

  private func setup() {
    bgLayer.lineWidth = 50
    bgLayer.fillColor = nil
    bgLayer.strokeStart = 470 / 1590 + 0.008
    bgLayer.strokeEnd = 1
    bgLayer.cornerRadius = 8
    progressView.layer.addSublayer(bgLayer)
    fgLayer.lineWidth = 50
    fgLayer.fillColor = nil
    fgLayer.strokeStart = 0
    fgLayer.strokeEnd = 470 / 1590 - 0.008
    progressView.layer.addSublayer(fgLayer)
  }

  private func configure() {
    bgLayer.strokeColor = UIColor(rgb: 0xE3EDF7).cgColor
    fgLayer.strokeColor = UIColor(rgb: 0x18D4F4).cgColor
  }

  private func setupShapeLayer(shapeLayer: CAShapeLayer) {
    let linePath = UIBezierPath(arcCenter: CGPoint(x: progressView.bounds.midX, y: progressView.bounds.midY), radius: progressView.frame.height / 2, startAngle: 9/11 * CGFloat.pi, endAngle: 2/11 * CGFloat.pi, clockwise: true)
    linePath.lineWidth = 10
    shapeLayer.path = linePath.cgPath
  }

  override func draw(_ rect: CGRect) {
    super.draw(rect)
    boxView.addFloatEffect()
    continueButton.addFloatEffectForButton()
    bgLayer.addSankEffect()
    fgLayer.addFloatEffect()
  }

  @IBAction func continueButtonTapped(_ sender: UIButton) {
    onTap?()
  }
}

A: The cornerRadius only adjusts the corners of the bounds of the layer, not of the path. If you want path with rounded corners, you'll have to stroke that yourself.
There are two approaches to rendering an arc with a particular corner radius:

*

*If rendering a simple solid rendition, one very simple approach is to render two arcs, one clockwise, one counter clockwise, using different radii. The line width of these individual arcs should be twice the desired corner rounding of the final shape. Then, if you render these two arcs with a matching stroke color and fill color, you'll get the desired shape.
Here it is, animated so you can see what's going on:

This is the code (without the animation):
class ArcView: UIView {
    var startAngle: CGFloat = .pi * 3 / 4
    var endAngle: CGFloat = .pi * 5 / 4
    var clockwise: Bool = true

    /// Radius of center of this arc
    var radius: CGFloat = 100

    /// The linewidth of this thick arc
    var lineWidth: CGFloat = 50

    /// The corner radius of this thick arc
    var cornerRadius: CGFloat = 10

    static override var layerClass: AnyClass { return CAShapeLayer.self }
    var shapeLayer: CAShapeLayer { return layer as! CAShapeLayer }

    override func layoutSubviews() {
        super.layoutSubviews()
        updatePath()
    }

    func updatePath() {
        let center = CGPoint(x: bounds.midX, y: bounds.midY)
        let innerRadius = radius - lineWidth / 2 + cornerRadius
        let innerAngularDelta = asin(cornerRadius / innerRadius) * (clockwise ? 1 : -1)
        let outerRadius = radius + lineWidth / 2 - cornerRadius
        let outerAngularDelta = asin(cornerRadius / outerRadius) * (clockwise ? 1 : -1)

        let path = UIBezierPath(arcCenter: center, radius: innerRadius, startAngle: startAngle + innerAngularDelta, endAngle: endAngle - innerAngularDelta, clockwise: clockwise)
        path.addArc(withCenter: center, radius: outerRadius, startAngle: endAngle - outerAngularDelta, endAngle: startAngle + outerAngularDelta, clockwise: !clockwise)
        path.close()

        // configure shapeLayer

        shapeLayer.lineWidth = cornerRadius * 2
        shapeLayer.fillColor = UIColor.blue.cgColor
        shapeLayer.strokeColor = UIColor.blue.cgColor
        shapeLayer.lineJoin = .round
        shapeLayer.path = path.cgPath
    }

}

The only trick in the above is how to adjust the starting and ending angles of these inner and outer arcs such that they'll be perfectly circumscribed by the desired final shape. But a little trigonometry can be used to figure out those angular deltas, as shown above.

*The other approach is to define a path for the outline of the desired shape. Calculating the inner arc and outer arcs is similar, but you have to manually calculate the angles for the four rounded corners. It's just a little trigonometry, but it's a little hairy:
class ArcView: UIView {
    var startAngle: CGFloat = .pi * 3 / 4
    var endAngle: CGFloat = .pi * 5 / 4
    var clockwise: Bool = true

    /// Radius of center of this arc
    var radius: CGFloat = 100

    /// The linewidth of this thick arc
    var lineWidth: CGFloat = 100

    /// The corner radius of this thick arc
    var cornerRadius: CGFloat = 10

    static override var layerClass: AnyClass { return CAShapeLayer.self }
    var shapeLayer: CAShapeLayer { return layer as! CAShapeLayer }

    override func layoutSubviews() {
        super.layoutSubviews()
        updatePath()
    }

    func updatePath() {
        let center = CGPoint(x: bounds.midX, y: bounds.midY)
        let innerRadius = radius - lineWidth / 2
        let innerAngularDelta = asin(cornerRadius / (innerRadius + cornerRadius)) * (clockwise ? 1 : -1)
        let outerRadius = radius + lineWidth / 2
        let outerAngularDelta = asin(cornerRadius / (outerRadius - cornerRadius)) * (clockwise ? 1 : -1)

        let path = UIBezierPath(arcCenter: center, radius: innerRadius, startAngle: startAngle + innerAngularDelta, endAngle: endAngle - innerAngularDelta, clockwise: clockwise)

        var angle = endAngle - innerAngularDelta
        var cornerStartAngle = angle + .pi * (clockwise ? 1 : -1)
        var cornerEndAngle = endAngle + .pi / 2 * (clockwise ? 1 : -1)
        var cornerCenter = CGPoint(x: center.x + (innerRadius + cornerRadius) * cos(angle), y: center.y + (innerRadius + cornerRadius) * sin(angle))
        path.addArc(withCenter: cornerCenter, radius: cornerRadius, startAngle: cornerStartAngle, endAngle: cornerEndAngle, clockwise: !clockwise)

        angle = endAngle - outerAngularDelta
        cornerStartAngle = cornerEndAngle
        cornerEndAngle = endAngle - outerAngularDelta
        cornerCenter = CGPoint(x: center.x + (outerRadius - cornerRadius) * cos(angle), y: center.y + (outerRadius - cornerRadius) * sin(angle))
        path.addArc(withCenter: cornerCenter, radius: cornerRadius, startAngle: cornerStartAngle, endAngle: cornerEndAngle, clockwise: !clockwise)

        path.addArc(withCenter: center, radius: outerRadius, startAngle: endAngle - outerAngularDelta, endAngle: startAngle + outerAngularDelta, clockwise: !clockwise)

        angle = startAngle + outerAngularDelta
        cornerStartAngle = angle
        cornerEndAngle = startAngle - .pi / 2 * (clockwise ? 1 : -1)
        cornerCenter = CGPoint(x: center.x + (outerRadius - cornerRadius) * cos(angle), y: center.y + (outerRadius - cornerRadius) * sin(angle))
        path.addArc(withCenter: cornerCenter, radius: cornerRadius, startAngle: cornerStartAngle, endAngle: cornerEndAngle, clockwise: !clockwise)

        angle = startAngle + innerAngularDelta
        cornerStartAngle = cornerEndAngle
        cornerEndAngle = angle + .pi * (clockwise ? 1 : -1)
        cornerCenter = CGPoint(x: center.x + (innerRadius + cornerRadius) * cos(angle), y: center.y + (innerRadius + cornerRadius) * sin(angle))
        path.addArc(withCenter: cornerCenter, radius: cornerRadius, startAngle: cornerStartAngle, endAngle: cornerEndAngle, clockwise: !clockwise)

        path.close()

        // configure shapeLayer

        shapeLayer.fillColor = UIColor.blue.cgColor
        shapeLayer.strokeColor = UIColor.clear.cgColor
        shapeLayer.lineJoin = .round
        shapeLayer.path = path.cgPath
    }
}


text:
Q: Mobility scooter motor overvolting/cooling I have a 8 1/2" motor originally running 24 V 90 A, but I've been running up to 82 V, 20 A with no problem. How high can I overvolt this? I'd like to have it as high as 110 V. The controller is no issue at this time.

A: There is probably no way to determine the maximum operating voltage for successful operation. It is possible that the manufacturer started with a motor designed for 90 volts or higher and modified the motor slightly for 24 volt operation. You probably know that the speed is proportional to voltage and you are running the motor at about 3-1/2 times the 24 volt speed. If the rotor structure, bearings and dynamic balance are not suitable for the higher speed, it may not last very long. It is unlikely to overheat while running at less than the design current. The motor might experience excessive commutator sparking or flashover. The motor may have a self-cooling fan that will add more load as the speed increases.


text:
Q: How to pass username and password in image URL HTML.? How to pass username and password as a variable in image URL HTML and angular 6?
I tried this but I am getting error.
http://......./folder/img.jpg@httpOptions

A: 1st you shouldn't. It's insecure to have user and password in query parameters.
2nd you could pass the image file name and any other parameters that are secure as query parameters
If you want more help,  please make your question more specific. Give some code and explanation on why you are trying to do that.
The asset URLs are not in your routing in angular. If you want to secure them, then you need to expose them via a backend service.
You can check the structure here as the @ means nothing in the url
 https://en.m.wikipedia.org/wiki/Query_string


text:
Q: android sdk and avd manager does not launch on windows 7 x64 Can anyone please confirm if android development is not yet supported on windows 7 x64?
I downloaded the sdk, but when I tried to launch the sdk and avd manager it fails to launch.

A: This question is probably dead but I think I've figured it out.
Ensure you've added the c:\android_sdk_windows\tools dir to your %PATH% environmental variable.
In eclipse check Windows->Preferences->Android and ensure you've set the SDK location to the SDK directory above.
Manually create 2 directories under the SDK directory
platforms

add-ons

The SDK and AVD manager should now be launchable.

A: For me the problem was solved on windows 8 64 by editing the find_java.bat in the android_sdk/tools/lib folder.
Basically the for loops that set java_exe and javaw_exe will not work correctly if
the path has a white space in it! Ie. "C:\Program Files\Java\jdk" has this, find_java.bat
will set java_exe to "C:\Program" which android.bat doesn't like.
I was ok when i edited find_java.bat like this:
(see the two lines after 'rem edit:)
rem Check we have a valid Java.exe in the path. The return code will
rem be 0 if the command worked or 1 if the exec failed (program not found).
for /f %%a in ('%~dps0\find_java.exe -s') do set java_exe=%%a
rem edit:
set java_exe="%JAVA_HOME%\bin\java.exe"
if not defined java_exe goto :CheckFailed

:SearchJavaW
rem Check if we can find a javaw.exe at the same location than java.exe.
rem If that doesn't work, just fall back on the java.exe we just found.
for /f %%a in ('%~dps0\find_java.exe -s -w') do set javaw_exe=%%a
rem edit:
set javaw_exe="%JAVA_HOME%\bin\javaw.exe"
if not exist %javaw_exe% set javaw_exe=%java_exe%
goto :EOF

HTH

A: What worked for me was adding the JAVA_HOME environment variable pointing to the jdk folder (in my case c:\Program Files\Java\jdk1.7.0_04) and adding %JAVA_HOME%\bin to PATH variable

A: I got the same problem...but I did not find any solution on the problem...so finaly I set down and start to debug android.bat file. You find it installed androidSDK folder and inside the tools folder.
What I found was interesting...
Missing two important variables setting!
First: find the next row: java_exe=
Here missing java.exe location. You can use global variable if you set example: JAVA_HOME.
If set it you can override the row like: java_exe=%JAVA_HOME%
Second:
Find the next row: for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a
Here missing varibale before lib...settings.
A few lines above you can find a variable setting row like: set work_dir="%cd%"
So...you can use this variable to help to find lib\archquery.jar file
Solution:
for /f %%a in ('%java_exe% -jar %work_dir%\lib\archquery.jar') do set swt_path=lib\%%a
If you finished...just save the modified bat file and try to start Abdroid SDK manager from command promt, exe file or Eclipse...
SORRY GUYS!!! I don't understand yet...
So! I did my modification in android.bat. Install Eclipse Juno Java and Android SDK.
I set a workspace directory in eclipse, try to run Android SDK manager...and it is not run.
It refered the set workspace not the installed AndroidSDK folder...
So possible the best soulution if you use exact path to ...\lib\archquery.jar file.

A: I think you have your android-sdk folder in one of windows 7 system folders, e.g. Program Files (x86). Permissions there are tightly controlled by the system. You better create the android-sdk folder outside of those system directories.

A: I am having this same issue.  I have my SDK in C:\Android\android_sdk_windows. It already has the platform and add-ons folders.  From the UI, I can enter the infor for the AVD, but when I click [Create AVD], it just hangs.  I can see that it created a new folder of .avd under .ini file.  And in the .avd folder are an sdcard.img and userdata.img file.
When I finally go to close the AVD program (from Windows), it comes back with a dialog telling me that the "Java SE platform binary is not responding."
One possible issue was that I had both Java 6 (32-bit) and Java 7 (64-bit) and the find_java.bat program called by android.bat was finding the 64-bit.  It still seemed to be working to bring up the UI but it was very slow so I uninstalled the Java 7.  Now the UI comes up very quickly (relatively speaking).
However, I've traced the real culprit to the mksdcard.exe program.  If I create an AVD with an empty SD value, it creates it fine.  If I give it an SD value -- HANG.

A: Hey guys finally got a answer to your problem for the ANDROID AVD. My name is Jeremy; I'm not a user of Stack Overflow. Anyway.
*WINDOWS ONLY**
FIRST STEP: Delete everything you downloaded from Android. When i say everything I mean everything, from folders and anything else. Sometimes the uninstall does not do that, so you may have to manually do it. Reboot once you finish.
SECOND STEP: Re-install everything. I recommend that you use the installer_r21-windows.exe (Recommended) on the website.
THIRD STEP: Install all of your packages that you are going to use while developing.
FOURTH STEP: Set up your AVD and click OK. It will take a while, and it will say "Application not responding" at the top of the window. Do not do anything to it; let it keep going and it will eventually start up.
Hope that get it for you it did for me without the hassle.
P.S. I did it on Windows 7.

A: As one of the comments indicated its C:\android-sdk-windows\tools\lib\find_java.exe and find_java.bat to blame. I have Win7-64bit, no 32bit JavaJRE/JDK installs, one jre7 64bit install. Find_java.bat+exe tool cannot find proper path to 64bit version. I guess you're fine if only 32bit JRE was installed (did not try this).

*

*Open DOS console and goto folder C:\android-sdk-windows\tools\lib\

*run find_java.bat and find_java.exe, you should get "failed to convert path..." and "c:\windows\system32\java.exe" printouts

*type command set path=c:\Program Files\Java\jre7\bin;%path%

*run find_java.bat and find_java.exe, you don't get any errors and proper path to c:/program files/java/jre7/bin/java.exe is printed

If you don't want to mess with Control Panel's environment prefs you could create two batch scripts to run AVD and SDK Manager.
C:\android-sdk-windows\AVD Manager.bat
set PATH=C:\Program Files\Java\jre7\bin;%PATH%
"AVD Manager.exe"

C:\android-sdk-windows\SDK Manager.bat
set PATH=C:\Program Files\Java\jre7\bin;%PATH%
"SDK Manager.exe"

This problem and fix was tested on Win7-64bit/Android SDK Tools 20.0.3/Android SDK Platform-tools 14 releases.

A: If you have moved your Users directory to a drive that is not called c:\ it will not work - a workaround is to copy the .android folder from E:\Users\Username\.android to E:\Users\Username\.android - then it should work.
Also make sure your environmental variable Path is set to the location of the tools folder - e.g. E:\android-sdk_r05-windows\android-sdk-windows\tools


text:
Q: Add column in dataframe from another dataframe matching the id and based on condition in date columns pandas My problem is a very complex and confusing one, I haven't been able to find the answer anywhere.
I basically have 2 dataframes, one is price history of certain products and the other is invoice dataframe that contains transaction data.
Sample Data:
Price History:
    product_id    updated  price
id
1            1 2022-01-01    5.0
2            2 2022-01-01    5.5
3            3 2022-01-01    5.7
4            1 2022-01-15    6.0
5            2 2022-01-15    6.5
6            3 2022-01-15    6.7
7            1 2022-02-01    7.0
8            2 2022-02-01    7.5
9            3 2022-02-01    7.7

Invoice:
   transaction_date  product_id  quantity
id
1        2022-01-02           1         2
2        2022-01-02           2         3
3        2022-01-02           3         4
4        2022-01-14           1         1
5        2022-01-14           2         4
6        2022-01-14           3         2
7        2022-01-15           1         3
8        2022-01-15           2         6
9        2022-01-15           3         5
10       2022-01-16           1         3
11       2022-01-16           2         2
12       2022-01-16           3         3
13       2022-02-05           1         1
14       2022-02-05           2         4
15       2022-02-05           3         7
16       2022-05-10           1         4
17       2022-05-10           2         2
18       2022-05-10           3         1

What I am looking to achieve is to add the price column in the Invoice dataframe, based on:

*

*The product id

*Comparing the Updated and Transaction Date in a way that updated date <= transaction date for that particular record, basically finding the closest date after the price was updated. (The MAX date that is <= transaction date)

I managed to do this:
invoice['price'] = invoice['product_id'].map(price_history.set_index('id')['price'])

but need to incorporate the date condition now.
Expected result for sample data:
Expected Result
Any guidance in the correct direction is appreciated, thanks

A: merge_asof is what you are looking for:
pd.merge_asof(
    invoice,
    price_history,
    left_on="transaction_date",
    right_on="updated",
    by="product_id",
)[["transaction_date", "product_id", "quantity", "price"]]

A: merge_asof with arg direction
merged = pd.merge_asof(
    left=invoice,
    right=price_history,
    left_on="transaction_date",
    right_on="updated",
    by="product_id",
    direction="backward",
    suffixes=("", "_y")
).drop(columns=["id_y", "updated"]).reset_index(drop=True)

print(merged)

    id transaction_date  product_id  quantity  price
0    1       2022-01-02           1         2    5.0
1    2       2022-01-02           2         3    5.5
2    3       2022-01-02           3         4    5.7
3    4       2022-01-14           1         1    5.0
4    5       2022-01-14           2         4    5.5
5    6       2022-01-14           3         2    5.7
6    7       2022-01-15           1         3    6.0
7    8       2022-01-15           2         6    6.5
8    9       2022-01-15           3         5    6.7
9   10       2022-01-16           1         3    6.0
10  11       2022-01-16           2         2    6.5
11  12       2022-01-16           3         3    6.7
12  13       2022-02-05           1         1    7.0
13  14       2022-02-05           2         4    7.5
14  15       2022-02-05           3         7    7.7
15  16       2022-05-10           1         4    7.0
16  17       2022-05-10           2         2    7.5
17  18       2022-05-10           3         1    7.7


text:
Q: Hoffman and Kunze Linear Algebra Section 6.8 Decomposition Theorem Below you can find the related theorem and part of the proof that I am confused about. I understand that with the related definition of $E_i$'s we get k linear operators on $V$that satisfy

*

*$E_1+...+E_k=I$, where $I$ denotes the identity operator on $V$

*$E_iE_j=0$ if $i{\neq}j$
However, as far as I know, we additionally need to show that each $E_i$ is a projection on $V$ to conclude their ranges can be taken as direct summands of $V$, which can be confirmed by showing $E_i^2=E_i$ for each $i$. It seems the writers claim that from 1 and 2, one can directly conclude that $E_i$'s are projections on $V$, but I cannot see why.

A: Apply $E_i$ to formula (1) $\sum_j E_j=I$ and using (2) to eliminate all $i\neq j$ using $E_i E_j=0$ gives $E_i^2=E_i$  Thus, those two are sufficient to show the $E_i$ are projections which split up the space.


text:
Q: 500 Error, Works good after first refresh WebSphere, IHS External User -> Virtual IP F5 -> IHS (SSL configured)-> WAS 855
there is firewall between IHS and WAS,
When I hit the application URL for the 1st time it gives 500 error, when I refresh the page, It is working good.
I tried to use fiddler, it just says "No server responce" for the 500 error.
In the webserver logs I see only 304 and 302 errors.
Has anyone faced this issue before?


text:
Q: Facebook c# sdk get users email I have a site which is using facebook for auth. I want to gather some basic info when a user signs up including their email address.
The code i have for the login is standard:
public ActionResult Login(string returnUrl)
    {
        var oAuthClient = new FacebookOAuthClient();
        oAuthClient.AppId = AppSettings.GetConfigurationString("appId");
        oAuthClient.RedirectUri = new Uri(AppSettings.GetConfigurationString("redirectUrl"));
        var loginUri = oAuthClient.GetLoginUrl(new Dictionary<string, object> { { "state", returnUrl } });
        return Redirect(loginUri.AbsoluteUri);
    }

How do i add the request to access permissions in that? Or do i do it another way?

A: A snoop at the sdk code and i came up wiht:
 public ActionResult Login(string returnUrl)
    {
        var oAuthClient = new FacebookOAuthClient();
        oAuthClient.AppId = AppSettings.GetConfigurationString("appId");
        oAuthClient.RedirectUri = new Uri(AppSettings.GetConfigurationString("redirectUrl"));

        var parameters = new Dictionary<string, object>();
        parameters["state"] = returnUrl;
        parameters["scope"] = "email";

        var loginUri = oAuthClient.GetLoginUrl(parameters);
        return Redirect(loginUri.AbsoluteUri);
    }

not tested it yet and the missus is shouting at me for working late so will have to test tomoz :)

A: You need to use the email permission (the full list is here: http://developers.facebook.com/docs/authentication/permissions/ )
The way to add permissions to the authorization is by appending a comma separated list to &scope= , e.g.:
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream

Update: As you marked, the parameters are passed to the GetLoginUrl() method, although in the codeplex forum they also used ExchangeCodeForAccessToken(), which you might want to take a look at also.
A couple of examples using the C# SDK:
http://blog.prabir.me/post/Facebook-CSharp-SDK-Writing-your-first-Facebook-Application.aspx
Facebook .NET SDK: How to authenticate with ASP.NET MVC 2
http://facebooksdk.codeplex.com/discussions/244568


text:
Q: How to update ShqrePoint Group name? hope everything is fine.
I managed to created / delete SharePoint groups  but also add and remove users using HTTP requests.
The problem i'm facing now is ... how can I update the name of a group ??
I did something which is a mix between the group creation and the addition of user but that throws an error "__metadata does not exist in method GetById"
the problem is i can only reference my group from the ID since the name of the group has changed....
Would someone please be able to help me ...?
Thanks a lot in advance

A: #Config Variables
$SiteURL = "https://xxxxxx.com"
$GroupName= "Sales Portal Members"
$NewGroupName ="Sales Managers"
#Connect PNP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Update the Group Name
Set-PnPGroup -Identity $GroupName -Title $NewGroupName

A: You could try to use js to test the request,after the test is successful,you fill in the value one by one.
This code works well:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>

<script>
$(function(){
$("#btnClick").click(function(){
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getbyId(23)";
$.ajax({
url: requestUri,
type: "POST",
data:JSON.stringify({'__metadata': { 'type': 'SP.Group' }, 'Title':'testing'}),
headers: {
"content-type": "application/json;odata=verbose",
"X-HTTP-Method":"MERGE",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: onSuccess,
error: onError
});
function onSuccess(data) {
alert('Group description updated successfully');
}
function onError(error) {
alert(JSON.stringify(error));
}
});
});
</script>
<input type="button" id="btnClick" value="Update SharePoint Group Details"/>

Then you could find you need to add "X-HTTP-Method":"MERGE" in header.


text:
Q: Master-Slave replication for Mongo4 I have two databases with the same data (~1TB): one for write with no shards and indexes I need for updating, and the second one for reading sharded and indexes only for reading.
How to setup automatic replication between two databases?
I need to have these databases syncronized.
Now I'm using message queue and scripts for moving data, but is there some common solution for this problem?

A:
I have two databases with the same data (~1TB): one for write with no shards and indexes I need for updating, and the second one for reading sharded and indexes only for reading. How to setup automatic replication between two databases? I need to have these databases syncronized.

What you are describing is sync between two deployments. MongoDB's built-in replication only supports replication between members of the same deployment, where all members share a common data history via the replication oplog. With independent deployments that each allow write access, there is no guarantee the deployments will be (or remain) in sync.
If you are working with the same data set, it would be more typical to have a single sharded deployment with appropriate zone sharding and read preferences to achieve the desired workload isolation.
Sharding is also more typically used for horizontal write scaling, with each shard backed by a replica set for redundancy and read scaling.

Now I'm using message queue and scripts for moving data, but is there some common solution for this problem?

If you do want to maintain separate deployments you could consider writing a monitoring script using change streams to watch individual collections (MongoDB 3.6+) or all non-system collections (MongoDB 4.0+). There are also third party tools like Mongo Connector, or you could roll your own solution with message queues (as you have done).
Unless there are strong reasons not to use the built-in replication, I would consider doing so in order to avoid the administrative overhead of syncing and maintaining two deployments.


text:
Q: I want to add more options to my switch statements. Is there any way of achieving that? I have this code:
<input id = "input" type = "text" placeholder = "Type 'Help1' for actions"/>
<button onclick="button()">Confirm</button>

Now say I wanted to add to my case for South. As you can see there's a question for it (and note: there are other cases after this one). I'd like to add something like a yes or no kind of thing and if I type in, "yes" it'll give me something like, "You had fun". And no giving me, "You decided not to explore South Street 2.
Is there anyway of doing something like this? I tried starting another case but that didn't work out. Neither do if and else if statements inside the case.
Any feedback will be greatly appreciated.

A: It sounds like the text is being inserted into the DOM, and the user has to put in another input before the logic continues. This inputting of additional value(s) is asynchronous. The clearest way to express chained asynchronous code flow is with async/await: you can make a function which returns a Promise which resolves when the user presses the button. Whenever you want to implement logic for asking the user, call it and await the Promise.
switch is pretty ugly and verbose, consider using ordinary if/else statements.
Also consider lower-casing the input text, it'll make things a bit easier for the user.
It would also be good to avoid inline handlers, they have too many problems. Attach the listener using Javascript instead.

const button = document.querySelector('button');
const input = document.querySelector('input');
const nextInput = () => new Promise((resolve) => {
  button.onclick = () => {
    resolve(input.value.toLowerCase());
  };
});

const summary = document.querySelector('div');
const display = text => summary.innerHTML = text;
const main = async () => {
  const textInput = await nextInput();
  if (textInput === 'help1') {
    display("[Page 1 of 2. Type 'Help2' for page 2] Commands you can use:

South

North

East

West

North Again

South again
");
  } else if (textInput === 'help2') {
    display("[Page 2 of 2] Commands you can use:
North One More

East Once More

West Once More

South Once More

East Again

West Again
");
  } else if (textInput === 'south') {
    display("You went to the city; street 2. Do you want to explore?");
    const exploring = await nextInput();
    if (exploring === 'yes') {
      display('Exploring');
    } else {
      display('Not exploring');
    }
  }
  // go back to beginning state
  main();
};

main();
<input type="text" placeholder="Type 'Help1' for actions">
<button>Confirm</button>

A: You can nest another switch...case. You just have to be sure you are assigning a value to the answer, or using something like window.prompt which will get an answer.
for example:
switch (textInput) {
  case "Help1":
    text = "[Page 1 of 2. Type 'Help2' for page 2] Commands you can use:

South

North

East

West

North Again

South again
""
    break;
  case "Help2":
    text = "[Page 2 of 2] Commands you can use:
North One More

East Once More

West Once More

South Once More

East Again

West Again
";
    break;
  case "South":
    switch(window.prompt("Do you want to explore?")){
      case "yes":
        console.log("user wants to explore")
        break;
      case "no":
        console.log("user does not want to explor")
        break;
    }
  break
}


text:
Q: NoClassDefFoundError when trying to run android espresso tests I've added the dependencies and it always crash with java.lang.NoClassDefFoundError: android.support.test.espresso.base.BaseLayerModule_ProvideFailureHanderFactory
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.android.support', module: 'support-v4'
    exclude group: 'com.google.code.findbugs'
}

The same problem happens with Espresso 3.0.1. Stacktrace:
Testing started at 6:24 PM ...

04/09 18:24:17: Launching CoordinatorActivityT...
$ adb push /Users/plentz/Projects/example/android/main/build/outputs/apk/debug/main-debug.apk /data/local/tmp/foo.example
    pkg: /data/local/tmp/foo.example
Success

$ adb push /Users/plentz/Projects/example/android/main/build/outputs/apk/androidTest/debug/main-debug-androidTest.apk /data/local/tmp/foo.example.test
$ adb shell pm install -t -r "/data/local/tmp/foo.example.test"
    pkg: /data/local/tmp/foo.example.test
Success

Running tests

$ adb shell am instrument -w -r   -e debug false -e class 'foo.example.ui.activity.CoordinatorActivityTest' foo.example.test/android.support.test.runner.AndroidJUnitRunner
Client not ready yet..
Started running tests

java.lang.NoClassDefFoundError: android.support.test.espresso.base.BaseLayerModule_ProvideFailureHanderFactory
at android.support.test.espresso.DaggerBaseLayerComponent.initialize(DaggerBaseLayerComponent.java:66)
at android.support.test.espresso.DaggerBaseLayerComponent.<init>(DaggerBaseLayerComponent.java:54)
at android.support.test.espresso.DaggerBaseLayerComponent.<init>(DaggerBaseLayerComponent.java:40)
at android.support.test.espresso.DaggerBaseLayerComponent$Builder.build(DaggerBaseLayerComponent.java:123)
at android.support.test.espresso.DaggerBaseLayerComponent.create(DaggerBaseLayerComponent.java:62)
at android.support.test.espresso.GraphHolder.baseLayer(GraphHolder.java:42)
at android.support.test.espresso.Espresso.<clinit>(Espresso.java:51)
at foo.example.ui.activity.CoordinatorActivityTest.coordinatorActivityTest(CoordinatorActivityTest.java:37)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at android.support.test.internal.statement.UiThreadStatement.evaluate(UiThreadStatement.java:55)
at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:270)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1879)

Tests ran to completion.


text:
Q: Unity: keep reference of multiple string from same function I have 4 inputfields, and in each field i need to enter a name. name 1 , name 2 , name 3 , name 4. my issue is that i have a class that get's me the text in the inputfield, and other class that is my manager that handles sending the data i get from the field across the network. My problem is that I can't figure out how to store the all my fields. What i get now in my console is Name 1 = two , name 2 = two. It must be name 1 = one , name 2 = two.
public string name1;
public string name2;
public string name3;
public string name4;

public InputField input;

// Use this for initialization
void Start () {

}

// Called in Inputfield OnEndEdit Event.
public void OnEndEdit()
{
    name1 = input.text;
    name2 = input.text;
    name3 = input.text;
    name4 = input.text;
}

And this is my other script my manager:
    private InputFields inputFields;
    void Start () {

    inputFields = FindObjectOfType<InputFields>();

}
public void GetUserData ()
{
  Debug.Log ("Message 1 " + inputFields.name1 + "Message 2 " + inputFields.name2  + " Message 3 " + "Message 4" );
        }
}

So To recap i have 4 UI inputfields and i just want to get text from them and store them in my string. The inputFields script is attached to each inputfield.

A: Use array. Create array of InputField then you can access it from other script with he index from 0 to 3.
The whole string thing you have won't work because when the value of InputField changes, the string won't update the new value. This is why you have to reference the InputField itself which will always have the new value user entered.
public class ScriptB : MonoBehaviour
{
    public InputField[] input;

    public void GetUserData()
    {
        Debug.Log("Message 1: " + input[0].text + "Message 2: " + input[1].text
            + " Message 3: " + input[2].text + "Message 4: " + input[3].text);
    }
}

If you need to register the events, see this post.


text:
Q: how to draw the text exactly the same as what they are in the NSTextView I used NSTextView for text editing, setting font color and size, without set NSParagraphStyle.
Now I want to hide NStextView and take out NSString or NSAttributedString from NSTextView and draw it on the NSView behind the NSTextView object.
I want the rendered text to be exactly the same as in NSTextView, including fonts, word spacing, line height, line spacing.
What methods should be used to do this?
My current approach is as follows, but the effect is not good.
Line height is not consistent with that in NSTextView. There is also a problem with other details.
NSTextView* textView = [[NSTextView alloc]init];
        [[self contentView] addSubview:textView positioned:NSWindowAbove relativeTo:myView];
        [textView setAutoresizingMask:NSViewWidthSizable];
        [textView setMinSize:NSMakeSize(25, 25)];
        [textView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
        [textView setDrawsBackground:NO];

    [[textView textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];
    [[textView textContainer] setWidthTracksTextView:NO];

    [textView setVerticallyResizable:YES];
    [textView setHorizontallyResizable:YES];
    [textView setTextColor:[NSColor redColor]];
    [textView setFrame: NSMakeRect(200, 200, 25, 25)];  //the textView will auto resize when typing
    [textView setFont:[NSFont fontWithName:@"Arial" size:16.0f];
    [textView setHidden:NO];

//after typing, i will hide the textView and draw the attributedString in myView's drawInRect function.
    NSRect rct = textView.frame;
    [textView setHidden: YES];
    NSMutableAttributedString *textDraw = [[NSMutableAttributedString alloc] initWithAttributedString: textView.attributedString];
    //i get the defaultParagraphStyle to set to NSMutableAttributedString
    [textDraw setAttributes:textView.defaultParagraphStyle range:NSMakeRange(0, textDraw.length)];

    NSMutableDictionary *md = [NSMutableDictionary dictionary];
    [md setObject:[NSColor redColor] forKey:NSForegroundColorAttributeName];
    [textDraw setAttributes:md range:NSMakeRange(0, textDraw.length)];

    [textDraw drawInRect:rct];

A: i have found the answer.
[string drawAtPoint:point] - uses NSTypesetterBehavior_10_2_WithCompatibility, but NSTextView uses NSTypesetterLatestBehavior by default.
i use the code bellow to solve the problem:
[[textView layoutManager] setTypesetterBehavior:NSTypesetterBehavior_10_2_WithCompatibility];

set the TypesetterBehavier the same as NSString draw functions, then the problem disapears.
the origin link is here:
https://zachwaugh.com/posts/nstextview-and-nsstring-differences-in-text-rendering
so the last code is:
    NSTextView* textView = [[NSTextView alloc]init];
    [[self contentView] addSubview:textView positioned:NSWindowAbove relativeTo:myView];
    [textView setAutoresizingMask:NSViewWidthSizable];
    [textView setMinSize:NSMakeSize(25, 25)];
    [textView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
    [textView setDrawsBackground:NO];

    [[textView textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];
    [[textView textContainer] setWidthTracksTextView:NO];

    [textView setVerticallyResizable:YES];
    [textView setHorizontallyResizable:YES];
    [textView setTextColor:[NSColor redColor]];
    [textView setFrame: NSMakeRect(200, 200, 25, 25)];  //the textView will auto resize when typing
    [textView setFont:[NSFont fontWithName:@"Arial" size:16.0f];
    [textView setHidden:NO];
    [[textView layoutManager] setTypesetterBehavior:NSTypesetterBehavior_10_2_WithCompatibility];

and drawing code:
    NSRect rct = textView.frame;
    [textView setHidden: YES];
    NSAttributedString textDraw = textView.attributedString;
    [textDraw drawInRect:rct];


text:
Q: Specify a vaild path to the correct hive jars using $HIVE_METASTORE_JARS or change spark.sql.hive.metastore.version to 1.2.1 When i try to run spark-submit on the Jar which had HiveContext,getting the below error.
Spark-defaults.conf had
spark.sql.hive.metastore.version 0.14.0
spark.sql.hive.metastore.jars ----/external_jars/hive-metastore-0.14.0.jar
#spark.sql.hive.metastore.jars maven

I would like to use Hive Metastore version 0.14. both spark and hadoop are on diff clusters.
Can anyone helping me with resolving this one?
16/09/19 16:52:24 INFO HiveContext: default warehouse location is /apps/hive/warehouse
Exception in thread "main" java.lang.IllegalArgumentException: Builtin jars can only be used when hive execution version == hive metastore version. Execution: 1.2.1 != Metastore: 0.14.0.
 Specify a vaild path to the correct hive jars using $HIVE_METASTORE_JARS or change spark.sql.hive.metastore.version to 1.2.1.
        at org.apache.spark.sql.hive.HiveContext.metadataHive$lzycompute(HiveContext.scala:254)
        at org.apache.spark.sql.hive.HiveContext.metadataHive(HiveContext.scala:237)
        at org.apache.spark.sql.hive.HiveContext.setConf(HiveContext.scala:441)
        at org.apache.spark.sql.SQLContext$$anonfun$4.apply(SQLContext.scala:272)
        at org.apache.spark.sql.SQLContext$$anonfun$4.apply(SQLContext.scala:271)
        at scala.collection.Iterator$class.foreach(Iterator.scala:727)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
        at scala.collection.IterableLike$cla

A: try
val hadoopConfig: Configuration = spark.hadoopConfiguration
hadoopConfig.set("fs.hdfs.impl", classOf[org.apache.hadoop.hdfs.DistributedFileSystem].getName)
hadoopConfig.set("fs.file.impl", classOf[org.apache.hadoop.fs.LocalFileSystem].getName)

in the spark