text:
Q: Create different lists in Python from a text file So I have a text file called DOB that contains names and birthdates, and the .txt file is saved as follows (I'm only including the first few lines as there are quite a few of them:
Orville Wright 21 July 1988
Rogelio Holloway 13 September 1988
Marjorie Figueroa 9 October 1988
Debra Garner 7 February 1988
Tiffany Peters 25 July 1988
Hugh Foster 2 June 1988
What I would like to do is create a list of the names, and another list containing the birth dates. However, I don't know how to extract only a specific word/s in a line and append them to the list. Would anybody be able to help me in understanding how to do that?

A: This script assumes, that persons can have more than 2 names and the date consists of three strings (day, month and year):
names, dates = [], []
with open('your_text_file.txt', 'r') as f_in:
    for line in map(str.strip, f_in):
        if not line:    # skip empty lines
            continue
        tmp = line.split()

        names.append(' '.join(tmp[:-3]))
        dates.append(' '.join(tmp[-3:]))

print(names)
print(dates)

Prints:
['Orville Wright', 'Rogelio Holloway', 'Marjorie Figueroa', 'Debra Garner', 'Tiffany Peters', 'Hugh Foster']
['21 July 1988', '13 September 1988', '9 October 1988', '7 February 1988', '25 July 1988', '2 June 1988']

A: You could do this by using either the String .split(' ') method and accessing each value how you would access a list. Another great way to store this kind of information would be using the CVS module in python. You can read about its usage here. Hope I could help!


text:
Q: Dynamical search-function to show/hide divs this is my first post on StackOverflow. I hope it doesn't go horribly wrong.
<input type="Text" id="filterTextBox" placeholder="Filter by name"/>
<script type="text/javascript" src="/resources/events.js"></script>
<script>
$("#filterTextBox").on("keyup", function () {
    var search = this.value;
    $(".kurssikurssi").show().filter(function () {
        return $(".course", this).text().indexOf(search) < 0;
    }).hide();
});

</script>

I have a javascript snippet like this on my school project, which can be found here: http://www.cc.puv.fi/~e1301192/projekti/tulos.html
So the search bar at the bottom is supposed to filter divs and display only those, that contain certain keyword. (t.ex, if you type Digital Electronics, it will display only Divs that contain text "Digital Electronics II" and "Digital Electronics". Right now, if I type random gibberish, it hides everything like it's supposed to, but when I type in the beginning of a course name, it will not hide the courses that dont contain the certain text-string.
Here is an example that I used (which works fine): http://jsfiddle.net/Da4mX/
Hard to explain, but I hope you realize if you try the search-function on my page. Also, I'm pretty new to javascript, and I get the part where you set the searchbox's string as var search, the rest I'm not so sure about.
Please help me break down the script, and possibly point where I'm going wrong, and how to overcome the problem.

A: in your case I think you show and hide the parent of courses so you can try
$("#filterTextBox").on("keyup", function () {
    var search = $(this).val().trim().toLowerCase();
    $(".course").show().filter(function () {
        return $(this).text().toLowerCase().indexOf(search) < 0;
    }).hide();
});

A: Try this this is working now, paste this code in console and check, by searching.

$("#filterTextBox").on("keyup", function () {
    var search = this.value;  if( search == '') { return }
 $( ".course" ).each(function() {
   a = this; if (a.innerText.search(search) > 0 ) {this.hidden = false} else {this.hidden = true}
 }); })

Check and the search is now working.

A: Your problem is there :
return $(".course", this)

From jquery doc: http://api.jquery.com/jQuery/#jQuery-selection

Internally, selector context is implemented with the .find() method,
  so  $( "span", this ) is equivalent to  $( this ).find( "span" )

filter function already check each elements
then, when you try to put $(".course") in context, it will fetch all again...
Valid code :
$("#filterTextBox").on('keyup', function()
{
    var search = $(this).val().toLowerCase();
    $(".course").show().filter(function()
    {
        return $(this).text().toLowerCase().indexOf(search) < 0;
    }).hide();
});

In fact, you can alternatively use :contains() CSS selector,
but, it is not optimized for a large list and not crossbrowser
http://caniuse.com/#search=contains

A: You were accessing the wrong elements. This should be working:
$(".kurssikurssi").find('.course').show().filter(function () {
      var $this = $(this)
      if($this.text().indexOf(search) < 0){
              $this.hide()
      }
 })

redpajama_set_name: RedPajamaStackExchange


text:
Q: Autmapper Call method on every property map I want to call a specific method xyz() on every property mapped by generic mapper configuration. Is this possible?
I am using Automapper v 9. Purpose is to call the method on each property mapped by Automapper to check add remove data at runtime.
public static IMapper CreateMapper<TSource, TDestination>()
        {
            var config = new MapperConfiguration(
                cfg =>
                {
                    cfg.Advanced.AllowAdditiveTypeMapCreation = true;
                    cfg.AllowNullDestinationValues = true;
                    cfg.AllowNullCollections = true;
                    cfg.CreateMap<TSource, TDestination>()
                    .PreserveReferences()
                });

            config.AssertConfigurationIsValid();

            return config.CreateMapper();
        }

A: Yes of-course you can do it upon your need I mean before map or after map globally !
Use this official Auto-mapper Doc. for reference

A: Yes, you can call what you want. I already use like this.
  CreateMap<UserMessage, USER>()
                .ForMember(dest => dest.X, opts => opts.MapFrom(src => src.A!= null ? MessageExtensions.GetCvTitle(src.A) : string.Empty))
                .ForMember(dest => dest.Y, opts => opts.MapFrom(src => MessageExtensions.GetFacultyName(src.B)))
                .ForMember(dest => dest.Z, opts => opts.MapFrom(src => MessageExtensions.GetDepartmentName(src.C)))
                .ForMember(dest => dest.T, opts => opts.MapFrom(src => MessageExtensions.GetProgramName(src.D)))


text:
Q: Magento home page popular products Hi All I want to show 4 popular products on the home page of my magento 1.7.1 install. (The I can select by putting them into a category).
I've set this up by creating a hidden category called popularhome and added 4 products into it.
I've included this in a static block into my home page template by using:
{{block type="catalog/product_list" column_count="4" category_id="17" template="catalog/product/listhome.phtml"}}

My listhome.phtml template looks like this:

<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>

  ×
  <?php echo $this->__('There are no products matching the selection.') ?>

<?php else: ?>
    <?php // List mode ?>
    <?php if($this->getMode()!='grid'): ?>
    <?php $_iterator = 0; ?>
    <?php else: ?>
    <?php // Grid Mode ?>
    <?php $_collectionSize = $_productCollection->count() ?>
    <?php $_columnCount = $this->getColumnCount(); ?>
    <?php $i=0; foreach ($_productCollection as $_product): ?>
        <?php if ($i++%$_columnCount==0): ?>
            <?php endif ?>

            <?php if(($i-1)%$_columnCount==0): ?><?php elseif($i%$_columnCount==0): ?><?php endif; ?>

                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image thumbnail"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(225); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>

                    <?php if($_product->getRatingSummary()): ?>
                    <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                    <?php endif; ?>
                    <?php echo $this->getPriceHtml($_product, true) ?>

            <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>

        <?php endif ?>
        <?php endforeach ?>
    <?php endif; ?>

<?php endif; ?>

However this is only showing 2 of the 4 products yet I cannot figure out why? Does anyone see anything I am missing?
Thanks!

A: First you need to check ,the products that you want to be appear in category page,
Is they really belong to that categories.
After that make sure Backend > Manage Categories > Edit categories > Display settings >
is Anchor = yes Then re-index your catalog.
To verify you need to cross check catalog_category_product and catalog_category_product_index.
If the category id and product id is mapped properly in these tables you should be good to go.
hope this will sure help you!


text:
Q: how to cope with a null Date in an ibatis mapping I have the following in one of my result mappings.
<result property="updateDate" column="update_date" javaType="java.util.Date"
jdbcType="DATE" nullValue="01/01/1900"/>

basically updateDate is a setter that accepts Date.  However, sometimes updateDate will be null in the database.  In those cases I want to have a default date of 01/01/1900.
However, the above mappings gives me the following error when updateDate is null from DB
Cause: java.lang.RuntimeException: Error setting property 'setUpdateDate'

A: Is the problem that your nullValue="01/01/1900" is trying to pass a string into updateDate setter?  If you took that out, I assume the setter would be called by iBatis with 'null' and then you could apply the default in your setter in the Java code.

A: Can you change your updateDate method to take a null and set the "01/01/1900" Date in there?
This message can also occur when the setter doesn't exist or is spelled incorrectly too, make sure that's not the case.


text:
Q: Dynamic hyperlink that filters a table based on the ActiveCell value (VBA) I'm creating a dynamic hyperlink that will filter a table on another sheet (Sheet15).
My goal is to have the user be able to select a cell on Sheet3 and have the VALUE of this cell be the filter on the other sheet.
Here is my code so far:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    If Target.Type = msoHyperlinkRange And Target.Range.Address = "$S$15" Then
        Application.ScreenUpdating = False
        Sheet15.Visible = True
        Sheet15.ListObjects("Table17").Range.AutoFilter Field:=19, Criteria1:=ActiveCell.Value
        Sheet15.Activate
        Application.ScreenUpdating = True
    End If
End Sub

However, when I click the hyperlink, the table is not filtered at all, so I gotta be doing something wrong.
Can anyone assist?

UPDATE
Here is updated code.
Cell S17 is now the value that I want to filter the table to:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    If Target.Type = msoHyperlinkRange And Target.Range.Address = "$S$15" Then
        Application.ScreenUpdating = False
        Sheet15.Visible = True
        Sheet15.ListObjects("Table17").Range.AutoFilter Field:=19, Criteria1:=Sheet3.Range("S17").Value
        Sheet15.Activate
        Application.ScreenUpdating = True
    End If
End Sub

But the issue remains. When I click they hyperlink, I will be brought to this other sheet, but the table is not filtered at all.

A: Note: unless the hyperlink points to itself, ActiveCell.Value will be the value at the link destination: use Target.Range.Value if you want the value from the cell containing the link.
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    If Target.Type = msoHyperlinkRange And Target.Range.Address = "$S$15" Then
        Application.ScreenUpdating = False
        With Sheet15
            .Visible = True
            .ListObjects("Table17").Range.AutoFilter Field:=19, _
                                     Criteria1:=Target.Range.Value
            .Activate
        End With
        Application.ScreenUpdating = True
    End If
End Sub

A: sticking to your original plans, and assuming column "A" is the one with cities names, place the following in your worksheet code pane
Option Explicit

Dim lastCell As Range '<--| declare a module scoped range variable to store the last cell selected by the user, if "valid"

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address = "$S$15" Then Exit Sub '<-- do nothing if user selected cell with hyperlink
    Set lastCell = Intersect(Target, Columns("A")) '<-- change "Columns("A") to a named range with your cities
End Sub

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    If lastCell Is Nothing Then Exit Sub '<--| no action if lastCell has not been properly set by 'Worksheet_SelectionChange()'

    If Target.Type = msoHyperlinkRange And Target.Range.Address = "$S$15" Then
        Application.ScreenUpdating = False
        Sheet15.Visible = True
        Sheet15.ListObjects("Table17").Range.AutoFilter Field:=19, Criteria1:=lastCell.Value '<--| set the criteria as 'lastCell' value
        Sheet15.Activate
        Application.ScreenUpdating = True
    End If
End Sub

as per comments, you change  Columns("A") reference in Worksheet_SelectionChange() to your actual range with cities names (perhaps a named range)


text:
Q: How we use Loadrunner parameterization technique for distribute the parameterize data to different virtual devices while run time? I am using LoadRunner for test mobile application which is developed in Sybase Unwired Platform technology.
I recorded the LoadRunner script and I can able to run in LoadRunnear but for Load Testing we have to create more virtual devices that time we have to pass the different values to different Virtual devices for this scenario I used parametrization but its not working in my scenario could any one help me for resolve this issue.
P.S. parametrization works fine for iteration of the execute the script but my scenarios is one time I have to run the script with (ex) 100 users.
Thanks in advance,
Karthick

A: This precise scenario is covered both in the HP produced training material as well as the online book in the chapter on parameterization.  If you are being asked to deliver without having been though training then your manager is setting you up to fail.     This is not a reflection on your skills, but on your managers behavior

A: I think what you are asking about could be resolved by changing the value in the 'Parameter List' window from 'Select next row : Sequential' to 'Unique'.
This will force the individual virtual users to use unique data subsets of your parameters, as in no two users will use the same data rows. You can then allocate the number of rows of parameters to push to each virtual user and their behavior once they run out of their allocated data sets.


text:
Q: How to Integrate Azure API Management With Paypal I've been integrating Azure API Management with Paypal.
Here is the current flow

*

*User goes to APIM portal and Signs In

*Azure B2C flow is executed

*On Auth Success the Delegation endpoint is executed to evaluate the APIM operation (SignIn, Subscribe, etc)

*When the operation is Subscribe, redirect to the corresponding Paypal subscription link

*Paypal flow is executed

*Paypal return to the delegation endpoint configured in Paypals returnurl

So far so good, the issue I'm having is that the ony thing I have access to from paypal is the referer, which is like this
https://www.sandbox.paypal.com/webapps/billing/subscriptions?ba_token=[BA_TOKEN]&country.x=US&locale.x=en_US&mode=member&token=[TOKEN]
I'm lost on how I could use those tokens to identify which product the user subscribed to.

A: In step 4, store the subscription link or its ID before redirecting the user, as a pending checkout/order.
When they return, note any additional parameters in the return URL.
This should give you enough information to match the return event with the original subscription redirection and user.

For the best experience, change your flow to use no redirection at all.
See the modern "in-context" JS buttons solution here, which keeps your site loaded in the background: https://developer.paypal.com/docs/subscriptions/integrate/#4-create-a-subscription
(If you don't know what that means, click the PayPal button in this demo and note the window that opens; that's essentially the experience: https://developer.paypal.com/demo/checkout/#/pattern/client )


text:
Q: How do I grab a variable from a file and make it global? class vars{
    public static void main(String[] args) {

        try {
            File tokenFile = new File("./TOKEN");
            final Scanner token = new Scanner(tokenFile);
        } catch (FileNotFoundException e) {
            System.out.println("Make a file name \"TOKEN\" and put your token in it");
            e.printStackTrace();
        }

        try {
            File prefixFile = new File("./PREFIX");
            final Scanner prefix = new Scanner(prefixFile);
        } catch (FileNotFoundException e) {
            final String prefix = "-- ";
        }

        final long Creator = ******************L; // ----
        final long[] Dev = {******************L, ******************L, ******************L}; // -----, ----, ------

    }
}

public class discordbot extends ListenerAdapter {

    public static void main(String[] args) {

        System.out.println("\nJDA version: " + JDAInfo.VERSION + "\n");
        try {

            EnumSet<GatewayIntent> intents = EnumSet.of(
                    GatewayIntent.GUILD_MESSAGES,
                    GatewayIntent.GUILD_VOICE_STATES,
                    GatewayIntent.DIRECT_MESSAGES,
                    GatewayIntent.GUILD_INVITES,
                    GatewayIntent.GUILD_MEMBERS
            );

            JDA jda = JDABuilder.createDefault(vars.main().token, intents)
                    .addEventListeners(new discordbot())
                    .setActivity(Activity.watching("out for the summons"))
                    .setStatus(OnlineStatus.ONLINE)
                    .enableCache(CacheFlag.VOICE_STATE)
                    .disableCache(CacheFlag.EMOTE)
                    .build();
            jda.awaitReady();
            System.out.println("\nJDA is ready.\n");

        } catch (LoginException loginerror) {

            System.out.println("\nSomething went wrong with authentication.\n");
            loginerror.printStackTrace();

        } catch (InterruptedException interrupted) {

            System.out.println("\nJDA got interrupted.\n");
            interrupted.printStackTrace();

        }
    }

I'm trying to use the token variable in the JDA builder, but I can't seem to be able to make it into a global variable. I have a lot of functions that use these variables.
I can see them working if I just made them hard-coded, but since I'm planning to distrubute this when I'm done, it needs this type of flexibilty.
Sorry if the question looks bad, I'm not quite the questiong expert.

A: EDIT: THIS DOES NOT WORK
First make the variables global:
class vars{

    public enum Global {
        token,
        prefix,
        Creator,
        Dev
    }

}

Then just set the variables elsewhere:
class vars{

    public enum Global {
        token,
        prefix,
        Creator,
        Dev
    }

    public static void main(String[] args) {

        Scanner rawToken = null;
        try {
            File tokenFile = new File("./TOKEN");
            token = new Scanner(tokenFile);
        } catch (FileNotFoundException e) {
            System.out.println("Make a file name \"TOKEN\" and put your token in it");
            e.printStackTrace();
        }

        try {
            File prefixFile = new File("./PREFIX");
            Scanner prefix = new Scanner(prefixFile);
        } catch (FileNotFoundException e) {
            final String prefix = "-- ";
        }

        final long Creator = ******************L; // ----
        final long[] Dev = {******************L, ******************L, ******************L}; // -----, ----, ------

}

Now use can use them anywhere by calling vars.Global.token and etc.
EDIT: THIS DOES NOT WORK


text:
Q: XSLT copy output without node and filter on key XML Input:
<root>
    <results>
        <output>
            <tag1>
                <tag2>
                    <tag3>
                        <tag4>2016-03-27T14:27:10.542+03:00</tag4>
                    </tag3>
                    <tag5/>
                    <tag6>
                        <record>
                            <column name="Result">smth</column>
                        </record>
                    </tag6>
                </tag2>
            </tag1>
        </output>
    </results>
    <DesiredParentTag UserName="admin" UserId="1" timestamp="2016-03-27T17:06:10.764+03:00">
        <DesiredChildTag operation="delete">
            <action startInstant="2016-03-30T08:35:00+03:00" id="244078"/>
            <action startInstant="2016-03-29T08:35:00+03:00" id="244078"/>
        </DesiredChildTag>
        <DesiredChildTag operation="insert">
            <action id="2" startInstant="2016-03-21T08:35:00+03:00"/>
        </DesiredChildTag>
        <DesiredChildTag operation="update">
            <action id="222" startInstant="2016-03-21T08:35:00+03:00"/>
            <action id="45" startInstant="2016-03-21T08:35:00+03:00"/>
        </actions>
    </DesiredParentTag>
</root>

Desired XML OUTPUT:
    <DesiredParentTag UserName="admin" UserId="1" timestamp="2016-03-27T17:06:10.764+03:00">
        <DesiredChildTag operation="delete">
            <action startInstant="2016-03-30T08:35:00+03:00" id="244078"/>
            <!--excluded duplicate id if operation='delete'-->
        </DesiredChildTag>
        <DesiredChildTag operation="insert">
            <action id="2" startInstant="2016-03-21T08:35:00+03:00"/>
        </DesiredChildTag>
        <DesiredChildTag operation="update">
            <action id="222" startInstant="2016-03-21T08:35:00+03:00"/>
            <action id="45" startInstant="2016-03-21T08:35:00+03:00"/>
        </actions>
    </DesiredParentTag>

I want to copy all that's under the "DesiredParentTag" and if the operation="delete" to exclude the action tags that have the same id. Everythhing else just regular copy.
My current xsl: (it copies the tags I need and the attributes but doesn't exlucude the duplicates if the attirbute operation='delete')
<xsl:key name="ok" match="DesiredParentTag/DesiredChildTag/action" use="@id"/>
<xsl:template match="*">

    <xsl:copy-of select="DesiredParentTag[count(key('ok',@id)[1]|.)=1]"/>

</xsl:template>

</xsl:stylesheet>

A: Use a stylesheet that does not copy the duplicates:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:key name="id" match="DesiredChildTag[@operation = 'delete']/action" use="concat(generate-id(..), '|', @id)"/>

    <xsl:template match="/">
        <xsl:apply-templates select="//DesiredParentTag"/>
    </xsl:template>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="DesiredChildTag[@operation = 'delete']/action[not(generate-id() = generate-id(key('id', concat(generate-id(..), '|', @id))[1]))]"/>

</xsl:transform>

Online at http://xsltransform.net/6r5Gh47.
Or in an XSLT 2.0 version:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

    <xsl:key name="id" match="DesiredChildTag[@operation = 'delete']/action" use="@id"/>

    <xsl:template match="/">
        <xsl:apply-templates select="//DesiredParentTag"/>
    </xsl:template>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="DesiredChildTag[@operation = 'delete']/action[not(. is key('id', @id, ..)[1])]"/>

</xsl:transform>

http://xsltransform.net/6r5Gh47/1.


text:
Q: Code to turn blackberry off Is there a command or piece of code that I can use to switch the blackberry off from within my app? I have created a simple app that consists of a button, now what I want is for the device to shut down whenever the button is clicked. Is this possible?
Thanks

A: Yes Device.requestPowerOff(boolean allowAutoStart)


text:
Q: What permissions are required to allow Lambda function to create SageMaker Batch Transform Job if bucket name doesn't include sagemaker? Here is custom policy for calling SageMaker Batch Transform Job:
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject"
      ],
      "Resource": [
        "arn:aws:s3:::<bucket-name>/path/*"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject"
      ],
      "Resource": [
        "arn:aws:s3:::<bucket-name>/another_path/*"
      ]
    },
    {
      "Action": [
        "s3:ListBucket"
      ],
      "Effect": "Allow",
      "Resource": [
        "arn:aws:s3:::<bucket-name>"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
        "sagemaker:CreateTransformJob",
        "sagemaker:DescribeTrainingJob",
        "sagemaker:DescribeTransformJob"
      ],
      "Resource": "*"
    }
  ]
}

And I also attached to the Lambda role the default AWSLambdaBasicExecutionRole permissions.
If I change the bucket name to include start with sagemaker, everything works fine, however, I cannot do that. Do you have any suggestions about the policy and what permissions I have missed to add?
Edit
Here is error messages from SageMaker transform job logs: # 011... 24 more2020-07-15T12:49:26.332:[sagemaker logs]: <bucket-name>/path/input_file.json: 403 Forbidden (403): Forbidden and 2020-07-15T12:49:26.345:[sagemaker logs]: MaxConcurrentTransforms=2, MaxPayloadInMB=6, BatchStrategy=MULTI_RECORD. There are only 2 lines in that job log group. In another log group are no errors, only messages that model was loaded for predictions.
And error message in Lambda: Transform failed with the following error: ClientError: See job logs for more information


text:
Q: How can I read a specific key in c# being anywhere in the program. c# I'm a beginner programer that have started programming a week ago. As part of the learning to consolidate knowledge, I try to recreate my Toothbrush program. I want to dependent the program on two keys PowerButton and OptionButton.
Here's the code:
Console.WriteLine("Hello!");
int powerButtonCount = 0;

int optionButtonCount = 0;

if (Console.ReadKey().KeyChar == 'p')
{
    powerButtonCount++;
    while (powerButtonCount >= 1)
    {
        if (Console.ReadKey().KeyChar == 'o')
        {
            optionButtonCount++;
            switch (optionButtonCount)
            {
                case 1:
                    Console.WriteLine("Sensitive");
                    while (powerButtonCount == 2 && optionButtonCount == 1)
                    {
                        Console.WriteLine("Brushing in Sensitive mode!");
                    }
                    break;
                case 2:
                    Console.WriteLine("Gum Care");
                    while (powerButtonCount == 2 && optionButtonCount == 2)
                    {
                        Console.WriteLine("Brushing in Gum Care mode!");
                    }
                    break;
                case 3:
                    Console.WriteLine("Intense");
                    while (powerButtonCount == 2 && optionButtonCount == 3)
                    {
                        Console.WriteLine("Brushing in Intense mode!");
                    }
                    break;
                case 4:
                    Console.WriteLine("Daily Clean");
                    while (powerButtonCount == 2 && optionButtonCount == 4)
                    {
                        Console.WriteLine("Brushing in Daily Clean mode!");
                    }
                    break;
                case 5:
                    Console.WriteLine("Whiten");
                    while (powerButtonCount == 2 && optionButtonCount == 5)
                    {
                        Console.WriteLine("Brushing in Whiten mode!");
                    }
                    break;

            }
        }
        else if (powerButtonCount == 3)
        {
            powerButtonCount = 0;
            Console.WriteLine("Good Bye!");
        }
    }
}

What I came across is problem that I can't read input from user in realtime. After my testing, seems like I'm able to jump between switches, but when I want to initialize "Brushing thing" C# doesn't read 'p'.


text:
Q: Make UIView stay on screen I make a UIView that is movable by the user on the screen, it is a round rectangle that is 40x40, and the screen that it is on has a nav bar at the top and right now it can be moved under the nav bar, and then it is gone and can't come back.
Is there a way to make it so that it can't be moved off the screen?
I make it moveable like this:
- (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer;

- (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer {

    CGPoint translation = [recognizer translationInView:self.view];
    recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x, recognizer.view.center.y + translation.y);
    [recognizer setTranslation:CGPointMake(0, 0) inView:self.view];

}

So my question is how can I make it so it can be moved off the screen.
Thanks for the help.


text:
Q: Multiple Types of Objects in Java containers I am learning about generics in Java, and was wondering if this would be considered poor coding.
If I declare an ArrayList<Object> I know that I can put any type of object into this list, as all objects descend from Object. I also know that when I call ArrayList.remove(index) the object that gets taken out of the array is of type Object, and that I need to typecast it to the type of object that I want to use.
Now suppose I have object of Dog, Cat, and Car. Would it be bad to put all three objects into the array, considering they are not similar classes?

A: Let us revise the definition of a Collection, as found in the Java Introduction to Collections tutorial:

A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data. Typically, they represent data items that form a natural group [...].

Look at the bold words. That should give you your answer.
If you put objects in ArrayList which do not belong to same implementations, you are definitely inviting trouble in situations when you want to retrieve objects from the list and typecast them to appropriate types. So you should AVOID doing that.
Consider you store objects of Dog and Car in ArrayList.
Then for each object stored, you want to call some method, say barkLoudly(). Now,this method will work fine with the Dog object. But when this is called on Car, boooom....An Exception will arise.

A: I think the answer is "usually, but not always."  There's not a lot of hard and fast rules in coding;  if you look hard enough you can always find an exception.  But if you pull objects out of a collection that you then have to cast to the correct type, that's usually a design error.
Try to make code so that the objects you work with already have the correct type for what you want to do.  If you don't need to cast, then Object can be fine.  If you do need to cast, you should probably rethink your design.

A: The design will be really bad, to avoid all such kind of issues, Generics were introduced.
But the same you can achive using below, provided you have same type of objects.

Cat and Dog extends Animal
Car and Bike extends Vehicle

But do not mix the the above two statements.
Animal class:
public abstract class Animal {
    protected String name;
}

Dog class:
public class Dog extends Animal {
    public Dog(String name) {
        this.name=name;
    }
}

Cat class:
public class Cat extends Animal {
    public Cat(String name) {
        this.name=name;
    }
}

Main class:
public class Main {
    public static void main(String[] args) {
        Cat Cat = new Cat("C");
        Dog Dog = new Dog("D");
        ArrayList<Animal> list = new ArrayList<Animal>();
        list.add(Cat);
        list.add(Dog);
   }
}

A: You shouldn't do this
Lets look at it this way, if an we call a generic Object just a "thing" and you create a(n) (Array) List of just "things" then how useful is that to you? To store those three things that have seemingly nothing in common in one list doesn't make sense. Containers were added so that programmers could store groups of similar things.
If we take a look at it from more of a programming point of view as opposed to a real world point of view it raises more problems. Your code might try to perform an action that only Car can do, the compiler doesn't like that your Dog class just tried to turnOnEngine(), and throws an error that you didn't expect.
So in short, it is bad practice to add unrelated items to a collection.

A: The purpose of generics is to have the compiler doing all the type checking for us. So that we don't need to worry about casting or have to remember what types are really in the list. So using generics also helps documenting your code by making the contained type more explicit.
You could:

*

*not use generics and enforce your own type checking (by safe downcasting with instanceof)

*use generics with separate lists for each type

*use generics with an abstraction for related class, for example: List<Animal>

A: It depends on what you want to use the List for.
You should declare the generic type value of the List to be the most restrictive that suits your needs, and that way you get the strongest check from the compiler to eliminate the errors at compile time.
There might be cases when you really just want to store any type of objects in a List in which case you would use List<Object>. Again, depends on what you want to use the List and the elements for.


text:
Q: Write out the multiplication table for the following set of matrices over $\mathbb Q$ Question:
Write out the multiplication table for the following set of matrices over $\mathbb Q$:
$$A=\left(\begin{array}{ll}
    1 & 0  \\
    0 & 1
  \end{array}\right)$$
 $$B=\left(\begin{array}{ll}
    -1 & 0  \\
     0 & 1
  \end{array}\right)$$
 $$C=\left(\begin{array}{ll}
    1 &  0  \\
    0 & -1
  \end{array}\right)$$
 $$D=\left(\begin{array}{ll}
    -1 & 0  \\
     0 & -1
  \end{array}\right)$$
My Attempt: I am not sure what the question is asking. Is it just asking to do a 4x4 multiplication table and multiply each of the matrix by each other? For example:
\begin{array}{|c|c|c|c|}
\hline
& A& B & C & D \\ \hline
 A& & &\\ \hline
 B&  & &\\ \hline
 C&  & &\\ \hline
D&  & &\\ \hline
\end{array}
If that is what it's asking, should I multiply row x column or column x row?

A: Could you provide some more context? Without further context, your guess seems reasonable.
In this special case, the matrices are commutative, i.e. AB = BA (this is easy to see:
$$\left(\begin{array}{ll}
    a & 0  \\
    0 & b
  \end{array}\right)
  \times
\left(\begin{array}{ll}
    c & 0  \\
    0 & d
  \end{array}\right)
=
\left(\begin{array}{ll}
    ac & 0  \\
    0 & bd
  \end{array}\right)
=
\left(\begin{array}{ll}
    ca & 0  \\
    0 & db
  \end{array}\right)
=
\left(\begin{array}{ll}
    c & 0  \\
    0 & d
  \end{array}\right)
\times
\left(\begin{array}{ll}
    a & 0  \\
    0 & b
  \end{array}\right)
$$)
Therefore, you only have to compute half of that table.
simply using that $Q\backslash\{0\}$ is a commutative group with 1.

A: Hint:
note that $A$ is the identity matrix, and:
 $$D=-A \qquad C=-B \qquad B^2=C^2=A \qquad BC=CB=-A=D $$
so it is simple to complete the multiplication table.


text:
Q: Calculating Work rate ( word) problems 1. The problem statement, all variables and given/known data
A factory has gotten an order for $N$ products. For this job it has $n$ available machines.If all the machines would work simultaneously the order would have been completed in 24 hours. However due some complications there exist only two possible way to build the products:
$a)$ The machines begin working one after the other like this:
In the first hour only one machines works
In the second hour two machines work
3 hour tree machines are working
$\vdots$
n-th hour and all next hours  n machines are working
$b)$ $n-5$ machines are working all the time
in case $b)$ the products are made 6 hours faster than in case $a)$ How many machines are in the factory
2. The attempt at a solution
I was asked this question by some students I was helping out  and I was really surprised when I was unable to answer it .
The way I tried to tackle this was the following:
First I tried to calculate the amount of work 1 machine does in 1 hour .
I know that $n$ machines complete $N$ in 24 hours therefore one machines does $\frac{N}{n}$ of work in 24 hours. therefore the amount of work a machine does in 1 hour should be $\frac{N}{24n}$( not sure if this is correct)
then I started with case $4a)$
1 hour->1 machine->$\frac{N}{24n}$ of total work done
2 hour ->2 machines->$\frac{N}{24n}+\frac{2N}{24n}$ of total work done
3 hour -> 3 machines ->$\frac{N}{24n}+\frac{2N}{24n}+\frac{3N}{24n}$ of total work done
here is where I started noticing a recursion
n-th hour ->n machines ->$\sum\limits_{i=1}^{n} \frac{i \cdot N}{24n}=\frac{N}{24n}(1+2+3+4+\cdots+n)=\frac{N}{24n}\frac{n(n+1)}{2}=\frac{N(n+1)}{48}$
and every next hour we would add another $\frac{N}{24}$ of work
then I tried using case $b)$
we know that every hour we get $\frac{(n-5)\cdots N}{24n}$ work done
1 hour ->$\frac{(n-5)\cdot N}{24n}$ work done
2 hour -> $\frac{(n-5)\cdot N}{24n}+\frac{2(n-5)\cdot N}{24n}$
3 hour-> $\frac{(n-5)\cdot N}{24n}+\frac{2(n-5)\cdot N}{24n}+\frac{3(n-5)\cdot N}{24n}$
$\vdots$
t-th hour $\frac{(n-5)\cdot N}{24n}\sum\limits_{i=1}^{t} i=\frac{(n-5)\cdot N}{24n}\frac{t(t+1)}{2}$
however after (if it even is correct ) I'm not completely sure how to continue:
I know I still haven't used that case $b)$ takes 6 less hours to complete than $a)$  but i'm now exactly sure how to use that here. I know there is something obvious that i'm missing but I just cant find it
Any help is greatly appreciated

