text:
Q: Load Amazon MP3 widget on the fly I'm having a terribly frustrating time getting this to work. I want to dynamically load/update an amazon mp3 widget.
Amazon provides two scripts to include in the intended target location of the widget (https://widgets.amazon.com/Widget-Source/). I want to replace the widget with a new widget on a click event.
I have tried inserting the scripts as strings into a DOM element using jQuery's html() and appendTo(). I know that the injection works to some degree because I get the test alert that I added to the end of it.
I have tried using createElement() which is recommended here: Can't append <script> element. Again, the alert() fires but no widget appears.
I found someone dealing with the same issue here: Is it possible to programmatically add Amazon MP3 widgets. I'm hopeful since it has an accepted answer but I still don't understand how it helps to introduce the new widget into the DOM.
<script type='text/javascript'>
var amzn_wdgt={widget:'MP3Clips'};
amzn_wdgt.tag='widgetsamazon-20';
amzn_wdgt.widgetType='ASINList';
amzn_wdgt.ASIN='B0011Z0YR2,B00137W4P8,B0013G0PG4,B001AU8ZLK,B001AUCJZ8,B001AUEMDK,B001AU8YB6,B001AU8YBQ,B001AU8YCK,B001AUCK2U,B001AUEMFS,B001AUCK52,B001AU6XE6,B001AUEMH6';
amzn_wdgt.title='What I\'ve been listening to lately...';
amzn_wdgt.width='250';
amzn_wdgt.height='250';
amzn_wdgt.shuffleTracks='True';
amzn_wdgt.marketPlace='US';
</script>
<script type='text/javascript' src='http://wms.assoc-amazon.com/20070822/US/js/swfobject_1_5.js'>

Thanks.

A: You can try this. You will set the properties of the amzn_wdgt and then when someone clicks on your element it will load the script and do whatever it needs to do with the object that has been set.
<script>
var amzn_wdgt={widget:'MP3Clips'};
amzn_wdgt.tag='widgetsamazon-20';
amzn_wdgt.widgetType='ASINList';
amzn_wdgt.ASIN='B0011Z0YR2,B00137W4P8,B0013G0PG4,B001AU8ZLK,B001AUCJZ8,B001AUEMDK,B001AU8YB6,B001AU8YBQ,B001AU8YCK,B001AUCK2U,B001AUEMFS,B001AUCK52,B001AU6XE6,B001AUEMH6';
amzn_wdgt.title='What I\'ve been listening to lately...';
amzn_wdgt.width='250';
amzn_wdgt.height='250';
amzn_wdgt.shuffleTracks='True';
amzn_wdgt.marketPlace='US';

$('.clickMe').click(function(e){
    e.preventDefault();
    if(typeof amzn_wdgt != 'undefined'){
        $.getScript('http://wms.assoc-amazon.com/20070822/US/js/swfobject_1_5.js');
    }
});
</script>


text:
Q: Why is assigning the Value property of cell causing code to end aburptly? Private Sub FillRow(programCell As Range, storedProgramCell As Range)
    Dim counter As Integer

    For counter = 3 To 9
        Dim cellOffset As Integer
        cellOffset = counter - 3

        Dim currentStoredCell As Range
        Set currentStoredCell = storedProgramCell.Offset(0, cellOffset)

        Dim value As String
        value = currentStoredCell.value

        Dim currentTargetCell As Range
        Set currentTargetCell = programCell.Offset(0, cellOffset)

        MsgBox currentStoredCell.value 'Works correctly, prints correct value

        currentTargetCell.value = value
    Next counter
End Sub

The line:
currentTargetCell.value = value

causes the code to stop executing, with no error.
I added the expression to my watch list, then stepped through the routine. The expression was seen as a Boolean:

This makes me think the expression is being viewed as a comparison, and the program abruptly ends since the returned Boolean is not being stored or used anywhere. I wouldn't doubt if I were wrong though.
I'm new to VBA, struggling to debug my program, so please forgive me if this is a petty mistake. I couldn't find any sources online that explains this problem.

A: Replace your subroutine with following code:
Private Sub FillRow(Dst As Range, Src As Range)

    Dim x As Integer
    Dim v As Variant
    Dim Srcx As Range
    Dim Dstx As Range

    Debug.Print "FillRow"
    Debug.Print Src.Address
    Debug.Print Dst.Address
    Debug.Print "Loop"
    For x = 0 To 6
        Debug.Print x
        Set Srcx = Src.Offset(0, x)
        Debug.Print Srcx.Address
        v = Srcx.Value
        Debug.Print TypeName(v)
        Set Dstx = Dst.Offset(0, x)
        Debug.Print Dstx.Address
        Dstx.Value = v
    Next
    Debug.Print "Completed"

End Sub

Run and post in your question Immediate window output.

A: Value is a reserved word, even if vba does not raise an error on this name, you should not use it. Name it something else. Also, try setting it as a variant.

redpajama_set_name: RedPajamaStackExchange


text:
Q: clicking on angular mat-chip selected not firing valueChanges and chip value is not available in valueChanes event I have a mat-chip-list with multiple mat-chips. but when I click on the mat-chip they are no firing the valueChanges event and valueChanges event fired by other controls don't have the value of the select chips too.
here is the code.
<mat-chip-list aria-label="{{question.key}} selection" [selectable]=true>
                    <ng-container *ngFor="let opt of question.options">
                      <ng-container [ngSwitch]="opt.value">
                        <ng-container *ngSwitchCase="'No'">
                          <mat-basic-chip class="mat-basic-chip-no" [value]="opt.key" #lbl="matChip"
                            (click)="chipControlOnSelect(question.key,opt.key,fi,fgi, lbl)">
                            {{opt.value}}</mat-basic-chip>
                        </ng-container>
                        <ng-container *ngSwitchDefault>
                          <mat-basic-chip [value]="opt.key" #lbl="matChip"
                            (click)="chipControlOnSelect(question.key,opt.key,fi,fgi, lbl)">
                            {{opt.value}}</mat-basic-chip>
                        </ng-container>
                      </ng-container>
                    </ng-container>
                  </mat-chip-list>

A: (click)="chipControlOnSelect(opt.key)"
[value]="opt.key"

In the above statement, may be following changes can help to get the values.
(click)="chipControlOnSelect($event)"
[value]="opt.newkey"

combine all the parameters (question.key,opt.key,fi,fgi, lbl) with a pipe symbol and store it in the 'opt.newKey'
chipControlOnSelect(event: any){
  let newKey = event.target.value;
  --- here you can split the values by using pipe symbol and get the required values.

}


text:
Q: Select only 3 rows per user - SQL Query These are the columns in my table
id (autogenerated)
created_user
created_date
post_text

This table has lot of values. I wanted to take latest 3 posts of every created_user
I am new to SQL and need help. I ran the below query in my Postgres database and it is not helpful
SELECT * FROM posts WHERE created_date IN
(SELECT MAX(created_date) FROM posts GROUP BY created_date)

A: You could use the row_number() window function to create an ordered row count per user. After that you can easily filter by this value
demo:db<>fiddle
    SELECT
        *
    FROM (
        SELECT
            *,
            row_number() OVER (PARTITION BY created_user ORDER BY created_date DESC)
        FROM
            posts
    ) s
    WHERE row_number <= 3

*

*PARTITION BY groups the users

*ORDER BY date DESC orders the posts of each user into a descending order to get the most recent as row_count == 1, ...


text:
Q: Swagger with SpringBoot Version 1.2.2 is not working I am trying to integrate the swagger to my spring boot application.
Spring Version: 1.2.2.RELEASE
Java Version: 8
Swagger Maven Dependency
<swagger.version>2.0.1</swagger.version>
<swagger-annotations.version>1.5.21</swagger-annotations.version>
<swagger-models.version>1.5.21</swagger-models.version>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>${swagger.version}</version>
</dependency>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>${swagger.version}</version>
</dependency>
<dependency>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-annotations</artifactId>
    <version>${swagger-annotations.version}</version>
</dependency>
<dependency>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-models</artifactId>
    <version>${swagger-models.version}</version>
</dependency>

The configuration file is
@Configuration
@EnableSwagger2
@EnableAutoConfiguration
public class Swagger2UiConfiguration {

    public Docket postsApi() {
        return new Docket(DocumentationType.SWAGGER_2).groupName("public-api").select()
                .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)).paths(PathSelectors.any())
                .build();
    }

    @Bean
    public Docket apiDoc(ServletContext servletContext) {
        return new Docket(DocumentationType.SWAGGER_2)
                .host("http://localhost:8080")
                .pathProvider(new RelativePathProvider(servletContext) {
                    @Override
                    public String getApplicationBasePath() {
                        return "/services";
                    }
                });
    }

    private Predicate<String> postPaths() {
        return or(regex("/myproject/services/*"));
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("EMP").description("EMP Swagger Test").version("1.0").build();
    }

}

When running the application I can see the following logs,
2020-07-03 20:50:29,218 [ INFO] [] [localhost-startStop-1] (AbstractHandlerMethodMapping.java:220) - Mapped "{[/v2/api-docs],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json || application/hal+json],custom=[]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)
2020-07-03 20:50:29,225 [ INFO] [] [localhost-startStop-1] (AbstractHandlerMethodMapping.java:220) - Mapped "{[/swagger-resources/configuration/security],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.SecurityConfiguration> springfox.documentation.swagger.web.ApiResourceController.securityConfiguration()
2020-07-03 20:50:29,227 [ INFO] [] [localhost-startStop-1] (AbstractHandlerMethodMapping.java:220) - Mapped "{[/swagger-resources/configuration/ui],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.UiConfiguration> springfox.documentation.swagger.web.ApiResourceController.uiConfiguration()
2020-07-03 20:50:29,228 [ INFO] [] [localhost-startStop-1] (AbstractHandlerMethodMapping.java:220) - Mapped "{[/swagger-resources],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto org.springframework.http.ResponseEntity<java.util.List<springfox.documentation.swagger.web.SwaggerResource>> springfox.documentation.swagger.web.ApiResourceController.swaggerResources()

Still, the Swagger-UI URL returns 404.
http://localhost:8080/swagger-ui.html
http://localhost:8080/myproject/services/swagger-ui.html

Am I missing anything? Any help is very much useful.
P.S: After googling so many pages, I suspect it can be version compatibility. If so, I can not upgrade my spring-boot version. In that case, how can I integrate Swagger? Any suggestions?

A: I think something messed with your dependency. You need only two dependencies.
I am using only these two dependencies.

*

*springfox-swagger2

*springfox-swagger-ui

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>${swagger.version}</version>
</dependency>
<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>${swagger.version}</version>
</dependency>

A: I have added the following additional configurations,

*

*Maven Dependency,

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>2.6.1</version>
</dependency>
<dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-swagger-ui</artifactId>
  <version>2.6.1</version>
</dependency>

*Swagger config class, allowed all the URLs
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build();
}

*Accessed the following URL,

http://localhost:8080/<projectName>/swagger-ui.html#/


