text:
Q: How to fetch if a new query has been added while($fetchres = mysql_fetch_array($searchquery)) {
        $v1 = $fetchres['v1']; $v2 = $fetchres['v2']; $v3 = $fetchres['v3'];
        $v4 = $fetchres['v4']; $v5 = $fetchres['v5'];
        $v6 = $fetchres['v6'];
        $v7 = $fetchres['v7'];
        }

Hi! How can I set this columns automatically? I mean my system automatically adds a column. For example my system adds a new column 'v8'. But in my code, I only inputted until v7. How can I automatically code this fetching of query by depending on how many columns my system automatically made? Thanks.

A: If you really want to do this, you can use extract($fetchres).
More info about extract
Example:
$fetchres = array('v1'=>'foo', 'v2'=>'bar');
extract($fetchres);
echo '$v1 is ' . $v1 . 'and $v2 is ' . $v2;

A: Use extract.
while ($row = mysql_fetch_assoc($searchQuery))
{
  // Extract the keys of the array into the local symbol table.
  extract($row);

  // Now, all variables exist and you can echo them like this:
  echo $v1;
  echo $v8;
}

You still need to know the names of the variables. If you just want to echo everything inside, use foreach with a key assingnment:
while ($row = mysql_fetch_assoc($searchQuery))
{
  foreach($row as $key => $value)
  {
    echo "$key: $value\n"; // Will output something like 'v1: foo' and 'v2: bar', separated by newlines.
  }
}

A: You could use variable variables for that, although I think this is a really bad idea.

A: I think you actually want this:
while ($fetchres = mysql_fetch_array($searchquery)) {
    foreach ($fetchres as $key => $value) {
        echo $key . ': ' . $value . PHP_EOL;
    }
}


text:
Q: how to divide 2 times with specific time duration have 2 times $dayFrom = 10:00:00; and $dayTo = 12:00:00 i want to divide it in 15 minutes time duration.
Expected Result
10:00:00, 10:15:00, 10:30:00, 10:45:00 and so on
Looking for help

A: $timeArray = array();
$startTime  = new \DateTime("2010-01-01 10:00:00");
$endTime    = new \DateTime("2010-01-01 12:00:00");
while($startTime < $endTime) {
    $timeArray[] = $startTime->format('H:i:s');
    $startTime->add(new \DateInterval('PT 15 M'));
}
echo implode(",",$timeArray);

Here You can go with this code. It will be helpful to you :)

A: You can also try this -
$dayFrom = strtotime('10:00:00');
$dayTo = strtotime('12:00:00');

while($dayFrom <= $dayTo) {
   echo date('H:i:s', $dayFrom);
   $dayFrom= strtotime('+ 15 MINUTES', $dayFrom);
}

Output
10:00:00
10:15:00
10:30:00
10:45:00
11:00:00
11:15:00
11:30:00
11:45:00
12:00:00

strtotime()

A: Another variation on a theme - using DateInterval.
$df='H:i';
$timezone=new DateTimeZone('Europe/London');
$interval=new DateInterval('PT15M');

$ts=date( 'Y-m-d H:i:s', strtotime('10.00am') );
$tf=date( 'Y-m-d H:i:s', strtotime('12.00pm') );

$start=new DateTime( $ts, $timezone );
$end=new DateTime( $tf, $timezone );

while( $start->add( $interval ) <= $end ){
    echo $start->format( $df ).'<br />';
}

A: $dayFrom = "10:00:00";
$dayTo = "12:00:00";
while($endTime<$dayTo){
$endTime = strtotime($dayFrom) + 900;
echo date('h:i:s', $endTime);
}

Try this.

redpajama_set_name: RedPajamaStackExchange


text:
Q: folium.GeoJson (style function) not working as i want import folium ,pandas ,json

df=pandas.read_csv('Volcanoes_2.txt')

def colors(elev):
    minimum=int(min(df['ELEV']))
    step=int(max((df['ELEV'])-min(df['ELEV']))/3)
    if elev in range (minimum,minimum+step):
        col= "green"
    elif elev in range(minimum+step,minimum+step*2):
        col= "orange"
    else:
        col= "red"
    return col

map_1=folium.Map(location=[df['LAT'].mean(), df['LON'].mean()] ,
zoom_start=6,tiles='mapbox bright')

for name, lon, lat, elev in zip(df['NAME'], df['LON'], df['LAT'],
df['ELEV'] ):
    folium.Marker([lat, lon], popup= name,
     icon = folium.Icon(color =colors(elev))).add_to(map_1)

folium.GeoJson(open('world_geojson.json'),
           name='geojson',
           style_function= lambda x :{'fillcolor':'green' if \
  x['properties']['POP2005']<10000000 \
       else 'orange' if 10000000 <x['properties']['POP2005']>20000000 else 'red'},
       ).add_to(map_1)

folium.LayerControl().add_to(map_1)

map_1.save("map.html")

this is the map file https://github.com/xxspider4/new_repo/blob/master/map.html
this is the json file https://github.com/xxspider4/new_repo/blob/master/world_geojson.json

A: You were very close.  I was able to get it to work by changing fillcolor to fillColor in your style function
lambda x :{'fillColor':'green' if \
  x['properties']['POP2005']<10000000 \
       else 'orange' if 10000000 <x['properties']['POP2005']>20000000 else 'red'}


text:
Q: Meta Query compare if meta key is in specified range Posts have a price custom meta field associated with them. On frontend, there is an option to search a post by specifying a price range, such as all posts that's 'price' value is bigger than 1 AND smaller than 10.
Management decided that we have no option to use WooCommerce for whatever out-of-earth reason, so we have to use native Wordpress for this.
This is what I've managed to do as of now as the arguements of get_posts($args)
$args=array(
            'meta_query' => array(
                array(
                    'key' => 'price',
                    'value' => 1,
                    'compare' => '>'
                )
            )
        );

But this only returns posts where 'price' is bigger than 1. I need to have posts which's 'price' field is bigger than 1 AND at the same time smaller than 10.
Is this possible?

A: Try like this:
$args=array(
                'meta_query' => array(
                    array(
                        'key' => 'price',
                       'value' => array(1,10),
                        'compare' => 'BETWEEN'
                    )
                )
            );


text:
Q: energy function of surfaces The arc length of a curve $g(t)$ on a Riemannian manifold $M$ is
\begin{align}
L(g)=\int_a^b <\dot{g},\dot{g}>^{\frac 1 2}dt
\end{align}
Its variational problem is equivalent to that of the energy function
\begin{align}
E(g)=\int_a^b <\dot{g},\dot{g}>dt
\end{align}
For surface on $M$, can we have a similar conclusion?
The variational problem of area is equivalent to that of the energy of the surface?

A: I am not sure if there is a corresponding energy functional, but there does exist generalized length functional.
For any submanifold $N$ in $(M,g),$ we can define the area functional $A(N)$ as we know. This is a natural generalization of your $L,$ since the critical points of $L$ are geodesics, and the critical points of $A$ are minimal submanifolds.
By the way, when calculating the derivative of $A,$ we use $\sqrt{\det g}$ in its local expression, where $g$ is the Riemannian metric. Maybe we can take the square root out to get an energy (not sure if this quantity has been investigated).


text:
Q: SQL : update table from another grouped table I have two tables :
Product (P1)
id,
amount

Price (P2)
id
productId
calibre
amount

I want to update P1 amount column so that it is equal to the sum of P2  amount column per productId.
For example, from
P1
'apple',0
'orange,0

P2
'apple', 'A', 5
'apple', 'B', 6
'orange' 'AA',1
'orange' 'BBB', 3
'orange', 'CCC', 4

After update, P1 is like :
'apple', 11
'orange', 8

I can't find the SQL syntax to achieve this.
If someone knows...
Thank you.

A: Since you didn't tag your DBMS, I think this will be correct for most DBMS's :
UPDATE P1
SET p1.amount = (SELECT sum(p2.amount) FROM P2
                 WHERE p1.productID = p2.productID)

If p1 can have products that won't appear in p2, the you should use nvl functions - every dbms can have different functions to deal with nulls - coalesce,nvl ETC... Then change the sum(p2.amount) to:
COALESCE(sum(p2.amount),0)
NVL(sum(p2.amount),0)

Chose which one that suits you

A: The most efficient way to do your UPDATE query is to do an INNER JOIN of P1 with a temporary table containing the sums of P2:
MySQL:
UPDATE P1
INNER JOIN
(
    SELECT productId, SUM(amount) AS amount
    FROM P2
    GROUP BY productId
) t
    ON P1.id = t.productId
SET P1.amount = t.amount

SQL Server:
UPDATE P1
SET P1.amount = t.amount
FROM P1 INNER JOIN
(
    SELECT productId, SUM(amount) AS amount
    FROM P2
    GROUP BY productId
) t
    ON P1.id = t.productId

I'm hoping that your database is either MySQL or SQL Server.


text:
Q: work vs work out? Scenario:
Person A and B are working for the same project, A found an issue and asked B to fix.
B did some change, and he wants to ask A for double checking if the change has fixed the issue.
So can B ask as:

*

*Please check if it works.

*Please check if it works out.

Which one is correct?

A: When something works, it means it functions correctly.
When something works out, it means it produces the correct end result.
You would say a computer 'works' if it turned on okay, for example:

*

*Turn on the computer and see if it works.

You would say a plan, or a mathematical equation 'works out'. For example:

*

*Can you work out the answer to this equation?

*I hope your plan works out.


text:
Q: CORS error while authorize application to call API Azure AD? Calling the API through fetch() in React but getting CORS error.
https://login.microsoftonline.com/tenant_id/oauth2/v2.0/authorize?client_id=xxxxxxxxxxxxxxxxxxxxx&response_type=code&redirect_uri=http://localhost:3050&scope=user.Read.All&response_mode=query
Above URL has been made from Postman and working fine if pasted directly on the browser.
2.Is there a way to get code securely i.e get the response code in body and not in query?

Tried passing header in the fetch for Allow-access-origin to *.

A: We need to use msal in react to avoid CORS problems. Microsoft also provides some samples for react application, you can see this document. Here I tested this sample code. I also registered an azure ad application and set the redirect url http://locahost:3000, And here's my configuration:
enter image description here
enter image description here
And as you can see in the App.jsx, it uses the code below to generate access token and call graph api with it, it's no need to show auth code in the browser because the token is acquired silently. I think this could meet your requirement.
function RequestProfileData() {
        // Silently acquires an access token which is then attached to a request for MS Graph data
        instance.acquireTokenSilent({
            ...loginRequest,
            account: accounts[0]
        }).then((response) => {
            callMsGraph(response.accessToken).then(response => setGraphData(response));
        });
    }

========================UPDATE==================
For your question 2, I think this may help you:


text:
Q: IBDesignable controls and Cocoa bindings Having created an IBDesignable control for use in Interface Builder, it looks like Cocoa bindings are only available for its "Hidden" property and Tooltip parameter. Am I missing something here? Is it not possible to bind the control's value?