A: A simple way to tackle this interesting word puzzle is to work in machine-hours of which $24n$ are needed. Let (a) take $T$ hours.
This gives the following equations. $$nT-\frac{1}{2}n(n-1)=24n$$ $$(T-6)(n-5)=24n$$
Eliminating $T$ you will obtain a quadratic in $n$ with solution  $$n=25$$(Then $T=36.$)


text:
Q: How can I get *ALL* the info for available packages in apt at once? I would like to get the details about all the available packages in apt without installing them. I know that apt-cache search . would give me the list and description of all the available packages. However, I'm interested in the same list but with the most recent version. Is it possible?
I also know that I can loop over the package names and run apt-cache show pkgName, but I do not want to make multiple queries to apt-cache. I want to query it only once or use another tool or another available resource that could give me this info.
Edit: I would like the output to be something like this on each line:
package1, version
package2, version
...

And version, is the most recent version available in apt repository.

A: One easy answer to your question is to use dpkg instead of apt. apt will happily do all the logic and keep track of the versions precisely so you needn't muck around with such tedious details.
This particular command shows currently-installed versions, not available-for-upgrade (use apt list --upgradeable for that)
Try dpkg -l | grep ii | awk '{print$2, $3}' | sed 's/ /, /'

*

*Use dpkg -l to get the complete list of packages and versions in your package database