text:
Q: Using ConvertFrom-String with value that are not present in all sets of data I have a text file with data that are structured (similarly to Json) that I want to parse with ConvertFrom-String to extract part of the data. I cannot change how the data are structured in the file so I have to deal with them the way they are.
Here's a sample of the data. The complete file has many more of these blocks and each block have more 'properties' than what I'm showing here (Keeping it small and readable :-) ). Note that the third block as a icon property that the other items don't have.
$Data = @'
    c_first_item = {
        time = 270
        category = cat_red
        min_value = {
            int = 10
        }
        max_value = {
            int = 20
        }
    }

    c_second_item = {
        time = 270
        category = cat_blue
        min_value = {
            float = 10
        }
        max_value = {
            float = 20
        }
    }

    c_third_item = {
        time = 270
        icon = c_third_icon
        category = cat_red
        min_value = {
            int = 10
        }
        max_value = {
            int = 20
        }
    }
'@

And here's my template used by ConvertFrom-String.
    $Template = @'
    {Name*:c_first_item} = \{
        time = 270

        category = {Category:cat_red}

        random_property = \{
            random_property_value = 10
        \}

        random_property = \{
            random_property_value = 20
        \}
    \}

    {Name*:c_second_item} = \{
        time = 100
        icon = {Picture?:c_third_icon}

        category = {Category:cat_blue}

        random_property = \{
            random_property_value = 10
        \}

        random_property = \{
            random_property_value = 20
        \}
    \}
'@

I was running this code with ConvertFrom-String to parse the data I wanted :
$Result = $Data | ConvertFrom-String -TemplateContent $Template

The expected result should have looked like this :
Name          Category  Picture
----          --------  -------
c_first_item  cat_red
c_second_item cat_blue
c_third_item  cat_red   c_third_icon

But I was getting this instead :
Name          Category
----          --------
c_first_item  cat_red
c_second_item cat_blue
c_third_item  cat_red

As you can see there's no Picture property in my output object as ConvertFrom-String was unable to parse the data accordingly to what I asked. I guess the examples I'm giving aren't good enough to teach the algorythm how to react.
Is there a way for me to teach ConvertFrom-String to get an empty Picture property for the blocks where icon doesn't exists?

Update: 25th of January
As requested by @iRon, here's an example that adds a Length property to the result.
First, the file I'm parsing (Test.txt) :
d_mem_towers_sulfuric_forest = {
    is_for_colonizeable = yes
    category = deposit_cat_rare

    icon = d_radioactive_wasteland

    resources = {
        category = planet_deposits
        produces = {
            society_research = 4
            energy = 4
        }
    }

    planet_modifier = {
        planet_jobs_energy_produces_mult = 0.10
        planet_jobs_society_research_produces_mult = 0.10
        planet_max_districts_add = -1
        pop_environment_tolerance = -0.15
    }

    drop_weight = {
        weight = 0
    }
}

Then, the template file (Template.txt) :
{Object*:{Name:d_mem_sadrell_capital} = \{
    is_for_colonizeable = yes
    category = {Category:deposit_cat_rare}

    icon = {Picture:d_building}

    planet_modifier = \{
        planet_housing_add = 3
        pop_environment_tolerance = 0.1
        planet_jobs_specialist_produces_mult = 0.15
    \}

    triggered_planet_modifier = \{
        potential = \{
            exists = owner
            owner = \{ is_regular_empire = yes \}
        \}
        modifier = \{
            job_researcher_add = 2
            job_clerk_add = 2
        \}
    \}

    triggered_planet_modifier = \{
        potential = \{
            exists = owner
            owner = \{ is_hive_empire = yes \}
        \}
        modifier = \{
            job_brain_drone_add = 2
            job_maintenance_drone_add = 2
        \}
    \}

    triggered_planet_modifier = \{
        potential = \{
            exists = owner
            owner = \{ is_machine_empire = yes \}
        \}
        modifier = \{
            job_calculator_add = 2
            job_maintenance_drone_add = 2
        \}
    \}

    drop_weight = \{
        weight = 0
    \}
\}}

{Object*:{Name:d_mem_sadrell_industrial_complex} = \{
    is_for_colonizeable = yes
    category = {Category:deposit_cat_rare}

    icon = {Picture:d_crater}

    planet_modifier = \{
        pop_environment_tolerance = -0.1
        planet_jobs_minerals_produces_mult = 0.25
        district_mining_max = 4
    \}

    drop_weight = \{
        weight = 0
    \}
\}}

{Object*:{Name:_mem_strange_mountain} = \{
    time = 365
    is_for_colonizeable = yes
    category = {Category:deposit_cat_blockers}

    icon = {Picture:d_mem_strange_mountain}

    resources = \{
        category = deposit_blockers
        cost = \{
            energy = 1000
            minerals = 1000
        \}
    \}

    drop_weight = \{
        weight = 0
    \}
\}}

Finally, here's the piece of code I'm using to extract the data :
$testText = Get-Content  -Path "Path\to\text.txt" #MEM
$template = 'Path\to\template.txt'

$result = $testText |
    ConvertFrom-String -TemplateFile $template |
    Select-Object -ExpandProperty Object |
    Union-Object

$result

The expected result should be like that :
Name                         Category         Picture
----                         --------         -------
d_mem_towers_sulfuric_forest deposit_cat_rare d_radioactive_wasteland

But I'm getting this instead :
Name                         Category         Picture                 Length
----                         --------         -------                 ------
d_mem_towers_sulfuric_forest deposit_cat_rare d_radioactive_wasteland
                                                                      0

There's a second line to my object that contains a Length property that I don't parse so I guess it somehow comes from Union-Object.
Any idea?

A: Although all your properties (including Picture) are in the $Result object, they will not be output (to the display) as not all (especially the first) objects contain the Picture property (see related the issue: Not all properties displayed):
PS C:\> $Result

Name          Category
----          --------
c_first_item  cat_red
c_second_item cat_blue
c_third_item  cat_red

The Union-Object cmdlet will add all the missing properties (with a $Null value) to the concerned objects:
PS C:\> $Result = $Result | Union-Object
PS C:\> $Result

Name          Category Picture
----          -------- -------
c_first_item  cat_red
c_second_item cat_blue
c_third_item  cat_red
                       cat_blue

A: After a slight delay, here's the answer. I was helped by Nicolas Baudin (https://www.linkedin.com/in/nicolas-baudin-63491a111/) to find it.
The problem came from the template. As the icon property is not existent in all sets, the function had difficulties to retrieve it and it was in fact not returning it at all. The trick has been to change the template to include a structure that would then be returned with all the properties, including Picture. This structure is returned by ConvertFrom-String as an object whose properties are all the value you try to parse.
The new template looks like this :
$Template = @'
{Object:*{Name:c_first_item} = \{
    time = 270

    category = {Category:cat_red}

    random_property = \{
        random_property_value = 10
    \}

    random_property = \{
        random_property_value = 20
    \}
\}}

{Object:*{Name:c_second_item} = \{
    time = 100
    icon = {Picture?:c_third_icon}

    category = {Category:cat_blue}

    random_property = \{
        random_property_value = 10
    \}

    random_property = \{
        random_property_value = 20
    \}
\}}
'@

The command itself has been adapted to match the new outputted object and it is now :
$Result = $Data | ConvertFrom-String -TemplateContent $Template |
                  Select-Object -ExpandProperty Object |
                  Union-Object

As you can see, I'm using your Union-Object function which come handy as I have several templates that don't output the same property for each object. This way, I can have a single function to parse all my files.


text:
Q: Bibliography insertion prevents compilation I am trying to print a bibliography, following the example of the ShareLaTeX site.  I have a bibliography.bib file with the following contents:
@Article{sasai,
     author =       "Yoshiki Sasai",
     title =        "{Cytosystems dynamics in self-organization of tissue architecture}",
     journal =      "Nature",
     volume =       "493",
     number =       "7432",
     pages =        "318--326",
     year =         "2013/01/17",
     publisher =    "Nature Publishing Group",
     ISBN =         "0028-0836",
     URL =          "http://dx.doi.org/10.1038/nature11859",
     type =         "10.1038/nature11859",
}

And I have a main file with:
\documentclass[10pt,letterpaper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2.00cm, right=2.00cm, top=2.00cm, bottom=2.00cm]{geometry}
\begin{document}

\nocite{*}
\bibliography{bibliography}

\end{document}

As far as the information I have gleaned so far is concerned, this ought to produce a bibliography entry.  What is going wrong here?

A: Please see the following MWE:
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{sasai,
     author =       "Yoshiki Sasai",
     title =        "{Cytosystems dynamics in self-organization of tissue architecture}",
     journal =      "Nature",
     volume =       "493",
     number =       "7432",
     pages =        "318--326",
     year =         "2013/01/17",
     publisher =    "Nature Publishing Group",
     ISBN =         "0028-0836",
     URL =          "http://dx.doi.org/10.1038/nature11859",
     type =         "10.1038/nature11859",
}
\end{filecontents*}

\documentclass[10pt,letterpaper]{article}
\usepackage[latin1]{inputenc}
%\usepackage{amsmath}
%\usepackage{amsfonts}
%\usepackage{amssymb}
\usepackage[left=2.00cm, right=2.00cm, top=2.00cm, bottom=2.00cm]{geometry}

\begin{document}
\nocite{*}
\bibliographystyle{plain} % <===========================================
\bibliography{\jobname}
\end{document}

