text:
Q: using ajax to load from a database every type i run this it calls the error: OnError function and i can't see why it doesn't call the success: OnSuccess,
JS:
$(document).ready(function () {
                // retreving data on button click
                $("#data-submit").click(LoadDataThroughAjaxCall);
                //loading screen functionality - this part is additional - start
                $("#divTable").ajaxStart(OnAjaxStart);
                $("#divTable").ajaxError(OnAjaxError);
                $("#divTable").ajaxSuccess(OnAjaxSuccess);
                $("#divTable").ajaxStop(OnAjaxStop);
                $("#divTable").ajaxComplete(OnAjaxComplete);
                //loading screen functionality - this part is additional - end
            });
            // ajax call
            function LoadDataThroughAjaxCall() {
                $.ajax({
                    type: "POST",
                    url: "Ajax/dataloader.php",
                    data: '{}',
                    dataType: "json",
                    success: OnSuccess,
                    failure: OnFailure,
                    error: OnError
                });
                // this avoids page refresh on button click
                return false;
            }
            // on sucess get the xml
            function OnSuccess(response) {
                //debugger;
                var xmlDoc = $.parseXML(response.d);
                var xml = $(xmlDoc);
                var tweets = xml.find("Table");
                showOnATable(tweets);
            }
            // show data on a table
            function showOnATable(tweets) {
                //debugger;
                var headers = [];
                var rows = [];
                // header section
                headers.push("
");
                headers.push("tweets	");
                headers.push("created	");
                headers.push("source	");

                headers.push("
");
                // rows section
                $.each(tweets, function () {
                    var tweets = $(this);
                    rows.push("
");
                    rows.push("" + $(this).find("tweet_text").text() + "	");
                    rows.push("" + $(this).find("created_at").text() + "	");
                    rows.push("" + $(this).find("source").text() + "	");
                    rows.push("
");
                });
                var top = "
";
                var bottom = "
";
                var table = top + headers.join("") + rows.join("") + bottom;
                $("#divTable").empty();
                $("#divTable").html(table);
            }
            // loading screen functionality functions - this part is additional - start
            function OnAjaxStart() {
                //debugger;
                //alert('Starting...');
                $("#divLoading").css("display", "block");
            }
            function OnFailure(response) {
                //debugger;
                alert('Failure!!!' + '
' + response.reponseText);
            }
            function OnError(response) {
                //debugger;
                var errorText = response.responseText;
                alert('Error!!!' + '\n\n' + errorText);
            }
            function OnAjaxError() {
                //debugger;
                alert('Error!!!');
            }
            function OnAjaxSuccess() {
                //debugger;
                //alert('Sucess!!!');
                $("#divLoading").css("display", "none");
            }
            function OnAjaxStop() {
                //debugger;
                //alert('Stop!!!');
                $("#divLoading").css("display", "none");
            }
            function OnAjaxComplete() {
                //debugger;
                //alert('Completed!!!');
                $("#divLoading").css("display", "none");
            }

PHP:
       <?php

//if(isset($_POST['data'])==true&&empty($_POST['data'])==false){
        require_once('../connection.php');
        function clean($str)
        {
        if(get_magic_quotes_gpc())
        {
            $str= stripslashes($str);
        }
        return str_replace("'", "''", $str);
        }

    //Sanitize the POST values
    //$username = clean($_POST['data']);
        //$result=sqlsrv_query($conn,"execute sp_ORDER_BY_name '$username'");
        $result=sqlsrv_query($conn,"select tweet_text,source from tweets");
        if($result) {
        if(sqlsrv_has_rows($result) > 0) {
            //Login Successful
            while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC) ) {
                 echo $row['tweet_text'].", ".$row['source']."
";

                }
        }else {
            //Login failed
             echo 'Name not found';

            }
        }
    //}
?>

HTML FORM:

P-CAT version 0.1

Sreach  Catigroies

         <select id="data2">
         <option value="">Plece select one of the follwing</option>
          <option value="Name">Name</option>
          <option value="Location">Location</option>
        </select>
        <input name="data" id="data" type="text" />
        <input type="submit"  id="data-submit" value="Grab">

            Loading ...

            <input type="button" value="EDIT">
            <input type="button" value="HISTORY">
            <input type="button" value="SETTINGS">
            <input type="button" value="SEARCH">

A: You have to response a json from php like,
if(sqlsrv_has_rows($result) > 0) {
    //Login Successful
    $xml='
';
    while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC) ) {
       $xml.='<tweet_text>'.$row['tweet_text'].'</tweet_text>';
       $xml.='<source>'.$row['source'].'</source>';
       // create xml tag for created_at
    }
    $xml.='
';
    echo json_encode(array('d'=>$xml));
    return TRUE;
} else {
    //Login failed
    echo json_encode(array('d'=>'Name not found'));
}


text:
Q: Set connectionstring for Membership Service via code I have an ASP.NET web project and a membership provider configured via my web.config. Its fully working so no problem there.
We have an older system with a lot of users and I would therefor like to create a class library that can create users in this ASP.NET project but since its a class library it cannot have its own app.config-file.
is it possible to set all this information via code somehow?
<membership defaultProvider="ShidMembershipProvider">
  <providers>
    <clear/>
    <add name="ShidMembershipProvider" type="SundaHus.AspNet.Membership.ShidMembershipProvider" connectionStringName="ShidConnectionString" enablePasswordRetrieval="true" enablePasswordReset="true" requiersQuestionAndAnswer="true" applicationName="ECB3-development" minRequiredPasswordLength="5"/>
  </providers>
</membership>

A: You have a custom membership provider it looks like?  This connects to your own custom database?  You should be able to just point to that database for your code.  Or, if you just inherit the functionality from the base class, you can also try overriding the Initialize method, look for the connection string, and change the value to something else.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Azure Application Insights Web test result hanging with "loading..." message I have a web test that is running in Azure Application Insights, which displays the results in a scattergraph:

Clicking on any given test on the graph gives a results page, which should be populated with the test results like the following:

The above image is taken from my dev environment where everything works fine. For the integration environment I cloned the webtest powering the dev environment, changed the url to point at the integration endpoint with the correct credentials.
The test runs fine as I can see a raft of successful tests in the scattergraph, however when I click on the test to view the results page I get the following:

The loading message never updates, it just hangs forever even if I go away and come back to it hours later.
I have check all the config that I can see and ensured that the Webtest is set up right but cannot see anything obviously wrong.
What could be causing this? How does Azure know which set of results to return for a given web test? Is it name or Id driven perhaps?

A: It turns out that this is a bug in the search request that the Azure portal makes when clicking any of the tests in the graph.
An 500 response was being thrown and causing the "loading..." message to hang:
{
  "code":"One or more errors occurred.",
  "message":"One or more errors occurred.",
  "innererror":{
      "diagnosticcontext":"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
       "time":"2017-04-10T08:13:01.8861938Z"
   }
}

The root of the problem is that upper case characters are not handled in the search request, so if your web test names are not all lower case the internal server error is returned and the portal UI hang occurs.
Web tests created through the portal have the lower case naming convention enforced via a validation rule in the UI, but as I had created my tests via ARM template, there was no indication that upper case characters should not be used.
Until the bug is fixed, if you are creating tests via ARM templates, ensure that the following values do not contain upper case characters:
{
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
      "AvailabilityTestName": {
          "value": "lower-cased-name"
   },
      "WebTestResourceName": {
          "value": "lower-cased-name"
   },


text:
Q: Automated Logon with Macro backup script I'm having some issues with an automated backup macro script I've written using Autohotkeys.
My specific issue is that I need the script to run on a Windows based server at a given time during the night and run the macro in a Windowed environment. I have successfully created a Scheduled Task using Task Scheduler, this task launches my autohotkey binary and that part works just fine, task scheduler loads it with the correct arguments at the correct time of day.
The issue is that the scheduled task doesn't have an environment where Windows for the macro to interact with can exist (the macro clicks on buttons, checks to see if certain windows exist, etc), as there is no display device connected to the server. I have ran this script when connected via RDP, and as RDP acts as a display device it worked without a hitch.
I then downloaded AutoLogon which schedules a login to a windowed environment at a specific time. This of course works, in so far as it logs a user in at a given time to produce a windowed environment, and will work if a monitor is connected to the server. The issue here is that the server does not have a monitor attached and so does not actually render anything, so my script fails.
I'm at a loss on how to go forward from this point. Does anyone have any ideas or a similar experience which could possibly help me?


text:
Q: Python - More efficient way to loop through matrices I have

*

*an (height x width x 3) RGB image img

*a (256 x 256 x 256) matrix color_mapping mapping colors

*a (height x width) matrix pixel_result which I want to fill with the elements mapped with color_mapping for each pixel of the image

How can I fill that last matrix efficiently?
So far, I simply run through all the pixels in for loops, but I'm wondering if there is a more efficient way to do it
for i in range(width):
    for j in range(height):
        pixel_result[j,i] = color_mapping[img[j,i,0],img[j,i,1],img[j,i,2]]

A: You can implement this by subscripting the color_mapping:
pixel_result = color_mapping[img[:,:,0], img[:,:,1], img[:,:,2]]
For example if test the performance with:
>>> def f():
...   for i in range(width):
...     for j in range(height):
...         pixel_result[j,i] = color_mapping[img[j,i,0],img[j,i,1],img[j,i,2]]
...
>>> def g():
...     pixel_result = color_mapping[img[:,:,0], img[:,:,1], img[:,:,2]]
>>> color_mapping = np.random.randn(256,256,256)

Then for a small image: img = np.random.randint(0, 256, (12, 7, 3)), we get:
>>> timeit(f, number=10000)
0.5247259399620816
>>> timeit(g, number=10000)
0.032307324931025505

For larger images, like img = np.random.randint(0, 256, (1920, 1080, 3)), we get:
>>> timeit(f, number=10)
18.934733690926805
>>> timeit(g, number=10)
0.5807857210747898

or for a 72×128 image:
>>> timeit(f, number=100)
0.6014469779329374
>>> timeit(g, number=100)
0.011570235947147012


text:
Q: Fixed point property on the torus
Consider the torus $T = \Bbb S^1 \times \Bbb S^1$. Show that $T$ does not have the fixed point property. A space $X$ is said to have the fixed point property if for any continuous map $f : X \to X$ there exists $x \in X$ such that $f(x) = x$.

I think I've figured out why the torus doesn't have this proprety, but I cannot construct an explicit map for it. If we consider the identification

then we would need to construct a map such that it wont intersect the diagonal

and I think that a map like this blue line would work since it should not intersect the diagonal ever? Can this be constructed explicitly?

A: You need a map $\mathbb T \rightarrow \mathbb T$, not just a line segment in the torus. I am not sure what criterion you intend to invoke with the diagonal.
Let's consider an easier example. Let us show that the circle $\mathbb S^1$ does not have the fixed point property. Geometrically it is clear why: we can just rotate the circle a bit and this will not have a fixed point. Let $r:\mathbb S^1 \rightarrow \mathbb S^1$ be such a rotation.
Now one can identify the torus $\mathbb T$ up to homeomorphism with the topological space $\mathbb S^1 \times \mathbb S^1$. Since $r$ doesn't have a fixed point, the continuous map $$r\times\operatorname{id}:\mathbb S^1\times \mathbb S^1 \rightarrow \mathbb S^1 \times \mathbb S^1$$ doesn't have a fixed point.
If you insist on defining the torus via gluing the sides of a square and don't want to use the identification above, we can still write down essentially the same map as I just constructed. The idea is to just translate everything in the square a tiny bit to the right (points which map out of the right bound will be mapped into the left part of the square again). But this way we have to explicitly show that the map is welldefined and continuous, which is not hard but tedious.

A: If a space X does not have the fixed point property then any product XxY also does not have it.
This reduces your problem to showing that the circle does not have the fixed point property. You can surely do that.

A: $T=S^1\times S^1$, so define $f:T\to T$ by $f(z,w)=(iz,iw)$. It clearly has no fixed points.

A: What about $f(e^{2i \pi x}, e^{2i \pi y}) = (e^{2i \pi \left(x+\frac{\pi}{2}\right)}, e^{2i \pi y})$?
This is deduced from the fact that already $\mathbb S^1$ doesn't have the fixed point property as can be seen by rotating it around its center.

A: If we consider the torus $T=S^1\times S^1$ as the identification space $T=I\times I/\sim$ of the unit square as shown above, then $f([t,s])=[t+\frac{1}{2}-\lfloor{t+\frac{1}{2}}\rfloor,s]$ is a homeomorphism without fixed points and it is not the identity map. (All points of the identity map is fixed point). Here, $\lfloor x\rfloor$ denotes the floor of the real number $x$.


text:
Q: Private messages design I'm developing a new site, and I have to make private messages for our users. I have already made this on other projects, but the design there just doesn't seem right (I can't have more than two people engaged in a message for instance).
So what is the "right" approach to this? I'd like to offer my users the same functionality as Facebook (again, I have already done this but it feels dirty :))
So the system should support 2 or more users in a conversation and thread-like messages.
I was thinking and one solution would be to have two tables like so:
pm_messages:
id | pm_messages_id |user_id | title | content | date_time
pm_recipients:
id | pm_messages_id | user_id | has_seen | deleted
I would store the actual content in the "pm_messages" table, and I would store the recipients (including the original sender) in the "pm_recipients" table.
Is this the right direction or am I completely off with this? What bothers me here is that messages don't really get deleted until all of the recipients have deleted the message which leads to some awkward deleting logic.

A: If there can be multiple recipients, and they can send reply msgs, you are more dealing with some kind of chat application. You could store the "chat" sessions, or conversations in a seperate table with 1-n relation between conversation and participant, as well as 1-n relation between conversation and message (tables laid out below). But in the end, it's of course up to you. For regular message sending, a 1-n between message and recipient as you use will do.
table user:
- id (pk)
- name

table conversation (one entry per "chat/messaging" session)
- id (pk)
- started_by_user_id
- started_ts

table conversation_participant (keeps track of all recipients)
- id (pk)
- conversation_id
- user_id (refers to user.id)

table message
- id
- conversation_id (refers to conversation.id)
- sender (refers to user.id)
- msg

A: I wouldn't say the implementation you have proposed in your post is necessarily a bad one. Certainly, it's not the most concise or quickest, but it would appear to me the most understandable to humans. Also, the deletion logic shouldn't be very difficult to encapsulate.
One solution that I might suggest is to rather use a single table that stores each message, containing the field for the sender ID, and another field which is a list of recipient IDs. The problem, of course, is deciding on how to represent a list of IDs using one of the standard database types, given that there is usually no array/vector/list type. I would suggest you use the VARBINARY(max) type, if it's available, treating it as a bit vector (say, 4 bytes per recipient ID). Then you can just create a couple of functions to do the very simple bitwise encoding/decoding to/from an array/list.

A: What is the pm_messages_id column in the pm_messages table for?
Otherwise it makes sense... But I don't see why the deleting logic should be awkward. You could handle it one of two ways:

*

*After a user deletes it: delete if there are no more recipients.

*As a cron task or manually at a later time: There's no reason why this deletion needs to happen right away. They're just orphan records, and they can be found easily:

e.g.:
DELETE FROM pm_messages
RIGHT JOIN pm_recipients ON pm_messages.id = pm_recipients.pm_messages_id

A: One more use-case to consider (I know my users want this)... they all want a "sent items".  Might want to consider that use case before you clean-house so to speak.

What bothers me here is that messages
  don't really get deleted until all of
  the recipients have deleted the
  message which leads to some awkward
  deleting logic.

Create a trigger that does this for you.  All your application code needs to do is worry about setting your "deleted" column to true and have the UPDATE trigger nuke the whole deal when everybody flags the message as deleted.
Course, next thing you know, your users will want un-delete.  Personally, I'd never delete the message from the database, just hide it from the user.

A: (Too long for a comment)
Tehvans method involves storing a list of participants for a particular conversation, whereas in your method the participants are stored per-message. I expect the reason for this is to allow deleting and read-flagging, the question is - why do it like this?
Forums don't normally require you to mark each part of the conversation as read, so instead store a last_read timestamp in the participants table, that way any messages created/modified after the timestamp can be highlighted as such.
In (nearly) all cases, deleting of forum messages is done by a the author/admins, and causes the message to be removed from view to all users.


text:
Q: How to concatenate cells in column B based on condition in column A (via VBA loop) here is the tamplate
Column C with yellow color is my expected result.
I'm trying to combine values in column B if their corresponding values in column A are the same.
I'd like to solve it through VBA loop as a script below.
I consider that 'collection' method is appropriate in this case,
(to store a matrix of loop consequence then extract them by formula Textjoin)
but it doesn't work as my expect...are there any details that I miss?
Thanks for help!
Dim C As Range, BD As Range
Dim i As Long, LR As Long
Dim coll As New Collection
Set BD As Range("A2","A6")
Set LR As Cells(Rows.Count, "A").End(xlUp).Row
For each C in BD
  For i = 2 to LR
    If C.Value = Cells(i, "A").Value Then
    coll.add C.Offset(0, 1).Value
    C.Offset(0, 2).Value = Application.WorksheetFunction.TextJoin(";", True, col)
    End If
  Next i
Next C
End Sub

A: If I understand you correctly, since my Excel 2010 doesn't have TextJoin function, I try to code like this :
Sub test()
Dim rgData As Range: Dim rg As Range
Dim arr: Dim el
Set rgData = Range("A2:A6")
Set arr = CreateObject("scripting.dictionary")
For Each cell In rgData: arr.Item(cell.Value) = 1: Next
    For Each el In arr
        With rgData
            .Replace el, True, xlWhole, , False, , False, False
            Set rg = .SpecialCells(xlConstants, xlLogical).Offset(0, 1)
            .Replace True, el, xlWhole, , False, , False, False
        End With
        rg.Offset(0, 1) = Join(Application.Transpose(rg), ";")
    Next
End Sub

The code assume that the table/data already sorted by column A. It create unique value from rgData into arr variable. Then it loop to each element in arr as el variable, where on each el, it gets the range of cells which value is the looped el then offset(0,1) as rg variable. Finally it put the result on rg offset(0,1) using "Join".
If I may ask, what does this mean in your code Set BD As Range("A2","A6") ....
Set LR As Cells(Rows.Count, "A").End(xlUp).Row ?
Maybe you mean : Set BD = Range("A2","A6") .... LR As Cells(Rows.Count, "A").End(xlUp).Row ?


text:
Q: Further table url link scraping Using this awesome code I can scrape the majority of the data, however it seems like some of the url's may not scrape.  Also I need to be able to identify the data source in the future.  Therefore I have two question:

*

*how to program in a check that all links are identified and scraped?

*how to insert the url link as a new column so each row is identified?
  url = 'https://www.rootsandrain.com/organiser21/uci/events/filters/dh/'
  response = requests.get(url)
  soup = BeautifulSoup(response.content)

  urlList = ['https://www.rootsandrain.com'+row.a['href'] for row in soup.select('#T1 tbody tr')]

  data = []

  for url in urlList:
      try:
          data.append(pd.read_html(url)[0])
      except:
          print(f'No tables found:{url}')

  pd.concat(data)

Original post
Scraping URL links in a table

A: A small adjustment to the try/except block, that writes the url and also the status of scraping:
    try:
        df = pd.read_html(url)[0]
        df['url'] = url
        df['scraped'] = True
        data.extend(df.to_dict(orient = 'records'))
    except:
        print(f'No tables found:{url}')
        data.append(dict(url=url, scraped=False))

Example
Limited to for url in urlList[5:10] to not iterate all of the links in this example, just kick the [5:10] to get all:
import requests
from bs4 import BeautifulSoup
import pandas as pd

url = 'https://www.rootsandrain.com/organiser21/uci/events/filters/dh/'
response = requests.get(url)
soup = BeautifulSoup(response.content)

urlList = ['https://www.rootsandrain.com'+row.a['href'] for row in soup.select('#T1 tbody tr')]

data = []

for url in urlList[5:10]:
    try:
        df = pd.read_html(url)[0]
        df['url'] = url
        df['scraped'] = True
        data.extend(df.to_dict(orient = 'records'))
    except:
        print(f'No tables found:{url}')
        data.append(dict(url=url, scraped=False))

pd.DataFrame(data)

#to get rid of all these NaN columns
#pd.DataFrame(data).dropna(axis=1, how='all')

Output

url
scraped
Pos⇧
Bib
Name
Licence
YoB
Sponsors
km/h
sector1 +
sector2 +
sector3 +
sector4 +
sector5 =
Qualifier
km/h.1
sector1 +.1
sector2 +.1
sector3 +.1
sector4 +.1
sector5 =.1
Run 1
Diff

https://www.rootsandrain.com/event9599/2022-jul-9-mercedes-benz-uci-world-cup-dh-4-lenzerheide/
False
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan

https://www.rootsandrain.com/event9598/2022-jun-11-mercedes-benz-uci-world-cup-dh-3-leogang/
False
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan

https://www.rootsandrain.com/event9597/2022-may-22-mercedes-benz-uci-world-cup-dh-2-fort-william/
False
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan

https://www.rootsandrain.com/event9607/2022-apr-23-dhi-masters-world-championships-22-villa-la-angostura/
False
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan

https://www.rootsandrain.com/event9596/2022-mar-27-mercedes-benz-uci-world-cup-dh-1-lourdes/
True
1st
6
Amaury PIERRON
1.00088e+10
1996
COMMENCAL - MUC-OFF BY RIDING
62.211
45.680s5
32.179s3
36.880s2
27.636s5
28.399s8
2:50.7743
60.3411
44.269s1
33.091s23
36.159s1
26.774s2
27.418s1
2:47.7111
-

https://www.rootsandrain.com/event9596/2022-mar-27-mercedes-benz-uci-world-cup-dh-1-lourdes/
True
2nd
14
Finn ILES
1.00909e+10
1999
Specialized Gravity
60.072
44.915s3
32.242s5
37.407s5
27.636s5
28.254s3
2:50.4542
59.0821
44.924s2
31.474s3
37.175s4
26.781s3
28.204s6
2:48.5582
0.847s

https://www.rootsandrain.com/event9596/2022-mar-27-mercedes-benz-uci-world-cup-dh-1-lourdes/
True
3rd
1
Loïc BRUNI
1.00075e+10
1994
Specialized Gravity
59.6027
45.080s4
31.429s1
37.254s4
27.164s2
28.344s6
2:49.2711
58.8225
45.023s4
31.653s6
37.112s3
27.172s5
27.837s3
2:48.7973
1.086s

https://www.rootsandrain.com/event9596/2022-mar-27-mercedes-benz-uci-world-cup-dh-1-lourdes/
True
4th
8
Benoit COULANGES
1.00082e+10
1994
Dorval AM Commencal
60.671
46.785s15
31.773s2
36.688s1
27.496s3
28.348s7
2:51.0905
59.0821
45.302s7
31.591s5
37.745s9
26.711s1
27.828s2
2:49.1774
1.466s

https://www.rootsandrain.com/event9596/2022-mar-27-mercedes-benz-uci-world-cup-dh-1-lourdes/
True
5th
17
Luca SHAW
1.00088e+10
1996
Canyon Collective Factory Team
59.0836
46.267s7
32.952s14
38.067s10
28.504s17
28.453s9
2:54.24310
61.223
45.223s6
31.572s4
37.436s7
27.629s12
28.282s10
2:50.1425
2.431s

https://www.rootsandrain.com/event9596/2022-mar-27-mercedes-benz-uci-world-cup-dh-1-lourdes/
True
6th
9
Danny HART (elt)
1.00055e+10
1991
CUBE FACTORY RACING
59.8722
47.041s22
32.715s8
37.246s3
28.000s11
28.301s4
2:53.3037
60.0714
46.511s21
31.868s7
36.600s2
27.391s10
28.036s4
2:50.4066
2.695s


text:
Q: Get unicolor background navigation bar in Beamer's singapore theme I would like to get the background color of the navigation bar in a single color rather than the default color gradient. Is there any way to do this?

A: Singapore uses a vertical shading defined as
\pgfdeclareverticalshading{beamer@headfade}{\paperwidth}
  {%
    color(0cm)=(bg);
    color(1.25cm)=(section in head/foot.bg)%
  }

To get a solid color, you can redefine the shading to use only one color, as the following example demonstrates (of course, instead of structure.fg!25!bg you can use whatever color you wish):
\documentclass{beamer}
\usetheme{Singapore}

\makeatletter
\AtBeginDocument{%
  {
    \usebeamercolor{section in head/foot}
  }
  \pgfdeclareverticalshading{beamer@headfade}{\paperwidth}
  {%
    color(0cm)=(structure.fg!25!bg);
    color(1.25cm)=(structure.fg!25!bg)%
  }
  \setbeamercolor{section in head/foot}{bg=}
}
\addtoheadtemplate{\pgfuseshading{beamer@headfade}\vskip-1.25cm}{}
\makeatother

\begin{document}

\begin{frame}
\tableofcontents
\end{frame}

\section{Test section one}
\begin{frame}test\end{frame}

\section{Test section two}
\begin{frame}test\end{frame}

\section{Test section three}
\begin{frame}test\end{frame}

\end{document}

The result:


text:
Q: How to use the same DatagramPacket to send and receive data in UDP Here I am creating two separate packets to send and receive. Instead of this how can I use the same packet to reply, by overwriting the data, using the setData method with a new data buffer: packet.setData(newbuffer);

Client

package labsheet2;

import java.net.*;
import java.io.*;

public class Clientnew {
  public final static int UDP_PORT = 50001;
  public static void main(String[] args) throws Exception {
  System.out.println("Server Time >>>>");

  //create a DatagramSocket object
  DatagramSocket clientSocket = new DatagramSocket();
  InetAddress ip = InetAddress.getByName("localhost");

  //create buffers to store datagram data in DatagramPacket Objecct
  byte[] buffReceiveData = new byte[100]; //for incoming data
  byte[] buffSendData = new byte[100]; //for outgoing data

  //create the outgoing Datagram with ip and port
  DatagramPacket packetOut = new DatagramPacket(buffSendData,
  buffSendData.length, ip, UDP_PORT);

  //create the incoming DatagramPacket object to wrap receiving data
  DatagramPacket packetIn = new DatagramPacket(buffReceiveData,
  buffReceiveData.length);
  clientSocket.send(packetOut); //send data
  clientSocket.receive(packetIn); //receive data from the server
  String time = new String(packetIn.getData());
  System.out.println(time);
  clientSocket.close(); //close the client socket
}

}

Server

package labsheet2;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Date;

public class Servernew {
public final static int UDP_PORT = 50001;
public static void main(String[] args) throws Exception {

//create a DatagramSocket and bind it to the PORT
DatagramSocket serverSocket = new DatagramSocket(UDP_PORT);
while (true) {
System.out.println("Server is up....");

//create buffers to store datagram data in DatagramPacket Objecct
byte[] buffReceiveData = new byte[100]; //for incoming data
byte[] buffSendData = new byte[100]; //for outgoing data

//Datagram object to wrap incoming data
DatagramPacket packetIn = new DatagramPacket(buffReceiveData,
buffReceiveData.length);

//Receive the incoming data packet to DatagramPacket Object
serverSocket.receive(packetIn);

//Get the source ip from the incoming packet
InetAddress ip = packetIn.getAddress();

//Get the source port from the incoming packet
int port = packetIn.getPort();
buffSendData = new Date().toString().getBytes();//get Date in bytes

//packetIn.setData(buffReceiveData, buffReceiveData.length, ip, port);

//create the outgoing Datagram with source ip and port
DatagramPacket packetOut = new DatagramPacket(buffSendData,
buffSendData.length, ip, port);
serverSocket.send(packetOut);
packetIn = null; //reset incoming DatagramPacket Object
System.out.println("Done !! ");
}
}
}

A:
how can I use the same packet to reply, by overwriting the data, using the setData method with a new data buffer: packet.setData(newbuffer);

By overwriting the data, using the setData() method with a new data buffer: packet.setData(newbuffer);


text:
Q: Maximal subgroups of $\mathbb{Q}$ I have to prove that the group $(\mathbb{Q},+)$ hasn't got any maximal subgroup.
Let $H$ be a maximal subgroup of $G=\mathbb{Q}$. So $H$ is normal in $G$ and  I can consider the quotient group $G/H$. My idea is the following: if I prove
1) this quotient hasn't got any maximal subgroup
2) this quotient has order $p$, where $p$ is a prime number
then I could consider $r \in G$ and obtain $pr \in H$. Therefore $p \frac{x}{p}=x \in H$ for any $x \in G$, so $H=G$, absurde!
But I can't prove 1) and 2)...

A: *

*$G/H$ has no proper non-trivial subgroup because any such subgroup would come from a subgroup of $G$ containing $H$, and $G$ and $H$ are the only possible choices because $H$ is maximal.

*A non-trivial group $\Gamma$ with no proper non-trivial subgroup must be cyclic because any non-trivial element generates a subgroup. The group $\Gamma=\langle g \rangle$ cannot be infinite because $\langle g^2 \rangle$ would be a proper subgroup. Hence, $\Gamma$ is finite of order $n$. If $n=ab$ were composite, then $\langle g^a \rangle$ would be a proper subgroup. Thus, $\Gamma$ has prime order. Apply to $\Gamma=G/H$.

A: If you start with any strict subgroup $H$ of the rationals, can's you always generate a new subgroup with $H$ and a rational number not in $H$?


text:
Q: show points on google map I have list of coordinates in my database, I want to show that list of property on Google map using API, like this:
red mark are my coordinates/places
how is it possible any idea.

A: It's very easy, just read data from database, send it to client in json format and plot it in mail
refer following link,
https://developers.google.com/maps/documentation/javascript/markers
sample data
[{'latitude':'59.327383','longitude':'18.06747','title':'test'}....]

following is sample code
var center = new google.maps.LatLng('center latitude','center longitude'); // set center location

var mapOptions = {
  zoom: 4,
  center: center
}

var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

for(var m in points) {
    var myLatlng = new google.maps.LatLng(points[m].latitude,points[m].longitude);

    // To add the marker to the map, use the 'map' property
    var marker = new google.maps.Marker({
        position: myLatlng,
        map: map,
        title:points[m].title
    });
}


text:
Q: On hover, hide one div, display another I have seen this question have been asked many times, but mine is a little complicated.
I am using bootstrap on my website, and basically, I am trying to join two images one half is a customer image, other half is a business image. What actually I'd like is, when one hover overs the first half i.e the customer image, the second half i.e the business image should turn to the second half of the customer image and the vice versa when someone hovers over the business image.
Here's my HTML code.

In the above code, what I want is when someone hovers over #b1: #c2 should go away, and #b2 should be visible. I tried implementing CSS changes but it doesn't work.
I have added the link on JSfiddle here. http://jsfiddle.net/2R5bq/
Basically on hover, both should be the same.

A: No need for so many div's. One main wrapper, two image wrappers/masks is all you need. See this JSFiddle a threw together.
HTML

        <image src="http://lorempixel.com/320/180/animals/" />

        <image src="http://lorempixel.com/320/180/cats/" />

CSS
#imageWrapper {
    position: relative;
    width: 320px;
    height: 180px;
}