*Limit the output by showing only installed (ii) packages: grep ii

*Use awk to print only the second and third columns with : awk '{print$2, $3}'

*Insert your comma using sed: sed 's/ /, /'


text:
Q: Remotely access an EJB across a network or networks from client Assuming a CLI or Swing interface client, how is a remote Bean accessed through Glassfish?  By obtaining a reference to the BeanManager?
sample code:
Hashtable contextArgs = new Hashtable();

// First you must specify the context factory.
// This is how you choose between jboss implementation
// vs. an implementation from Sun or other vendors.
contextArgs.put( Context.INITIAL_CONTEXT_FACTORY, "com.jndiprovider.TheirContextFactory" );

// The next argument is the URL specifying where the data store is:
contextArgs.put( Context.PROVIDER_URL, "jndiprovider-database" );

// (You may also have to provide security credentials)

// Next you create the initial context
Context myCurrentContext = new InitialContext(contextArgs);

http://en.wikipedia.org/wiki/Java_Naming_and_Directory_Interface#Basic_lookup
So, for a CLI app to access a running glassfish app server, it would use something along the lines of:
    Context context = null;
    try {
        context = new InitialContext();
        hello = (Hello) context.lookup("java:global/SalutationApp/SalutationApp-ejb/Hello");
        hello.myRemoteMethod();
    } catch (Exception e) {
        e.printStackTrace();
    }