In your code the definition of the bibliography style is missing.  I added it (see line with marking % <==============
Result:


text:
Q: Simple User's Guide / Tutorial for Apache httpd? Is there a simple user guide or tutorial for Apache httpd?  I find that the official documentation (http://httpd.apache.org/docs/2.2/) is a little hard to navigate and learn from if you're not up to speed with a lot of the basics.

A: It might be best to start with a specific thing with Apache that you want to/need to accomplish. Otherwise Amazon, Borders and Barnes and Noble are your friends!
There is an Apache for Dummies book too (no offense!)
Things that might be helpful:
http://bytes.com/serveradministration/webservers/apache/theapachewebserver/page1.html
Also, each OS might implement Apache a bit differently as far as where it is stored, default settings, etc. Linux does differently than Windows for example.

A: Or, if this is your first experience with Apache, and if you are just experimenting, you could start with something easier like lighttpd: http://www.lighttpd.net/

A: The docs can look a bit daunting because Apache is so powerful and flexible, which has its price. I agree with indiecompanyllc in that you should select something specific to start with but rather than invest in books, which tend to be limited, costly and out of date, I recommend Googling. Just bear in mind that most tasks can be performed more than one way, so read more than one article on the same topic if you find the going a bit heavy.


text:
Q: Discord.js how to make it so bot does not respind to dms How do I make it so people cannot use commands in dms, it crashes my bot.

A: In order to prevent your bot from responding to DMs, your message event should contain a line of code that checks if the message in question originated from a guild. You can do this using the Message#guild property, which is read-only and returns a potentially null value (as denoted by a "?" before its returned type in the docs).
//assuming the first parameter of your message event is named "message"
if (!message.guild) return; //so the callback does not continue to process the message further if it did not originate from a guild

Your bot likely crashes due to it expecting there to always be an associated Message#member, which is also a potentially null value. This will not be the case if the message did not originate from a guild, where the property will be null.
Without a code snippet &/or error message from you, I can't tell for certain, but if the lack of this specific property is not the cause, then your crash is probably caused by a similar issue where a null is returned when your code isn't written to handle such a value.


text:
Q: Product of limit, sin, infinity, error? Hello I would like to know if there is a mistake :
I have to show that for any $t\geqslant0$ fixed
$$\lim_{n\to \infty}\sin\sqrt{t+4\pi n^{2}}=0$$
That's what I said,
Since $\sin(\cdot)$ is continuous and $$\sqrt{t+4\pi n^{2}}=2n\pi\sqrt{1+\frac{t}{4\pi n^{2}}}$$ for $n\geqslant1$.
$$\lim_{n\to \infty}\sin\sqrt{t+4\pi n^{2}}=\lim_{n\to \infty}\sin\left(2n\pi\sqrt{1+\frac{t}{4\pi n^{2}}}\right)$$
$$=\sin\left(\lim_{n\to\infty}2n\pi\sqrt{1+\frac{t}{4\pi n^{2}}}\right)=\\=\sin\left(\lim_{n\to\infty}2n\pi\cdot\lim_{n\to\infty}\sqrt{1+\frac{t}{4\pi n^{2}}}\right)=$$
$$=\sin\left(\lim_{n\to\infty}2n\pi\right)=\lim_{n\to\infty}\sin 2n\pi=\lim_{n\to\infty}0=0$$

A: Assuming $n$ is real.
Let $t=4\pi^2 M>0$ fixed and $n=\sqrt{\pi(m^2-M^2)}$ varying then
$$\lim_{n\to \infty}\sin\sqrt{t+4\pi n^{2}}=\lim_{m\to \infty}\sin 2\pi m=0.$$
Let $t=4\pi^2 M>0$ fixed and $n=\sqrt{\pi((m+\frac14)^2-M^2)}$ varying then
$$\lim_{n\to\infty}\sin\sqrt{t+4\pi n^{2}}=\lim_{m\to \infty}\sin (2\pi m+\frac\pi 2)=1.$$
So the limit does not exist, if OP didn't change the expression.

A: Actually it does not exist the limit:$$\lim_{n\to \infty}\sin\sqrt{t+4\pi n^{2}}\;.$$
So, I think the OP intended to write the following limit:$$\lim_{n\to \infty}\sin\sqrt{t+4\pi^2n^{2}}\;.\quad(\text{ where }n\in\Bbb N\;)$$
Indeed ,
$\lim\limits_{n\to \infty}\sin\sqrt{t+4\pi^2n^{2}}=$
$=\lim\limits_{n\to \infty}\sin\left(\sqrt{t+4\pi^2n^{2}}-2\pi n\right)=$
$=\lim\limits_{n\to \infty}\sin\left[\dfrac{\left(\sqrt{t+4\pi^2n^{2}}-2\pi n\right)\left(\sqrt{t+4\pi^2n^{2}}+2\pi n\right)}{\sqrt{t+4\pi^2n^{2}}+2\pi n}\right]=$
$=\lim\limits_{n\to \infty}\sin\left(\!\dfrac t{\sqrt{t+4\pi^2n^{2}}+2\pi n}\!\right)=$
$=\sin\left(\!\lim\limits_{n\to \infty}\dfrac t{\sqrt{t+4\pi^2n^{2}}+2\pi n}\!\right)=$
$=\sin 0=0\,.$
Addendum:
I am going to prove that it does not exist the limit:$$\lim_{n\to \infty}\sin\sqrt{t+4\pi n^{2}}$$
without necessity of assuming that $\,n\,$ is any real number ( that is $\,n\,$ could be any positive integer ) .
If there existed the limit $\,\lim\limits_{n\to \infty}\sin\sqrt{t+4\pi n^{2}}=l\in\Bbb R\;,\;$ there would also exist the limit $\,\lim\limits_{n\to\infty}\sin\left(2\sqrt\pi n\right)=l\;,\;$ indeed
$\begin{align}
\lim\limits_{n\to\infty}&\,\sin\left(2\sqrt\pi n\right)=\\
&=\lim\limits_{n\to\infty}\sin\left(\sqrt{t+4\pi n^2}+2\sqrt\pi n-\sqrt{t+4\pi n^2}\right)=\\
&=\lim\limits_{n\to\infty}\left[\sin\left(\sqrt{t+4\pi n^2}\right)\cos\left(2\sqrt\pi n-\sqrt{t+4\pi n^2}\right)+\\
+\cos\left(\sqrt{t+4\pi n^2}\right)\sin\left(2\sqrt\pi n-\sqrt{t+4\pi n^2}\right)\right]=\\
&=\lim\limits_{n\to\infty}\left[\sin\left(\sqrt{t+4\pi n^2}\right)\cos\left(\!\!\dfrac{-t}{2\sqrt\pi n+\sqrt{t+4\pi n^2}}\!\!\right)+\\
+\underbrace{\cos\left(\sqrt{t+4\pi n^2}\right)}_{\text{it is bounded}}\;\underbrace{\sin\left(\!\!\dfrac{-t}{2\sqrt\pi n+\sqrt{t+4\pi n^2}}\!\!\right)}_{\text{it is an infinitesimal}}\right]=\\\\
&=l\cos0=l\;.
\end{align}$
Moreover,
$\begin{align}\lim\limits_{n\to\infty}&\cos\left(2\sqrt\pi n\right)=\\
&=\lim\limits_{n\to\infty}\dfrac{\sin\left[2\sqrt\pi(n+1)\right]-\sin\left[2\sqrt\pi(n-1)\right]}{2\sin\left(2\sqrt\pi\right)}=\\
&=\dfrac{l-l}{2\sin\left(2\sqrt\pi\right)}=0\,.
\end{align}$
On the other hand,
$0=\lim\limits_{n\to\infty}\cos\left(4\sqrt\pi n\right)=\lim\limits_{n\to\infty}\left[2\cos^2\left(2\sqrt\pi n\right)-1\right]=-1$
which is a contradiction.
Hence, there does not exist the limit $\,\lim\limits_{n\to\infty}\sin\sqrt{t+4\pi n^{2}}\,.$


text:
Q: Using timers in swift I am a complete beginner and am starting to learn the Swift programming language. I'm following a tutorial on Udemy and am having some problems with setting up a timer.
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel!
var timer1 = Timer()
var counter = 0

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view.

    label.text = String(counter)

}
@IBAction func start(_ sender: Any) {

    timer1 = Timer(timeInterval: 1, target: self, selector: #selector(tim), userInfo: nil, repeats: true)

}

@IBAction func pause(_ sender: Any) {

    timer1.invalidate()

}

@IBAction func restart(_ sender: Any) {

    timer1.invalidate()
    counter = 0
    label.text = String(counter)

}

@objc func tim() {

    counter += 1
    label.text = String(counter)

}

}
This is my code but the timer is not working. Please tell me where im going wrong.

A: You need to add timer to RunLoop
RunLoop.current.add(timer1, forMode: .commonModes)

Or use scheduledTimer
timer1 = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(tim), userInfo: nil, repeats: true)

Also in your restart function you need to do it again, because now you are just invalidating it and not starting again.


text:
Q: mask/change url using .htaccess I already search regarding this but the result is not what I want. I hope someone can help me on this. Thanks in advance.
I would like to change/mask url using .htaccess from
http://localhost/ecwp/eccube/html/wpss/forum

to
http://localhost/ecwp/eccube/html/forum

This is my folder directory(i'm using XAMPP):-

*

*htdocs

*

*ecwp

*

*eccube

*

*html

*

*wpss->forum under this wp themes

*.htaccess

*data

For wpss, I'm using wordpress with permalink setting :
http://localhost/ecwp/eccube/html/wpss/archives/123

Here is .htaccess code:-
RewriteEngine On
RewriteRule ^forum/ http://localhost/ecwp/eccube/html/wpss/forum [L]

When running this code,
http://localhost/ecwp/eccube/html/forum

will redirect go to
http://localhost/ecwp/eccube/html/wpss/forum

A: RewriteEngine On
RewriteRule ^forum(.*)$ http://localhost/ecwp/eccube/html/wpss/forum/$1 [L]


text:
Q: Exclude folders from Net Beans 8 PHP code analysis I've been using Net Beans 8 for PHP development at work for the past year or so, and found (Since updating to 8.0 and generating new projects) that the code analyzer detects errors in some of the free libraries we use, which in turn causes the project to be marked as having errors (Red exclamation mark on the Projects browser).
Since we do not mantain these libraries, I added them to the Project Properties -> Ignored Folders -> Extra Folders for Code Analysis settings of my current project (I don't want to exclude them from the project, since we use the autocomplete/intellisense feature of the IDE), but this had no visible effect: The files are still marked as having an error, as well as the project.
Am I using the code analyzer exclusions feature wrongly? Is there any way to have the selected folders excluded from error checking but still have them visible within the project?
Thanks!

A: It seems to work when you add the folder to both boxes. The folders won't display in the project folder list, no errors are being displayed. But the autocomplete still shows all (in my case "WordPress") library functions stored in these folders.


text:
Q: Problem with redirect with PageReference in iframe I open a visualforce page in an iframe witch contain two commandButton.
The buttons call functions on the class.
At the end of my functions, i made a redirection with PageReference but the redirection is made inside the iframe...
How can i do the redirection in the same window, a new window, or just refresh the page ??
Thanks for the help.

A: You can render a <apex:outputPanel on the action of a <apex:commandButton as below. And inside the <apex:outputPanel you can refresh the parent page with the redirect URL with this script window.top.location.href = '{!redirectUrl}';. Hope this helps.
VF Page
<apex:page standardController="Opportunity" extensions="Opp_Ext" >
    <apex:form >
        <apex:commandButton value="Do Stuff" action="{!doStuffAndRedirect}" rerender="redirectPanel" />
        <apex:outputPanel id="redirectPanel" >
            <apex:outputText rendered="{!shouldRedirect}">
                <script type="text/javascript">
                    window.top.location.href = '{!redirectUrl}';
                </script>
            </apex:outputText>
        </apex:outputPanel>
    </apex:form>
</apex:page>

Controller
public class Opp_Ext {
    private ApexPages.StandardController stdController;
    public String redirectUrl {public get; private set;}
    public Boolean shouldRedirect {public get; private set;}

    public Opp_Ext(ApexPages.StandardController stdController) {
        this.stdController = stdController;
        shouldRedirect = false;
    }

    public PageReference doStuffAndRedirect() {
        shouldRedirect = true;
        redirectUrl = stdController.view().getUrl();
        return null;
    }
}


text:
Q: Blackberry - Google Maps (Sorry we have no imagery here) Please find below the markup I am using within my BlackBerry application (OS version 6 and 7) to display locations on a google map.
private String getHTMLText() {
    String HTMLText = null;
    HTMLText = "" +
               "" +
               "
" +
               "" +
               "";

    return HTMLText;

}

On every image, although the map loads correctly, it shows text over the top saying "sorry we have no imagery here".
However the same code used in any browser appears correctly.

I would be very appreciative of any feedback.

A: Try this -
StringBuffer html;
                String initial = "<!DOCTYPE html>\r\n" +
                " \r\n" +
                " \r\n" +
                "  <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" /> \r\n" +
                "  <title>Google Maps Multiple Markers</title> \r\n" +
                "  \r\n" +
                " \r\n" +
                "\r\n" +
                "

\r\n" +
                "\r\n" +
                "  \r\n" +
                "\r\n" +
                "";

            html=new StringBuffer();
            html.append(initial);
            String point = "['"+""+"',"+lattitude+","+longitude+","+""+"],";
            html.append(point);
            centerPoint = "  center: new google.maps.LatLng("+lattitude+","+longitude+"),";

               html.append(second);
               html.append(centerPoint);
               html.append(finalpart);
               //System.out.println("Plot is"+html.toString());
               BrowserFieldConfig _bfConfig = new BrowserFieldConfig();
              _bfConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
              _bfConfig.setProperty( BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE );
              _bfConfig.setProperty(BrowserFieldConfig.USER_AGENT, "MyApplication 1.0");
              BrowserField myBrowserField = new BrowserField(_bfConfig);
              myBrowserField.displayContent(html.toString(), "");
              add(myBrowserField);


text:
Q: Laravel 5.2 ServiceProvider override $listen array in own package What's the proper way to write the $listen mapping ?
- I got a package and a ServiceProvider file created in that package.
My problem is I don't know how to access the class path for the package, here is the code I tried:
/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
  'damjan\random\ActionDone' => [
  'damjan\random\ThingToDoAfterEventWasFired',
  ],
];

Did I set the class path of the Listener and Event classes in a wrong scheme :) ?