#imageWrapper #imageLeftImageWrapper {
    position: absolute;
    top: 0px;
    left: 5px;
    width: 160px;
    height: 180px;
    overflow: hidden;
}

#imageWrapper #imageRightImageWrapper {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 160px;
    height: 180px;
    overflow: hidden;
}

#imageWrapper #imageRightImageWrapper img {
    position: absolute;
    right: 0px;
}

#imageWrapper #imageLeftImageWrapper:hover,
#imageWrapper #imageRightImageWrapper:hover {
    width: 320px;
    z-index: 1;
}


text:
Q: Ionic nav controller pop flow I have a doubt about how can make this.
// Page 0.1
this.navController.pop();

// Page 0
ionViewWillEnter() {
  console.log("Im here");
}

I have a page that clicking a button I can go back to Page 0. But each time that I get back it doesn't enter inside ionViewWillEnter(). I need to enter to evaluate some new changes in data to print in screen. Any idea?
Environment:
Ionic CLI                     : 6.12.2
Ionic Framework               : @ionic/angular 5.5.1
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics    : 10.0.8
@angular/cli                  : 10.0.8
@ionic/angular-toolkit        : 2.3.3

A: There must be something else going on because it should always execute the ionViewWillEnter when it's about to enter to the page.
Please take a look at this Stackblitz demo