A: The two bindings exposed by NSControl are in fact inherited from NSView - NSControl itself exposes no additional bindings. Apple provides information about all available bindings in its Introduction to Cocoa Bindings. If you want to use bindings within your control you should consider adding more specialized subviews to the control (e.g. NSTextField, NSImageView) and exploiting their bindings.


text:
Q: Cordova + Webpack + Hot Module Replacement (HMR) как настроить для разработки? Как настроить проект для разработки приложений под Codova, с использованием вебпака, да еще и с горячей заменой модулей HMR. Чтобы при изменении кода, твое приложение на телефоне реалтайм обновлялось?

A: Ох лол, че придумал, ну короче я просто сделал айфрейм который настраиваю на вебпак дев сервер)))) куда деваться, но если кто-то напишет плагин для кордовы и вебпака, буду благодарен
просто кидаю в файл cordova/www/index.html такой код:

    <meta charset="UTF-8">
    <title>Main Transrus</title>
    <meta name='viewport'
          content='user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width'>

Загрузка...


text:
Q: How to alphabetically sort a multi-dimensional array according to certain key value(PHP) How can I write a functional to alphabetize a multidimensional array such that the first sort is by 'building name' then 'last_name', then 'first_name'
 [70] =>
  Array (
    [id] => 635
    [name] => Mick Kruzic
    [dob] => 11/05/1968
    [building_name] =>
    [department] =>
    [phone_ext] =>
    [team_name] =>
    [team_leader] =>
    [party_registered] =>
    [total_points] => 0
    [total_tickets] => 0
    [awarded_prizes] => 0
    [processing_prizes] => 0
    )

A: usort is your friend.
function cmp($a, $b){
    // compare building, e.g. using strcmp
    // compare last_name
    // compare first_name
    // return 0 ($a == $b), -1 ($a < $b) or 1 ($a > $b)
}

usort($array, 'cmp');

A: The function you want to look into is array_multisort(). http://php.net/manual/en/function.array-multisort.php
You can use it to sort a multi dimensional array, or sort several arrays together.
Make an array of just the keys you wish to sort by then use that array as the second parameter.
so for example if you whole array was $data:
foreach($data as $smallarray) $buildingnames[] = $smallarray['building_name'];
foreach($data as $smallarray) $lastnames[] = $smallarray['last_name'];
foreach($data as $smallarray) $firstnames[] = $smallarray['first_name'];
array_multisort($builingnames, ASC, $firstnames, ASC, $lastnames, ASC, $data);


text:
Q: Tab Completion in Linux for "java" command I wrote a java program with vim on a Linux operating system in the terminal.
It is possible to tab complete the program name with vim by typing vim then the beginning of the file name vim he and then press tab. (=> vim helloworld.java)
But when I execute the program with the javacommand there is no tab completion for the filename.
I can type java hellow, press tab but nothing happens, I have to write out the full file name.
So why is it that tab completing file names in commands with vim, mv or cd works, but not with the java command?
And is there a way to enable tab completion for java commands?

A: This depends on the shell you use.
In bash there must be a completion specification (compspec) for each command.
You can display the current compspec for a command name with
complete -p java
bash: complete: java: no completion specification

A simple approach (which you can put in ~/.bashrc or as a separate file in /etc/bash_completion.d/) is
complete -o default java

or you can narrow possible results with something like
complete -G "*.jar" java

A: Adding a completion for a command is a good approach, but you can force bash to do filename completion with Esc / instead of the default context sensitive completion that you get with tab


text:
Q: Searchable dropdown list goes behind the update panel when expanding I have  a dropdown list with search feature inside an update panel. But when expanding the dropdown list it goes behind the update panel as in the screenshot. Seems like it is because of the opacity (BackgroundCssClass) of ModalPopupExtender. How can I solve this issue?
  <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">

  <link href="Scripts/dropdownlist/select2.css" rel="stylesheet"/>

    </asp:Content>

    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
   <asp:ScriptManager ID="ScriptManager1" runat="server">
  </asp:ScriptManager>

   <asp:LinkButton ID="linkbtn_show" Style="margin-right: 15px" runat="server" class="lightbtnHyperlink-menu">
        New</asp:LinkButton>
<cc1:ModalPopupExtender ID="mp1" runat="server"   PopupControlID="Panl1addvehicle" TargetControlID="linkbtn_show"
     BackgroundCssClass="modalBackground"  >
</cc1:ModalPopupExtender>
<asp:Panel ID="Panl1addvehicle" runat="server" Style="display: none">
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>

               <asp:DropDownList ID="DropDownList2" runat="server" AppendDataBoundItems="true"
                    AutoPostBack="true" Height="25px"  Width="188px" >
                     <asp:listitem text="Select Color"></asp:listitem>
            <asp:listitem text="Red"></asp:listitem>
            <asp:listitem text="Green"></asp:listitem>
            <asp:listitem text="Blue"></asp:listitem>
            <asp:listitem text="Pink"></asp:listitem>
            <asp:listitem text="Yellow"></asp:listitem>
            <asp:listitem text="Lime"></asp:listitem>
                </asp:DropDownList>

        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
</asp:Content>


text:
Q: dimexpr: multiplication with constant real factor from macro I want to multiply a constant from a macro with a deimension using dimexpr.
When using real numbers the decimal point and the decimal digits are typeset behind the result and the result is a mutliplication with the floor value of the constant used.
\documentclass{report}
\begin{document}
  \def\const{1.9}
  \noindent
  \the\dimexpr \linewidth*\const\relax \newline
  \the\dimexpr \linewidth*\numexpr\const\relax\relax \newline
  \the\linewidth
\end{document}

The second multiplication is an attempt to use the suggestion from here, to wrap the macro in a sub expression

A: \dimexpr doesn't allow arbitrary calculations: you need to have things in the correct form. In particular, if you want to multiply a dimension by a decimal then you need to use the form
<multiple><dimension>

So you example will work with
\the\dimexpr\const\linewidth\relax

while the format
\the\dimexpr\linewidth*\const\relax

can only be used if \const is an integer.
(The linked answer Multiplication with dimexpr? does mention this limitation.)


text:
Q: ¿ Control select con AutoPostBack = true y OnSelectedIndexChanged? Tengo unos controles html que mediante runat="server" los uso en el lado del servidor. El problema es que con el elemento "Select" al seleccionar un elemento me debe ejecutar codigo en servidor para cargar datos en otros "Select" pero no me acepta el AutopostBack="true" ni OnSelectedIndexChanged
<select id="mySelect" name="mySelect" runat="server" AutoPostBack="true"  OnSeletedIndexChanged="mySelect_SelectIndexChanged"></select>

A: En vez de usar 'OnSelectedIndexChanged' (tienes una typo ahí) puedes intentar usar el evento de cliente 'onchange':
<select id="mySelect" ... onchange="selectChanged()">

y en tu JavaScript:
function selectChanged() {
     var myValue= document.getElementById("mySelect").value;
     __doPostBack('mySelect', myValue);
 }

Tras esto, se llamará al postback de la página, que podrás usar para recoger la información enviada (myValue) en el code behind mediante la propiedad Request.Params.

A: Utiliza asp:DropDownList que al igual que el Select sirve para seleccionar un único elemento de una lista.
<asp:DropDownList id="AutosList" AutoPostBack="True" OnSelectedIndexChanged="AutosList_SelectIndexChanged"
                    runat="server">
      <asp:ListItem Value="1">Ford</asp:ListItem>
      <asp:ListItem Value="2">Toyota</asp:ListItem>
      <asp:ListItem Value="3">Ferrari</asp:ListItem>
 </asp:DropDownList>


text:
Q: Automatização de processo - Excel - VBA Estou tentando automatizar um processo do meu serviço. Entretanto ao rodar o código ele diz que "A variável do objeto ou a variável do bloco 'With' não foi definida".
O que gostaria que ele fizesse é:

*

*Que identificasse a barra do site onde é para inserir o Cnpj e dentro da celula 3 coluna 1 inserir esse dado.

*Realizar esse processo porém com o os dados do captcha.

*

*Dúvida: Como seria possível traduzir ou "burlar" o capthca nessa situação?

Sub PullData()

    Dim HTMLDOC As HTMLDocument

    Range("B3:D3").ClearContents

    Set ie = CreateObject("internetexplorer.application")

    ie.navigate "https://cvmweb.cvm.gov.br/swb/default.asp?sg_sistema=fundosreg"
    ie.Visible = True

    Do While ie.busy And ie.readyState <> "READYSTATE_COMPLETE"
        DoEvents
    Loop

    HTMLDOC.getElementsByid("txtCNPJNome")(0).Value = Cells(3, 1).Value
    ie.document.getElementsByTagName("numRandom")(0).Value = Cells(3, 2).Value
    ie.document.getElementsByTagName("btnContinuar")(3).Click

    Do While ie.busy And ie.readyState <> "READYSTATE_COMPLETE"
        DoEvents
    Loop

    Cells(4, 2) = ie.document.getElementsByName("td")(0).innertext
    Cells(4, 3) = ie.document.getElementsByTagName("td")(1).innertext
    Cells(4, 4) = ie.document.getElementsByTagName("td")(2).innertext

    ie.Quit

    Range("A3:D3").WrapText = False

    For Each aba In ThisWorkbook.Sheets
        aba.Columns("A:F").AutoFit
    Next