A: The $listen mapping is only used to register listeners at an app-level inside App\Providers\EventServiceProvider, not within a package's ServiceProvider.
The proper way to register an event listener from within a package's ServiceProvier in my opinion is to simply use the Event facade in it's boot function.
So in OP's case that would be:
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        \Illuminate\Support\Facades\Event::listen(
            'damjan\random\ActionDone',
            'damjan\random\ThingToDoAfterEventWasFired'
        );
    }

A: Had the same question a week ago. Found out today how to solve. I don't know if it's possible to overwrite the array but you could add a second service provider to your package with the same code as the Laravel 5.2 Event Service Provider.
Code can be found here: https://github.com/laravel/laravel/blob/master/app/Providers/EventServiceProvider.php
Then you could serve this service provider within your package service provider with the following code:
/**
 * Register the service provider.
 *
 * @return void
 */
public function register()
{
    $this->app->register(PackageEventServiceProvider::class);
}


text:
Q: Writing a Mongo Converter for only one field I have the case that i have a simple POJO with one long field in it, which is actually a timestamp.
This field must be in the mongo database represented by an ISODate.
I could write an Converter fot the whole Pojo, but since it is only one field out of 25 that would not make much sense and is another spot for errors when a field would change or one more gets added.
Is there a way to call the default converter service and change the 2 other after the default converting service which will impact the performance a lot.
Or is there a default Converter interface to override?
Whats the best practice here?
Maybe there is an annotation that I can apply to this field?
And yes i could also write an LongToDate Converter, but this would affect all POJOs, not just this single one.
Here the sample POJO:
public class Person {
   private long someTimestamp;
//getters and setters
}

Without converters this would look like this:
{
    "_id" : ObjectId("52ae8eede4b0249cde22059e"),
    "someTimestamp" : NumberLong(1392714950940)
}

Thats how the result should look like:
{
    "_id" : ObjectId("52ae8eede4b0249cde22059e"),
    "someTimestamp" : ISODate("2013-12-23T23:00:00.000Z")
}

The desribed problem gets even more complicated when such a timestampt value is in a nested document for exmaple:
{
    "_id" : ObjectId("52ae8eede4b0249cde22059e"),
    "items" : [
        "someTimestamp" : NumberLong(1392714950940)
    ]
}

POJO:
public class Person {
   private Collection<OtherPojoThatHoldsTimestamps> items;
//getters and setters
}