The code of the home page:
import { Component } from "@angular/core";
import { NavController, ViewWillEnter } from "@ionic/angular";

@Component({
  selector: "app-home",
  templateUrl: "./home.page.html",
  styleUrls: ["./home.page.scss"]
})
export class HomePage implements ViewWillEnter {
  constructor(private navController: NavController) {}

  ionViewWillEnter() {
    console.log("Will enter!");
  }

  public openDetailsPage(): void {
    this.navController.navigateForward("/details");
  }
}

And the details page:
import { Component } from "@angular/core";
import { NavController } from "@ionic/angular";

@Component({
  selector: "app-details",
  templateUrl: "./details.page.html",
  styleUrls: ["./details.page.scss"]
})
export class DetailsPage {
  constructor(private navController: NavController) {}

  public goBack(): void {
    this.navController.pop();
  }
}


text:
Q: Getting the name of the input variable from within the function If say I have something like:
myList = []

and a function:
def f(a):
    ...

and I call the function as such (where myList is still of List type):
f(myList)

then within this function itself, is there a way to obtain the name of the variable that is passed in? (i.e. can I get the value "myList" as a string from within the function?)

A: It's not possible. The name of the list holds the reference to the object, not the other way around.
Though if you know the contents of the list, you can do something like this:
a = ["kk","jj"]
for key,value in globals().iteritems():
  if type(value) == list and value == ["kk","jj"]:
    print key