only with a specified URL to connect to a specific glassfish instance?  How is a connection established?

A: If you are doing a real remote lookup, you cannot do it through the CDI's BeanManager, since the Swing GUI is not local.
First you need to configure the application server to allow remote calls - this most likely includes some authentication settings, but I have never done this on Glassfish.
Here is how we lookup the remote interface of our EJB bean in one of our own Swing applications that accesses a EJB deployed on JBoss 4.
First, we added a jndi.properties into the ClassPath of the UI, which contains the information which server is responsible for the naming lookup (note that the port number is application server specific).  This is a jndi.properties file used in one of our own Swing GUIs:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=server.local\:1199

Next, given that your naming context now knows how to lookup remote JNDI names, you can use something like this (again, this is used in our Swing UI):
InitialContext ctx = new InitialContext();
MyRemote mr = (MyRemote) ctx.lookup("global/jndi/name/of/remote/interface");

Instead of using the properties file, you can also configure the InitialContext by passing config values in code, something like this:
    Properties env = new Properties();
    env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory"); // depends on your server
    env.setProperty(Context.PROVIDER_URL, "jnp://server.local:1099/");
    env.setProperty(Context.SECURITY_PRINCIPAL, "user");
    env.setProperty(Context.SECURITY_CREDENTIALS, "password");
    InitialContext ctx = new InitialContext(env);

This answer is not complete, but I hope this helps to get you started.


text:
Q: VHDL writing to file I have a simple task to do. I have a moudule hilbert which is unit under test. I just want to write "real_o" and "img" in a file on every rising edge of clock like

1   2
1   3
0  -2
0  -1
1   0
1   4

Where left column is real_o and right is img.
test bench code is
COMPONENT hilbert

PORT(

     clk : IN  std_logic;

     reset : IN  std_logic;

     x : IN  std_logic_vector(15 downto 0);

     real_o   : out STD_LOGIC;

     img : OUT  std_logic_vector(3 downto 0)

    );

END COMPONENT;

--Inputs
signal clk : std_logic := '0';

   signal reset : std_logic := '0';

   signal x : std_logic_vector(15 downto 0) := (others => '0');

--Outputs
   signal img : std_logic_vector(3 downto 0);

   signal real_o : std_logic;

BEGIN

-- Instantiate the Unit Under Test (UUT)

uut: hilbert PORT MAP (

      clk => clk,

      reset => reset,

      x => x,

      real_o => real_o,

      img => img

    );

Can someone tell me steps to write real_o and img signals columnwise in a file?

A: Your question is not specific enough for this site.  People will help you, but only if you have a specific problem that you are trying to solve.  "Can you tell me what steps to do whatever" is too vague.
I will link you to an example that I created for file IO in VHDL that might help you.  If you have any specific problems feel free to create a new post about them.
VHDL Writing to File


text:
Q: Proving $M$ has a unique topology s.t. each $\phi_\alpha$ is a homeomorphism onto its image; and in this topology, $M$ is a top. manifold. Can someone please help me with the following problem? I understand why these conditions are necessary, however, I am having difficulties grasping the uniqueness component. Doesn't it just stem from the homeomorphism that we get from $\phi$?
Let $M$ be a set, and suppose we have a collection of subsets $U_\alpha \subset M$ and injections $\phi\colon U_\alpha \to \mathbb{R}^n$ satisfying:
(a) For each $\alpha, \phi_\alpha(U_\alpha)$ is open in $\mathbb{R}^n$.
(b) For each $\alpha, \beta, \phi_\alpha(U_\alpha \cap U_\beta)$ is open in $\mathbb{R}^n$.
(c) If $U_\alpha \cap U_\beta \ne \emptyset, \phi_\beta \cap \phi_\alpha^{-1}\colon \phi_\alpha(U_\alpha\cap U_\beta) \to \phi_\beta(U_\alpha \cap U_\beta)$ is a continuous bijection.
(d) $M$ is the union of countably many $U_\alpha$.
(e) For any $p,q \in M$, either there exists some $U_\alpha$ containing both $p$ and $q$, or there exist disjoint $U_\alpha, U_\beta$ with $p\in U_\alpha$ and $q\in U_\beta$.
Prove that $M$ has a unique topology such that each $\phi_\alpha$ is a homeomorphism onto its image; and in this topology, $M$ is a topological manifold.

A: It is in fact false that the topology is unique.  For instance, let $M=\mathbb{Q}$ and let the $U_\alpha$ be all the singleton subsets of $M$, with $\phi_\alpha:U_\alpha\to\mathbb{R}^0$ the unique map for each $\alpha$.  Then this satisfies all your hypotheses, but any topology at all on $M$ makes each $\phi_\alpha$ a homeomorphism to its image.
For the topology to be unique, you need to additionally require that each $U_\alpha$ is open in the topology.  Since the $U_\alpha$ cover $M$, this implies a set $U\subseteq M$ is open iff $U\cap U_\alpha$ is open in $U_\alpha$ for each $\alpha$.  But we know which subsets of $U_\alpha$ are open since $\phi_\alpha$ is a homeomorphism, so the topology is uniquely determined.