Maybe I should mention that I am using Spring to accomplish this. (http://projects.spring.io/spring-data-mongodb/)

A: It sounds like you need annotation-driven conversion. Section 6.6.2 in the reference manual talks about this for formatters, and even has an example with timestamps.
The general idea is that you'd mark fields which need special handling with an annotation (it's a good use of annotations, you're specifying metadata after all). You'd then register a converter for fields having that annotation.
Problem is I've just tried this and can't get it to work, because metadata is getting lost. I've filed a JIRA ticket to see whether there's a way around this.

A: the solution one is to use spring data mongodb listener:
package com.rc.user.auth.model.listener;

import com.mongodb.DBObject;
import com.nimbusds.jwt.JWTParser;
import com.rc.user.auth.model.OAuth2AccessTokenEntity;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
import org.springframework.data.mongodb.core.mapping.event.AfterConvertEvent;
import org.springframework.data.mongodb.core.mapping.event.BeforeSaveEvent;
import org.springframework.stereotype.Component;

import java.text.ParseException;

@Component
public class OAuth2AccessTokenEntityListener extends AbstractMongoEventListener<OAuth2AccessTokenEntity> {

    @Override
    public void onBeforeSave(BeforeSaveEvent<OAuth2AccessTokenEntity> event) {
        OAuth2AccessTokenEntity oat = event.getSource();
        DBObject db = event.getDBObject();

        db.put("tokenValue", oat.getJwt().serialize());
    }

    @Override
    public void onAfterConvert(AfterConvertEvent<OAuth2AccessTokenEntity> event) {

        OAuth2AccessTokenEntity oat = event.getSource();
        DBObject db = event.getDBObject();

       try {
          oat.setJwt(JWTParser.parse(db.get("tokenValue").toString()));
      } catch (ParseException e) {
          e.printStackTrace();
        }
    }
}

the solution two is to use converter:
package com.rc.user.auth.model.convert;

import com.nimbusds.jwt.JWT;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.WritingConverter;

@WritingConverter
public class JWTToStringConverter implements Converter<JWT, String> {

    @Override
    public String convert(JWT jwt) {
        return jwt.serialize();
    }
}

A: As of Spring Data MongoDB 3.2, there seems to be no way to easily define a field specific (not global) type converter.
The type converters registered through the overriden configureConverters() method in the configuration bean affect all the domain object.
But you can use a simple workaround using different types for field and accessor methods(getter/setter) to accomplish what you want.
public class Person{

  @AccessType(AccessType.Type.FIELD)
  private Instant timestamp;

  public long getTimestamp() {
    return this.timestamp.getEpochSecond();
  }

  public void setTimestamp(final long ts) {
    this.timestamp = Instant.ofEpochSecond(ts);
  }
}

In the above code, persistency mapper to MongoDB will see java.time.Instant type
field and the timestamp field will be mapped to Date(ISODate) type in MongoDB.
But, other Java programs will access the Person.timestamp field via long type, because the getter and setter uses long type.
Although this approach is not so fancy to use field level annotations (if exists), it is simple and intuitive.
java.time.Instant is one of the essential classes for date/time after Java 8. It seems to be the best fit for timestamp in Java.  Spring Data MongoDB provided built-in type mapping for both java.util.Date and java.time.Instant to/from MongoDB's date(Date, ISODate) type.
Below is a sample domain object from my program. Lombok is applied. In the domain object, java.math.BigInteger type is mapped to MongoDB's decimal(Decimal128) type.
@Getter
@Setter
@RequiredArgsConstructor
@Accessors(chain = true)
@Document(collection = "transactions")
public class Transaction implements java.io.Serializable{

  @Id
  private final String hash;

  @Field(name = "block_no")
  private long blockNo;

  private long index;

  private String from;

  // denormalized field from account
  @Field("from_is_contr")
  private boolean fromIsContract;

  private String to;

  // denormalized field from account
  @Field("to_is_contr")
  private boolean toIsContract;

  @Getter(AccessLevel.NONE)
  @Setter(AccessLevel.NONE)
  @AccessType(AccessType.Type.FIELD)
  @Field(targetType = DECIMAL128)
  private BigDecimal value;

  public BigInteger getValue() {
    return this.value.toBigInteger();
  }

  public Transaction setValue(BigInteger val) {
    this.value = new BigDecimal(val);
    return this;
  }

  @Indexed
  private Instant at;

}

A: You can't define a Converter for just one class.  But you can use @PreLoad to massage that data before morphia maps it back in to your class:
    @PreLoad
    void convertDate(final DBObject dbObject) {
        dbObject.put("someTimestamp", new Date(dbObject.get("someTimestamp")));
    }

Something to effect should get you what you need.  There are a few drawbacks to this approach.

*

*You have to do it for each field where you find yourself in this situation.  So your "items" example above would need similar code in a @PreLoad method.  This hopefully doesn't happen too often so it shouldn't be overly burdensome.

*This is a lazy conversion.  If you have queries that rely on the property being a date, they will not find records that haven't been converted yet.  One solution is to simply load/save every item via morphia.  This could potentially clobber other writes to those documents unless you version your objects.  Or you could write some javascript to run in the shell to load those documents, create a new date and simply $set back to that one field.  (You could also do something similar with morphia and some low level java driver code, of course).  Any of these solutions, without versioning enabled, would probably need some downtime depending on your application and its usage.

Hopefully this gets you started in the right direction.  Good luck.


text:
Q: Difference of surface tension on area of same surface Last day I was doing an experiment about surface tension phenomenon of water.
I had a floated bussiness card on surace of water near edge of container and some drops of detergent- container was big enough, thus card had abillity of moving on the surface. No heat had been given to liquid(water).
I added on drop of detergent to water surface in a point close to card. The card escaped from that point; water pulled it to the opposite edge of the bowl.
I was wondering if anyone can help me knowing the reason of this happening.
Thank you.
Best regards

A: This is an example of the Marangoni effect and the Khan Academy video is very informative.
By adding detergent ot the water the surface tension in the proximity of the detergent is reduced and the rest of the water surface actually pulls the card as it reduces its surface area where the surface tension is larger.
That reduction in surface area of the water is accompanied by a liberation of energy (which was used to create the water surface in the first place) and so the card gains kinetic energy.


text:
Q: integration of iterates vs. integration of powers Suppose $f:[0,1]\to [0,1]$ is continuous and has the property $$\forall n\in\Bbb N\;\;\int_0^1f^n(x)\;dx=\int_0^1(f(x))^n\;dx$$ where $f^n=f\circ\cdots\circ f=f\circ f^{n-1}$ is the $n^{\text{th}}$ composition of $f$ on itself ; i.e. $f^1(x)=f(x), f^2(x)=f(f(x)),\dots$
Must $f$ be the zero function (or the constant function given by $f(x)=1$) ? Or might $f$ be a non-constant function ?


text:
Q: When opening a file, Word slowly counts the pages before it is ready to work When I open a file in Microsoft Word, Word does not open the whole file immediately, but loads one page after another. There is a small counter in the lower right corner of the file window in which the total number of pages slowly counts up (screenshot from the German version of Word):
screenshot of the page counter from the German version of Word
This is not a problem when I am working on files that are a handful of pages long, although even then it takes about ten seconds to load 50 pages of text, tables, and images, but when, as in this case, the file totals several hundred pages (631 KB of pure text, no tables, no images, no links etc.), it takes about a minute for Word to load the whole file – and while the file loads (and the page counter counts up), I cannot use the file, because whenever Word loads a new bunch of pages, the file window scrolls to a different place.
How can I avoid this slow loading?
Hardware: MacBook Air (mid 2012)
System: macOS 10.13.2
Version: Microsoft Word for Mac 15.41
Please note that I have observed this behavior in all versions of Word since Word for Mac 2011 under all version of Mac OS X since 10.6 and that no other software on my computer opens files so slowly.

A:
How can I avoid this slow loading?

A solution some people use is to split the MS-Word document into a series of smaller documents at some natural page boundary (chapter, section etc).
As an aside, the solution I use is to use a plain text editor to edit the content and something such as Markdown or Pandoc to create final formats such as HTML or MS-Word's DOCX - but you probably have some requirements to use Word.


text:
Q: How do I reorder the Account Create section of the woocommerce checkout page The Account Creation section of the woocommerce checkout page has two fields:
1. Create account password
2. Account username
I want to reorder these two fields so that 1. Create account password is below 2. Account username
I want "Account username" first and "Create account password" second.
How do I do that?

A: In woocommerce template you need to overwrite my account folder and in that you can get all related files for account page file is form-login.php


text:
Q: how to embed multiple events on function? I'm having like this:
$(selector).on('click hover', function() { /*code to be executed*/ });

but only click is triggered but not hover.

A: There's no hover event. jQuery's hover function listens for mouseenter and mouseleave to conveniently bind two event handlers.
If you want your function to be called when the mouse enters the object, do
$(selector).on('click mouseenter', function(){/*code to be executed*/});

A:
Deprecated in jQuery 1.8, removed in 1.9: The name "hover" used as a shorthand for the string "mouseenter mouseleave". It attaches a single event handler for those two events, and the handler must examine event.type to determine whether the event is mouseenter or mouseleave. Do not confuse the "hover" pseudo-event-name with the .hover() method, which accepts one or two functions.

http://api.jquery.com/on/

A: $("#target").hover(function(){
  $(this).click();
}).click(function(){
  //common function
});

A: I can also manage like this:
var ch= function () {
    // code to be executed
}
$(selector).click(ch).hover(ch);


text:
Q: Checking if the last diff command had output I have some commands in a file that are like
diff file1 file2
diff file3 file4

And if anything is output I want to print which command this happened in  such as
diff file1 file2
if (there was output from the diff command)
     print "file1 and file2 had the difference"
endif
diff file3 file4
if (there was output from the diff command)
     print "file3 and file4 had the difference"
endif

A: The diff command exits with 1 if there is a difference.  The easy way uses that as a success/failure check:
diff file1 file2 || print "file1 and file2 had the difference"
diff file3 file4 || print "file3 and file4 had the difference"


text:
Q: VBA Jagged Array Duplicates I'm new to coding with VBA, and a beginner programmer in general. I have the following simple table (the data keeps getting inputted on daily basis, so it changes):

Item #
Description
Date
Location
Plate
Load
Type
Rate
Cost

0001
des1
30/1/21
Site
ABC123
5
One
typ1
100

0002
des2
30/1/21
Office
ACB465
4
One
typ1
100

0003
des3
30/1/21
Office
ABC789
3
One
typ1
100

0004
des4
30/1/21
Site
ABS741
5
One
typ1
100

0005
des4
31/1/21
Office
ABC852
2
One
typ1
100

I would like to filter this data by specific date first, then delete duplicates in Location while adding the Load for said duplicates.
For example, if I wanted to filter for 30/1/21. It would end up as follows:

Location
Load

Site
10

Office
7

I would then want to put it in one summary cell as follows:

Summary

10 Site,  7 Office

I was able to filter the original table into jagged arrays. The code for that is:
For j = numberSkipD To numberRowsD
    If Worksheets("Disposal Fees").Range("F" & j).Value = Worksheets("Daily Tracking").Range("B2").Value Then
        For k = numberDisposalInformationRaw To numberDisposalLocation
            ReDim Preserve disposalLocation(numberDisposalLocation)
            disposalLocation(numberDisposalLocation) = Worksheets("Disposal Fees").Range("I" & j).Value

        Next
        numberDisposalLocation = numberDisposalLocation + 1

        For k = numberDisposalInformationRaw To numberDisposalLoad
            ReDim Preserve disposalLoad(numberDisposalLoad)
            disposalLoad(numberDisposalLoad) = Worksheets("Disposal Fees").Range("K" & j).Value
        Next
        numberDisposalLoad = numberDisposalLoad + 1
    End If
Next

I then tried to do the second table above (deleting duplicates and adding the values for said duplicates together) but it is giving me errors, not sure how to solve them. I know they're index errors, but don't know how to fix them. (Please help me with this part, here is the code)
Dim disposalInformationRaw As Variant
    Dim disposalInformationCooked As Variant
    Dim FoundIndex As Variant, MaxRow As Long, m As Long

    ReDim disposalInformationCooked(1 To UBound(disposalInformationRaw, 1), 1 To UBound(disposalInformationRaw, 2))

    MaxRow = 0
    For m = 1 To UBound(disposalInformationRaw, 1)
        FoundIndex = Application.Match(disposalInformationRaw(m, 1), Application.Index(disposalInformationCooked, 0, 1), 0)

        If IsError(FoundIndex) Then
            MaxRow = MaxRow + 1
            FoundIndex = MaxRow
            disposalInformationCooked(FoundIndex, 1) = disposalInformationRaw(m, 1)
        End If

        disposalInformationCooked(FoundIndex, 2) = Val(disposalInformationCooked(FoundIndex, 2)) + Val(disposalInformationRaw(i, 2))
    Next m

    Range("G1").Resize(MaxRow, UBound(disposalInformationCooked, 2)).Value = disposalInformationCooked

I don't think I'd have much trouble finalizing the third part (the summary), but if you know how to do it, please feel free to share how you would approach it. I mostly need help with the second part. I would be more than happy to edit and provide more information if needed. Thanks in advance.

A: Here's one approach using a dictionary.
dim dict, rw as range, locn, k, msg, theDate

set dict= createobject("scripting.dictionary")

theDate = Worksheets("Daily Tracking").Range("B2").Value

'adjust table range as required
for each rw in worksheets("Disposal Fees").range("F6:K100").rows
   if rw.cells(3).Value = theDate Then              'date match?
       locn = rw.cells(4).Value                     'read location
       dict(locn) = dict(locn) + rw.cells(6).Value  'add load to sum
   end if
next rw

'loop over the dictionary keys and build the output
for each k in dict
    msg = msg & IIf(len(msg) > 0, ", ", "") & dict(k) & " " & k
next k

debug.print msg

A: Sum Unique
Disposal Fees

Daily Tracking

*

*Adjust the values in the constants section.

The Code
Option Explicit

Sub TESTsumByValue()

    ' Source
    Const srcName As String = "Disposal Fees"
    Const lCol As Long = 3
    Const kCol As Long = 4
    Const sCol As Long = 6
    Const SumFirst As Boolean = True
    Const KSDel As String = ":"
    Const IDel As String = ", "
    ' Destination
    Const dstName As String = "Daily Tracking"
    ' Define workbook.
    Dim wb As Workbook: Set wb = ThisWorkbook ' Workbook containing this code.

    ' Define Source Range (You may have to do something different).
    Dim srg As Range: Set srg = wb.Worksheets(srcName).Range("A1").CurrentRegion

    ' Write Criteria to variable.
    Dim drg As Range: Set drg = wb.Worksheets(dstName).Range("B2")
    Dim Criteria As Variant: Criteria = drg.Value

    ' Use function to get the result.
    Dim s As String
    s = sumByValue(Criteria, srg, lCol, kCol, sCol, SumFirst, KSDel, IDel)
    Debug.Print s ' "10:Site, 4:Bathroom, 4:Office"

    drg.Offset(, 3).Value = s ' writes to 'E2'

End Sub

Function sumByValue( _
    ByVal LookupValue As Variant, _
    rng As Range, _
    ByVal LookupColumn As Long, _
    ByVal KeyColumn As Long, _
    ByVal SumColumn As Long, _
    Optional ByVal SumFirst As Boolean = False, _
    Optional ByVal KeySumDelimiter As String = ": ", _
    Optional ByVal ItemsDelimiter As String = ", ") _
As String

    ' Validate range ('rng').
    If rng Is Nothing Then Exit Function

    ' Write values from range to Data Array ('Data').
    Dim Data As Variant: Data = rng.Value ' 2D one-based array

    ' Declare additional variables.
    Dim vKey As Variant ' Current Key Value
    Dim vSum As Variant ' Current Sum Value
    Dim i As Long ' Data Array Row Counter

    ' Create a reference to Unique Sum Dictionary (no variable).
    With CreateObject("Scripting.Dictionary")
        .CompareMode = vbTextCompare ' 'A = a'

        ' Loop through Data Array ('Data') and write and sumup unique values
        ' to Unique Sum Dictionary.
        For i = 1 To UBound(Data, 1)
            If Data(i, LookupColumn) = LookupValue Then
                vKey = Data(i, KeyColumn)
                If Not IsError(vKey) Then
                    If Len(vKey) > 0 Then
                        vSum = Data(i, SumColumn)
                        If IsNumeric(vSum) Then
                            .Item(vKey) = .Item(vKey) + vSum
                        Else
                            .Item(vKey) = .Item(vKey) + 0
                        End If
                    End If
                End If
            End If
        Next i

        ' Validate Unique Sum Dictionary.
        If .Count = 0 Then Exit Function

        ' Redefine variables to be reused.
        ReDim Data(1 To .Count) ' Result Array: 1D one-based array
        i = 0 ' Result Array Elements Counter

        ' Write results to Result Array.
        If SumFirst Then
            For Each vKey In .Keys
                i = i + 1
                Data(i) = .Item(vKey) & KeySumDelimiter & vKey
            Next vKey
        Else
            For Each vKey In .Keys
                i = i + 1
                Data(i) = vKey & KeySumDelimiter & .Item(vKey)
            Next vKey
        End If

    End With

    ' Write the elements of Data Array to Result String.
    sumByValue = Join(Data, ItemsDelimiter)

End Function


text:
Q: Search option with specific text words with multiple inputs [=IF(ISNUMBER(SEARCH("apple",A1)),"Y"," ")]
Search option with specific text words with multiple inputs

Column A contains text trying to search a specific test in a cell prints output Y/N
A1 cell contain text apple applying formula in B1 =IF(ISNUMBER(SEARCH("apple",A1)),"Y"," ") output prints "Y" as expected.
A2 Cell contain text [apples][3] applying the same formula in B2 =IF(ISNUMBER(SEARCH("apple",A2)),"Y"," ")output still shows "Y" How to get it printed as "N"
A3 Cell contain text apple,apples applying the same formula in B3 =IF(ISNUMBER(SEARCH("apple",A3)),"Y"," ") output prints "Y" as expected.
A4 cell contain text apples,apple applying the same formula in B4 =IF(ISNUMBER(SEARCH("apple",A4)),"Y"," ")output prints "Y" as expected.
Now the query is how to get printed as "N" or Blank if "apple" is not exist in cell.

A: If your words are always separated by a comma as shown in your provided sample data, this should work for you to find an exact match.  Put in cell B1 and copy down:
=IF(ISNUMBER(SEARCH(",apple,",","&A1&",")),"Y","N")


text:
Q: Unable to get same results than in concurrency in Go book sample code I'm reading Concurrency in Go: Tools and Techniques for Developers by Katherine Cox-Buday. Great read thus far, I stumbled into a block of code in the book that I wanted to test. When I run it in my IDE I get a different results and I don't know why.
here is the code:
package main

import (
"fmt"
"sync"
)

func main() {
var count int
var lock sync.Mutex
increment := func() {
    lock.Lock()
    defer lock.Unlock()
    count++
    fmt.Printf("Incrementing: %d\n", count)
}
decrement := func() {
    lock.Lock()
    defer lock.Unlock()
    count--
    fmt.Printf("Decrementing: %d\n", count)
}
// Increment
var arithmetic sync.WaitGroup
for i := 0; i <= 5; i++ {
    arithmetic.Add(1)
    go func() {
        defer arithmetic.Done()
        increment()
    }()
}
// Decrement
for i := 0; i <= 5; i++ {
    arithmetic.Add(1)
    go func() {
        defer arithmetic.Done()
        decrement()
    }()
}
arithmetic.Wait()
fmt.Println("Arithmetic complete.")
}

I'm getting this result:
$ go run main.go
Incrementing: 1
Incrementing: 2
Incrementing: 3
Incrementing: 4
Incrementing: 5
Incrementing: 6
Decrementing: 5
Decrementing: 4
Decrementing: 3
Decrementing: 2
Decrementing: 1
Decrementing: 0
Arithmetic complete.

Whereas in the book I should be having this result:
Decrementing: -1
Incrementing: 0
Decrementing: -1
Incrementing: 0
Decrementing: -1
Decrementing: -2
Decrementing: -3
Incrementing: -2
Decrementing: -3
Incrementing: -2
Incrementing: -1
Incrementing: 0
Arithmetic complete.

Can someone clarify it for me.

A: There are no guarantees on the running order of goroutines. Depending on how the runtime schedules them, goroutines can run in different orders when you run the program multiple times. The output you observed appears to be one of the valid interleavings of the goroutines whereas the book lists only one of the possible outputs.


text:
Q: Which version of Entity Framework is used by my project? I have a project using Entity Framework, but I am not sure which version of EF I am using.
According to the Microsoft version history EF5 will install itself:

If you create a new model using the Entity Framework Designer in Visual Studio 2012, the EF5 NuGet package will be installed to your project and the generated code will make use of EF5.

However I did not create the EF-part of the project, but got it from version control (TFS).  Now I am not sure how to determine if I have EF5.
If I right-click on the References folder of the project and select Manage NuGet Packages, it show EF5 with an Uninstall-button, implying I have EF5.
But the system.data.entity in the References folder has a Runtime Version v4.0.30319 and Version 4.0.0.0 in the Properties explorer, which would imply EF 4 (according to Determine version of Entity Framework I am using?).
I do have this in my app.config:

And this in my web.config:
<configSections>

</configSections>

  <dependentAssembly>
    <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
  </dependentAssembly>

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>

Can anybody clarify this?

A: Maybe your proyect is based in .NET 4.0, in this case you have an EF5 version without .NET 4.5 features:
EntityFramework 5 use dll version 4.4.0.instead 5.0

A: According to this answer to Entity Framework 5 not installing correctly?, one should only look at EntityFramework.dll, which in my case shows Runtime version  v4.0.30319 but Version 5.0.0.0.  (So I do have EF 5.)

A: Go to packages.config file of your project.
  <package id="EntityFramework" version="6.1.3" targetFramework="net45" />

A: I have the same version number on System.Data.Entity. This comes from the .Net framework, not the Entity Framework installation. You can see which parts of your app are using it by right-clicking the reference and select Find Code Dependent on Module. There's generally not a lot unless the code is accessing metadata, mostly state enums and attribute defn's. Next version will bring all of this into the EntityFramework.dll - see EFv6
BTW, looking at the folder in properties of System.Data.Entity, v4.0.30319 is in .NETFramework\v4.5

A: The easiest way to get this kind of information is to install Microsoft ASP.NET MVC Diagnostics 5.2.3
This just produces a webpage for your project with all the pertinent information. For example, you could just search for "Entity" on that page and see the version information right away.
Here is an article showing one use of this diagnostic tool.


text:
Q: Disable MySQL startup in Linux I have KDE, and it has software to manage startup packages. But, I don't see any mysql, mariaDB or mysqld service.
How can I disable or prevent the mariaDB and mysql daemons from starting automatically?

A: If you're on systemd (default on Arch) then that would be
systemctl disable mysqld.service


text:
Q: Efficient way to if else statement with hundreds of blocks I've got a list of hundreds of numbers that the user can click on, each number corresponds with a scene variable that ends with the same number the user clicks on, ie if user picked "43", renderer.render(scene43,camera) is performed.
//jumpSwitcher is defined the numerical value that the user has clicked on
jumpSwitcher = +value;

if (jumpSwitcher == 1) {
     renderer.render(scene1, camera);
} else if (jumpSwitcher == 2) {
     renderer.render(scene2, camera);
}

This could go on hundreds of times though. How do I write the above code so that I may save myself a lot of work. And how do I efficiently define an array worth of hundreds of these scene variables?

A: I suggest using "literal object"
var conditions = {
    "1": ..., // treat condition to 1
    "2": ... // treat condition to 2
    "default": ... // default treatment
}

var treatment = conditions[scene] || conditions.default;

A: Use an array.
var scenes = [ null, scene1, scene2, scene3 ];
renderer.render(scenes[jumpSwitcher], camera);

A: One approach would be to use eval(), but don't.
You can populate a scenes array using this:
scenes = Array.apply(null, Array(100)).map(function () {return new Scene();});

Alternatively, with ES6,
scenes = Array.from(Array(100), () => new Scene())

Then just use:
renderer.render(scenes[jumpSwitcher-1], camera);

A: You could use either an array, if you have contiguous numbers
scenes = [scene0, scene1, ..., sceneN ]
// access
renderer.render(scenes[scene], camera);

or an object for numbers with gaps
scenes = { 10: scene10, 15: scene15 }
// access
renderer.render(scenes[scene], camera);

or a Map
scenes = new Map([[4, scene4], [20, scene20]]);
// access
renderer.render(scenes.get(scene), camera);

The other possibillity is to use the programming style return early, which means, to make a condition and end the function if the condition is met.
function callScene(scene) {
    if (scene === 1) {
        renderer.render(scene1, camera);
        return;
    }
    if (scene === 2) {
        renderer.render(scene2, camera);
        return;
    }
    // ...
}

A: Use the switch statement, example
switch(jumpSwitcher)
{
    case 1: {renderer.render(scene1, camera); break;}
    ...
}

A: Since the scenes appear to be global variables, you can also use this:
renderer.render(window['scene' + jumpSwitcher], camera);

No eval, single line, variable scene number... It doesn't get any more simple than this.
If the scenes aren't on window, replace it with the proper scope object. (this, for example).

A: Just simply write this:
"use strict";
renderer.render(eval('scene' + jumpSwitcher), camera);

And you don't need if or switch.
UPDATE: Strict mode added for safer eval(), docs


text:
Q: pointers and .net pointers I heard that NULL is equivalent to .net nullptr and that 0 is not equivalent to .net nullptr.  why?  I thought that NULL is a macro equal to 0 ?

A: I depends on if you're talking about unmanaged pointers or managed handles. Regarding pointers, a quote from the documentation here:
The following sample shows that nullptr and zero can be used interchangeably on native
pointers.
However, if you're talking about a managed handle, then you can't use 0 as described in this quote from the same page:
You cannot initialize a handle to zero; only nullptr can be used. Assignment of constant 0 to an object handle produces a boxed Int32 and a cast to Object^.


text:
Q: How to create a Migration which will update some rows, when an Observer is present? I am working on a Laravel App, and in a Migration, I want to update certain objects. For this my Migration has the following code:
public function up()
{
    //Update the filter whose current name is City
    $filter= App\Filter::where('name', 'City')->firstOrFail();
    if($filter){
        $filter->name='City Region Type';
        $filter->description='City Region Type';
        $filter->save();
    }

}

I also have an Observer on this class which puts in the user_id of the user who is doing the update, using:
public function updating(Filter $filter)
{
     $filter->updated_by = auth()->user()->id;
}

Running this migration fails, because it cannot get the user_id.
What's the Recommended way to write a Migration when you have an Obser set up like this?
Or Do I give up and use Raw SQL?

A: There is one way in Laravel in which you can check whether application on console or web.
So you can use below code in observer. And if App is on console then no need to run code inside observer.
public function updating(Filter $filter)
{
     if (\App::runningInConsole()) {
         return false;
     }
     $filter->updated_by = auth()->user()->id;
}

I hope this will help you.


text:
Q: Button Eventhandler not fire when in CollapsibleExtender inside a ModalpopupExtender I have a detailsview inside a ModalPopupExtender which works perfectly.
In the footertemplate section of the detailsview I have placed several linkbuttons.
When a linkbutton is pressed it should trigger a CollapsiblePanelExtender which is create dynamically. So far everything works as it should be . Below is the part of the detailsview inside the modalpopup
<Toolkit:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="btnShowPopup"
    PopupControlID="pnlPopUp" BackgroundCssClass="modalBackground"
    PopupDragHandleControlID="DragHandle"  DropShadow="true"/>
<asp:Panel ID="pnlPopUp" runat="server" style="display:none;"
    CssClass="popUpStyle">
    <asp:Panel ID="DragHandle" runat="server" CssClass="drag" ></asp:Panel>
    <asp:DetailsView ID="dvwDetailsUser" runat="server"
         AutoGenerateRows="False"
         Width="100%"
         onitemcommand="dvwDetailsUser_ItemCommand"
         FooterStyle-HorizontalAlign="Right"
         ForeColor="#990000"
         BorderWidth="0px" >
         <Fields>
          <asp:BoundField DataField="GivenName" HeaderText="First name" />
          <asp:BoundField DataField="SurName" HeaderText="Last name" />
          <asp:BoundField DataField="DisplayName"  HeaderText="DisplayName" />
          <asp:BoundField DataField="SamAccountName"  HeaderText="Account" />
          <asp:BoundField DataField="EmailAddress" HeaderText="E-mail" />
          <asp:CheckBoxField DataField="Enabled" HeaderText="user enabled" />
          <asp:BoundField NullDisplayText="" />
          <asp:BoundField DataField="DistinguishedName"
              HeaderText="DistinguishedName" />
         </Fields>
         <FooterStyle HorizontalAlign="Right" />
            <FooterTemplate >
               <asp:LinkButton ID="btnProperties"
           runat="server" CommandName="Remove" Text="Remove" />
            </FooterTemplate>
            <HeaderStyle BackColor="#FFCD4A" Font-Bold="True"
             HorizontalAlign="left" />
            <AlternatingRowStyle BackColor="#EFEFEF" />
    </asp:DetailsView>
</asp:Panel>

The modalpopup extender and the details-view are wrapped inside a updatepanel.
when I pressed a link-button inside the pop-up window the collapsible panel will be displayed.
Inside the collapsiblepanel I have button also created dynamically. When I press the button the new eventhandler which is attached to the button is not fired.
protected void dvwDetailsUser_ItemCommand(object sender, DetailsViewCommandEventArgs e)
{
   if (e.CommandName == "Remove")
        DeleteAccount();
   end if
}

public void DeleteAccount()
{

    Panel p = new Panel();
    Button btnRemove = new Button();

    p.ID = "pnlDeleteAccount";
    p.GroupingText = "Remove" + dvwDetailsUser.Rows[2].Cells[1].Text;

    btnRemove.Text = "Remove"
    btnRemove.ID = "Apply";
    btnRemove.CausesValidation = false;

    btnRemove.UseSubmitBehavior = false;
    btnRemove.Click += new EventHandler(btnRemove_Click);
    p.Controls.Add(btnRemove);

    CollapsiblePanelExtender cpe = new CollapsiblePanelExtender();

        cpe.TargetControlID = p.UniqueID;
        cpe.ExpandControlID = p.UniqueID;
        cpe.CollapseControlID = p.UniqueID;
        cpe.AutoCollapse = false;
        cpe.AutoExpand = false;
        cpe.ScrollContents = false;
        cpe.SuppressPostBack = false;
        cpe.ExpandDirection = CollapsiblePanelExpandDirection.Vertical;
        cpe.Page = this.Page;

        pnlPopUp.Controls.Add(cpe);
        cpe.Controls.Add(p);

    mdlPopup.Show();
 }

public void btnRemove_Click(object sender, EventArgs e)
{
    Response.Redirect("UserAccount.aspx");
}

I have placed a response.redirect to see if the event btnRemove_click will fire when the remove button is pressed.
Am I missing something here?


text:
Q: Mathematical Paper That Just Links Two Different Fields of Sciences I have a soft question that is interesting for me in some aspects. I appreciate your answers and comments about it.
Four years ago, one of my friends in MIT, in the biology lab, had working on neuroscience and specially he worked on Deja-Vu phenomenon. When he asked me about writing a program with Matlab for simulating this phenomenon with a network of cells that they want simulate the Sinc function, I found that there are many good theorems in graph theory that can be useful for his research. When I suggested him this idea, he found it very interesting.
My question are about this event in a little bit different way. Is it possible that we publish a paper in some mathematical journals that:
1) The only new thing in the paper is relation between a real phenomena and a field of mathematics that is well known. For example, we just model the controversy with bandwidth problem, and no more things just using the theorems that proved for bandwidth problem.
2) This paper does not have new theorems as like as theorems that are common in mathematical papers. This paper just use mathematical theorems in its direction.
Also, do we have some mathematical journals that publish such a papers? And if yes, is there some evidences for this type of publication?
Maybe someone think about the Hilbert Spaces and quantum mechanic. But, in my view, this is not the case. We use Hilbert spaces to model some aspects of quantum mechanics and we get some new results and theorems in quantum mechanic. If we want to think this relation, the paper only must be contain the modeling of quantum mechanic by Hilbert spaces and no more.
Briefly, suppose we found a connection between a real phenomenon and a field of mathematics that can be acceptable or a new view point for analysis the phenomenon. For example, if we found a relation between Darwin's evolutionary theory and a game on graph, is it possible that we can publish such a results as a paper in a mathematical journal? And what kind of mathematical journal is good for this work?
Sorry me for long question.