text:
Q: mui-datatables example doesn't render sample code New to React and trying to learn MUI-datatables. Sample code from the Codebox given on the library's page won't render for me in browser and all I see is an empty page. The console shows zero errors.
My HTML:
<!DOCTYPE html>

        <title>MUIDatables Example</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">

Errors regarding CORS and import statements would appear in console unless 'type="text/jsx"' was specified. I am using the Node http-request server and it does load various files in the current directory. Currently the console shows no errors.
JS:
import React from "react";
import ReactDOM from "react-dom";
import MUIDataTable from "mui-datatables";

class App extends React.Component {
  render() {
    const columns = ["Name", "Title", "Location", "Age", "Salary"];

    const data = [
      ["Gabby George", "Business Analyst", "Minneapolis", 30, "$100,000"],
      ["Aiden Lloyd", "Business Consultant", "Dallas", 55, "$200,000"]
// other sample data omitted
    ];

    const options = {
      filterType: "dropdown",
      responsive: "scroll"
    };

    return (
      <MUIDataTable
        title={"ACME Employee list"}
        data={data}
        columns={columns}
        options={options}
      />
    );
  }
}

ReactDOM.render(<App />, document.getElementById("root"));

A: Your code seems ok. Just include the line at the end: export default App; I copy/paste your code and run it. It shows the table perfectly.
import React, {useState, useEffect} from 'react';
import axios from 'axios';

function EditStudentDetails() {
    const [post, setPost] = useState({});
    const id = 1;

    const handleChange = ({target}) => {
        const {name, value} = target;
        setPost({...post, [name]: value});
        console.log(post);
    };

    const handleSubmit = async e => {
        e.preventDefault();

        const editDataById = async () => {
            try {
                const response = await axios.put(`https://jsonplaceholder.typicode.com/posts/${id}`, {
                    method: 'PUT',
                    body: JSON.stringify({
                        id: id,
                        title: post.title,
                        body: post.body,
                        userId: 1
                    }),
                    headers: {
                        "Content-type": "application/json; charset=UTF-8"
                    }
                })
                    .then(response => response.json())
                    .then(json => console.log(json));
                // latestEdit(response.data);
                console.warn(response.data);
            } catch (error) {
                console.warn(error);
            }
        };
        editDataById();
    };
    return (

                    <form onSubmit={handleSubmit}>

                            Title
                            <input type="text" name='title' value={post.title} onChange={handleChange}
                                   className="form-control" id="title"/>

                            Body
                            <input type="text" name='body' value={post.body}
                                   onChange={handleChange} className="form-control" id="body"/>

                        <button type="submit" className="btn btn-primary">Submit</button>
                    </form>

    )
}

export default EditStudentDetails;


text:
Q: Why does Chef throw SSL error when using knife Command on Chef-Workstation? SSL error occurs when we use the knife command to verify successful setup of the Chef-Workstation or when we try to upload a Chef-Cookbook. Using the following commands :
knife client list
knife node list
knife cookbook upload cookbookname

we get the following error on the Chef-Workstation:
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

To resolve this error we tried using rackfile software to create following 3 files:
hostname.key
hostname.pem
hostname.crt