text:
Q: How do I migrate google OpenID to OAuth? openid_id seems to be missing Since google has deprecated OpenID support, I figured I'd try to migrate, but boy is that an undertaking. I've gotten to the point where I can get user data from google, but I can't figure out how to get a user's OpenID identifier. The documentation says I can add openid.realm as a parameter when requesting the access code, and it should return an openid_id field. But it does not. My request looks as such:
$params = array(
    "response_type" => "code",
    "client_id" => $appdata['client_id'],
    "redirect_uri" => self::$REDIR,
    "scope" => "https://www.googleapis.com/auth/userinfo.email",
    "state"=>$callback,
    "openid.realm"=>$openid->trustRoot
);
$request_to = 'https://accounts.google.com/o/oauth2/auth'. '?' .http_build_query($params);
header("Location: " . $request_to);

Returned fields:
["access_token","token_type","expires_in","id_token"]

Am I doing something wrong or is this a bug with google?


text:
Q: Set individual image cache/expire date I have a question regarding the image caching and although I am not quite sure, if Magento SE is the right place for this kind of question, but I thought it would be interesting for others to know as well. (If you disagree, I would be glad to know what stack exchange would be a better place for it :-) )
In my shop I am using an image that was usually delivered from another server. It is a seal that can change its content about 1-2 times per day.
Unfortunately the other server is not very fast, so I wrote a caching module for it. The module has a cron observer that loads the image once per day and stores it in the media directory.
This is ready and working as expected.
My problem is, that the browser does not show the current version of the image.
As far as I can tell, Magento sets the image expiration per default as "access plus 1 month" in the .htaccess file in the Magento root directory.
This is ok for all images except the one I mentioned.
What is the best way to tell the webserver that this single image has an expiration time of 12 or 24 hours?
I would be fine with a solution, that explicitly uses the filename of my image.

A: The following article makes use of the FilesMatch directive for .htaccess - https://stackoverflow.com/questions/2508783/add-expires-headers-for-specific-images
This seems like the most logical solution. So, you'd end up with something like :
<FilesMatch "^(seal\.jpg)$">
  ExpiresActive on
  ExpiresDefault "access plus 1 month"
</FilesMatch>

You should be able to use any of the following for timings:

*

*years

*months

*weeks

*days

*hours

*minutes

*seconds

A: #THIS IS WRITTEN TO WORK IN YOUR .HTACCESS FILE
#THIS IS WHAT I GOT TO WORK ON APACHE 2.2 ON 111317 ON A SHARED SERVER AT GODADDY.COM
#PLACED IN YOUR ROOT .HTACCESS THIS APPLYS TO EVERY FILE NAMED SEAL.JPG
#IF YOU HAVE MANY SEAL.JPG AND YOU WANT IT TO
#APPLY TO JUST ONE PUT THIS IN THE .HTACCESS FILE IN THE DIRECTORY WHERE
#THE SEAL.JPG FILE IS.
#IF YOU PUT A TIMESTAMP IN THE FILENAME (I.E. sealTIMESTAMP.jpg )
#USE <FilesMatch "^seal.*.jpg$". THE TWO DOTS ARE CORRECT.
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpeg "access plus 1 month"
 <FilesMatch "^seal.jpg$">
  ExpiresByType image/jpeg "access plus 12 hours"
 </FilesMatch>
 <FilesMatch "^seal.*.jpg$">
  ExpiresByType image/jpeg "access plus 12 hours"
 </FilesMatch>
</IfModule>

**I am 99% certain it does not matter which comes first
**(ExpiresByType image/jpeg "access plus 1 month") or (<FilesMatch "^seal.jpg$">)
**FilesMatch will take precedence.

@Douglas answer set me on the right track, but I could not get his <FilesMatch "^(seal.jpg)$"> to work.
how to set Expires HTTP headers on a file named X. change the cache of one file. cache only one file. how to cache one file. I do not want to cache by type Web server cache one file

A: Not sure on the exact code for less than 1 day, but it would be something along the lines of the below in full that you would need inside your .htaccess file in root:
## EXPIRES CACHING  ##
<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-javascript "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##

Guessing it is probably simply "access 12 hours" ? or "access 1 day" ?


text:
Q: Android force orientation one way only I know this :
android:screenOrientation="landscape"

But depending on which orientation you open the app, the way changes (even if it's landscape, there're 2 ways).
How can I force an app to open one way?
For clarity sake, I really want the volume button at the bottom of the tablet only.
Though I know it changes depending on which constructor I'm building my app for a single device, so I wonder if that is possible.

A: Try with this in onCreate() method of Activity
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

A: You can just lock the landscape orientation this way :
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

Or if you want the reversed landscape orientation :
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);

A: Don't forget to put in the manifest file where the activity is defined!!!
Best regards

A: I believe you can find what you need here:
activity | Android Developer #android:screenOrientation
There are more options than landscape and portrait, I believe the ones helpful to you would be "reverseLandscape" and "sensorLandscape". Since the volume button differs from tablet to tablet, you may want to use "sensorLandscape" and ask the user turn their tablet to such orientation, just a suggestion.
Edit: Just saw you said you are building for one device, I guess "reverseLandscape" will do just fine.

A: You can also add to manifest file this option:
android:screenOrientation="portrait"
or
android:screenOrientation="landscape"


text:
Q: Google Maps Info window by url parameters only How can we display the info window of google map by just using the url parameter.
like.
http://maps.google.com/?qCalifornia, United States&infowindow="address"

A: I don't think that's possible.
Here's the way to add info windows: http://code.google.com/apis/maps/documentation/javascript/overlays.html#InfoWindows


text: Q: Dynamically generating data list textbox from a database I am working on a project that requires text boxes to be dynamically generated. the problem that I am running into is these text boxes must also have a datalist generated by a database. these tasks on their own are fairly easy but to accomplish both I have to call a php function within my javascript. does anyone know how to call a php function with javascript?


text:
Q: How to create systemVerilog wrapper for vhdl DUT? This is simple VHDL design for flipflop. Please show me how to import vhdl file to systemverilog so i can do verification using UVM. If there is better way then wrapper please tell me. I am using Questa 10.4d.
library ieee;
use ieee. std_logic_1164.all;
use ieee. std_logic_arith.all;
use ieee. std_logic_unsigned.all;

entity flipflop is
    port(D, Clock : in  std_logic;
         Q : out  std_logic);
end flipflop;