A: Here's a practical example:
This paper (now considered a classic in the field with 120+ citations) connected the Thurston-Neilsen surface classification theorem with the problem of mixing in fluids.
Boyland, Philip L., Hassan Aref, and Mark A. Stremler. "Topological fluid mechanics of stirring." Journal of Fluid Mechanics 403 (2000): 277-304

A: Further journals devoted to papers linking mathematics with other scientific areas are the following:
Mathematical medicine and biology;
Bulletin of mathematical biology;
Computers and mathematics with applications;
Journal of mathematical imaging and vision;
Mathematical geology;
Mathematical geosciences.

A: Oh yes! Establishing a connection between some class of natural phenomena and a well known
field of mathematics can make you famous. And you do not have to prove new theorems.
The most striking recent example is Benoit Mandelbrot.
According to the Google Scholar he is THE MOST cited mathematician of all (at the time I write this).
And all his activity was exactly as you describe.
Even before fractals, he was looking for new connections between "well known" fields
of mathematics and real world. For example he was looking for "stable probability
distributions" everywhere, "power laws" etc.
But his greatest success was "fractals". The relevant mathematics was known for about
50 years. Well known to a very narrow circle of specialists, as it happens to most
areas of pure mathematics. He invented a catchy word "fractal" and then showed by examples
that "fractals are everywhere". I don't know a single new theorem that Mandelbrot proved.
But his influence on mathematics and science was really enormous.
On a smaller scale we have Kramers-Kronig relations.
Which is nothing else but the "well known" Spkhotski-Plemelj formula.
It is not important that Kramers and Kronig discovered these known relations independently.
What is important is that they proposed a physical interpretation. And there are
thousands of examples like this. You can even receive a Nobel prize by establishing
a new relation to the real world of some well known mathematics.