on the Chef-Server.
We placed hostname.pem inside the chef folder on the server itself and inside certs folder on the workstation. Finally we tried to run the commands once again but did not succeed. Any help to resolve the SSL error will be sincerely appreciated.

A: The Chef Server certificate has not yet been pulled into the workstation's trusted_certs directory.
Run the command
knife ssl fetch
from your Chef Workstation.
This will pull the certificate from the Chef Server and place it in the Workstation's trusted_certs directory. The default location of the trusted_certs is in your .chef/trusted_certs directory within your chef-repo directory.
Then run
knife ssl check
to verify the certificate.
Certificates that are in the trusted_certs directory will be trusted by any execution of the knife command.
https://docs.chef.io/workstation/getting_started/#get-ssl-certificates

A: You need to register that certificate on each workstation. Also, make sure the certificate matches the correct URL (i.e. the API endpoint, not the web interface)


text:
Q: How to convert MIMO transfer function to SS model in MATLAB I have a system with 2 inputs and 2 outputs
described by 4 tf's with common denominators of order 4.
How can I convert this system to a state-space model of order 4 ?
If I use the following code I am getting MIMO SS model of order 8 while MIMO SS model of order 4 is expected. Please suggest any solution to this problem.
numr11=[1 2 3];
denr11=[1 2.273 14.03 20.15 27.82];

R11=tf(numr11,denr11);

numr12=[3 2 1];

R12=tf(numr12,denr11);

numr21=[4 5 6];

R21=tf(numr21,denr11);

numr22=[7 8 9];

R22=tf(numr22,denr11);

R=[R11,R12;R21,R22]

sys1= ss(R)

sys_final=minreal(sys1)


text:
Q: Scala optional parameter of a Case class implicit val formats = DefaultFormats
val p = each_rsvp.extract[RSVPData]
p.venue.getOrElse(default = None)

I have done the extraction using case classes. RSVPData is a case class defined as follows:
case class RSVPData(
                     venue: Option[VenueDetails] = None,
                     visibility: String,
                     response: String,
                     guests: Int,
                     member: MemberDetails,
                     rsvp_id: Long,
                     mtime: Long,
                     event: EventDetails,
                     group: GroupDetails
                   )

As shown above, parameter 'venue' is an optional field of type VenueDetails which is also a case class.
case class VenueDetails(venue_name: String, lon: Double, lat: Double, venue_id: Int)

When I do:
p.venue.getOrElse(Default=None)

I get the output as :
VenueDetails(Waller Creek Pub House,-97.73584,30.266438,24179503)

The above is returned as 'Product with Serializable'. How to extract data from VenueDetails case class separately as venue name, latitude, longitude, venue id, from this output .

A: I'm going to assume that p is an RSVPData item. Correct? (
When you use .getOrElse on an Option, you are attempting to provide a default value in the case where no value is defined (that is, when the value is None). In other words, getOrElse gives you an opportunity to provide default venue details when none are available, so that you can handle both cases in a consistent manner. In your case, this argument should be an instance of VenueDetails.
By passing None as the argument to getOrElse you're saying that you want None if the Option's value is None - which makes very little sense. Even worse, getOrElse now returns two types of value: a VenueDetails or None. So Scala determines the return type as those traits that are common to both of these types, which it has determined to be Product with Serializable. As a result, you can't treat the return value as a VenueDetails, and so you cannot access its members.
General rule of thumb: NEVER pass None to Option.getOrElse! ;-)
(As an aside, specifying the argument name in the call is unnecessary; p.venue.getOrElse(None) is simpler and equivalent to p.venue.getOrElse(default = None).)
So, now it depends upon what you're trying to do, which isn't clear from your question. I'll try to provide a few examples...
This first example is more imperative than functional. It attempts to print out details of the venue:

// Is the venue defined? (If None, then it's undefined.)
if (p.venue.isDefined) {

  // Retrieve the defined details. Note that get throws an exception if p.venue is None.
  // BTW, detail's type is inferred to be VenueDetails.
  val details = p.venue.get
  println(s"Venue: ${details.venue_name}, loc: (${details.lon}, ${details.lat}), id: ${details.venue_id}")
}

// Handle the case where the venue details are undefined.
else {
  println("Venue details are unknown")
}

Here's a slightly more functional version:

val desc = p.venue.fold {

  // This argument is evaluated only if p.venue is None.
  "Venue details are unknown"
} {

  // This argument is executed only if p.venue is defined (not None).
  // Again, details is inferred to have type VenueDetails
  details =>
    s"Venue: ${details.venue_name}, loc: (${details.lon}, ${details.lat}), id: ${details.venue_id}"
}
println(desc)

This version uses a default VenueDetails instance for cases where the venue details are unknown:

// Default details for case where p.venue is None.
val defaultDetails = VenueDetails("Unknown", 0.0, 0.0, -1)

// Here, details will have type VenueDetails.
val details = p.venue.getOrElse(defaultDetails)
val desc = s"Venue: ${details.venue_name}, loc: (${details.lon}, ${details.lat}), id: ${details.venue_id}"
println(desc)

In this latter case, if p.venue is None, then the following will be printed:
Venue: Unknown, loc: (0.0, 0.0), id: -1

However, if p.venue is defined as per your example, then the following will be printed:
Venue: Waller Creek Pub House, loc: (-97.73584, 30.266438), id: 24179503

A: I hope this would work:
p.venue.map(_.venue_name).getOrElse(None)


text:
Q: Want to Show Image and Text side by side in android I am new to android development, I am building an app and on that I want to show Imageview and Textview side by side in android layout. Below code is showing textview below the imagview. Here I am using linearlayout.
In this layout I am showing some data from database.
Expected layout design:
Imageview Text1
          Text2

Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.example.spand.krishnasoftwares.Main2Activity">
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@color/colorBackground">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingTop="20px"
        android:id="@+id/vly">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageView"
            android:src="@drawable/gym_logo1"/>
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:id="@+id/ly1">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Exercise 1"
                android:textAlignment="center"
                android:textAllCaps="true"
                android:textColor="#ffffff"
                android:layout_marginTop="20px"
                android:textSize="10dp"/>
        </LinearLayout>
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/ly1"
            android:paddingLeft="5px"
            android:paddingRight="5px"
            android:id="@+id/ly2"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Exercise Name:"
                android:textColor="#ffffff"
                android:layout_marginTop="20px"
                android:layout_weight="1"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/en1"
                android:textColor="#ffffff"
                android:layout_marginTop="20px"
                android:layout_weight="1"/>
        </LinearLayout>
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/ly2"
            android:id="@+id/ly3"
            android:paddingLeft="5px"
            android:paddingRight="5px"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Speed: "
                android:textColor="#ffffff"
                android:layout_marginTop="10px"
                android:layout_weight="1"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/es1"
                android:textColor="#ffffff"
                android:layout_marginTop="10px"
                android:layout_weight="1"/>
        </LinearLayout>
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/ly3"
            android:paddingLeft="5px"
            android:paddingRight="5px"
            android:orientation="horizontal"
            android:id="@+id/ly4">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Repetition: "
                android:textColor="#ffffff"
                android:layout_marginTop="10px"
                android:layout_weight="1"/>

            <TextView
                android:id="@+id/erep1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10px"
                android:layout_weight="1"
                android:textColor="#ffffff"
                android:textDirection="ltr" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/erep2"
                android:textColor="#ffffff"
                android:layout_marginTop="10px"
                android:layout_weight="1"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/erep3"
                android:textColor="#ffffff"
                android:layout_marginTop="10px"
                android:layout_weight="1"/>
        </LinearLayout>
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/ly4"
            android:paddingLeft="5px"
            android:paddingRight="5px"
            android:orientation="horizontal"
            android:id="@+id/ly5">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Weight: "
                android:textColor="#ffffff"
                android:layout_marginTop="10px"
                android:layout_weight="1"/>

            <TextView
                android:id="@+id/ew1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10px"
                android:layout_weight="1"
                android:textColor="#ffffff"
                android:textDirection="ltr" />

        </LinearLayout>
    </LinearLayout>

</RelativeLayout>

A: why don't you use drawable left?
Use drawable left in first text-view and with proper padding between drawable and text you can easily achieve what you intend.
        <?xml version="1.0" encoding="utf-8"?>
     <android.support.constraint.ConstraintLayout
       xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:app="http://schemas.android.com/apk/res-auto"
       xmlns:tools="http://schemas.android.com/tools"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       tools:context="com.example.spand.krishnasoftwares.Main2Activity">

           <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Exercise 1"
            android:textAlignment="center"
            android:textAllCaps="true"
            android:textColor="#ffffff"
            android:drawableLeft="@drawable/"
            android:layout_marginTop="20px"
            android:textSize="10dp"/>
      </android.support.constraint.ConstraintLayout>

BENEFITS:
    You can save extra nesting of multiple view groups.
    Lesser rendering time in case of recycler view or list view.
    Recommended by Google developers resource.