architecture behavioral of flipflop is
begin
  process(CLOCK)
  begin
    if(CLOCK='1' and CLOCK'EVENT) then
      Q<=D;
    end if;
  end process;
end behavioral;

A: Questa lets you import VHDL entities without creating a wrapper. Check the user manual for mixed language simulation and look at the examples in questadir/examples/mixedlang/sv_vhdl_param


text:
Q: Enable PHP Extension (php_odbc.dll) on Azure I have started working with Azure and testing connectivity to an Microsoft SQL Database. I would like to utilize our current php_odbc.dll extension instead of using the PDO approach.
  $query = "SELECT * FROM TABLE ";
  //perform the query
  $result=odbc_exec($conn, $query);

I have performed the steps for adding an extension by configuring via App Setting and configuring via ini settings. Both ways cause my main index page to throw a 500 error. My main index.php only includes the phpinfo(); function for testing.
https://learn.microsoft.com/bs-latn-ba/azure/app-service/web-sites-php-configure#configure-via-app-setting
Question: How do I enable the php_odbc.dll ext on Azure? PHP version is 7.3

A: I see you were using Azure WebApp for Windows to deploy your PHP app with Azure SQL Database connection by php_odbc.dll.
As I known, Azure WebApp for Windows has been installed several versions of PHP runtime with many extensions, which include PHP 7.3 that is under the path D:\Program Files (x86)\PHP as the figure below and I checked php_odbc.dll whether be exists via Kudo console https://<your webapp name>.scm.azurewebsites.net/DebugConsole

Then, I moved to v7.3 to view the php.ini file to check the php_odbc.dll extension whether be enabled.

As the figure above, you can see there is no php_odbc declared in php.ini, so it's not enabled default. And Azure regulates all files and directories under D:\ (except D:\home) that can not be changed by customers, so to try to edit php.ini to enable php_odbc will cause error issue.

So the solution is to refer to the section How to: Enable extensions in the default PHP runtime of the offical document Configure PHP in Azure App Service as the figure below to enable a default existing extension.

By default, there may not be a directory named ini in the path D:\home\site which need to be created by yourself, and then to create a file named extensions.ini under it and edit it to add the extension name or the absoluted path of php_odbc.
; Enable Extensions
extension=php_odbc
; Or use its absoluted path, such as for 32bit platform
; extension=D:\Program Files (x86)\PHP\v7.3\ext\php_odbc.dll

After restart your Azure WebApp, you can try your PHP page again.


text:
Q: Getting Thread.callStackSymbols from release version give me weird stack trace In my project, I send logs to my server when an error happens (not a crash, only an error). These logs are an error description and the stack trace that should give me information about where and when the error happens. I'm getting the stack trace using
Thread.callStackSymbols

And it works very well when I'm using it on my device from Xcode, but I'm receiving stack traces on my server from release versions of my app that don't make sense.
I tested it forcing an error in a class named X and sending the stack trace of this error to my server. Running locally directly from the Xcode, the stack trace shows class X as expected. But when I built my release version to use as my users, the stack trace that I received in my server doesn't mention class X (where the error happens).
I'm using the dSYM files generated and all the necessary things to symbolicate my stack trace, but it still does not work. I also saw my DEBUG_INFORMATION_FORMAT and it is DWARF with dSYM file which seems right to me.
What am I missing? I read somewhere that maybe Thread.callStackSymbols don't be reliable on the device side in the release version. Is there another way to get the stack trace to send to my server?

A: I think I understand the problem:
Thread.callStackSymbols symbolicates the address automatically on the device, but it probably does not work because symbols are removed from release versions. To fix this problem, I based my code on the NSProgrammer's answer
Now, I'm sending Thread.callStackReturnAddresses (you need to translate these addresses to hex values) and the load address to my server. I got the load address using _dyld_get_image_header. It's important to notice that, if you want to get the load address of a specific framework, you need to check like this
    for i in 0..<_dyld_image_count() {
      guard let address = _dyld_get_image_header(i),
            let name = String(validatingUTF8: _dyld_get_image_name(i)) else {
        continue
      }

      if name.contains(FRAMEWORK_NAME) {
        // send address to the server
      }
    }

With the stack address and the load address in your server, you can get the dSYM file and use atos like
atos -arch arm64 -o <PathToDSYMFile>/Contents/Resources/DWARF/<BinaryName>  -l <LoadAddress> <AddressesToSymbolicate>

Some addresses probably won't be symbolicated because they refer to other libs like system libs, but the correct addresses will work fine!


text:
Q: How to test a Solidity payable contract I am currently testings an application created using solidity with foundry, and I am wondering how to mock a "payable" function in the tests by a method paying ether to the blockchain. Does anyone know of any built-in functions that would do this? Thanks in advance.

A: you can use HARDHAT for integrated testing with local devchain.


text:
Q: Loading XMLTYPE data with IMPDP I am trying to take a schema from an existing database and place it in a new database.
I've created dependant tablespaces for the data and everything seems to work ok except any tables with XMLTYPE columns error and fail with the error message below. The XMLTYPE are unvalidated CLOBs
KUP-11007: conversion error loading table "SCHEMA"."TABLE_NAME"
ORA-01400: cannot insert NULL into (XML_COLUMN)
KUP-11009: data for row: XML_COLUMN : 0X''

Some investigation seemed to indicate that using TABLES=TABLE_NAME instead of SCHEMA=SCHEMA would help but I have had no such luck.
Note that there are no constraints on this column and that some data could indeed be null (though after the import I get 0 of my several million records)
The command I am using to initiate the datapump is:
impdp TABLES=SCHEMA.TABLE_NAME DIRECTORY=DATA_PUMP_DIR DUMPFILE=oracledpexport.dmp LOGFILE=LOGFILE.LOG TABLE_EXISTS_ACTION=REPLACE

A: We have been facing some problems during ORACLE import process.
The IMPDP process was not able to import tables containing XML data types.
The reason for this is due to a bug in ORACLE 11g R1 version.
The work around for this is to use EXP process to create a dump instead of EXPDP.
For a permanent fix, we have to explicitly save XML Type columns as CLOB
Also, Oracle has confirmed that this issue has been fixed in ORACLE 11gR2 version.


text:
Q: How to listen for events on postbin and get the values out of it? I am testing out webhooks and I created a postbin test url and I am trying to create a webservice that would listen to the postbin url and be able to get the values out of the post, but I am not sure how to do this:  My sample postbin url could be http://www.postbin.org/abcdef

A: I can't think of anything other than scraping text.  Is this what you are asking about? If you want to scrap text, there are numerous libraries for any language.


text:
Q: Problem separating js out from an svg file I have an svg file which is almost entirely made up of a script. I'd like to separate the script out, so that I can run it through a compressor, but I can't find a way to do this. Any help gratefully appreciated.
The svg file look like this:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg id="chart"
     xmlns="http://www.w3.org/2000/svg"
     onload="init(evt)" >

<script type="application/ecmascript">
<![CDATA[
...lots of code
//]]>
</script>
</svg>

What I've done is extracted out "lots of code" as lotsOfCode.js, and changed the svg file to:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg id="chart"
     xmlns="http://www.w3.org/2000/svg"
     onload="init(evt)" >

<script type="application/ecmascript" src="lotsOfCode.js">
</script>
</svg>

However, this doesn't work. The browser complains that it can't find the onload 'init' function. Any ideas? Do I have to do something to tell the browser that 'init' is in 'lotsOfCode.js'?
Thanks -
Al

A: Try using xlink:href instead of src:
<script type="text/ecmascript" xlink:href="lotsOfCode.js"></script>

Edit: You'll also need to reference the xlink namespace:
<svg id="chart"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     onload="init(evt)" >

A: In addition to Gillys answer, have you tried moving the script include to go before the svg line?
Like this:
<script type="application/ecmascript" src="lotsOfCode.js">
</script>
<svg id="chart"
     xmlns="http://www.w3.org/2000/svg"
     onload="init(evt)" >
</svg>

A: <?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg id="chart"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     onload="init(evt)" >
<script type="text/ecmascript" xlink:href="lotsOfCode.js"></script>
   <circle id='BlueCircle' cx='25' cy='25' r='20' style='fill:blue; '/>
</svg>


text:
Q: How to run synchronous execution in node js? I'm trying to run synchronous execution in node js is there any way to do that other than using events and Async because those didn't work for me?
 for (i=1; i < response.payload.parts.length; i++) {
     if(response.payload.parts[i]!==undefined && response.payload.parts[i].filename!==undefined) {
         console.log("5")
         myEmitter.emit('trah', auth, 'me', response.id, response.payload.parts[i].body.attachmentId, response.payload.parts[i].filename,response.payload.parts[i].mimeType);
     }
}

var ul = fs.readdir('content/'+response.id,(err) => {
    if(err) { console.log(err) }
})

console.log("9")

if(ul!==undefined) {
    console.log('mahiech lehné')

    for (var i=0; i<ul.length; i++) {
        if(mime.getType(ul[i]).substring(0,5)==='image') {
            console.log("10")

            // console.log(te)
            te+=''
       }

       console('11----'+i)
       fs.writeFile(__dirname+'/test.txt',te)
   }
}
}
fs.writeFile(__dirname+'/test1.txt',te)
console.log("12")
res.end(buildres(te))

This my 'trah' event
myEmitter.on('trah', (auth,userId,messageId,id,name,type) => {
    gmail.users.messages.attachments.get({
            auth: auth,
            userId: userId,
            messageId: messageId,
            id: id},
        function (err, res) {
            if (err) {
                console.log('The API returned an error: ' + err);
                return;
            }
            if (!res) {
                console.log('no resposnse found')
            }
            if (res===undefined) {
                console.log('No messages found.');
            }
            if (res) {
                console.log("6")
                if(type.substring(0, 5)==='image'){
                    res.data = res.data.replace(/_/g, "/");
                    res.data = res.data.replace(/-/g, "+");
                    console.log("7")
                    fs.writeFile(__dirname + '/content/' + messageId + '/'+name,res.data,'base64',(err)=>{console.log(err)})
                }
                else {
                    console.log("8")
                    fs.writeFile(__dirname + '/content/' + messageId + '/' + name, utf8.decode(base64.decode(res.data)),(err)=>{console.log(err)})
                }
            }
        })
});

this is the execution order i get since my execution is depentdent on each ordered statement i can't get it to work right
1
2
3
4
5
9
12
6
8

A: Most of the file system calls have a synchronous equivalent. For example, sync version of fs.readdir is fs.readdirSync. Refer to the documentation: https://nodejs.org/api/fs.html
While you CAN call the synchronous versions of these functions, it is not really recommended. Refer to this post for more info on why: Node.js sync vs. async


text:
Q: How to pass array in Sweet Alert 2 Promise I'm using SweetAlert2 to display forms which is working just great, however I have recently run into a problem that I am unable to solve and I have already wasted days trying to find a solution on Google.
I'm building a form dynamically with PHP that is loaded by Sweet Alert. The form contains multiple check-boxes with the same name/id. I have 3 sets of multiple check-boxes and because its a dynamic form I don't know how many check-boxes will be in each set.
The Check-box sets are named invoice_details, invoice_hours and invoice_materials. Each set might have no check-boxes or they might have ten or more. But each set of check-boxes have the same name, so invoice_details set are all named invoice_details.
How can I get the results into an array for each group of check-boxes and pass them to the promise so I can process the form in a php page?

A: Forget ids. Build the form with name attributes of the format name="xxx[]".
For example :
<form id="myForm">
    <input name="invoice_number" value="invoice_no_000" />

    <input type="checkbox" name="invoice_details[]" value="abc" />

    <input type="checkbox" name="invoice_details[]" value="bcd" />

    <input type="checkbox" name="invoice_hours[]" value="cde" />

    <input type="checkbox" name="invoice_hours[]" value="def" />

    <input type="checkbox" name="invoice_hours[]" value="efg" />

    <input type="checkbox" name="invoice_hours[]" value="fgh" />

    <input type="checkbox" name="invoice_materials[]" value="ghi" />

    <input type="checkbox" name="invoice_materials[]" value="hij" />

    <input type="checkbox" name="invoice_materials[]" value="ijk" />

    <input type="checkbox" name="invoice_materials[]" value="jkl" />

    <input type="checkbox" name="invoice_materials[]" value="klm" />

    <input type="checkbox" name="invoice_materials[]" value="lmn" />

    <input type="checkbox" name="invoice_materials[]" value="mno" />

    <input type="submit" />
</form>

Elements within each set need not necessarily be adjacent. Interleaved elements will serialize in the same way.
Now you can simply serialize the form with jQuery's .serialize().
'preConfirm': function () {
    return Promise.resolve($('#myForm').serialize());
}

As the documentation says :

Only "successful controls" are serialized to the string. No submit button value is serialized since the form was not submitted using a button. For a form element's value to be included in the serialized string, the element must have a name attribute. Values from checkboxes and radio buttons (inputs of type "radio" or "checkbox") are included only if they are checked. Data from file select elements is not serialized.

So, depending on which checkboxes are checked, the resultant serialization (with added line breaks) might be :
invoice_number%5B%5D=invoice_no_000&
invoice_details%5B%5D=bcd&
invoice_hours%5B%5D=cde&
invoice_hours%5B%5D=fgh&
invoice_materials%5B%5D=hij&
invoice_materials%5B%5D=jkl&
invoice_materials%5B%5D=klm&
invoice_materials%5B%5D=lmn

And server-side, PHP will see the data as :

*

*$_POST['invoice_number'] : 'invoice_no_000'

*$_POST['invoice_details'] : ['bcd']

*$_POST['invoice_hours'] : ['cde', 'fgh']

*$_POST['invoice_materials'] : ['hij', 'jkl', 'klm', 'lmn']

I suspect this is what is required.

A: The following code combines names and ids as well as php POST request in the sweetalert2 popup.
Add the necessary code in the html field:
<form id="myForm">
    <input name="invoice_number" value="invoice_no_000" />

    <input type="checkbox" name="invoice_details[]" value="abc" />

    <input type="checkbox" name="invoice_details[]" value="bcd" />

</form>
<input id="datepicker-checkin" name="checkin-date" value="7-09-2020">'
<input id="datepicker-checkout" name="checkout-date" value="9-09-2020">'

do a php POST request
preConfirm: () => {
    jQuery.ajax({
        type: 'POST',
        url: "myfile.php",
        data: {
            checkin: document.getElementById('datepicker-checkin').value,
            checkout: document.getElementById('datepicker-checkout').value,
            invoices_data: $('#myForm').serialize(), //invoices_data contains every "name" data from the myForm form
        },
        success: function(result) {
            alert(result);
        },
        error: function(result) {
            alert(JSON.stringify(result));
        }
    });
}

Because the .serialize jQuery function converts the data into a string, all you have to do in the php file to handle the form parameters is use parse_str:
$searcharray = array();
parse_str($_POST['invoices_data'], $searcharray);

//save the other data from the request
$checkin = $_POST['checkin'];
$checkout = $_POST['checkout'];
...


text:
Q: Rails - Current_user is nil when delete a Pain I'm using Public Activity to get notifications. I'm tracking the new prayers in my Prayer model. For some reason current_user is nil when i deleted a Pain and i don't understand why.
class Prayer < ApplicationRecord
 include PublicActivity::Model

  has_many :activities, as: :trackable, class_name: 'PublicActivity::Activity', dependent: :destroy
  tracked owner: Proc.new { |controller, model| controller.current_user } #fail current_user is nil
end

class Pain < ApplicationRecord
 belongs_to :user
 has_many :prayers, dependent: :destroy
end

I can provide more code, but I'm not sure what would be useful.
Thanks a lot
Edit: I forgot to say that i'm trying to delete the Pain in the Rails admin page
Edit2 : Rails admin config
RailsAdmin.config do |config|

 config.actions do
  dashboard                     # mandatory
  index                         # mandatory
  new
  export
  bulk_delete
  show
  edit
  delete
  show_in_app
 end

 config.authorize_with do |controller|
  redirect_to main_app.root_path unless current_user &&    current_user.admin
 end
end

A: Ok i found the solution, in my ApplicationController i call the helper_method :current_user
class ApplicationController < ActionController::Base
  helper_method :current_user

  def current_user
    @current_user ||= User.find_by(id: session[:user])
  end
end

Now i can access to current_user in my Prayer model.
Thanks for all guys


text:
Q: The strategies yielding a zero-sum game's value Let $m, n \in \mathbb{N}_1 := \{1, 2, \dots\}$ and let $\mathbf{A} \in \mathbb{R}_{m \times n}$ be a real, $m \times n$ matrix. Denote by $\Gamma$ the two-players, zero-sum game, whose payoff matrix is $\mathbf{A}$, to be interpreted from the point of view of the row player. It is known that there is a number $v \in \mathbb{R}$, called $\Gamma$'s value, a strategy $\mathbf{x}$ for the row player and a strategy $\mathbf{y}$ for the column player, such that $v$ is $\Gamma$'s expected payoff given $\mathbf{x}$ and $\mathbf{y}$, $v = p_\Gamma(\mathbf{x}, \mathbf{y})$, and such that for any strategy $\mathbf{x}'$ of the row player and for any strategy $\mathbf{y}'$ of the column player we have
$$
p_\Gamma(\mathbf{x}', \mathbf{y}) \leq v \leq p_\Gamma(\mathbf{x}, \mathbf{y}')
$$
Now let $\mathbf{a}$ be some strategy for the row player and let $\mathbf{b}$ be some strategy for the column player, such that $p_\Gamma(\mathbf{a}, \mathbf{b}) = v$. Is it necessarily the case that for any strategy $\mathbf{a}'$ of the row player and for any strategy $\mathbf{b}'$ of the column player the following holds?
$$
p_\Gamma(\mathbf{a}', \mathbf{b}) \leq v \leq p_\Gamma(\mathbf{a}, \mathbf{b}')
$$

A: You are basically asking whether every strategy profile that yields the value of the game is a Nash equilibrium. This is not true. Consider the following normal-form game:
$$\begin{array}{cccc}&\text{L}&\text{R}\\\text{T}&1&0\\\text{B}&0&0\end{array}$$
where the row player's payoffs are shown. Consider the pure strategy $(\text{T},\text{R})$. It is easy to see that it is a minmax strategy (its payoff is maximal in the column and minimal in the row), so the value of the game vanishes: $v=0$. Also, $(\text B,\text L)$ gives the same payoff, but it is clearly not a Nash equilibrium, since the row player could just go to T and increase the payoff.


text:
Q: Lombok String Array Property Is there away to use an array value from a JSON object as a lombok value. For example the body
{
"associatedCompanyIds": [
      332510120384
    ]
}

As
@lombok.value
private static class Payload{
    private List<String> associatedCompanyIds;
}

I know this won't work, but I'm trying to do something similar to this so that I can extract that first value of the array.

A: This works almost out of the box. The only thing you have to do is to advise lombok to generate a @java.beans.ConstructorProperties annotation, so that Jackson knows which constructor parameter to use for which JSON value.
Simply create a lombok.config in your project root folder with this content:
lombok.anyConstructor.addConstructorProperties = true
config.stopBubbling = true

The drawback is that Jackson will pass an ArrayList, which is mutable. So if you want a truely immutable value class, you have to use lombok's @Builder with @Singular:
@Builder(setterPrefix = "with")
@JsonDeserialize(builder = Payload.PayloadBuilder.class)
@Value
public class Payload {
    @Singular
    private List<String> associatedCompanyIds;
}

You don't even need the lombok.config with this approach, but you need at least lombok v1.18.12 (because of the setterPrefix).


text:
Q: I am using Getx for statemanagement, when I add data to server it doesn't appear newer data in listview until hot restart while list view is in Obx I am working on an app. It's working fine with the rest API to get data from the server. But when I try to add data to the server newer data doesn't appear in the list. Here is my code for view and  controller class.
View class code. It is in stateless widget

Expanded(
            child: Obx(() {
              if (controller.isLoading.value) {
                return Center(child: LoadingBar());
              } else {
                return controller.profilesList.length == 0
                    ? Center(child: Text("No Service Found"))
                    : ListView.builder(
                        physics: ScrollPhysics(),
                        shrinkWrap: true,
                        itemCount: controller.profilesList.length,
                        itemBuilder: (context, index) {
                          return Card(
                            elevation: 5,
                            shape: RoundedRectangleBorder(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(5))),
                            clipBehavior: Clip.antiAlias,
                            child: Container(
                              height: 100,
                              child: Row(
                                children: [
                                  Padding(
                                    padding: const EdgeInsets.all(2.0),
                                    child: Container(
                                        width: 100,
                                        // height: 100,
                                        decoration: BoxDecoration(
                                            borderRadius: BorderRadius.all(
                                                Radius.circular(5)),
                                            image: DecorationImage(
                                                image: NetworkImage(
                                                    'http://192.168.43.113:4000/${controller.profilesList[index].shopImage}'),
                                                fit: BoxFit.cover))),
                                  ),
                                  Flexible(
                                    child: Padding(
                                      padding: const EdgeInsets.all(2.0),
                                      child: Column(
                                        crossAxisAlignment:
                                            CrossAxisAlignment.start,
                                        mainAxisAlignment:
                                            MainAxisAlignment.spaceBetween,
                                        children: [
                                          Text(
                                            controller
                                                .profilesList[index].shopName,
                                            style: TextStyle(
                                                color: Colors.black,
                                                fontWeight: FontWeight.bold,
                                                fontSize: 15),
                                          ),
                                          Text(
                                              controller
                                                  .profilesList[index].address,
                                              maxLines: 1,
                                              overflow: TextOverflow.ellipsis,
                                              style: TextStyle(
                                                  color: Colors.black54)),
                                          Text('9:AM-10:PM Mon-Sat',
                                              maxLines: 1,
                                              overflow: TextOverflow.ellipsis,
                                              style: OrdersTextStyle
                                                  .servicesTextStyle()),
                                          Align(
                                            alignment: Alignment.bottomLeft,
                                            child: Container(
                                              decoration: BoxDecoration(
                                                color: CustomColors.lightRed,
                                                //   border: Border.all(width: 1),
                                                borderRadius: BorderRadius.all(
                                                    Radius.circular(5)),
                                              ),
                                              child: Padding(
                                                padding:
                                                    const EdgeInsets.all(3.0),
                                                child: Text(
                                                  controller
                                                      .profilesList[index]
                                                      .providercategories
                                                      .providerCatName,
                                                  style: TextStyle(
                                                      color: Colors.white,
                                                      fontWeight:
                                                          FontWeight.normal),
                                                ),
                                              ),
                                              // height: 25,
                                              // width: 70,
                                            ),
                                          )
                                        ],
                                      ),
                                    ),
                                  )
                                ],
                              ),
                            ),
                          );
                        },
                      );
              }
            }),

Here is my controller class

class ProviderProfilesController extends GetxController {
  var id = ''.obs;
  var isLoading = true.obs;
  var profilesList = <ProfileModel>[].obs;

  void getProfilesData(String id) async {
    isLoading(true);
    try {
      var list = await ApiServices.getProvidersprofileData(id);
      if (list != null) {
        profilesList.value = list;

      }
    } finally {
      isLoading(false);

    }
//profilesList.refresh();

  }
  @override
  void onInit() {
    super.onInit();
    getProfilesData(id.value);

  }
}

A: I think the problem here is that you are using profileList.value to update the list and the right way to do that is adding items to the list using the List's functions like in the following examples:
final abc = [0,1,2].obs;

abc.add(12);

In your case you can use the following code once you want to add a whole list:
abc.addAll(['12','234','1465']);
Let me know if this don't work because there is also the update and refresh functions on getx which solved my problem sometimes. I'll answer here asap.


text:
Q: Problem in configuring spring boot and redis I have an old spring boot application (1.5.0-FINAL) and I can't change this version.
I want to add redis to my application, that's what I did:
1) added the maven dep:
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
        <version>1.5.10.RELEASE</version>
    </dependency>

2) Added the property to my boot
@EnableCaching
public class MySpringBootApp{

3) Added config properties to check if it starts the connection:
spring.cache.type: redis
spring.redis.host: 192.168.99.100
spring.redis.port: 6379