A: Some journals:
J Theor Biol
PLoS Computational Biology

A: There are a gazillion of papers like that. Actually, that's how this lowly talking duckling roles when not proving mathly-hardcore theorems.
Where to submit depends on the nature of your paper. You may have to adjust your writing style and even change the content to an extent. Either way, the golden rule I learned from my advisor and postdoc mentors is that you write your paper for your target audience and submit where they do research.
Since shiny papers by great researchers like nobel laureates may not be extremely practical examples your average guy can easily reproduce, here are how I usually do, just so you know there are a lot of mediocre examples like that too. (No. This is not a shameless self-promotion of my papers. Honest!)
A typical example of things like what you described happens when you find an equivalence between a well-studied math object in your field and something that's seemingly unrelated in another field. For example, I was reading this paper published in Science about how you can exploit Bell pairs to correct the effect of decoherence for quantum communication and another paper by the same authors published in Physical Review A about how that idea and state-of-the-art coding theory may go together. I also did a serious amount of research on this myself and actually published one paper. But after a while, I suddenly realized that what we'd been looking at is, after all, exactly the same as a fundamental class of combinatorial designs (with some caveat in fine print which I omit).
With this equivalence, I was able to import known classical results in design theory; I described what kind of quantum code their method must end up with and gave bounds on code parameters and whatnot without really proving anything except the equivalence. In this case, the target audience was coding theorists, design theorists, and physicists who read said two papers. So I chose the journal that has exactly this audience.
I could submit it to some physics journal, but such a journal wouldn't attract coding theorists and design theorists; the point of my paper was to show an example of how design theory, coding theory, and quantum error correction interact. A specialized combinatorics journal wouldn't be the best choice either because that's not where quantum physicists usually come. So I picked a journal that has a dedicated section for quantum information and is read by both mathematicians and electrical engineers. Incidentally, the editor asked us to translate some part of the original manuscript into the language of coding theory, so it's important to consider what the majority of the journal's audience is familiar with.
You can still do serious mathematics too if you like even if you just found an equivalence or new application of known math. For example, when I was a grad student, I was given a design theory problem that an engineer at nVidia brought to my mentor. I got curious about the computer engineering behind it, and I found out that the problem actually stems from a more general VLSI testing technique which Intel developed years ago. And I noticed that this general version can be understood as a problem of finding a linear hash function with certain nice combinatorial properties.
This combinatorial problem got me, so I formalized the technique Intel used to use and did purely combinatorial research. The direction of research I took and the results I got was too math-centric, so my paper wouldn't be extremely attractive to people making money in real life off of the kind of computer engineering I did some math about. But I couldn't help it because I got more interested in the math problem I defined by (obviously overly) generalizing the original engineering problem. So I wrote my paper the way (applied) discrete mathematicians would do, and submit it to a very mathematical journal that also deals with electrical engineering.
One thing you might want to note is that such papers may take longer to get published. For instance, editors may have hard time finding appropriate referees. If you're connecting two fields, the editor may need someone who speaks two previously unrelated subfields or find it difficult to convince potential referees that they can understand and judge your manuscript; your paper may look frightening at first glance to a potential referee who only knows one of the two fields well. And if your paper does require a substancial amount of knowledge in two fields to check validity and judge its quality, you don't expect your referees would return their reports in a month.
In any case, there are a lot of examples like your case. And it doesn't need to be an all-time-most-cited paper either. After all, if you're doing mathematics that you find cute and interesting, chances are someone in a different field was/is/will be thinking about a similar thing in a different scientific language. And pure math shines when you find such relations because of its rigor and generality.

A: In the last paragraph, you answer your own question.
Every article must contain something new. A new in which field of science? If in biology, then it must be submitted in a biological journal (e.g., in Journal of Mathematical Biology). If you succeed to use Darwin's evolutionary theory in games on graphs (:-)) then you can publish your results in Journal of Graph Theory.


text:
Q: SQLite group by all the days in selected date range even data not exsist I have a table invoice with two columns, date and total I want get last 30 days total group by all days of the month (or else last 7 days groups by all days of the week)
date     total
11/16    500
11/23    200
12/2     400
12/4     600

I have tried something like this,
SELECT strftime('%m/%d', Date) as valDay, SUM(Total)
FROM invoice
GROUP BY valDay
Order By Date DESC LIMIT 30 ;

It gives last 30 records. but I want records for all last 30 days even the table have no data for some of days (it must return 0 as total for that days)

A: You can use a recursive query to generate the dates, then bring the table with a left join, and aggregate:
with recursive cte as (
    select date('now') as dt,  date('now', '-30 day') last_dt
    union all select date(dt, '-1 day'), last_dt from cte where dt > last_dt
)
select c.dt, coalesce(sum(i.total), 0) as total
from cte c
left join invoice i on i.date >= c.dt and i.date < date(c.dt, '+1 day')
group by c.dt
order by c.dt desc


text:
Q: Java Client won't connect to remote server Bare with me as it's been a while since I've been on here and I know there's format rules for questions. I have coded two java applications, both are pretty simple. One being a server and two being a client that connects to the server via socket. Now this works on my computer but when I have a buddy run on his computer it doesn't connect. I want the server to be able to run on my computer and anyone who has the client can connect.
The relevant code for the server:
public static void main(String[] args) throws IOException {
// write your code here
    System.out.println("Server Running...");
    int port = 1020, backlog = 5;
    String ipAddress = "2552:548:41aa:c3f0:563c:hgj9:8ca2:b3aa";
    ServerSocket serverSocket = new ServerSocket(port, backlog, InetAddress.getByName(ipAddress));
    Server server = new Server(serverSocket);
    server.startServer();
}