A: Check this.. It will creates layout view hows you want.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/vly"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingTop="20px"
        android:weightSum="3">

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:src="@drawable/add" />

        <LinearLayout
            android:id="@+id/ly"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="2"
            android:orientation="vertical">

            <LinearLayout
                android:id="@+id/ly1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="20px"
                    android:text="Exercise 1"
                    android:textAlignment="center"
                    android:textAllCaps="true"
                    android:textSize="10dp" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ly2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/ly1"
                android:orientation="horizontal"
                android:paddingLeft="5px"
                android:paddingRight="5px">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="20px"
                    android:layout_weight="1"
                    android:text="Exercise Name:" />

                <TextView
                    android:id="@+id/en1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="20px"
                    android:layout_weight="1" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ly3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/ly2"
                android:orientation="horizontal"
                android:paddingLeft="5px"
                android:paddingRight="5px">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"
                    android:text="Speed: " />

                <TextView
                    android:id="@+id/es1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ly4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/ly3"
                android:orientation="horizontal"
                android:paddingLeft="5px"
                android:paddingRight="5px">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"
                    android:text="Repetition: " />

                <TextView
                    android:id="@+id/erep1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"

                    android:textDirection="ltr" />

                <TextView
                    android:id="@+id/erep2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"
                    android:textColor="#ffffff" />

                <TextView
                    android:id="@+id/erep3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ly5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/ly4"
                android:orientation="horizontal"
                android:paddingLeft="5px"
                android:paddingRight="5px">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"
                    android:text="Weight: " />

                <TextView
                    android:id="@+id/ew1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"

                    android:textDirection="ltr" />

            </LinearLayout>
        </LinearLayout>

    </LinearLayout>
</RelativeLayout>

A: you can't use ConstraintLayout in this way, follow the this code;
    <LinearLayout
    android:weightSum="2"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"/>

</LinearLayout>

A: Looks like @drawable/gym_logo1 is the child of @+id/vly LinearLayout that has android:orientation="vertical". You should try making it the child of @+id/ly1

A: Create your layout like this it'll work for you...but remind one thing search first if you don't get solution then ask...
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/colorBackground">
<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageView"
    android:src="@drawable/gym_logo1"/>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingTop="20px"
    android:layout_toRightOf="@+id/imageView"
    android:id="@+id/vly">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/ly1">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Exercise 1"
            android:textAlignment="center"
            android:textAllCaps="true"
            android:textColor="#ffffff"
            android:layout_marginTop="20px"
            android:textSize="10dp"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ly1"
        android:paddingLeft="5px"
        android:paddingRight="5px"
        android:id="@+id/ly2"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Exercise Name:"
            android:textColor="#ffffff"
            android:layout_marginTop="20px"
            android:layout_weight="1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/en1"
            android:textColor="#ffffff"
            android:layout_marginTop="20px"
            android:layout_weight="1"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ly2"
        android:id="@+id/ly3"
        android:paddingLeft="5px"
        android:paddingRight="5px"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Speed: "
            android:textColor="#ffffff"
            android:layout_marginTop="10px"
            android:layout_weight="1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/es1"
            android:textColor="#ffffff"
            android:layout_marginTop="10px"
            android:layout_weight="1"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ly3"
        android:paddingLeft="5px"
        android:paddingRight="5px"
        android:orientation="horizontal"
        android:id="@+id/ly4">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Repetition: "
            android:textColor="#ffffff"
            android:layout_marginTop="10px"
            android:layout_weight="1"/>

        <TextView
            android:id="@+id/erep1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10px"
            android:layout_weight="1"
            android:textColor="#ffffff"
            android:textDirection="ltr" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/erep2"
            android:textColor="#ffffff"
            android:layout_marginTop="10px"
            android:layout_weight="1"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/erep3"
            android:textColor="#ffffff"
            android:layout_marginTop="10px"
            android:layout_weight="1"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ly4"
        android:paddingLeft="5px"
        android:paddingRight="5px"
        android:orientation="horizontal"
        android:id="@+id/ly5">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Weight: "
            android:textColor="#ffffff"
            android:layout_marginTop="10px"
            android:layout_weight="1"/>

        <TextView
            android:id="@+id/ew1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10px"
            android:layout_weight="1"
            android:textColor="#ffffff"
            android:textDirection="ltr" />

    </LinearLayout>
</LinearLayout>

</RelativeLayout>
</android.support.constraint.ConstraintLayout>

A: Change your .xml to
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:background="@color/colorBackground">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="20px"
            android:id="@+id/vly">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/imageView"
                android:src="@drawable/gym_logo1"/>
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:id="@+id/ly1">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Exercise 1"
                    android:textAlignment="center"
                    android:textAllCaps="true"
                    android:textColor="#ffffff"
                    android:layout_marginTop="20px"
                    android:textSize="10dp"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Exercise Name:"
                    android:textColor="#ffffff"
                    android:layout_marginTop="20px"
                    android:layout_weight="1"/>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/en1"
                    android:textColor="#ffffff"
                    android:layout_marginTop="20px"
                    android:layout_weight="1"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Speed: "
                    android:textColor="#ffffff"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"/>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/es1"
                    android:textColor="#ffffff"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"/>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Repetition: "
                    android:textColor="#ffffff"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"/>

                <TextView
                    android:id="@+id/erep1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"
                    android:textColor="#ffffff"
                    android:textDirection="ltr" />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/erep2"
                    android:textColor="#ffffff"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/erep3"
                    android:textColor="#ffffff"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Weight: "
                    android:textColor="#ffffff"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"/>

                <TextView
                    android:id="@+id/ew1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10px"
                    android:layout_weight="1"
                    android:textColor="#ffffff"
                    android:textDirection="ltr" />
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
</android.support.constraint.ConstraintLayout>