The host/port above do not exist: I just want to see something like "connection error" on boot to make sure I configured everything but nothing appears! It seems that spring boot just doesn't try to use a cache.
Am I missing something?Maybe my spring boot version is too old?

A: Spring Boot parent pom already defines the versions of the starters, so remove the version from spring-boot-starter-data-redis dependency.
Your pom.xml would have at least these dependencies.
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.RELEASE</version>
    <type>pom</type>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

Next, @EnableCaching will look for beans with @Cacheable or @CachePut annotations.


text:
Q: Convert "Friday, February 1, 2013" to "2013-02-01" How can I perform this conversion in Java?
Currently, I'm doing:
public static String formatDate(String strDateToFormat) {
    try {
        SimpleDateFormat sdfSource = new SimpleDateFormat("EEEE, MMMM DD, YYYY");
        Date date = sdfSource.parse(strDateToFormat);
        SimpleDateFormat sdfDestination = new SimpleDateFormat("yyyy-MM-dd");
        return sdfDestination.format(date);
    } catch (ParseException pe) {
        System.err.println("Parse Exception : " + pe);
    }

    return null;
}

However, this results in an incorrect format. It gives me the following output:
Friday, February 1, 2013 > 2013-01-04
Thursday, January 31, 2013 > 2013-01-03