End Sub
```

A: Se entendi bem sua questão, vc quer pegar as informações do formulário e jogar nas células.
Mas nesse momento vc está fazendo o contrário.
...
    HTMLDOC.getElementsByid("txtCNPJNome")(0).Value = Cells(3, 1).Value
    ie.document.getElementsByTagName("numRandom")(0).Value = Cells(3, 2).Value
...

Cells(3, n).Value tem que estar ao lado esquerdo do sinal de atribuição.


text:
Q: 'int' object has no attribute '__getitem__' when using enumerate? I'm trying to make a tic tac toe game, the problem is the function that checks the table and then updates it with the players '0' or 'X' at the chosen index.
Please tell me how I can fix this because I can't see what's wrong with this.
table = [['1','2','3'],
         ['4','5','6'],
         ['7','8','9']]

def title():
    for row in table:
        print row

def check(indx, sym):
    for indd, row in enumerate(table):
        for ind, cell in enumerate(row):
            if cell == indx and cell != '0' or cell != 'X':
                table[indd][ind] = sym
            else:
                return False

def main():

    moves_left = 1
    while moves_left > 0:
        if moves_left == 1:
            title()
            indx = raw_input('Where do you want your nought?: ')
            new_table = check(indx, '0')
            if new_table != False:
                moves_left += 1
            else:
                print 'Invalid selection'
        elif moves_left == 2:
            title()
            indx = raw_input('Where do you want your cross?: ')
            new_table = check(indx, 'X')
            if new_table != False:
                moves_left -= 1
            else:
                print 'Invalid Selection'
        else:
            print 'it\'s a draw'

if __name__=='__main__':
    main()

My Traceback:
Traceback (most recent call last):
  File "tictac.py", line 45, in <module>
    main()
  File "tictac.py", line 28, in main
    new_table = check(indx, '0')
  File "tictac.py", line 19, in check
    table[indd[ind]] = sym
TypeError: 'int' object has no attribute '__getitem__'

A: Change
table[indd[ind]] = sym # you're treating an integer like a list, which is wrong

to
table[indd][ind] = sym

in order to access the cell at the 'indd'th row & 'ind'th column.
Actually, table[indd[ind]] is a short hand for doing this:
table.__getitem__(indd.__getitem__(ind))

& integers don't have a getitem() special method.

A: DeveloperXY already got your immediate problem.  There are several more.  The one vexing you at the moment is because your if logic is incorrect:
if cell == indx and cell != '0' or cell != 'X':

Either use parentheses, or learn the order of evaluation for Boolean operators.  Among other things, this statement must always come up True at the start: every cell is something other than 'X'.  Since you perform the update for every cell in the loop, you change them all to '0'.
Instead, you need to design logic that finds the one cell you want to change (at cell == indx) and then changes only that one cell.  Try this for starters:
def check(indx, sym):
    for indd, row in enumerate(table):
        for ind, cell in enumerate(row):
            if cell == indx:
                table[indd][ind] = sym
print table  # I added this to watch what happens to the actual game state.

Note that I got rid of the return value: you were returning either None or False, which have the same effect in the statement if new_table.
By the way, notice that if you return True from check, then moves_left becomes 2, and your main program goes into an infinite loop.
Now, note that your title function pays no attention at all to the game state: it won't print anything but the initial numbering.
Does that move you along far enough to close this issue?


text:
Q: Filter results to columns with data and 2 or more conditions I have a database (L1:AC),
The title is from M1:AC  with 3 categories (tv shows, music, movies)
I want to apply filters in a way it only appears columns where I have data. Columns where I have no data should not appear in filter results.
I have formulas in BD!B3 for titles and BD!B4 for results.
2 problems with my current formulas, in BD!B4 i only get one row of results and I want to get all corresponding. I would also like to have chance of applying a second condition to the filter.
I have a second sheet "desired results" where I exemplify the results I want to obtain.
Can someone help?
Many thanks for the help.
Sheet here (feel free to edit)
https://docs.google.com/spreadsheets/d/1MOKCaIVDWM18QvPBUUXoUXYXMeS3rPJaJFaig5-72vE/edit?usp=sharing

A: use:
=QUERY(FILTER(M$2:AD; REGEXMATCH(""&COLUMN(M:AD);
 JOIN("|"; ""&MATCH(B2; A$1:AD$1; 0)+{1\2\3\4\5\6}))); "where 1=1 "&
 IF(D2=""; "and Col1 is not null";" and Col1 = '"&D2&"'"); 1)


text:
Q: Can a large transitive permutation group need many generators? let $G$ be a transitive permutation group acting on $\{1, \ldots, n\}$, and let $d(G)$ be the minimal number of generators of $G$. Is it true, that for $n\rightarrow\infty$ we have $\frac{d(G)\log|G|}{n^2}\rightarrow 0$? If this is true, can you give a complete list of groups with $\frac{d(G)\log |G|}{n^2}\geq \frac{\log 2}{4}$, i.e. groups which are "worse" than $C_2$?
I believe the answer to the first question is yes, because a transitive group on $n$ letters needs $\mathcal{O}(\frac{n}{\sqrt{\log n}})$ generators, thus if $\frac{d(G)\log|G|}{n^2}$ is large, then $|G|>e^{cn\sqrt{\log n}}$. But then $G$ must involve quite large alternating or symmetric sections, which should imply that $G$ is actually quite easy to generate. I guess that the answer to the second question involves only subgroups of $S_4$, although I am not too certain about that.

A: Let $G$ be a permutation group of degree n, and let $r>1$ be the minimal block size of $G$. Also, let $s:=n/r$, so that G may be viewed as a subgroup in the wreath product $R\wr S$, where $R\le Sym(r)$ is primitive, and $S=\pi(G)\le Sym(s)$ is transitive ($\pi$ here denotes projection $G\rightarrow Sym(s)$). Then
$$d(G)\le \frac{a(R)bs}{\sqrt{\log_{2}{s}}}+d(S) \text{   ($\ast\ast$})$$
where b is an absolute constant, and $a(R)$ denotes the composition length of R. By a result of Pyber and Guralnick, $a(R) \le C\log_{2}(r)$ for an absolute constant $C$. Also, as you mentioned, $d(S)\le cs/\sqrt{\log_{2}{s}}$, for an absolute constant c. (For information on the constants $b,c$, and $C$, and on the bound at ($\ast\ast$), see http://arxiv.org/abs/1504.07506 .)
Now, we also have $\log{|G|}\le \log{|R\wr S|}\le rs\log{r}+s\log{s}$. This means that your first claim follows when $r>\sqrt{\log{s}}$, for example. Thus, it only remains to deal with the case $r\le \sqrt{\log{s}}$.
As you said, the key seems to be reducing the upper bounds when S is either $Alt(s)$ or $Sym(s)$. However, I think that a bound of the form $d(G)\le c'd(R)+2$ would be difficult to prove in this case, and is probably not true. For example, when $R=C_2$ and $K$ is the intersection of $G$ with the base group of the wreath product, then the number of generators for $K$ as an $S$-group can grow as $bs/\sqrt{\log{s}}$, where b is as above (see Section 3.1 of the paper I mentioned above).
EDIT: @Jan-Christoph Schlage-Puchta The first part of your question, that is, that for a transitive permutation group of degree $n$, $\frac{d(G)\log{|G|}}{n^{2}}$ tends to $0$ as $n$ tends to $\infty$, has now been proved in http://arxiv.org/abs/1601.02561 .


text:
Q: Differentiation under the integral Now I have this expression.
$\psi(\theta)=\text{log}\int_{-\infty}^{\infty}\exp{\{\Delta\theta-f(\nu)\Delta^2\}}h(\Delta)d\Delta$. The expression of  $h(.)$ is not given. So $h(\Delta)$ is some function of $\Delta$ which is not given. What is $\psi'(\theta)$?.

A: Differentiation with respect to $\theta$ will give
$$
\psi'(\theta)=\frac{\int_{-\infty}^{\infty}\Delta\exp{\{\Delta\theta-f(\nu)\Delta^2\}}h(\Delta)\ \mathrm{d} \Delta}{\int_{-\infty}^{\infty}\exp{\{\Delta\theta-f(\nu)\Delta^2\}}h(\Delta) \ \mathrm{d}\Delta}.
$$


text:
Q: setting the max-width property on CSS uncenter the elements in the row I am coding a page with Bootstrap 3. I have a container and inside it I placed a row, split into 2 columns (col-6) with centered text (text-align: center on the parent, cascading to every child). The problem is one of these 2 columns is too wide since has more text than the other. I then set the max-width to render them equally but now on the screen they are pulled on the left part of the screen, not perfectly centered. How to center them again mantaining the max-width property?
HTML

Servizi Per i Privati

GET ON BOARD si occupa della formazione professionale e linguistica di giovani professionisti, orientati ad un mondo del lavoro sempre piu' competitivo ed internazionale. Mettiamo a disposizione per i privati numerosi servizi quali:

Corsi individuali di formazione online e/o in presenza volti alla preparazione dei candidati a
          sostenere colloqui di lavoro in lingua inglese.

Corsi di inglese standard e commerciale a seconda delle esigenze del cliente..

Corsi di lingua italiana per stranieri individuali o di gruppo, presso privati o aziende

Preparazione di colloqui di lavoro per vari settori tra cui Pharma, Oil and Gas, Hospitality, Food & Beverage…

Ottimizzazione di profili Linkedin

Organizzazione di seminari e workshop formativi internazionali con docenti e ricercatori specializzati.

CSS
.servizi_jumbotron {
    background: url("../images/students.jpg");
    width: 100%;
    height: 20vw;
    margin: 0;
    color: #ffffff;
    font-size: 30px;
    text-shadow: 1px 1px 1px #222;
    min-height: 200px;
}

.servizi_title {
    font-size: 45px;
}

.service_box {
    max-width: 450px;
}

A: First of all you're missing

 tags.
You've used col-md-6 class for service_box elements. That means below md they will use 100% of parent witdh. If you want to keep column width at 50% of parent then just use col-xs-6 and add offset below md. You don't need to set max-width. Although I would rather make it bigger on smaller screens. Like this:

.servizi_jumbotron {
    background: url("../images/students.jpg");
    width: 100%;
    height: 20vw;
    margin: 0;
    color: #ffffff;
    font-size: 30px;
    text-shadow: 1px 1px 1px #222;
    min-height: 200px;
}

.servizi_title {
    font-size: 45px;
}

.service_box {

}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

Servizi Per i Privati

GET ON BOARD si occupa della formazione professionale e linguistica di giovani professionisti, orientati ad un mondo del lavoro sempre piu' competitivo ed internazionale. Mettiamo a disposizione per i privati numerosi servizi quali:

Corsi individuali di formazione online e/o in presenza volti alla preparazione dei candidati a
          sostenere colloqui di lavoro in lingua inglese.

Corsi di inglese standard e commerciale a seconda delle esigenze del cliente..

Corsi di lingua italiana per stranieri individuali o di gruppo, presso privati o aziende

Preparazione di colloqui di lavoro per vari settori tra cui Pharma, Oil and Gas, Hospitality, Food & Beverage…

Ottimizzazione di profili Linkedin

Organizzazione di seminari e workshop formativi internazionali con docenti e ricercatori specializzati.

A: You can use css display flex property to center "service_box". There are also other ways to make it center.

.servizi_jumbotron {
    background: url("../images/students.jpg");
    width: 100%;
    height: 20vw;
    margin: 0;
    color: #ffffff;
    font-size: 30px;
    text-shadow: 1px 1px 1px #222;
    min-height: 200px;
}

.servizi_title {
    font-size: 45px;
}

.service_box {
    max-width: 450px;
}
.flex-row{
  display: flex;
  justify-content: center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

Servizi Per i Privati

GET ON BOARD si occupa della formazione professionale e linguistica di giovani professionisti, orientati ad un mondo del lavoro sempre piu' competitivo ed internazionale. Mettiamo a disposizione per i privati numerosi servizi quali:

Corsi individuali di formazione online e/o in presenza volti alla preparazione dei candidati a
          sostenere colloqui di lavoro in lingua inglese.

Corsi di inglese standard e commerciale a seconda delle esigenze del cliente..

Corsi di lingua italiana per stranieri individuali o di gruppo, presso privati o aziende

Preparazione di colloqui di lavoro per vari settori tra cui Pharma, Oil and Gas, Hospitality, Food & Beverage…

Ottimizzazione di profili Linkedin

Organizzazione di seminari e workshop formativi internazionali con docenti e ricercatori specializzati.


text:
Q: ASP.NET Core 5.0 - Redirecting non-WWW to WWW in Azure I have an ASP.NET Core 5.0 app and I've tried to use very simple code inside Startup.cs to be sure that all requests without www would be redirected to www domain (and http to https).
I've specified my domain to avoid the situation that the rule applies also to myapp.azurewebsites.net as the app is hosted in Azure (without the domain list I was getting www.myapp.azurewebsites.net). While URL http://www.example.com/Test is properly redirected to https://www.example.com/Test, for https://example.com/Test nothing happens - I get error 404 Not found. I'll appreciate any suggestions.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    string[] domains = { "example.com" };
    app.UseRewriter(new RewriteOptions().AddRedirectToHttpsPermanent().AddRedirectToWwwPermanent(domains));

    app.UseHsts();
    app.UseHttpsRedirection();
    (...)
}

I've found few similar questions, but they were for pre-3.0 Core and the logic of AddRedirectToWwwPermanent changed in 3.0. Maybe it'd be better to do it in web.config, but I saw some information that it's recommended to use Rewrite middleware for Core apps... Or maybe as it's hosted on Azure (Windows) I should explore option .AddIISUrlRewrite(iisUrlRewriteStreamReader)?
Side question: not sure if I should keep all three https redirections "rules": .AddRedirectToHttpsPermanent(); app.UseHsts(); app.UseHttpsRedirection(). They seem a bit overlapping, but not sure which to keep (or it's fine to have all three together).


text:
Q: tring to take read only and write protect of flash drive I have a 125 GB flash drive that is read only and when i take that off then it goes to write protected. and goes back and forth between the two how can i fix it so it wont be read only and take the write protection off at same time. I have win 7 HP on dell Optiplex 3010 8 GB ram and 500 GB hard drive. i still looking on line for a answer.  I have used coomand prompt as administrator and took the read only off then when i try to format then it say's it write protected.

A: In most cases the following steps will solve this kind of problem:

*

*Open command line as an administrator.

*type: diskpart

*list disk

*select disk x where x is the number of your pendrive

*attributes disk

*If read-only is yes, type: attributes disk clear readonly
source: http://www.makeuseof.com/tag/format-write-protected-usb-flash-drive/
If this doesn't solve your problem, I suggest trying the Apacer USB3.0 Repair Tool


text:
Q: Late static binding & isset in PHP prior 7.0 The following code works as expected on PHP 7.0 and newer:
class foo {
    const BLAH = [];

    public function bar() {
        return isset(static::BLAH['baz']);
    }
}

var_dump((new foo)->bar());

While PHP 5.6 just gives:
Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead)
Changing the code as suggested leads to a notice (which is expected):
Notice: Undefined index: baz
This would work:
class foo {
    const BLAH = [];

    public function bar() {
        return null !== static::BLAH['baz'];
    }
}

var_dump(@(new foo)->bar());

Is there an alternative that doesn't end in a notice, without prefixing the call with an @?

A: You can make use of array_key_exists instead, which should work without any issue with PHP5.
return array_key_exists('baz', static::BLAH);

Note that a minor difference with isset is that array_key_exists will always return true if static::BLAH['baz'] is defined, whereas isset will return false if it's defined but its value is null.


text:
Q: Firebird database tuning for multiprocessor I'm running a software called Fishbowl inventory and it is running on a firebird database (Windows server 2003). At this time the fishbowl software is running extremely slow when more then one user accesses the software. I'm wondering if anyone could provide some information on tuning the database or best practices? We are currently running a dell power edge 2700 dual quad core with 4 gig's of ram. Any help would be greatly appreciated.
Thank you in advance. Robert

A: I do report development for Fishbowl Inventory (2009.1-2010.2) and my business partner is a Fishbowl VAR. We have dealt with customers with slow databases. oGive me a shout at ilopez at fishbowlreports dot com
It is odd that your server with those specs is showing lag, but It is not unheard of.
Top Three Things To Keep In mind
1) Database Size - The larger the db, the more rows it has to deal with when working on reports/updates, etc.
2) Activities - Certain activities pound on the server
3) Version - The newer fishbowl versions have additional indexes on the tables, which allow faster queries
In my experience most of the tasks increase in time linearly by the work done. see: http://www.fishbowlinventory.com/forums/viewtopic.php?f=16&p=5240 - I did some benchmarking on Fishbowl Inventory 2009.3, hope to do the same in Fishbowl 2010.2 (Once it is released).
-Israel

A: For good tuning information on Firebird database: look at the documentation you can find on www.ibphoenix.com.

A: I think the problem is not from the Firebird Database. IbPhoenix can help you but you also have to ask your Fishbowl ressealler.

*

*First thing : choosing between Firebird SuperServer or Firebird ClassicServer

*Increase cache for database

other interresting links :

*

*http://www.ibphoenix.com

*http://www.ibsurgeon.com/knowledgebase/

*http://www.sinatica.com/

A: Take a look in Firebird Performance in Detail video from Dmitry Yemanov (chief of Firebird development team). Also, if you are using SuperServer, make sure that FB is attached to a single CPU/core (check CPUAffinity parameter in firebird.conf).

A: Usually. A bad transaction handling from client part, produce a lot o record versioning. Extract using gstat statitistical data and look for "total version" for each table. Ideal value is 0 for every table. When total  version is greather than total efectives records, we are in trouble.


text:
Q: How to repeatedly enter a string until user enters keyword to stop loop in java I am stuck in this program that is string method, my issue is that I cannot get the loop to stop and the program to print the output that is currently stored after the keyword has been entered. I am not trying to compare strings, I am trying to input multiple strings and add a word, in this case, "not" to the strings until the word "stop" is entered. Once "stop" has been entered. the system will output the entire string stored.
Here is the question for the program:
 (StringConcat.java) This program asks the user to repeatedly enter a String.  It ,should concatenate those Strings together, but insert spaces and the word "not" between every pair of words the user enters.  Stop when the user enters the String "stop".  Display the final String.  For instance, the program output might look like:
Please enter some Strings:
"Such"
"eyes"
"you"
"have"
"stop"
"Such not eyes not you not have"
Here is my code so far:
import java.util.*;
public class StringConcat{

  public static void main(String [] args){

  Scanner sc = new Scanner(System.in);
  String s = new String();
     System.out.print("Please enter some Strings: ");
  for(int x=0; x<s.length(); x++){
     s = sc.nextLine();
     s = s + "not ";
     if(s == "stop"){
     System.out.println(s);
     break;
     }
     else{
     continue;
     }
   }
  }
}

A: Use while loop.
Why while loop?
Usually we have to use while loops always when we don't know the number of loops we will do. In this case only when the user inputs "stop".
So you need a String field to hold the user words. Also we can use a number field to track if is the first or the second word, thinkg in append the "not" word.
Then, take a look in this example:
Scanner s = new Scanner(System.in);
String currentAnswer = "";
String userWords = "";
int tracker = 0;

while (!currentAnswer.equals("stop")){
     currentAnswer = s.nextLine();
     userWords += currentAnswer + " ";

     if (tracker % 2 != 0) {
         userWords += "not ";
     }

     tracker++;
}

System.put.println(userWords);

This can be done using for loop too but I really recommend the while loop to this case.
EDIT:
As you saw, I used equals() instead == to compare two Strings because we are wiling to check for its value, not for its object equality.
When we use == operator we are trying to check if two objects target to the same memory adress, but we only want to know if two Strings have the same value.
For this case is valid to know that we can compare it using other ways, such as Objects.equals() or even contentEquals().
Check this discussion to learn more about comparing strings.

A: Several issues with your code:
(1) Why do you use a for loop and iterate up to s.length() when the length of s (which is 0 at that point) has nothing to do with your problem?
You need a loop which has not predefined number of iterations like a while (true) from which you will exit with a break.
(2) In each iteration you get the user's input and store it in s, so you lose all previous values.
You need a separate variable to store the user's input.
(3) The continue statement is not needed as the last statement in a loop.
(4) Because at each iteration you append " not " at the end, after the loop has finished you must delete that last " not " from s
(5) Don't use == when you compare strings. There is the method equals() for this.
This is my solution:
Scanner sc = new Scanner(System.in);
String s = "";
System.out.print("Please enter some Strings: ");
while (true){
    String input = sc.nextLine();
    if(input.equalsIgnoreCase("stop"))
        break;
    s += input + " not ";
}
if (s.length() >= 5)
    s = s.substring(0, s.length() - 5);
System.out.println(s);


text:
Q: Connection to local SQL Server database works on emulator but fails on real device I am trying to connect to an SQL Server database that is currently hosted on my local machine. I am using the following code to connect:
public class DBConnect {

    private static volatile DBConnect INSTANCE = null;
    String URL = "";
    Connection conn = null;
    Statement statement = null;
    ResultSet resultSet = null;

    private DBConnect() {

    }

    public static DBConnect getInstance() {
        if (INSTANCE == null) {
            synchronized (DBConnect.class) {
                INSTANCE = new DBConnect();
            }
        }
        return INSTANCE;
    }

    public void setConnection(String DBName, String UserName, String Password) {
        try {
            Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
            URL = "jdbc:jtds:sqlserver://192.168.0.81:1433;instanceName=SQLEXPRESS;DatabaseName=" + DBName + ";integratedSecurity=true;user=" + UserName + ";password=" + Password;
            conn = DriverManager.getConnection(URL);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

This works on my Genymotion emulator since I also executed a select and seen the results being displayed.
I am using the JTDS driver to do this
However when I try with a real device that is on the same Wi-Fi network it doesn't work, I get a connection error.
Any ideas why I am getting this?
This is my error log:
java.sql.SQLException: Network error IOException: failed to connect to /192.168.0.81 (port 1433) after 90000ms
07-18 08:29:09.465  27413-27514/ordermanager.sentosa.ro.ordermanager W/System.err﹕ at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:410)
07-18 08:29:09.466  27413-27514/ordermanager.sentosa.ro.ordermanager W/System.err﹕ at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:187)
07-18 08:29:09.466  27413-27514/ordermanager.sentosa.ro.ordermanager W/System.err﹕ at java.sql.DriverManager.getConnection(DriverManager.java:175)
07-18 08:29:09.467  27413-27514/ordermanager.sentosa.ro.ordermanager W/System.err﹕ at java.sql.DriverManager.getConnection(DriverManager.java:140)
07-18 08:29:09.467  27413-27514/ordermanager.sentosa.ro.ordermanager W/System.err﹕ at ordermanager.sentosa.ro.ordermanager.utils.DBConnect.setConnection(DBConnect.java:39)

A: Two possible solutions to your problem that i can see:

*

*your are using a Genymotion emulator which is probably working on a different network

*check if your SQL Server database is accessible in online mode by setting this:
ALTER DATABASE database-name SET ONLINE

A: Your problem might get solved by simply TURNING OFF the WINDOWS FIREWALL. Firewall will prevent your real device from establishing connection with your local MS SQL server.
By doing so it worked fine for me.
BUT since turning off firewall is not a good idea, configure the Windows Firewall for Database engine access, click this link and follow the steps.
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-a-windows-firewall-for-database-engine-access?view=sql-server-ver15


text:
Q: Finiteness of the set of zeros Please help me with the following problem:
Let $f$ be a continuous function, linearly bounded, i.e.
$$x+A<f(x)<x+B$$
We also now, that there exists an $x_0>0$ such that
$$f(x)=x+C,\quad x>x_0.$$
Let $g$ be a probability density function supported on $[0,\infty)$.
We can assume that $g$ may be as smooth as we want.
Fix $\gamma\in(0,1)$ and $d>0$.
The problem, bothering me for a very long time is how to show that the $h(x):[0,\infty)\to\mathbb{R}$ defined by
$$h(x)=-1+\gamma g(0) f(d+x)+\gamma\int_{0}^{d+x}f(y)g'(d+x-y)dy$$
has only finitely many zeros.
I actually show that for $x$ large enough $h(x)<0$, so I need to show that this equation has only finitely many zeros on any compact interval $[0,x_1]$


text:
Q: Woocommerce: Disable login requirement for appointment cancelation URL adress [wp nonce] I am using woocommerce + plugin for appointments calendar. People can book their appointment right from the product and create a purchase.
If they want to cancel this appointment they can do it from my-account area by clicking at cancel button.
Cancelation URL adress slug is generated by system and it looks like this:
/?cancel_appointment=true&appointment_id=442&redirect&_wpnonce=c328e0bab6

When you are logged out it does not work and when you are logged in your appointment will change status to canceled.
What I need to do is to change the requirement of the URL authorization so when you are logged out it will let you cancel the appointment because here is creating of accounts really annoying for the customers.
This is a part of the code I have found in files of the plugin. Maybe it should help.
/**
 * Returns the cancel URL for an appointment
 *
 * @param string $redirect
 *
 * @return string
 */
public function get_cancel_url( $redirect = '' ) {
    $cancel_page = get_permalink( wc_get_page_id( '' ) );

    if ( ! $cancel_page ) {
        $cancel_page = home_url();
    }

    return apply_filters(
        'appointments_cancel_appointment_url',
        wp_nonce_url(
            add_query_arg(
                array(
                    'cancel_appointment' => 'true',
                    'appointment_id'     => $this->get_id(),
                    'redirect'           => $redirect,
                ),
                $cancel_page
            ),
            'woocommerce-appointments-cancel_appointment'
        ),
        $this
    );
}

Another code I have found is here
<?php
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

/**
* Handle frontend forms
*/
class WC_Appointment_Form_Handler {

/**
 * Hook in methods
 */
public static function init() {
    add_action( 'init', array( __CLASS__, 'cancel_appointment' ), 20 );
}

/**
 * Cancel an appointment.
 */
public static function cancel_appointment() {
    if ( isset( $_GET['cancel_appointment'] ) && isset(
 $_GET['appointment_id'] ) ) {

        $appointment_id         = absint( $_GET['appointment_id'] );
        $appointment            = get_wc_appointment( $appointment_id );
        $appointment_can_cancel = $appointment->has_status( get_wc_appointment_statuses( 'cancel' ) );
        $redirect               = $_GET['redirect'];
        $is_wc_appointment      = is_a( $appointment, 'WC_Appointment' ) ? true : false;

        if ( $appointment->has_status( 'cancelled' ) ) {
            // Message: Already cancelled - take no action.
            wc_add_notice( __( 'Your appointment has already been cancelled.', 'woocommerce-appointments' ), 'notice' );

        } elseif ( $is_wc_appointment && $appointment_can_cancel && $appointment->get_id() == $appointment_id && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-appointments-cancel_appointment' ) ) {
            // Cancel the appointment
            $appointment->update_status( 'cancelled' );
            WC_Cache_Helper::get_transient_version( 'appointments', true );

            // Message.
            wc_add_notice( apply_filters( 'woocommerce_appointment_cancelled_notice', __( 'Your appointment has been cancelled.', 'woocommerce-appointments' ) ), apply_filters( 'woocommerce_appointment_cancelled_notice_type', 'notice' ) );

            do_action( 'woocommerce_appointments_cancelled_appointment', $appointment->get_id() );
        } elseif ( ! $appointment_can_cancel ) {
            wc_add_notice( __( 'Your appointment can no longer be cancelled. Please contact us if you need assistance.', 'woocommerce-appointments' ), 'error' );
        } else {
            wc_add_notice( __( 'Invalid appointment.', 'woocommerce-appointments' ), 'error' );
        }

        if ( $redirect ) {
            wp_safe_redirect( $redirect );
            exit;
        }
    }
}
}

WC_Appointment_Form_Handler::init();

If you need anything else from the code I may search for it. Because this is the first time I am facing the problem like this.
Thank you everyone for your help.

A: Fixed by code edit from
elseif ( $is_wc_appointment && $appointment_can_cancel && $appointment->get_id() == $appointment_id && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-appointments-cancel_appointment' ) ) {

to
elseif ( $is_wc_appointment && $appointment_can_cancel && $appointment->get_id() == $appointment_id) {


text:
Q: How to put timestamp on bluemix iot payload of connected device How do i put timestamp on the msg payload from each streaming devices.
and also those timestamp should be from device timezone.
Thanks

A: You could use a function node to obtain a timestamp and add that to the msg.payload data. Here is how I produced a timestamp in a function node:
var tstamp=(new Date).toISOString().replace(/t/gi,' ').trim();

To add a timestamp depending on the device timezone you would need to know where the device is located. This might be even more complex if the device is mobile.


text:
Q: Fetch dependent picklist values depending on record type I have a two picklists PL1 and PL2. PL1 is controlling picklist and PL2 is dependent picklist.
I want to fetch values of PL1 in Apex depending on recordTypes in Apex method, which I already have using the API endpoint

/ui-api/object-info/{0}/picklist-values/{1}/{2}.

Now I want to fetch the dependent values of PL2 in a map depending on record type. Is there any API endpoint for the same?
I have already read some blogs on fetching dependent picklist values, but none of them implement record types.

A: According to UI API for Salesforce:
The endpoint:
GET /ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}/{fieldApiName}

gives you valid values for record type along with controlling fields and their values.
In the documentation, it gives an example for Country to City dependent picklist for a given recordType. The sample response would look like
{
  "picklistFieldValues" : {

    "Cities__c" : {
      "controllerValues" : {
        "Australia" : 0,
        "Brazil" : 1,
        "China" : 2,
        "Colombia" : 3,
        "France" : 4,
        "Italy" : 5,
        "Mexico" : 6,
        "New Zealand" : 7,
        "Nigeria" : 8,
        "Senegal" : 9,
        "South Korea" : 10,
        "US" : 11
      },
      "defaultValue" : null,
      "url" : "/services/data/v44.0/ui-api/object-info/account/picklist-values/012000000000000AAA/Cities__c",
      "values" : [ {
        "attributes" : null,
        "label" : "Cali",
        "validFor" : [ 3 ],
        "value" : "Cali"
      }, {
        "attributes" : null,
        "label" : "Chicago",
        "validFor" : [ 11 ],
        "value" : "Chicago"
      }, {
        "attributes" : null,
        "label" : "Dakar",
        "validFor" : [ 9 ],
        "value" : "Dakar"
      }, {
        "attributes" : null,
        "label" : "Lagos",
        "validFor" : [ 8 ],
        "value" : "Lagos"
      }, {
        "attributes" : null,
        "label" : "Los Angeles",
        "validFor" : [ 11 ],
        "value" : "Los Angeles"
      }, {
        "attributes" : null,
        "label" : "Oaxaca",
        "validFor" : [ 6 ],
        "value" : "Oaxaca"
      }, {
        "attributes" : null,
        "label" : "Wellington",
        "validFor" : [ 7 ],
        "value" : "Wellington"
      } ]
    },

Which you can easily parse and create map of dependent picklist values depending on record type
Here for dependent field City__c see the controlling values for countries in controllerValues
Src: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_features_records_dependent_picklist.htm?search_text=dependent


text:
Q: If I have a Python list of CSV files, how do I merge them all into one giant CSV file? I created a list of files like this:
merge_files = []
for i in range(2, 12):
    merge_files.append(pandas.read_csv(final_user_study_path + "/P" + str(i) + "/DataCollection/data/merge.csv"))

I want to create a giant csv file with all the files from this list.
Is this the most efficient way to do this?

A: I recommend unix shell. If they have no headers, or only first have a header:
cat file1.csv file2.csv ... fileN.csv > result.csv

If they have headers, you have to cut them off first:
cat file1.csv > result.csv
for i in {1..N}; do tail +2 file$i.csv >> result.csv; done

If files are in different directories - use path to each file:
cat path1/file.csv path2/file.csv > result.csv

A: The pandas way would be to use concat on the dataframes, this can be useful if you want to do some operations too (as filtering, removing duplicates... etc)
import io
import pandas as pd

Let's create two files
csv1 = "a,b\n1,2"
csv2 = "a,b\n3,4"

file1 = io.StringIO(csv1)
file2 = io.StringIO(csv2)

Loop over them and concat:
pd.concat((pd.read_csv(i) for i in [file1,file2])).to_csv(index=False)

Results in:
'a,b\n1,2\n3,4\n'

Adapted for you in a readable way (my preferred way):
files = []
for i in range(2, 12):
    path = "{}/P{}/DataCollection/data/merge.csv".format(final_user_study_path,i)
    files.append(path)

pd.concat((pd.read_csv(i) for i in files)).to_csv("output.csv",index=False)


text:
Q: Point Shiny fileInput to S3 I'm trying to put a Shiny app on AWS. I have a vast amount of data and multiple users would want to interact with this data without the need to add any external data.
For simplicity, let's assume the data is stored in flat files which I can upload on S3. I allow the user to read a file in through a fileInput button but when hosted on an AWS EC2 instance, it points to the local machine. Is there any way I can point it to the data on S3 and let the user upload one of those files into the shiny app?

A: Lets assume your files rds;
before shinyUI(
rdsPath <- "your data path"
fileList <- dir(rdsPath, full.name = TRUE, pattern = ".rds")
fileList <- setNames(lapply(fileList, function(x){x}),substr(fileList, 33, nchar(fileList)-4))

use select input in shinyUI(
selectInput("file",label = "file name:",multiple = F,choices = fileList,selected = fileList[[1]])
then in server.R you can call its path as:
input$file


text:
Q: Dense subalgebra that is closed under unbounded derivation on noncommutative torus Let $A_{\theta}$ be the noncommutative torus, we can define:
$$
A^{\infty}_{\theta}\mathrel{:=}\left\{\sum_{n,m\in\mathbb{Z}}a_{n,m}U^{n}V^{m} \,\middle\vert\, a_{n,m}\in S(\mathbb{Z}^{2})\right\}
$$
where $S(\mathbb{Z}^{2})$ is the space of rapidly decreasing sequences $a$, i.e. $\sup_{n,m\in\mathbb{Z}}(1+n^{2}+m^{2})^{k}\lVert a_{n,m}\rVert<\infty$ for any $k\in\mathbb{N}\cup\{0\}$. This is a dense subalgebra of $A_{\theta}$ which is closed under unbounded *-derivation $\delta$, i.e. $\delta(A^{\infty}_{\theta})\subseteq A^{\infty}_{\theta}$.
My question is, is $A^{\infty}_{\theta}$ the only dense subalgebra with the property that it is closed under unbounded *-derivation? In Morita equivalence of smooth noncommutative tori, Elliott and Li seem to imply $A^{\infty}_{\theta}$ is the only choice when talking about smooth structures on $A_{\theta}$. Does there exist another dense subalgebra which has the above property?


text:
Q: anything more accurate than Marshal.SizeOf? The size of a char is 2 bytes in c# but Marshal.SizeOf(typeof(char)) equals 1:
using System;
using System.Runtime.InteropServices;

class Program
{
    static void Main()
    {
        Console.WriteLine(Marshal.SizeOf(typeof(char)));
        Console.ReadKey();
    }
}

output: 1
Is there any methods anything more accurate than Marshal.SizeOf in .Net?


text:
Q: Google Login: SignIn API Exception 10 only in the Play Store First of all, I already try this solution:Patrik's Solution . Did not work!
If I run directly from Android Studio it works perfectly, but when I create and install the Signed APK the exception happens.
what could be happening?
my code:
@Override
protected void onCreate(Bundle savedInstanceState) {
...
  btnGoogleLogin.setOnClickListener(V -> singinGoogle());
...
}
void singinGoogle(){
        Intent singinIntent = mGoogleSignInClient.getSignInIntent();
        startActivityForResult(singinIntent,GOOGLE_SIGN);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode==GOOGLE_SIGN){
            Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
            try{
                GoogleSignInAccount account = task.getResult(ApiException.class);
                if(account!=null) {
                    firebaseAuthWithGoogle(account);
                }

            }catch (ApiException e){

                Toast.makeText(this, "ERROR: "+e.getMessage(), Toast.LENGTH_LONG).show();
                DialogError de = new DialogError();
                FragmentManager fm = this.getSupportFragmentManager();
                dec.show(fm, "");
            }
        }
    }
    private void firebaseAuthWithGoogle(GoogleSignInAccount account){
        AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(),null);
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(this,task -> {
                    if(task.isSuccessful()){
                        FirebaseUser user = mAuth.getCurrentUser();
                    }else {
                        Toast.makeText(this, "The Login as Failed", Toast.LENGTH_SHORT).show();
                    }
                });

    }

A: I found the problem, when I generate the signed app, the play store generates a new SHA1 and MD5 key for the app. So the solution to the problem was simply to copy the Play Store key to Firebase.
Step-by-step solution:

*

*open the app on the Google Play Console.

*go to Version Management -> App Signature

*Copy the key you want

*Add the new key to your project in the Firebase Console.

Note: You can keep the key generated by Android Studio too, so the application will work both on debug and on Google Play.
Hope this helps!


text:
Q: File association in Mac Finding help from here we are now able create a Mac application from a jar file and associate the application with certain file extension .
When double click a file with that extension it is opening in that application and ultimately in the embedded java application.
However our need is to get the selected file path as an argument to the main method of the java application.
How can we achieve this.
for file type association we have used
defaults write com.apple.LaunchServices LSHandlers -array-add

<dict>
  <key>LSHandlerContentTag</key>
  <string>PUT_FILE_EXTENSION_HERE_WITHOUT_PERIOD</string>
  <key>LSHandlerContentTagClass</key>
  <string>public.filename-extension</string>
  <key>LSHandlerRoleAll</key>
  <string>org.category.program</string>
</dict>

with changes.
Should there be any change in the Info.plist file?

A: Use Java Web Start to declare the interest in that file-type.  Here is a demo of the JNLP file services that associates the .zzz file-type with the app.  This approach should work for OS X (& Windows, & *nix).

A: Apple provides some specific classes that allow you to better incorporate Java applications into Mac OS X. Google for "Apple Java eawt", or try this link: http://developer.apple.com/library/mac/documentation/Java/Reference/JavaSE6_AppleExtensionsRef/api/com/apple/eawt/package-summary.html. Look especially for the Application- and ApplicationAdapter-Class (reps. their not-deprecated parts). you can register special listeners to get the information about files that should be opened.


text:
Q: Correct way of doing a safe copy from a range of kernel addresses that could contain invalid addresses? I need to read from a kernel address called myKernelAddress to myKernelAddress + size and copy it to my buffer.
But the problem is that some addresses between myKernelAddress to myKernelAddress + size could be invalid. So my question is what is proper and safe way of doing this copy, which also saves me from a kernel panic? Do I need to manually check every address between  myKernelAddress to myKernelAddress + size with  virt_addr_valid, or is there a better way?


text:
Q: getResourceAsStream() returning null I have a java .jar library, and from there i'm trying to access a file of my Android project
with:
InputStream inputStream = getClass().getResourceAsStream("/folder/data.txt");
someMethod(inputStream); // inputStream is null

But the inputStream is always null. I'm confused about where should i put my /folder/data.txt in order to
be able to find it from the .jar.
From within the .jar project i can find the data.txt, doing the following in eclipse:
MyProject > properties > java build path > libraries > Add class folder

and this code:
InputStream inputStream = getClass().getResourceAsStream("/data.txt"); // without the folder

This is the structure of the Java Project:
MyJavaProject

  - src
    - com.example
      - something.java
      - folder
           - data.txt

Now, inside the Android Project i try to do the same but i keep getting null (inputStream):
MyAndroidProject

  - src
    - several packages
    - folder
       - data.txt
  - libs
     - my jar

Where should i put my data.txt? or should i change something in my .jar
I've read a lot of similar questions but i haven't found a solution. I've also read about getResourceAsStream() but i'm obviously not getting it.

A: getResourceAsStream() isn't terribly useful in android.  It refers to files embedded in a JAR or classpath container, not android Resources.  You probably want to use the android assets feature instead.  You can simply place the asset file ("data.txt") under your project's assets/ directory.
To get an InputStream for the asset, you can use the AssetsManager, like this (error handling is omitted for clarity:
// get the assets manager from your activity or `Context`
final AssetsManager am = getAssets();
final InputStream   in = am.open("data.txt");
// do stuff with the input stream

Another approach is to use Resources instead, but this depends on the contents of data.txt  Resources are intended for data types that android knows how to load and parse, such as drawables, strings, and various xml files.  Assets are for raw data that you are going to read and parse yourself.

A: Resouses in android means drawables, values ..  etc folders.
For text file create a folder named raw and put your data file there.
Try to send the path to the library method as as data.txt then as raw/data.txt


text:
Q: register lengthMenu dataTables in session? I use the DataTables plugin. I want to save lengthMenu in the session and if the user reopens the page we display the array with the same lengthMenu as saved in the session.
If he chose 50 we keep 50 in a session variable and if the user reopens the page we display it with the array with 50 elements. Here is the source code:
$(document).ready(function() {
  $('#Example').DataTable({
    "lengthMenu": [
      [10, 25, 50, -1],
      [10, 25, 50, "All"]
    ]
  });
});

A: DataTables already has this functionality built in. You can enable it by setting the stateSave property to true. Note that this technically uses a cookie, not the server side session, however the functionality is the same. Try this:
$('#Example').dataTable({
  stateSave: true,
  lengthMenu: [
    [10, 25, 50, -1],
    [10, 25, 50, "All"]
  ]
});

You can read more about stateSave and it's associated settings in the DataTables documentation
If you still required this to be saved in the session on the server, then you could use the stateSaveCallback and stateLoadCallback properties to make AJAX requests to get/set the session value.


text:
Q: exim4 happen: Too many "Received" headers - suspected mail loop When I use Mailman and ExIM4 to set up a mailing list server, I send information to the mailing list using my personal mailbox, and the message "Action: failed, Final-Recipient: rfc822;  dev@tomtoworld.xyz  Status: 5.0.0" is returned. The log output is as follows:
2022-05-04 13:19:09 1nmEuL-0000Ht-G3 <= 353712217@qq.com H=(71b59c6d89cc) [43.155.80.72] P=esmtp S=19481 id=tencent_42C7156C70D41B29B12B9B720262AA270908@qq.com T="test" from <353712217@qq.
2022-05-04 13:19:09 1nmEuL-0000Hp-F0 => dev@tomtoworld.xyz F=<353712217@qq.com> P=<353712217@qq.com> R=dnslookup_relay_to_domains T=remote_smtp H=tomtoworld.xyz [43.155.80.72] C="250 OK id
2022-05-04 13:19:09 1nmEuL-0000Hp-F0 Completed
2022-05-04 13:19:09 1nmEuL-0000Hx-HB <= 353712217@qq.com H=(71b59c6d89cc) [43.155.80.72] P=esmtp S=20101 id=tencent_42C7156C70D41B29B12B9B720262AA270908@qq.com T="test" from <353712217@qq.
2022-05-04 13:19:09 1nmEuL-0000Ht-G3 => dev@tomtoworld.xyz F=<353712217@qq.com> P=<353712217@qq.com> R=dnslookup_relay_to_domains T=remote_smtp H=tomtoworld.xyz [43.155.80.72] C="250 OK id
2022-05-04 13:19:09 1nmEuL-0000Ht-G3 Completed
2022-05-04 13:19:09 1nmEuL-0000I1-IH <= 353712217@qq.com H=(71b59c6d89cc) [43.155.80.72] P=esmtp S=20721 id=tencent_42C7156C70D41B29B12B9B720262AA270908@qq.com T="test" from <353712217@qq.
2022-05-04 13:19:09 1nmEuL-0000Hx-HB => dev@tomtoworld.xyz F=<353712217@qq.com> P=<353712217@qq.com> R=dnslookup_relay_to_domains T=remote_smtp H=tomtoworld.xyz [43.155.80.72] C="250 OK id
2022-05-04 13:19:09 1nmEuL-0000Hx-HB Completed
2022-05-04 13:19:09 1nmEuL-0000I5-JM <= 353712217@qq.com H=(71b59c6d89cc) [43.155.80.72] P=esmtp S=21341 id=tencent_42C7156C70D41B29B12B9B720262AA270908@qq.com T="test" from <353712217@qq.
2022-05-04 13:19:09 1nmEuL-0000I1-IH => dev@tomtoworld.xyz F=<353712217@qq.com> P=<353712217@qq.com> R=dnslookup_relay_to_domains T=remote_smtp H=tomtoworld.xyz [43.155.80.72] C="250 OK id
2022-05-04 13:19:09 1nmEuL-0000I1-IH Completed
2022-05-04 13:19:09 1nmEuL-0000I5-JM ** dev@tomtoworld.xyz F=<353712217@qq.com>: Too many "Received" headers - suspected mail loop
2022-05-04 13:19:09 1nmEuL-0000I8-KE <= <> R=1nmEuL-0000I5-JM U=Debian-exim P=local S=22506 T="Mail delivery failed: returning message to sender" from <>

I have set and checked through DKIM, SPF, DMARC. But the problem remains.
Have any idea to solve this question?


text:
Q: Why is my alias not working in Zsh? I have added my alias to ~/.aliases file and the file right now is like this:
alias gss="git status"
alias gl="git log"
alias pa="php artisan"
alias reload=". ~/.zshrc && echo 'ZSH config reloaded from ~/.zshrc'"

When I run gss, gl, reload they all work, but when I run pa I am getting an error zsh: command not found: pa why is that?

A: Alternatively, you can keep your aliases in ~/.aliases file itself which can be portable across systems but then add below lines at the end of ~/.zshrc to include all of them
#...more zsh config above

if [ -f ~/.aliases ]; then
        . ~/.aliases
fi

A: The problem was that I was editing the wrong file.
I edited my ~/.zshrc file to add the aliases. Everything works fine after that.


text:
Q: How to conditionally change the initial JSP for a JSR-168 portlet? I have a JSR-168 portlet application running on WebSphere Portal 6.0.
In the application's portlet.xml file, a specific portlet is defined as follows:

<portlet>
        <portlet-name>Individual Portlet</portlet-name>
        <display-name>Individual Portlet</display-name>
        <display-name xml:lang="en">
            Individual Portlet
        </display-name>
        <portlet-class>
            com.companyname.util.hibernate.MHFacesHibernatePortlet
        </portlet-class>
        <init-param>
            <name>com.ibm.faces.portlet.page.view</name>
            <value>/TEIndividual/TEIndividualView.jsp</value>
        </init-param>
        <init-param>
            <name>wps.markup</name>
            <value>html</value>
        </init-param>
        <expiration-cache>0</expiration-cache>
        <supports>
            <mime-type>text/html</mime-type>
            <portlet-mode>view</portlet-mode>
        </supports>

        <resource-bundle>
            resources.nl.IndividualPortletResource
        </resource-bundle>
        <portlet-info>
            <title>Individual Portlet</title>
        </portlet-info>
        <portlet-preferences>
            <preference>
                <name>portletType</name>
                <value>individual</value>
            </preference>
            <preference>
                <name>wmmAttribSalesmanId</name>
                <value>facsimileTelephoneNumber</value>
            </preference>
        </portlet-preferences>
    </portlet>

Note that it defines a parameter named "com.ibm.faces.portlet.page.view" with the value "/TEIndividual/TEIndividualView.jsp", which is the initial JSP used when the portlet is rendered.
I need to conditionally change the value of that parameter based on the result of a database query.
I think this might involve a redirect somewhere in the MHFacesHibernatePortlet class.
Is that correct, and what method of the class should I modify?
Edit, with more info and source code for two classes...
I've added code for the MHFacesHibernatePortlet class below, and also the MHFacesPortlet class which it extends.
In the application's portlet.xml file, multiple portlets are all configured to use the MHFacesHibernatePortlet class, but each portlet uses a different initial JSP. The "Individual Portlet" above is just one example.
I need to conditionally change the initial JSP only for some of the portlets, so I have some code that should be able to check the JSP name against a list of the ones I want to change, then run a Hibernate query, then change the JSP name only if necessary.
I saw in MHFacesPortlet.processAction that it reads the relevant parameter and passes it to request.getPortletSession().setAttribute() under some conditions, so I tried to put my code there and change the homeJsp variable, but that didn't work. After adding some logging I found that processAction isn't even called when I go to a page with one of these portlets.
Source for the MHFacesHibernatePortlet class:

package com.companyname.util.hibernate;

import java.io.IOException;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.companyname.util.portlet.MHFacesPortlet;

public class MHFacesHibernatePortlet extends MHFacesPortlet {
    /*
     * (non-Javadoc)
     *
     * @see com.ibm.faces.webapp.FacesGenericPortlet#doConfigure(javax.portlet.RenderRequest,
     *      javax.portlet.RenderResponse)
     */
    public void doConfigure(RenderRequest arg0,RenderResponse arg1)
    throws PortletException,IOException {
        super.doConfigure(arg0,arg1);
        try {
            HibernateUtil.commitTransaction();
        } finally {
            HibernateUtil.closeSession();
        }
    }

    /*
     * (non-Javadoc)
     *
     * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest,
     *      javax.portlet.RenderResponse)
     */
    public void doView(RenderRequest arg0,RenderResponse arg1)
    throws PortletException,IOException {
        super.doView(arg0,arg1);
        // Close and commit open hibernate transactions
        try {
            HibernateUtil.commitTransaction();
        } finally {
            HibernateUtil.closeSession();
        }
    }
}

Source for the MHFacesPortlet class:

package com.companyname.util.portlet;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import com.ibm.faces.webapp.FacesGenericPortlet;

public class MHFacesPortlet extends FacesGenericPortlet {
    private static final String FACES_CURRENT_PAGE_STUB="com.ibm.faces.portlet.page.";

    /** parameter used to fire an extended action */
    public static final String PARAMETER_EXTENDED_ACTION="extAction";

    /** Action to reset view mode of the portlet */
    public static final String ACTION_VIEW_MODE_RESET="viewReset";

    public MHFacesPortlet() {
        super();
    }

    /*
     * (non-Javadoc)
     *
     * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest,
     *      javax.portlet.ActionResponse)
     */
    public void processAction(ActionRequest request,ActionResponse response)
    throws PortletException {
        // Check if we need to process an extended action
        String extendedAction=(String)request
            .getParameter(PARAMETER_EXTENDED_ACTION);

        if (extendedAction!=null&&!extendedAction.equals("")) {
            // Reset view mode
            if (extendedAction.equals(ACTION_VIEW_MODE_RESET)) {
                PortletMode portletMode=request.getPortletMode();
                String modeString=null;
                if (portletMode.equals(PortletMode.EDIT)) modeString="edit";
                else if (portletMode.equals(PortletMode.VIEW)) modeString="view";
                else if (portletMode.equals(PortletMode.HELP)) modeString="help";
                else modeString=portletMode.toString();

                String homeJsp=getPortletConfig().getInitParameter(
                    FACES_CURRENT_PAGE_STUB+modeString);
                request.getPortletSession().setAttribute(
                    FACES_CURRENT_PAGE_STUB+modeString,homeJsp);
            }

        }

        //delegate to ibm faces
        super.processAction(request,response);
    }
}

A: This shouldn't involve a redirect, as much as changing the JSP that the portlet dispatches to.
As I commented to your question, it would really be helpful to see the source of MHFacesHibernatePortlet.  However, at a minimum, within MHFacesHibernatePortlet, you could override init(PortletConfig config), then conditionally change the value of the init parameter that is used.  This could follow the approach of adding a filter around the passed-in PortletConfig that is overridden to return an alternate value for getInitParameter if called with the same com.ibm.faces.portlet.page.view key name - then calling super.init(...) with your filter implementation.  However, this will not work if you need to return different JSPs to different portlet requests, as this init param will be used for all requests serviced by the portlet instance.
However, the better approach would be to see where the custom portlet (or one of its parents) is referring to this init param, and putting your custom logic there instead.

Update (following your updated comments):
For changing the initial (view) JSP, you need to override doView, not processAction.  See http://publib.boulder.ibm.com/infocenter/radhelp/v6r0m1/index.jsp?topic=%2Fcom.ibm.etools.portal.doc%2Ftopics%2Ftnoactionmode.html for a specific example on how to accomplish this:

Changing a JSF portlet page without a JSF action
You can change a page in a Faces portlet using a Faces action outcome and the navigation rules.
If you want to change a page without using a Faces action, you can set a JSP file path to the one of the following session attributes:

...

For example, you can create a subclass of your Faces portlet and set the session attribute in the doView() method to change the page in some conditions:
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
  if (...) {
    request.getPortletSession().setAttribute("com.ibm.faces.portlet.page.view", "/MyPage.jsp");
  }

  super.doView(request, response);
}


text:
Q: C/C90/Counting words in large text file I have a text file which consists of about 30000 words. My goal is to count the actual number of the words (keep in mind that multiple punctuation marks and consecutive spaces are included, as well as words connected with - (for example three-legged), so counting just the spaces isn't correct).
I have managed to count the total characters but I am struggling with the words.
Any help?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define SIZE 50

char *getfile(void);
void stats(char *filename);

int main() {
    char *file;
    file = getfile();
    stats(file);
    return 0;
}

char *getfile(void) {
    char *filename;
    FILE *fp;
    filename = malloc(SIZE);

    printf("Enter the name of the text file: ");
    scanf("%49s", filename);

    fp = fopen(filename, "r");
    printf("\n");

    if (fp == NULL) {
        printf("The entered file does not exist.");
        printf("\n");
    } else {
        printf("The file exists.");
        fclose(fp);
    }

    return filename;
}

void stats(char *filename) {
    int cnt = 0, space = 0, lines = 0;
    int c;
    int count = 0;

    FILE *fp;
    fp = fopen(filename, "r");
    while (((c = fgetc(fp)) != EOF)) {
        cnt++;

        if (c == ' ') {
            space++;
        }
        if (c == '\n' || c == '\0') {
            lines++;
        }
    }

    printf("\nTotal characters in file: %d", cnt);
    printf("\nTotal characters (excluding spaces) in file: %d", cnt - space);

    fclose(fp);
    return;
}

A: You should make a list of all the chars that can separate between words, and count every sequence of separating characters.

A: The reason you are having trouble is you have no state. That is, classifying context about what came before. You can use other methods to break the file into words, but a state-machine is simple and fast. As suggested in the comments and by other answers, you need two states, a white-space came before, and a word character came before. It's sort of like the one-bit derivative, with rising edge, white-space space to word, as a the thing you count.
Stripping off most of the extraneous stuff, this might be how you do a state machine.
#include <stdio.h>

int main(void) {
    unsigned char buf[16384 /*50*/]; /* 50 is small. */
    enum { WHITE, WORD } state = WHITE;
    size_t cnt = 0, lines = 0, words = 0, nread, i;
    do { /* Fill `buf`. */
        nread = fread(buf, 1, sizeof buf, stdin);
        if(ferror(stdin)) { perror("wc"); return 1; }
        cnt += nread;
        for(i = 0; i < nread; i++) { /* Char-by-char in `buf`. */
            unsigned char c = buf[i];
            /* https://en.cppreference.com/w/cpp/string/byte/isspace */
            switch(c) {
            case '\n':
                lines++; /* Fall-though. Doesn't handle CRs properly. */
            case '\0': case ' ': case '\f': case '\r': case '\t': case '\v':
                state = WHITE;
                break;
            default:
                if(state == WORD) break;
                state = WORD;
                words++;
                break;
            }
        }
    } while(nread == sizeof buf);
    printf("Total characters in file: %lu\n", (unsigned long)(cnt - lines));
    printf("Total lines in file: %lu\n", (unsigned long)lines);
    printf("Total words in file: %lu\n", (unsigned long)words);
    return 0;
}

I off-loaded some work on the hosted-environment for brevity, ./wc < file.txt and I used a buffer.


text:
Q: trace() is not working in flashbuilder 4? i'm trying to use actionscript 3.0 and using trace(), it never outputs content of trace of variable either in flash player or in output area?
how to coorect or should i enable something?
whats the problem?

A: As others have pointed out, trace only works when in debug.
If you want information to get dumped out when running "release", you'll need to use the logging api that flex provides.

A: When you test your movie, are you using "Run Application" or "Debug Application"? I'm not sure if this has changed in 4, but if you just run it, trace actions are omitted by default.

A: Note that you can also view the output from the debug version of the flash player from the command line.  Then you don't have to run the application in the Flash Builder debuger.  You need to create a mm.cfg file They have changed where this file has to be located a number of times so there is a lot of misinformation about where the file goes.  The instructions here look like the most upto date - http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e63e3d11c0bf69084-7fc9.html


text:
Q: What's the best way to store multiple values for jQuery's $.data()? If storing multiple (10+) values on a large number of divs, is it more optimal to store them all in a single object, or as separate values?
Single Object:
$("#div_id").data("data", {foo:1, bar:2});

Separate Values:
$("#div_id")
  .data("foo", 1)
  .data("bar", 2);

What are the trade-offs of each method? Some of these attributes will be accessed frequently (during event callbacks like dragging, for instance).

A: If both approaches are as easy to use in your code, go for storing a single object. It avoids the extra overhead of calling the data() method every time you need a value. This way, you can fetch the mapping object with one call to data(), and then retrieve values from this object as many times as you want without having to call data() again.
The data() method uses objects to map elements to keys/values under the hood, so it does not offer any performance improvements over managing a mapping object yourself.

A: I'd probably do something like:
var data = $("#div_id").data();
data.foo=1;
data.bar=2;

A: In 1.4 you can do this:
$('#somediv').data({ one : 1, two : 2, three : 3 });

This is a great way to initialize the data object.  HOWEVER, in 1.4.2, bear in mind that using this form will REPLACE ANY existing data on this element.  So, if you try this:
$('#somediv').data( 'one', 1 );

$('#somediv').data({ two : 2, three : 3 });

You will be blowing away the value for 'one'.
(On a personal note, I think it is a shame since jQuery already makes extensive use of merging objects with its $.extend.  Its not clear to me why that wasn't used here.)
UPDATE (suggested by user: @ricka, thank you):
1.4.3 and on, it merges the data (http://api.jquery.com/data/#data-obj):

In jQuery 1.4.3 setting an element's data object with .data(obj)
  extends the data previously stored with that element. jQuery itself
  uses the .data() method to save information under the names 'events'
  and 'handle', and also reserves any data name starting with an
  underscore ('_') for internal use.
Prior to jQuery 1.4.3 (starting in jQuery 1.4) the .data() method
  completely replaced all data, instead of just extending the data
  object. If you are using third-party plugins it may not be advisable
  to completely replace the element's data object, since plugins may
  have also set data.


text:
Q: Sticky footer that shows only below the window I am using display: table property to achieve sticky footer with the following features:

*

*Header and footer heights are not fixed

*Content is always 100% of the remaining height

Here is a fiddle of what I currently have: JSFiddle
Everything works perfectly, but what I am trying to achieve is a footer that is not visible on the screen, unless the user scrolls. The footer should be right below the window if there is not enough content, otherwise the content should push it. Here is a picture that explains what I actually mean. In the left is what I currently have, in the right what I am trying to achieve.

A: You could use flexboxes, along with view height for that !

.container {
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: stretch;
  height: 100vh;
}

.header {
  flex: 0 0 50px;
  background: lightblue;
}

.content {
  flex: 1 1 auto;
  background: lightgrey;
}

.footer {
  height: 100px;
  background: darkcyan;
}

A: @trichetriche's answer is better than mine (I really need to get to grips with flexbox!), but I updated your fiddle with a little bit of jQuery. This could be distilled down more but you can see what's going on as it is.
All it does is get the header height and content height, and if they're smaller than the window height then it sets the content height accordingly.
Fiddle
$(document).ready(function() {
    var h = $('#header').height();
    var c = $('#content').height();
    var w = $(window).height();

    if((h + c) < w) {
        $('#content').height(w - h);
    }
});

A: I ended up using just the same code, but instead of having all elements in the container I left the footer outside. Seems to work just right. Here is an updated fiddle: JSFiddle

* {
  margin: 0;
  padding: 0;
}
body, html{
  width: 100%;
  height: 100%;
}
.container{
  width: inherit;
  height: inherit;
  display: table;
  background: red;
}
.container div {
  width: inherit;
}
.header {
  background: darkgray;
}
.content {
  height: 100%;
  background: green;
}
.footer {
  background: yellow;
}

HEADER

CONTENT

CONTENT

CONTENT

FOOTER


text:
Q: Using typescript/web audio api on ios I'm working on a web site that will play audio files using the Web Audio API. I'm using typescript and Angular 2 in Visual Studio Code. I can get everything to work well on platforms other than ios; but on e.g. an iPad, I'm running into some baffling errors.
The first problem is how to get an AudioContext that will work on both ios and non-ios platforms. I know it can be done in plain javascript, e.g. http://gopherwoodstudios.com/wa/mp3/test.htm. The need for a button press is annoying, but I can live with it. So I think the problem I'm having is related to typescript. (I'm a typescript newbie, so I could be misunderstanding some basics here.)
On ios, what you get at runtime is still a webkitAudioContext, not an AudioContext. It seems that the typescript definitions I'm using don't understand how to deal with that. Either that or I don't know how to tell it what it needs to know. Originally I had a member variable of type AudioContext, and on non-ios platforms everything worked fine. To accommodate ios, I tried changing the variable's type to any, so that I could put in a webkitAudioContext if that exists and AudioContext doesn't; that code looks like this (this is all prototype code, so the error handling very provisional):
export class PlayerService {
private static _audioContext: any = null;
//......
public static getAudioContext(): any {
  if (!PlayerService._audioContext) {
    try {
      if (typeof AudioContext !== "undefined") {
        // We have an AudioContext type, so use it.
        PlayerService._audioContext = new AudioContext();
      } else if (window['webkitAudioContext'] !== "undefined") {
        // We don't have AudioContext, but we do have webkitAudioContext,
        // so attempt to use that.
        PlayerService._audioContext = Object.create(window['webkitAudioContext'].prototype);
      } else {
        throw new Error('AudioContext not supported. :(');
      }
    } catch (err) {
      console.log(err.message);
      alert('Cannot create audio context.');
      throw err;
    }
  }
  return PlayerService._audioContext;
}

This still works on non-ios platforms; and on ios, it manages to return a webkitAudioContext, complete with the expected methods and properties. (The Object.create(...) was the only way I could find to get this much to work.) Later, though, when I call decodeAudioData on this object, I get an error that says
TypeError: Can only call AudioContext.decodeAudioData on instance of AudioContext.

Since the variable that it's trying to call the decodeAudioData method on is typed as 'any' rather than 'AudioContext', I don't know where it's getting the idea that it has to be an AudioContext. But in any case, this can't be the right way to approach the problem. I don't have type info anywhere about webkitAudioContext, only about AudioContext. Does the necessary type info exist somewhere and I just haven't found it? If it doesn't exist, would it be difficult to create it? Alternatively, is there a way to bypass the type checking altogether for this set of classes (not my preferred option, but if it's the best we can do for now, I'll take it)? Or is there some completely different way to approach this that I don't know about?

A: Solved, at least to a first approximation. This line:
    PlayerService._audioContext = new ((<any>window).AudioContext || (<any>window).webkitAudioContext)();

creates an audio context that works on ios and non-ios platforms, and the "any's" keep typescript from complaining. This will do for my purposes, until either the browsers all move away from the webkit prefix, or it's supported by an appropriate type definition.
The problem I was having with decodeAudioData() was caused by Chrome on ios being unable to understand the .ogg file I was trying to play. When I switched to mp3 it worked.


text:
Q: why data not recognized in model.matrix() in R? I was wondering why in my function below where I use the base R dataset CO2 with Plant as one of its data columns I get the following error:
Error in eval(predvars, data, env) : object 'Plant' not found
How to fix this problem?
pc <- function(data, ref.variable){

as.data.frame(model.matrix(ref.variable ~ ., data = data))
}

pc(data = CO2, ref.variable = Plant) # Gives Error

## NOTE: it works OK this way: model.matrix(Plant ~ ., data = CO2)

A: We need to paste and then wrap with formula
pc <- function(data, ref.variable){

     as.data.frame(model.matrix(formula(paste0(ref.variable,  "~ .")), data = data))
 }

res <- pc(data = CO2, ref.variable = "Plant")
head(res)
#  (Intercept) TypeMississippi Treatmentchilled conc uptake
#1           1               0                0   95   16.0
#2           1               0                0  175   30.4
#3           1               0                0  250   34.8
#4           1               0                0  350   37.2
#5           1               0                0  500   35.3
#6           1               0                0  675   39.2

If we need to pass the ref.variable as unquoted, then use substitute within the function
pc <- function(data, ref.variable){

  ref.variable <- substitute(ref.variable)

 as.data.frame(model.matrix(formula(paste0(ref.variable,  "~ .")), data = data))
 }

pc(data = CO2, ref.variable = Plant)


text:
Q: are there any benefits of ending a bash script with exit I encountered a bash script ending with the exit line. Would anything changes (save scaring users who 'source' rather than calling straight when  the terminal closes )?
Note that I am not particularly interested in difference between exit and return. Here I am only interested in differences between having exit without parameters in the end of a bash script (one being closing console or process which sources the script rather than calling).
Could it be to address some less known shell dialects?

A: There are generally no benefits to doing this. There are only downsides, specifically the inability to source scripts like you say.
You can construct scenarios where it matters, such as having a sourceing script rely on it for termination on errors, or having a self-extracting archive header avoid executing its payload, but these unusual cases should not be the basis for a general guideline.

A: The one significant advantage is that it gives you explicit control over the return code.
Otherwise the return code of the script is going to be the return code of whatever the last command it executed happened to be.  Which may or may not be indicative of the actual success or failure of the script as a whole.
A slightly less significant advantage is that if the last command's exit code is significant, and you follow it up with "exit $?" that tells the maintenance programmer coming along later that yes, you did consider what the exit code of the program should be and he shouldn't monkey with it without understanding why.
Conversely, of course, I wouldn't recommend ending a bash script with an explicit call to exit unless you really mean "ignore all previous exit codes and use this one".  Because that's what anyone else looking at your code is going to assume you wanted and they're going to be annoyed that you wasted their time trying to figure out why if you did it just by rote and not for a reason.