The relevant code for the client:
public class Client{

public String username;
private Socket socket = new Socket("2552:548:41aa:c3f0:563c:hgj9:8ca2:b3aa", 1020);
public BufferedReader bufferedReader;
public BufferedWriter bufferedWriter;
public ChatController chatController;

public Client(String username) throws IOException {
    try {
        this.username = username;
        this.bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        this.bufferedWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
        bufferedWriter.write(username);
        bufferedWriter.newLine();
        bufferedWriter.flush();
        listenForMessage();
    } catch (IOException e) {
        closeEverything(socket, bufferedReader, bufferedWriter);
    }
}

Like I said, this works on my computer but the not when client is on a different computer. My thoughts are that the issue is on the client side, possibly not using an open port? Thank you in advance and let me know if I need to edit if it's not a proper question format.


text:
Q: How to invert the confusion matrix in Sklearn `plot_confusion_matrix` function? When using the sklearn.metrics.plot_confusion_matrix function, it plots a confusion matrix with actual values as rows and the predicted as columns. However, every other source I have seen sets up the matrix with actual values as columns and predicted as rows. Frankly, that approach seems better and Sklearn's way is truly confusing.
It would be great if the plot showed the matrix in that format. How would I achieve this?
This thread comes close to answer but it does not directly do so.

A: It seems that Sklearn provides another function to display the confusion matrix. Instead of taking the estimator and the validation sets, it directly accepts the matrix and plots it:
import numpy as np
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.metrics import confusion_matrix

# Create the CM
cm = confusion_matrix(y_true, y_pred)
# Flip it using Numpy and feed it to the display function
cmp = ConfusionMatrixDisplay(cm, display_labels=['label_1', 'label_2'])

plt.xlabel('Actual')
plt.ylabel('Predicted')

cmp.plot();

It has also display_labels parameter to accept custom class labels before plotting. As we are feeding the function an inverted matrix, it is important you add custom axes labels. Here is the documentation for the function:
https://scikit-learn.org/stable/modules/generated/sklearn.metrics.ConfusionMatrixDisplay.html


text:
Q: Upgrading RAM in a server [Dell poweredge T610] While this may come off as yet another ram question it is slightly different in what I have seen covered.
I've updated my own RAM before, but this is throwing me off for two reasons. One, it is a server that has two processors. Which is nice, but does each processor need to have matching RAM? what are the rules when dealing with two processors?
The second question is what to make of what I have
All I know about them is what the invoice says 24GB Memory (6x4GB), 1333MHz Dual Ranked LV RDIMMs for 1 Proc, Optimized (note this machine was not purchased by me. It was purchased early last winter)
I have six open slots and would like too add 6x8GB and triple the memory available. But I am having a hard time figuring out what I have from the above line. So would something like this work http://www.newegg.com/Product/Product.aspx?Item=N82E16820139273 (x2):
Kingston 24GB (3 x 8GB) 240-Pin DDR3 SDRAM ECC Registered DDR3 1333 (PC3 10600) Server Memory Model KVR1333D3D4R9SK3/24G
I'm using linux/centOs5.5 if that matters to anyone.

A: There are significant benefits to keeping the same amount of RAM on each channel of a single CPU. There are some benefits, but not much, to keeping the same amount of RAM on each CPU.
Each CPU can access memory connected to the other CPU almost as efficiently as it can access its own. It's so close to the same that today's operating systems and software don't even bother to track it -- they don't try to run tasks on CPU 'close' to the memory they need or allocate memory 'close' to the CPU that's going to use it.
However, by evening out the memory, you do prevent memory controller channels from being a bottleneck. If you have two CPUs each with two channels, putting the same amount of memory on each of the four channels helps to even out the load -- a channel with more RAM than the others wouldn't tend to become a bottleneck. It also permits the CPU to interleave across its channels. Interleaving across CPUs is not done.

A: I agree with everythin mentioned by David and IMO it is better to match the memory config for both the processors!! if you need some suggestions on where to find the compatible memory for your server then try some of these -

*

*http://www.memorystock.com/memory/DellPowerEdgeT610DDR31333MHzRegECC.html

*http://www.crucial.com/upgrade/Dell-memory/PowerEdge/PowerEdge+T610-upgrades.html
Newegg is good but I personally prefer the above two or try to get the memory with the same specifications mentioned in the links according to your place and preference.
P.s - LOL!! What was I thinking .... this thread is quite old.


text:
Q: LocalNotification Plugin doesn't work on Android I'm learning PhoneGap and I tried to use the Notification Local Plugin, but does not work for me.
I'm trying to build my app, but it is returning error in XML AndroidManifest.xml. I followed all instructions in the README on GitHub.
I am using cordova-2.0.0 and API10.
Someone can help me?
Note: I changed LocalNotification.java:
//alarm = new AlarmHelper(this.ctx);
alarm = new AlarmHelper(ctx.getContext());

EDIT: My AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="br.com.xpd.saleiro1"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <supports-screens
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:resizeable="true"
        android:anyDensity="true" />

    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main"
            android:configChanges="orientation|keyboardHidden" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver android:name="com.phonegap.plugin.localnotification.AlarmReceiver" >
    </receiver>

        <receiver android:name="com.phonegap.plugin.localnotification.AlarmRestoreOnBoot" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

    </application>

A: Have you tried with a older version? When I tried i got successfully results with 1.6.1 version.


text:
Q: boost::object_pool constructor number of arguments I am using boost::object_pool interface from the boost pool library. By default boost::object_pool::construct can take up to three arguments. I need to pass 13 arguments to construct one of the objects. I defined the m4 macro NumberOfArguments (the maximum arguments that can be passed to boost::object_pool::construct ) as 13 in the file detail/pool_construct.m4 as advised here. Finally the file looks like
m4_dnl
m4_dnl Copyright (C) 2000 Stephen Cleary
m4_dnl
m4_dnl Distributed under the Boost Software License, Version 1.0. (See accompany-
m4_dnl ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
m4_dnl
m4_dnl See http://www.boost.org for updates, documentation, and revision history.
m4_dnl
m4_dnl
m4_dnl
m4_dnl Avoid the use of any m4_* identifiers in this header file,
m4_dnl  as that may cause incompatibility problems with future
m4_dnl  versions of m4.
m4_dnl
m4_dnl This is a normal header file, except that lines starting
m4_dnl  with `m4_dnl' will be stripped, TBA_FOR
m4_dnl  macros will be replaced with repeated text, and text in
m4_dnl  single quotes (`...') will have their single quotes
m4_dnl  stripped.
m4_dnl
m4_define(`NumberOfArguments', 13)
m4_dnl
m4_dnl Check to make sure NumberOfArguments was defined.  If it's not defined,
m4_dnl  default to 3
m4_dnl
m4_ifdef(`NumberOfArguments', , `m4_errprint(m4___file__:m4___line__`: NumberOfArguments is not defined; defaulting to 3
')m4_define(`NumberOfArguments', 3)')m4_dnl
m4_ifelse(NumberOfArguments, , `m4_errprint(m4___file__:m4___line__`: NumberOfArguments is defined to be empty; defaulting to 3
')m4_define(`NumberOfArguments', 3)')m4_dnl
m4_dnl
m4_dnl Check to make sure NumberOfArguments >= 1.  If it's not, then fatal error.
m4_dnl
m4_ifelse(m4_eval(NumberOfArguments < 1), 1, `m4_errprint(m4___file__:m4___line__`: NumberOfArguments ('NumberOfArguments`) is less than 1
')m4_m4exit(1)')m4_dnl
m4_dnl
m4_dnl Include the BOOST_M4_FOR macro definition
m4_dnl
m4_include(`for.m4')`'m4_dnl
m4_dnl
m4_dnl Begin the generated file.
m4_dnl
// Copyright (C) 2000 Stephen Cleary
//
// Distributed under the Boost Software License, Version 1.0. (See accompany-
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.

m4_dnl These warnings apply to the file generated from this file.
m4_dnl Of course, you may freely edit this file.
// This file was AUTOMATICALLY GENERATED from "m4___file__"
//  Do NOT include directly!
//  Do NOT edit!

m4_dnl
m4_dnl First we define a simple 'cv_qual' macro which takes a number, either
m4_dnl   0, 1, 2, or 3, and determines cv-qualification.
m4_dnl
m4_define(`cv_qual',
`m4_ifelse($1, 0, `',
`m4_ifelse($1, 1, `const ',
`m4_ifelse($1, 2, `volatile ',
`m4_ifelse($1, 3, `const volatile ',
`m4_errprint(m4___file__:m4___line__: `Boost m4 script: cv-determiner: Not 0, 1, 2, or 3 (was '$1`)')'
)')')')')m4_dnl
m4_dnl
m4_dnl Next we go through the actual loop.  For each number of arguments from
m4_dnl   1 to NumberOfArguments, we create a template function that takes that
m4_dnl   many template arguments, and also generate all cv-qualified permutations
m4_dnl   of that function.
m4_dnl
BOOST_M4_FOR(N, 1, NumberOfArguments + 1,
`BOOST_M4_FOR(cv, 0, m4_eval(4 ** N),
  `template <BOOST_M4_FOR(i, 0, N, `typename T`'i', `, ')>
element_type * construct(BOOST_M4_FOR(i, 0, N,
    `cv_qual(m4_eval((cv >> (i * 2)) % 4))T`'i & a`'i', `, '))
{
  element_type * const ret = (malloc)();
  if (ret == 0)
    return ret;
  try { new (ret) element_type(BOOST_M4_FOR(i, 0, N, `a`'i', `, ')); }
  catch (...) { (free)(ret); throw; }
  return ret;
}
')')

Now I get error messages like
    'boost::object_pool<T>::construct' : function does not take 3 arguments
    'boost::object_pool<T>::construct' : function does not take 1 arguments
    'boost::object_pool<T>::construct' : function does not take 13 arguments

The funny thing is that even reverting the changes in detail/pool_construct.m4 did not fix it and now  even with the original file I am unable to pass any number of arguments to boost::object_pool::construct. I am using Visual C++ 2010 express. Any help will be appreciated.
Thanks


text:
Q: Compact open topology
*

*Let $X$, $Y$ be topological spaces.  If $K$ is a compact subspace of $X$ and $U$ is an open subset of $Y$, define $[K,U]=\{f\mid f\in C(X,Y) \text{ and } f(K)\subset U\}$. The sets $[K,U]$ form a subbasis for a topology on $C(X,Y)$ that is called the compact open topology.

*A subbasis $S$ for a topology on $X$ is a collection of subsets of $X$ whose union equals $X$. The topology generated by the subbasis $S$ is defined to be the collection $T$ of all unions of finite intersections of elements of $S$.
So why the union of $[K,U]$s equals $C(X,Y)$?

A: Take $K = \emptyset, U = Y$. Then $[K, U] = C(X,Y)$.

A: There are two possible definitions of a subbasis: see Subbase in Wikipedia for a full discussion. The most frequently used definition does not require that the subbasis covers $X$. The trick is that finite intersection includes intersection indexed by the empty set, which by convention gives $X$.