A: You're using DD in your parsing part, which is the day of year. You want dd instead. You also probably want yyyy (year) instead of YYYY (week year). (In most cases they're the same value, but not always.)

A: You're using DD in your parsing part, which is the day of year. You want dd instead.
Change also YYYY in yyyy.
You can find all patterns here.
http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

A: Your code has got two major problems and the existing answers have already solved one of them. The second and even more dangerous problem is, not using Locale with SimpleDateFormat, which is a Locale-sensitive type. Since your Date-Time string is in English, make sure to use Locale.ENGLISH or some other English-Locale. So, a correct initialization would be:
SimpleDateFormat sdfSource = new SimpleDateFormat("EEEE, MMMM d, y", Locale.ENGLISH);

Check Never use SimpleDateFormat or DateTimeFormatter without a Locale to learn more about it. Also, notice a single d which, for parsing, can cater to both single-digit as well as double-digit representation of a day-of-month. Similarly, a single y can cater to both two-digit as well as four-digit representation of a year.
Switch to the modern Date-Time API
Note that the java.util Date-Time API and their formatting API, SimpleDateFormat are outdated and error-prone. It is recommended to stop using them completely and switch to the modern Date-Time API* released with Java SE 8 in March 2014.
Solution using java.time, the modern Date-Time API
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Locale;

public class Main {
    public static void main(String[] args) {
        String input = "Friday, February 1, 2013";
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("EEEE, MMMM d, u", Locale.ENGLISH);
        LocalDate date = LocalDate.parse(input, dtf);
        System.out.println(date);
    }
}

Output:
2013-02-01

ONLINE DEMO
Some notes:

*

*Here, you can use y instead of u but I prefer u to y.

*The LocalDate#toString gives you a String in [ISO-8601 format] which is the exact same format you are expecting. So, you do not need to format LocalDate explicitly to obtain a String in this format.

Learn more about the modern Date-Time API from Trail: Date Time.

* For any reason, if you have to stick to Java 6 or Java 7, you can use ThreeTen-Backport which backports most of the java.time functionality to Java 6 & 7. If you are working for an Android project and your Android API level is still not compliant with Java-8, check Java 8+ APIs available through desugaring and How to use ThreeTenABP in Android Project.


text:
Q: Exceptions in crash-dumps I have a Crash Dump from a Windows Executable (a .DMP file that opens well in WinDbg).
While I can read the stack, interpret some of the registers, and examine heap memory, I suspect there is an unhandled exception in play here as well.
What does an exception "look like" in memory?Is it certain values in registers, or a certain state of the stack?How do I find this and interpret it?

A: type .ecxr to get the current exception displayed - it jumps to the source code, and call stack.
I thought it did it automatically, but that could just be the way I have it set up.


text:
Q: QGIS on Ubuntu hanging at 'save file' dialogue Whenever I encounter a 'save file' dialogue in QGIS (saving processing results, duplicating a layer, 'save project as'), QGIS hangs entirely for around 60 seconds.
I am using QGIS 3.0 on Ubuntu 18.04 (though the problem has persisted through several QGIS versions and through Ubuntu 16.04 -> 17.10 -> 18.04).
I have inspected the output of /var/log/syslog when the problem occurs. It tends to spit out a few lines like this:
May  3 10:03:15 [MACHINE NAME] qgis.bin[26657]: GtkDialog mapped without a transient parent. This is discouraged.
May  3 10:03:15 [MACHINE NAME] dbus-daemon[950]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.300' (uid=1000 pid=26657 comm="/usr/bin/qgis.bin " label="unconfined")
May  3 10:03:15 [MACHINE NAME] anacron[25909]: Anacron 2.3 started on 2018-05-03
May  3 10:03:15 [MACHINE NAME] systemd[1]: Started Run anacron jobs.
May  3 10:03:15 [MACHINE NAME] anacron[25909]: Normal exit (0 jobs run)
May  3 10:03:15 [MACHINE NAME] systemd[1]: Starting Hostname Service...
May  3 10:03:15 [MACHINE NAME] org.gnome.Shell.desktop[1805]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x5e057f1 (Save Layer)
May  3 10:03:15 [MACHINE NAME] dbus-daemon[950]: [system] Successfully activated service 'org.freedesktop.hostname1'
May  3 10:03:15 [MACHINE NAME] systemd[1]: Started Hostname Service.

I'm not sure how relevant they are. These lines occur immediately when I open the file save dialogue (preceding the 60 second freeze) and no new messages are spat out when QGIS starts responding again.
I have searched quite extensively for people with similar problems, to no avail. I'm not expecting a fix, but I seek any advice on how to further diagnose the problem. What else should I be monitoring?
Some extra info: the freeze isn't quite immediate. There is about a second where the file dialogue still responds, and if I can click 'OK' or 'Save' before that, then all is well. Not sure what this indicates.
Following suggestion from bugmenot123, I ran
strace -e file -p $(pidof qgis.bin) | grep -v '/etc/localtime'

I am having a hard time understanding the output, which is here: https://pastebin.com/V9Xm7rFW. The freeze occurs at 12:52:30 and lasts until 12:53:57.
I also ran strace -c to see what QGIS is spending its time doing:
 % time     seconds  usecs/call     calls    errors syscall
 ------ ----------- ----------- --------- --------- ----------------
 23.11    0.101156           1     86037     54292 stat
 12.75    0.055794          11      5259           poll
 12.24    0.053552           9      5970       707 futex
 6.53    0.028583          10      3004           writev
 6.36    0.027817           1     21698           read
 5.98    0.026168           9      2836           getdents
 5.86    0.025652           2     11115      4179 openat
 5.66    0.024754          20      1212           select
 4.00    0.017521           1     12063           pread64
 3.81    0.016690        2782         6           wait4
 2.78    0.012169           1     14772        13 lseek
 1.98    0.008670         377        23           clone
 1.77    0.007763           1      9660           fstat
 1.55    0.006789           1      6768           close
 1.34    0.005885           1      4435      3630 recvmsg
 0.96    0.004222           1      3532        25 lstat
 0.86    0.003760           1      4003           write
 0.61    0.002666           2      1543           mmap
 0.38    0.001656           2       763           mprotect
 0.26    0.001133           1      1229           fcntl
 0.19    0.000835           0      2404      2391 ioctl
 0.16    0.000707           1       584       382 access
 0.13    0.000570           2       365           brk
 0.13    0.000555           1       417         3 readlink
 0.12    0.000538           2       319           munmap
 0.08    0.000349          10        34           fdatasync
 0.05    0.000204           1       397           getpid
 0.04    0.000181           0       444       438 mkdir
 0.04    0.000158           0       439           getrandom
 0.03    0.000138           1       272           fstatfs
 0.03    0.000121           9        14           rename
 0.02    0.000096           1        90           rt_sigaction
 0.02    0.000084           1       113           madvise
 0.02    0.000069           2        30           unlink
 0.02    0.000068           8         9           ppoll
 0.01    0.000063           2        37         7 recvfrom
 0.01    0.000055           0       114           fadvise64
 0.01    0.000045           6         7           inotify_add_watch
 0.01    0.000043           1        48           eventfd2
 0.01    0.000033           4         8           dup2
 0.01    0.000025           1        18           geteuid
 0.01    0.000023           2        11         3 connect
 0.00    0.000021          11         2           execve
 0.00    0.000021           2        13           fchmod
 0.00    0.000021           1        16           clock_gettime
 0.00    0.000018           1        21           pwrite64
 0.00    0.000018           1        14           socket
 0.00    0.000017           1        12           sendmsg
 0.00    0.000016           1        30           uname
 0.00    0.000016           1        20           getcwd
 0.00    0.000015           1        15           flock
 0.00    0.000015           8         2           arch_prctl
 0.00    0.000014           1        10           shmat
 0.00    0.000013           1        12           shmget
 0.00    0.000013           1        10           getuid
 0.00    0.000011           1         9           getegid
 0.00    0.000010           2         6         5 statfs
 0.00    0.000009           3         3           rt_sigreturn
 0.00    0.000009           1        18           sendto
 0.00    0.000009           3         3           getgid
 0.00    0.000008           8         1           getppid
 0.00    0.000006           2         4           inotify_init1
 0.00    0.000005           1         5           rmdir
 0.00    0.000005           0        18           pipe2
 0.00    0.000004           1         3           prlimit64
 0.00    0.000003           0        13           shmctl
 0.00    0.000003           1         5           getsockname
 0.00    0.000003           3         1           sched_getaffinity
 0.00    0.000003           3         1           waitid
 0.00    0.000001           0         4           rt_sigprocmask
 0.00    0.000001           1         1           shutdown
 0.00    0.000001           1         2           bind
 0.00    0.000001           0         4         1 getpeername
 0.00    0.000001           1         1           getsockopt
 0.00    0.000001           1         2           sysinfo
 0.00    0.000001           0         3           getresuid
 0.00    0.000001           0         3           getresgid
 0.00    0.000000           0         5           mremap
 0.00    0.000000           0         3           dup
 0.00    0.000000           0         3           kill
 0.00    0.000000           0         3         1 semget
 0.00    0.000000           0         6           semop
 0.00    0.000000           0         3           semctl
 0.00    0.000000           0         5           shmdt
 0.00    0.000000           0         1           chmod
 0.00    0.000000           0         1           setuid
 0.00    0.000000           0         1           sigaltstack
 0.00    0.000000           0         1           mlock
 0.00    0.000000           0         1           munlock
 0.00    0.000000           0         1           set_tid_address
 0.00    0.000000           0         1           clock_getres
 0.00    0.000000           0         5           tgkill
 0.00    0.000000           0         1           set_robust_list
 ------ ----------- ----------- --------- --------- ----------------
 100.00    0.437674                202430     66077 total

It seems to be spending a lot of time doing poll, stat and futex, but i'm not sure if this is normal. I get the feeling the hang is caused by blocking of some sort.