`


text:
Q: How to use css media queries inline tag? i have element, and this element have style, the style is auto generate from jQuery Plugin, can i do media queries inline tag?
My Code :

Can i do this?

A: You can't. Anything that would require curly braces, such as media queries, pseudo-elements or pseudo-classes, can't be put in a style attribute. Only the stuff that is inbetween the curly braces.
So depending on your setup, there may not be a solution at all. Sorry.


text:
Q: How to remove AdmPwd Permission from BUILTIN\Users (MS LAPS) I've deployed MS LAPS to manage local admin passwords and all is working fine, except that non-privileged users are able to access the local admin password, in both Powershell and LAPS UI.
Running the command below shows me that in addition to the intended groups, BUILTIN\Users can also read the password.  (This command is the same that the LAPS_OperationalGuide suggests, but I piped results to a ForEach and Out-File so that output was not truncated.)
    Find-AdmPwdExtendedRights -Identity 'All Computers' | `
     ForEach-Object -Begin $null -Process {$_.ObjectDN}, {$_.ExtendedRightHolders} -End $null |`
      Out-File C:\Temp\WTF.txt

mydomain\Domain Users group is a member of BUILTIN\Users (which is normal), so maybe this is where the problem is coming from...?  Regardless, I cannot find a way to remove the AdmPwd permission from BUILTIN\Users or from mydomain\Domain Users.  I've stepped through every single account listed in ADSIEdit\AllComputers\Properties\Security\Advanced but no user or group has the AdmPwd permission, except those that should.  Did same in ADUC with same result.
Can someone please tell me how to remove the AdmPwd permission from BUILTIN\Users?  There is a Set-AdmPwdExtendedRights cmdlet, but no Remove-AdmPwdExtendedRights cmdlet.  Failing that, can someone tell me how to find where the permission is coming from?
Before folks start asking, yes, I have closely followed the LAPS_OperationGuide, have run all the Powershell cmdlets, have gone to ADSI Edit and removed "All Extended Rights", and have given rights to my two intended groups.  Everything about LAPS is working properly except for the BUILTIN\Users problem.

A: Your issue has nothing to do with your implementation of LAPS. We noticed the same problem with regular domain users being able to read LAPS passwords. The issue was caused by misconfigured permissions or privilege creep on AD computer objects. The solution was to audit all computer objects by script and reset inheritance to remove any custom permissions on new objects. One major reason for this issue was discovered to be caused by administrators giving domain users permission to join a computer to the domain when creating the computer object. This permission stayed with the object and was enough to let them read the LAPS password after the computer was joined to the domain.

A: Thanks to Semicolon over at Spiceworks.com, I found the solution.
https://community.spiceworks.com/topic/2314503-laps-problem-still?page=1#entry-9150359
TL;DR:
When looking at Properties > Security > Advanced of the relevant computer OU, and then the offending MyDomain\Users entry, I did not notice that the list of Permissions/Properties was scrollable.  There are a ton of settings in there that I wasn't seeing.  The Users entry did not have All Extended Rights, but did have Read mcs-McS-AdmPwd.  Wasn't able to uncheck the box (would just re-check itself after OK), so I removed the entry entirely.  Problem solved.  Thanks to all that contributed.


text:
Q: Which string encoding is this? On one of my webhooks, I am receiving the following string
9\x09?\x09\x02\x09&\x09@

This was supposed to be the text in regional language. For English, the content seems fine. But for vernacular strings, the service provider is sending this. Consider that I am using Javascript, how do I decode this string?
This is how the webhook is being called :
/api/test?content=9\x09?\x09\x02\x09&\x09@&timestamp=20210120145223

A: It's ASCII. All occurrences of the four characters \xST are converted to 1 character, whose ASCII code is ST (in hexadecimal), where S and T are any of 0123456789abcdefABCDEF.


text:
Q: Regex to remove non alphanumeric characters from UTF8 strings How can I remove characters, like punctuation, commas, dashes etc from a string, in a multibyte safe manner?
I will be working with input from many different languages and I am wondering if there is something that can help me with this
Thanks

A: There are the unicode character class thingys that you can use:

*

*http://www.regular-expressions.info/unicode.html

*http://php.net/manual/en/regexp.reference.unicode.php
To match any non-letter symbols you can just use \PL+, the negation of \p{L}. To not remove spaces, use a charclass like [^\pL\s]+. Or really just remove punctuation with \pP+
Well, and obviously don't forget the regex /u modifier.

A: I used this:
$clean = preg_replace( "/[^\p{L}|\p{N}]+/u", " ", $raw );
$clean = preg_replace( "/[\p{Z}]{2,}/u", " ", $clean );

A: Similar post
Remove non-utf8 characters from string
I'm not sure if this covers all characters though.
According to this post on th dreamincode forum
http://www.dreamincode.net/forums/topic/78179-regular-expression-to-remove-non-ascii-characters/
this should work
/[^\x{21}-\x{7E}\s\t\n\r]/

A: Maybe this will be usefull?
$newstring = preg_replace('/[^0-9a-zA-Z\s]/', $oldstring);


text:
Q: How can we delete space with a shell script? I did a script in order to display different things, in different case.
The script is :
#!/usr/bin/env bash

# declare an array, to store stuff in
declare -a myArray
shopt -s nocasematch

# read the full file into the array
# This while loop terminates when pressing CTRL-D
i=1
while read -r line; do
   myArray[i]="${line}"
   ((i++))
done < /dev/stdin

# Process the array
for ((j=1;j<i;++j)); do
   # perform your actions here on myArray[j]

    case "${myArray[j]}" in
    bob)
        echo  "boy"
        ;;
    alicia)
        echo "girl"
        ;;
    cookie)
        echo "dog"
        ;;
    *)
        echo "unknown" "${myArray[j]}"
        ;;

    esac

done

But I have a problem, when I execute the code with this command:
cat input.txt | ./prog.sh > file.txt

I have the following input:
bob
alicia
amhed
cookie

daniel

In this input I have so space, but when I run my program I don't obtain this right result.  I need my code not to take into account spaces, but if it take care about the space, is wrote "unknown" on the OUTPOUT file.txt
and I obtain the result :
boy
girl
unknown amhed
dog
unknown
unknown
unknown daniel

So can I eliminate/delete the space without touching the input file?

A: why do this in bash?
with awk
$ awk 'BEGIN{n=split("bob boy alicia girl cookie dog",x);
             for(i=1;i<n;i+=2) a[x[i]]=x[i+1]}              # build the lookup table

            {print $1 in a?a[$1]:"unknown "$1}' file

boy
girl
unknown amhed
dog
unknown
unknown
unknown daniel

you can externalize the lookup map to another file as well, so that the code doesn't need to be modified if either values change.

A: If you want to do nothing when the input line is empty, you can add that to your case:
#!/usr/bin/env bash

# declare an array, to store stuff in
declare -a myArray
shopt -s nocasematch

# read the full file into the array
# This while loop terminates when pressing CTRL-D
i=1
while read -r line; do
   myArray[i]="${line}"
   ((i++))
done < /dev/stdin

# Process the array
for ((j=1;j<i;++j)); do
   # perform your actions here on myArray[j]

    case "${myArray[j]}" in
    "") # This is an empty line, skip it
        ;;
    bob)
        echo  "boy"
        ;;
    alicia)
        echo "girl"
        ;;
    cookie)
        echo "dog"
        ;;
    *)
        echo "unknown" "${myArray[j]}"
        ;;

    esac

done

Alternatively, check whether the line you read was empty before adding it to the array.

A: *

*You can read from stdin and process each line and avoid array creation.

*Use && [[ -n $line ]] to make sure you process only non-empty lines.

*By default read command reads it from /dev/stdin so you can omit < /dev/stdin from your code.

Code:
shopt -s nocasematch

while read -r line && [[ -n $line ]]; do

    case "$line" in
    bob)
        echo  "boy"
        ;;
    alicia)
        echo "girl"
        ;;
    cookie)
        echo "dog"
        ;;
    *)
        echo "unknown $line"
        ;;
    esac

done

Run it as:
./prog.sh < input.txt

Output:
boy
girl
unknown amhed
dog


text:
Q: Perl script to dynamically monitor web pages I'm tweaking a perl script that I use to monitor sites (response times etc.) and I'm running into issues using Nagios::WebTransact.
I want to be able to post to a page on one of my sites, get a response, and use the values in that response to post to the next page. It doesn't look like Nagios::WebTransact supports this. I read it has "limited ability to respond to dynamic web pages".
Is there an alternative I can use or possibly a feature of WebTransact that I am unaware of?

A: I am not familiar with Nagios::WebTransact, but would suggest looking into WWW::Mechanize

A: My solution ended up being to parse the response text, which you can get using check() on the transaction. Not the solution I was hoping for but it was still workable.


text:
Q: microsoft exchange 2003 and the iPad2 Trying to get my ipad2 phone and other things to work with microsoft exchange, but nothing seems to work. anyone know of a how-to guide to set it up to work with mobile devices? at the moment no mobile devices work with the exchange server, only computer with Outlook, and the web-based email. tried getting an OMA installer to work with it but it caused issues and didnt work at all. I need help, preferrably a step-by-step guide. Exchange is Service Pack 2 as well

A: Here's the documents for setting up Exchange emails on an iOS.
Basically Settings > Mail, Contacts, Calendars > Add Account > Microsoft Exchange.

A: I have not setup an iPad, but if it is anything like the iPhone, the settings you want would be:
servername.com:443
emailaddress@domain.com
password


text:
Q: TypeError: Object doesn't support this action (node_modules) I already checked all the similar issues with regards to this error in stackoverflow. However, my issue rather seems unique as the error is not due to my own code on the script itself. Rather to Angulars modules that are imported alright (the scripts included in the node_modules directory). When I'm debugging the code, all of the errors points out to  every node_modules scripts, and mostly pointing over and over again back to a specific file named _object-sap.js. I only encounter this issue in IE, and I've already uncommented the polyfill files and even added some more shims, still the issue exist. it's just some code I could not edit actually as this modules/libraries are maintained and imported with angular. How do I fix this?, Are there any specific polyfills that I need to import for this to work in I.E?. Because this seems to be rather dependency/polyfill issues to me but I could no longer get where would I get those and if ever I did wrong on importing dependencies or polyfills.
THe following screenshots are some of the things happening on debug.

Console output:

I already converted the es6 polyfill files to es5 with a transpiler (as could be seen in the screenshot), and still the issue exist. (so I just reverted this changes back to the default polyfill files included in the polyfil.ts file.

Also, when I was searching for the error Object.free: argument is not an Object which is one of the errors being thrown.
Object.freeze Error Fix
It seems that I just need to pass an argument as it is required on IE. But this is a module in Angular, I don't have to edit this afaik among other node_modules files.
How do I fix this 13 errors then?. TIA


text:
Q: ASROCK Q1900B-ITX won't start I have a ASROCK Q1900B-ITX main board with DDR3 1333 SODIMM CL9 RAM (2x 2 GB by Transcend) and a 400 watts ATX power supply.
However, the system won't start. The board is powered, the power LED is burning, but that's all: speaker says nothing and the screen remains black (neither by VGA or by HDMI).
Interestingly sometimes the power supply powers up twice when I push the power button: The fans start and the power LED burns for about 4 seconds, then turns off for 2 seconds and restart. Then they run "forever" and nothing more happens.
Any ideas?
UPDATE
Meanwhile I'm totally stumped: I tried to start the system with only one RAM bar (for the case that one of them is broken). The system started. Putting the other bar in: it started as well. Putting both back, it won't start (as above).
How can that be?

A: The RAM slot B had a defect. A bit more "debugging" showed: Putting any RAM bar in slot A: everything was fine, putting anything in slot B: the board won't start.
I sent the board back, the vendor verified this error and sent me another board working fine.


text:
Q: How to use param passing in Lambda / API Gateway I am trying to build an API using API Gateway, Lambda, and RDS. So you type in the URL and get the specific rows from RDS back in a JSON format.
So this is what I would like to achieve.

*

*/production/myfootballapi?table=football -> all rows in the table
should be returned (not working)

*/production/myfootballapi?table=football&id=2 -> only the id 2 row
should be returned (only this case works)

The main problem that I am having is that I currently can't show all rows because I always have to define the id otherwise an error occurs.
My API Gateway Body Mapping Template:
{
"table" : "$input.params('table')",
"id" : $input.params('id')
}

My Lambda function
var mysql = require('mysql2');
var config = require('./config.json');

var pool  = mysql.createPool({
host     : config.dbhost,
user     : config.dbuser,
password : config.dbpassword,
database : config.dbname,
});

exports.handler =  (event, context, callback) => {

//prevent timeout from waiting event loop
context.callbackWaitsForEmptyEventLoop = false;

pool.getConnection(function(err, connection) {
if (err) throw err;
// Use the connection

var table = event.table;
var id = event.id;

// This if-function is just a try to solve this problem but it doesn't work
if (id !== null) {
  var sql = "SELECT * FROM ?? WHERE id = ?";
  var inserts = [table, id];

} else {
  var sql = "SELECT * FROM ?";
  var inserts = table;
}

sql = mysql.format(sql, inserts);

connection.query(sql, function (error, results, fields) {
  // And done with the connection.
  connection.release();
  // Handle error after the release.
  if (error) callback(error);
  else callback(null,results);
  });
});
};

If you need further information, please leave a comment.
THANKS!

A: First of all, many thanks to everyone for helping me. I fixed it myself but I will also document this if someone has a similar question.
> API Gateway <
Go to Integration Request

Add the following Body Mapping Template

{
#set($queryMap = $input.params().querystring)

#foreach( $key in $queryMap.keySet())
  "$key" : "$queryMap.get($key)"
  #if($foreach.hasNext),#end
#end
}

Go to Method Request

Add the parameters

> Lambda <
var mysql = require('mysql2');
var config = require('./config.json');

var pool  = mysql.createPool({
    host     : config.dbhost,
    user     : config.dbuser,
    password : config.dbpassword,
    database : config.dbname,
  });

exports.handler =  (event, context, callback) => {

  //prevent timeout from waiting event loop
  context.callbackWaitsForEmptyEventLoop = false;

  pool.getConnection(function(err, connection) {
    if (err) throw err;
    // Use the connection

   var table = event.table;
   var id = event.id;

    if (isNaN(id)) {
       var sql = "SELECT * FROM ??";
       var inserts = table;
     } else {
       var sql = "SELECT * FROM ?? WHERE id = ?";
       var inserts = [table, id];
     }

    sql = mysql.format(sql, inserts);

  connection.query(sql, function (error, results, fields) {
      // And done with the connection.
      connection.release();
      // Handle error after the release.
      if (error) callback(error);
      else callback(null,results);
    });
  });
};

Source: https://aws.amazon.com/de/blogs/compute/using-api-gateway-mapping-templates-to-handle-changes-in-your-back-end-apis/
I think, it is probably not the best code in lambda but it works for now. I will improve it later. :D

A: I believe your problem may be your if (id !== null) statement.  I mocked up your example, added console.log(sql); and found that even when no id was sent in the request, the SQL query returned was SELECT * FROM '\"Customer\"' WHERE id = NULL.
I changed your if statement to the following.

if (id) {
  var sql = "SELECT * FROM ?? WHERE id = ?";
  var inserts = [table, id];

} else {
  var sql = "SELECT * FROM ?";
  var inserts = table;
}

After making this change, the SQL query was SELECT * FROM '\"Customer\"' as expected when no ID is in the request.
For completeness, I did make one other modification.  I did not use the Body Mapping Template at all.  I used the "Use Lambda Proxy Integration" setting in the Integration Request configuration instead.  This will eliminate the need to use Body Mapping Templates.

In the Method Request configuration, define the URL Query String Parameters

In your Lambda function, you will be able to access your table and id as event.queryStringParameters.table and event.queryStringParameters.id respectively.  Then perform whatever actions you want in your Lambda function.

var table = JSON.stringify(event.queryStringParameters.table);
var id = JSON.stringify(event.queryStringParameters.id);

console.log("Table: " + table);
console.log("ID: " +id);

----------- EDITED ---------------
Make sure your callback in your Lambda function sends a valid response that can be handled by the API gateway.  Here is how I formatted my sample code that I mocked up to test this.

var response = {
    "statusCode": 200,
    "headers": {
        "my_header": "my_value"
    },
    "body": JSON.stringify(results),
    "isBase64Encoded": false
};
callback(null, response);

Hope this helps.

A: I think your mapping template is probably too simple. If you get that to work I'd love to know how because my template requires a great deal of code and it was a pain to get right but I've accepted it. I think without more processing you'll probably run into other issues when certain values or put into your parameters. You'll have to deal with escaping etc etc.
This is the template I use to map API gateway to lambda. I pulled it out of my cloudformation template so forgive me if random json or extra quotes are still present. If you rather see the cloudformation template I can show that.
#set($allParams = $input.params()) {
       \"params\" : {
                #foreach($type in $allParams.keySet())
                #set($params = $allParams.get($type))
                \"$type\" : {
                    #foreach($paramName in $params.keySet())
                   \"$paramName\" :
                   \"$util.escapeJavaScript($params.get($paramName))\
                    if($foreach.hasNext),#end\
                   #end
                }\
                #if($foreach.hasNext),#end
                #end\
       }
}

A: You should change the if-else statement to :
if (id !== "") {
  var sql = "SELECT * FROM ?? WHERE id = ?";
  var inserts = [table, id];
} else {
  var sql = "SELECT * FROM ?";
  var inserts = table;
}

Since you have set the body mapping template the id will be set to "" when you don't pass it as parameter. You can see its value in logs or you can try to log the id before you enter the if-else statement.


text:
Q: Still ok to use Session variables in ASP.NET mvc, or is there a better alternative for some things (like a cart) I have a situation where I need access to a shopping cart over several pages.
So, on the product page - create the cart an add some items
On the cart checkout page - confirm the billing address
On the cart checkout post - do a final check, add cart to DB and go off to payment
My question is, whats the best way to pass around the cart?
I have tried passing the Cart from page to postback and keeping all the values alive, however on some pages (the billing address confirmation page) this seems like a lot of hassle, all I want to check is the billing address and dont really want tons of HiddenFor() on the page to populate the cart back again
TempData[] is what I used for the product to checkout page, then wondered is it best to keep on setting TempData all the time when....
you could just use a session variable?
For some reason I read its not great practice to use Session, hence the question.
Thanks for your guidance, I can happy provide some code/more info if you deem it helpful.

A: It is perfectly OK to use sessions in ASP.NET MVC, especially in the shopping cart scenario of yours.
There are drawbacks of using sessions, but they seem not to apply to your case:
1) The sessions prevent a user to properly browse your site from multiple browser tabs, the changes made in one tab are reflected in all others.
But with a shopping cart, it's exactly what you need. You don't need several shopping carts per user, do you?
2) The sessions aren't persisted by default, and if you're operating on a webfarm, you need to save the sessions in your database to be accessible by every farm node.
But it seems unlikely that you're scaling like this. And if you meet the scaling neccessity, sessions won't be your top problems.
3) Sessions require additional functionality from the user's browser (typically, cookies). But modern browsers all support cookies, so you only have to worry about very special browsers.
There are also some benefits of the sessions over hidden inputs:
1) The smaller overhead. Only a small session cookie is passed back and forth between you and the client, rather than the complete set of hidden inputs.
2) Simpler programming. You don't have to make sure you included your hidden inputs in every single one of your pages.
3) Security. The client can alter the contents of hidden inputs however he pleases. You can't easily pass sensitive information via hidden inputs, you need to encrypt it. Session values are stored on the server, so the client doesn't have access to them.

A: I would use Session, unless there were reasons to avoid it.
For example, I have one project where I have repeated calls to an MVC action in the background. This action serves a file, which is slow over the network. I used to use Session, but I quickly discovered the main adverse effect: IIS won't execute calls from the same user in parallel, but only sequentially one after the other. This had a dramatic impact on performance, so I used an alternative method: I set  HttpContext.User.Identity to the username, and use it as the key to fetch things from the database. But you could probably set it to some random GUID and have this to replace Sessions.

A: For a shopping cart, you should definitely not use session state. A sound approach is to use the Anonymous Identification Module to manage a cookie for you. All you need is one line in web.config.
<system.web>
    <anonymousIdentification enabled="true" />
</system.web>

Then, on each request you can use the Request.AnonymousID property (which returns a string representing a GUID) to lookup the shopping cart in the database.
public ActionResult ShowCartDetails()
{
    var CartId = new Guid(Request.AnonymousID);

    // Lookup cart...

    return View();
}

This is not only more efficient than using session state, it is also simpler.
References:

*

*http://brockallen.com/2012/04/07/think-twice-about-using-session-state/

*http://forums.asp.net/t/1785321.aspx?Stored+Shopping+Cart+for+unknown+user

A: I tend to use a cookie with my shopping cart serialized into base64 string this seems to work quite well

A: Sessions are fine, but consider the Amazon-style system whereby you are issued with a recognition cookie even when you are not logged in. This allows them to store your shopping basket in the database, keyed against the recognition cookie.
The result is that you avoid the horrible user experience of losing your shopping basket due to session timeout / server appdomain recycling (the latter is mitigated by using SQLState session storage, which I recommend). The user can come back days later and their basket will still be there. Unless that's a security / privacy problem, I find it the better solution.

A: It is very much ok to use session with asp.net mvc application. steve sanderson has used session for cart in sample application that comes with his book. The code is available here

A: In cart system the products that are added to cart are very important so using session is not good idea in my view. Using cookies and a temporary table in database is one of best Idea. We can store those data for forever or can clear after certain days.


text:
Q: How to move objects between buckets on Google Cloud Platform? Newbie here, I apologize for my ignorance.
I have 2 buckets on google cloud platform. Each bucket has folders with objects in those folders.
/bucket2/cloud-backup-archive/4-media set/object
/bucket/cloud-backup/4-media set/object
I want to move all the objects from the bucket2 named directories to the bucket named directories.
I have tried using transfer on the console and that doesn't work as it doesn't allow me to drill down to the directories.  It seems to only allow the contents of a bucket to be transffered.
Thank you for the help.
Kevin

A: One of the possible ways to move the specific objects from one bucket to another is to use gsutil.
To move all objects from specific subdirectory in bucket2 to specific subdirectory in bucket, use the following command:
gsutil mv "gs://bucket2/cloud-backup-archive/4-media set/*" "gs:bucket/cloud-backup/4-media set/"

Note if you have a large amount of objects you might want to use gsutil -m mv option to perform a multi-threaded/multi-processing move.