text:
Q: How to get the id of a clone element I have cloned a element and changed their id but unable to fetch the id's of the clone element in the Jquery Can anyone please help??
The Html View source code is as follows

                        UserName
                        Password
                        Service line
                        Track
                        subtrack

                        <input data-val="true" data-val-required="The Username field is required." id="z0__UserName" name="[0].UserName" type="text" value="Required">
                        <input data-val="true" data-val-required="The Password field is required." id="z0__Password" name="[0].Password" type="text" value="Required">

                            <select class="wrapper-dropdown Service_Line" id="z0__Service_Line" name="[0].Service_Line">
                                <option value="">--Select--</option>
                                <option value="A">A</option>
                                <option value="B">B</option>
                                <option value="C">C</option>
                            </select>

                            <select class="wrapper-dropdown Track" id="z0__Track" name="[0].Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                            <select class="wrapper-dropdown Sub_Track" id="z0__Sub_Track" name="[0].Sub_Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                        <input data-val="true" data-val-required="The Username field is required." id="z0__UserName" name="[1].UserName" type="text" value="Required" class="[1].UserName">
                        <input data-val="true" data-val-required="The Password field is required." id="z0__Password" name="[1].Password" type="text" value="Required" class="[1].Password">

                            <select class="[1].Service_Line" id="z0__Service_Line" name="[1].Service_Line">
                                <option value="">--Select--</option>
                                <option value="A">A</option>
                                <option value="B">B</option>
                                <option value="C">C</option>
                            </select>

                            <select class="[1].Track" id="z0__Track" name="[1].Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                            <select class="[1].Sub_Track" id="z0__Sub_Track" name="[1].Sub_Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                        <input data-val="true" data-val-required="The Username field is required." id="z0__UserName" name="[1].UserName" type="text" value="Required" class="[1].UserName">
                        <input data-val="true" data-val-required="The Password field is required." id="z0__Password" name="[1].Password" type="text" value="Required" class="[1].Password">

                            <select class="[1].Service_Line" id="z0__Service_Line" name="[1].Service_Line">
                                <option value="">--Select--</option>
                                <option value="A">A</option>
                                <option value="B">B</option>
                                <option value="C">C</option>
                            </select>

                            <select class="[1].Track" id="z0__Track" name="[1].Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                            <select class="[1].Sub_Track" id="z0__Sub_Track" name="[1].Sub_Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                        <input data-val="true" data-val-required="The Username field is required." id="z0__UserName" name="[1].UserName" type="text" value="Required" class="[1].UserName">
                        <input data-val="true" data-val-required="The Password field is required." id="z0__Password" name="[1].Password" type="text" value="Required" class="[1].Password">

                            <select class="[1].Service_Line" id="z0__Service_Line" name="[1].Service_Line">
                                <option value="">--Select--</option>
                                <option value="A">A</option>
                                <option value="B">B</option>
                                <option value="C">C</option>
                            </select>

                            <select class="[1].Track" id="z0__Track" name="[1].Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                            <select class="[1].Sub_Track" id="z0__Sub_Track" name="[1].Sub_Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                        <input data-val="true" data-val-required="The Username field is required." id="z0__UserName" name="[1].UserName" type="text" value="Required" class="[1].UserName">
                        <input data-val="true" data-val-required="The Password field is required." id="z0__Password" name="[1].Password" type="text" value="Required" class="[1].Password">

                            <select class="[1].Service_Line" id="z0__Service_Line" name="[1].Service_Line">
                                <option value="">--Select--</option>
                                <option value="A">A</option>
                                <option value="B">B</option>
                                <option value="C">C</option>
                            </select>

                            <select class="[1].Track" id="z0__Track" name="[1].Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                            <select class="[1].Sub_Track" id="z0__Sub_Track" name="[1].Sub_Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                        <input data-val="true" data-val-required="The Username field is required." id="z0__UserName" name="[1].UserName" type="text" value="Required" class="[1].UserName">
                        <input data-val="true" data-val-required="The Password field is required." id="z0__Password" name="[1].Password" type="text" value="Required" class="[1].Password">

                            <select class="[1].Service_Line" id="z0__Service_Line" name="[1].Service_Line">
                                <option value="">--Select--</option>
                                <option value="A">A</option>
                                <option value="B">B</option>
                                <option value="C">C</option>
                            </select>

                            <select class="[1].Track" id="z0__Track" name="[1].Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

                            <select class="[1].Sub_Track" id="z0__Sub_Track" name="[1].Sub_Track">
                                <option value="">--Select--</option>
                                <option> </option>
                            </select>

In the above code i have cloned the rows by incrementing their id's
using jquery code below
 $(document).ready(function () {
            /* 1. Initialise our variable to keep count of the rows added */
            var rowcount = 1;

            //Add new row
            $("#addNew").click(function (e) {
                e.preventDefault();
                var $tableBody = $("#dataTable");
                var $trLast = $tableBody.find("tr:last");

                // 2. Create the new id with the row count
                //var newId = "TemplateRow-" + rowcount;

                // 3. clone the row with our new id
                var $trNew = $trLast.clone(true);

                // 4. rename each input and give an id
                $.each($trNew.find(':input'), function (i, val) {

                    oldName = $(this).attr('name');
                    inputParts = oldName.split(".");

                    // set the  name and id with the base name and rowcount
                    $(this).attr('name', '[' + rowcount + '].' + inputParts[1]);
                    $(this).attr('class', '[' + rowcount + '].' + inputParts[1]);

                    $(this).removeClass("input-validation-error");
                });

                $trLast.after($trNew);
                $("#[" + rowcount + "].Service_Line").change(function () {
                    debugger;
                    $.get("/Users/GetTrackList", { Service_Line_ID: $("#[" + rowcount + "].Service_Line").val() }, function (data) {
                        $("#[" + rowcount + "].Track").empty();
                        $.each(data, function (index, row) {
                            $("#[" + rowcount + "].Track").append("<option value='" + row.Track_ID + "'>" + row.Track_Options + "</option>")
                        });
                    });
                })
                rowcount++;
            });
        });

But here in this line $("#[" + rowcount + "].Service_Line").change(function () { I'm unable to fetch the id of the cloned rows from the webpage Can anyone please help me? Thanks in advance
The service_line id of the rows when cloned goes on increasing as [1].service_line, [2].service_line , [3].service_line, [4].service_line, so on......... i need to fetch this id's using jquery here in this function
 $("#[" + rowcount + "].Service_Line").change(function () {
                    debugger;
                    $.get("/Users/GetTrackList", { Service_Line_ID: $("#[" + rowcount + "].Service_Line").val() }, function (data) {
                        $("#[" + rowcount + "].Track").empty();
                        $.each(data, function (index, row) {
                            $("#[" + rowcount + "].Track").append("<option value='" + row.Track_ID + "'>" + row.Track_Options + "</option>")
                        });
                    });
                })

A: You aren't setting the id like you think you are, you're setting the className and name attributes, so $("#[" + rowcount + "].Service_Line") is not going to return anything:
Your Script:
   // set the  name and id with the base name and rowcount
   $(this).attr('name', '[' + rowcount + '].' + inputParts[1]);
   $(this).attr('class', '[' + rowcount + '].' + inputParts[1]);

You can select the element by name attribute like so:
 $("select[name='[" + rowcount + "].Service_Line']").change(function() {); //etc.

A:  $("select[name='[" + rowcount + "].Service_Line']").change(function () {
            //get the row count of this row using the keyword this, to
            //get the select which fired the event, then use regex
            //to capture the number from the name attribute:
            const thisrow = $(this).attr('name').match(/\[(\d+)\]/)[1];

            $.get("/Users/GetTrackList", { Service_Line_ID: $("select[name='[" + thisrow + "].Service_Line']").val() }, function (data) {
                $("select[name='[" + thisrow + "].Track']").empty();
                $.each(data, function (index, row) {
                    $("select[name='[" + thisrow + "].Track']").append("<option value='" + row.Track_ID + "'>" + row.Track_Options + "</option>")
                });
                debugger;
            });
        })


text:
Q: Multithreaded downloader slows down for no reason I've been working on an multithreaded image scraper in Python using requests and multiprocessing.dummy.
The script runs fine until it reaches a certain point. Then the whole workflow gets really slow. Also it seems like the more threads I'll use the earlier I experience this.
The download part looks like:
def download(URL):
    try:
        URL = URL.rstrip()
        down = requests.get(URL, headers={'x-test2': 'true'})
        # Download Images

    except BaseException as e:
        print("Error")

The threading part looks like:
if __name__ == '__main__':
    ThreadPool(20).map(download, URLlist)

So my question is what is slowing down my whole download process since the urls are fine and it should continue just like it did before. Is there any command I'm missing or is it something with my threading part? (threads aren't closed correctly...)
Also important is that this problem doesn't appear with a smaller url list.
( But It shouldn't be an request limit problem with the page I download from because meanwhile the script is running and after I expierence 0 problems in terms of page speed & availability ). Why is that?

A: If pool operations slow down over a period of time, closing the pool every so often might (or might not) help.  Try something simple like this...
if __name__ == '__main__':
    max_size = # use some large value here
    for i in range(0, len(URLlist), max_size):
        st = time.time()
        pool = ThreadPool(20)
        pool.map(download, URLlist[i: i + max_size])
        pool.close()    # should not be needed in practice
        pool.join()
        et = time.time()
        print('Processing took %.3f seconds' % (et-st))

Try some different, but large values for max_size.  This is the number elements from the URLlist that your code will process before closing down the pool and opening another one.
As I said in my comment, I'm aware of this issue for multiprocessing.Pool() but I'm not certain that ThreadPool() has the same issue.  For mp.Pool(), this only happens with extremely large lists of items to process.  When this happens you typically see memory usage continually increase as the program runs (so look for this).  I believe the underlying issue is that pool workers get created over and over but not correctly garbage-collected until you close the pool.
One other thing to consider...  It may be possible that some URLs take a long time to process and after your code runs for a while, many of your threads may be bogged down with the slower URLs making things appear to slow down overall.  If that's the case, closing the pool occasionally won't help.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Launcher app not in chooser I'm in the process of making a Launcher app, but I can't get my app to show up in the activity chooser when the home button is pressed. I'm sure I'm just missing something simple, but I can't find it! Here's my manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.espian.jump"
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="17" />
<application
    android:label="@string/app_name"
    android:icon="@drawable/ic_launcher">
    <activity
        android:name="JumpActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Holo.NoActionBar"
        android:launchMode="singleTask"
        android:clearTaskOnLaunch="true"
        android:stateNotNeeded="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

A: Try replacing that
<category android:name="android.intent.category.LAUNCHER"/>

with
<category android:name="android.intent.category.DEFAULT"/>

As it says in the android intent filter documentation:

activities that are willing to receive implicit intents must include
  "android.intent.category.DEFAULT" in their intent filters

Actually I'd suggest opening that page and searching for that text, and having a little read around it. I think you'll find these categories make a lot more sense if you do. You're specifying that this appears in the launcher instead.


text:
Q: Cast increment and assign in C How can I achieve the following? De-reference and assign a value to a pointer and increment the pointer by (uint64_t) bytes in one line.
// random address 0xDEADBEEF
unsigned int *myvalue = 0xDEADBEEF;
*((uint64_t*) myvalue)++ = 34;

An error is produced due to the casting if i remove the casting then it "works" but not with the results which I want.
unsigned int *myvalue = 0xDEADBEEF;
*(myvalue)++ = 34;

What I expect by the statement of :
// myvalue points to 0xDEADBEEF
*((uint64_t*) myvalue)++ = 34;
 //myvalue points to 0xDEADBEEF + (64/8)
 // at 0xDEADBEEF (a random address) should contain 34

A:
[How can I] De-reference and assign a value to a pointer and increment the pointer by (uint64_t) bytes in one line[?]

You are trying to do too many things with a single expression.  You should break it up.  Moreover, "one line" is more or less arbitrary.  I could take your one-liner and spread it out over 12 non-empty lines, and I can take many lines and join them together.  The closest actually meaningful thing would be one full expression.
Nevertheless, if you insist on doing it in one full expression, and you're willing to assume that the size of an int evenly divides the size of a uint64_t, then you might do it like so:
unsigned int *myvalue = 0xDEADBEEF;
*myvalue = 34, myvalue += (sizeof(uint64_t) / sizeof(int));

Of course, that's mostly sophistry around the meaning of a "full expression" -- it would be much better style to use a semicolon instead of a comma operator, but then there would be two full expressions.  But that's the ground on which you chose to pitch your tent.
Alternatively, if you're open to changing the type of myvalue, then it would be a bit cleaner to do it like this:
uint64_t *myvalue = 0xDEADBEEF;
* (int *) (myvalue++) = 34;

Overall, however, although C permits casting from one object pointer type to another, it makes few promises about how the converted result can safely be used.  Furthermore, such casts violate the strict aliasing rule, which may contribute to an optimizing compiler producing an incorrect and hard-to-debug program.

A: So the subject of an increment operator needs to be a modifiable lvalue.
Your expression ceases to be an lvalue when you cast it.
Now, you can increment the result of the dereference with something like
*(*x)++ ... for example, this is conforming...
int f(int **x)
{
  return *(*x)++;
}

A: You could write *(*(uint64_t**) &myvalue)++ = 34;, but why would you do that?

Above line works because casting yields a rvalue, i.e. can only be on the right of an assignment (the assignment here is the ++), and dereference yields a lvalue (which can be on the left).
Also, as noted by others, dereferencing your casted pointer is undefined behavior.

A: Casting an unsigned int* to a uint64_t* and then dereferencing the uint64_t* is wrong by itself.
Disregarding that fact for a moment...
Due to operator precedence,
*((uint64_t*) myvalue)++ = 34;

is equivalent to:
*(((uint64_t*) myvalue)++) = 34;

i.e. it increments the pointer first before dereferencing it.
When you use a cast, you get an rvalue. You cannot increment or decrement an rvalue.
Also, it's not clear why you want to increment the temporary pointer obtained from the cast in the first place. Unless you have a variable that you want to use afterward, it is pointless to increment or decrement a pointer.


text:
Q: Ionic 5 Capacitor FileTransfer I'm running in the browser an ionic 5 APP using capacitor and I'm trying to use the file transfer functionality. I follow the documentation https://ionicframework.com/docs/native/file-transfer and configure my app using capacitor. Thus running:
npm install cordova-plugin-file-transfer
npm install @ionic-native/file-transfer
ionic cap sync

In my app.module, I registered the providers:
import { FileTransfer } from '@ionic-native/file-transfer/ngx';
import { File } from '@ionic-native/file/ngx';

...
providers: [
        StatusBar,
        SplashScreen,
        ...
        FileTransfer,
        File
    ],

Note that I also installed the native file package, so in total I have the following 4 new packages:
"@ionic-native/file": "^5.27.0",
"@ionic-native/file-transfer": "^5.27.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-transfer": "^1.7.1",

My code in the component is:
import { Input, Component } from '@angular/core';
import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer/ngx';
import { File } from '@ionic-native/file/ngx';

@Component({
    selector: 'app-order-detail-order-card',
    templateUrl: './order-detail-order-card.page.html'
})
export class OrderDetailOrderCardPage {
    @Input() pdfUrl: string;
    @Input() orderCardId: string;

    constructor(private transfer: FileTransfer, private file: File) { }

    public downloadFile(): void {
        const fileTransfer: FileTransferObject = this.transfer.create();
        fileTransfer.download(this.pdfUrl, this.file.applicationDirectory + `${orderCardId}.pdf`).then((entry) => {
          console.log('download complete: ' + entry.toURL());
        }, (error) => {
          // handle error
        });
    }
}

When I run the app in the browser, I get the following warning and I'm not sure whether the file should donwload somewhere?
common.js:284 Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

Even if I don't get the file, I would be expecting to see the "download complete" message. It's not very clear to me as to whether I have to configure something else in my app to be able to run it locally or I have to use this functionality ONLY in either the emulator or the device itself.
What else needs to be configured to get this to work?

A: common.js:284 Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

this means that you are using the browser emulator which doesn't have any splashscreen, you can totally ignore that warning ( you won't get it using a simulator or a real device).
You should paste the html section of that page too, because probably the download doesn't start because an incomplete url and it doesn't proceed with the "then()"
maybe i'm wrong, but it can be possible.


text:
Q: Build a jquery custom calender with events i need some hints to build an calendar. Is there a good solution for a calender, that get the Data from an Xml-file and show the Events only in the Year view??
Some like that?
http://imagizer.imageshack.us/a/img849/5237/p6jr.jpg

A: I am using the following Bootstrap Calender in some projects. The code is well structured and quite easy to comprehend and use:
Bootstrap Calendar


text:
Q: В чём ошибка при удалении блока в JS? Есть скрипт добавления блоков на страницу https://jsfiddle.net/7su5s63d/
// Добавлене блоков
var div = '';
var next_id = 3;
add_block.onclick = function() {
    next_id++;
    var div = document.createElement('div');
    div.id = 's'+next_id;
    div.className = 'text block';
    var template = '
<input type="text" class="form-control form-about w100" placeholder="Введите имя поля">
удалить';
    div.innerHTML = template;
    main.appendChild(div);

    // Удаление блоков
    document.getElementById(div.id).addEventListener('click', function(e) {
        this.remove();
    });
};

Проблема в том, что в добавляемом блоке есть input и по задумке удаляться блок должен только когда в нём будет нажат span со словом удалить, но удаляется блок даже если просто на input нажать. Т.е. ввести в input ничего нельзя, он сразу удаляется.

A: Нужно событие click вешать конкретно на span, а вы искали елемент по ид div.id тоесть это всетаки див, вот он при любом клике и удалялся

// Добавлене блоков
var div = '';
var next_id = 3;
add_block.onclick = function() {
  next_id++;
  var div = document.createElement('div');
  div.id = 's' + next_id;
  div.className = 'text block';
  var template = '
<input type="text" class="form-control form-about w100" placeholder="Ваше имя">
удалить';
  div.innerHTML = template;
  main.appendChild(div);

  document.getElementById('del' + next_id).addEventListener('click', function(e) {
    div.remove();
  });
};

  + добавить блок

one

two

three

A:

    // Добавлене блоков
var div = '';
var next_id = 3;
add_block.onclick = function() {
    next_id++;
    var div = document.createElement('div');
    div.id = 's'+next_id;
    div.className = 'text block';
    var template = '
<input type="text" class="form-control form-about w100" placeholder="Ваше имя">удалить
';
    div.innerHTML = template;
    main.appendChild(div);
    // Удаление блоков
    document.getElementById('del'+next_id).addEventListener('click', function(e) {
        this.parentNode.remove();
    });
};

  + добавить блок

one

two

three


text:
Q: Namespace breaking call to Composer imported classes I'm currently trying to autoload some classes that I created via Composer into some older code I had.
My current folder structure is very simple, just the following:
/src

*

*Searcher.php

*Authenticator.php
composer.json
index.php
I have more files, but these are the ones that matter. Then I added the following to both my classes:
namespace ApiReddit;

And my composer.json is the following:
{
    "require": {
            "guzzlehttp/guzzle": "^6.2",
            "adoy/oauth2": "^1.3",
            "twig/twig": "^1.30"
    },
    "autoload": {
      "psr-4": {"ApiReddit\\": "src/"}
    }

The problem is that now my Searcher.php file that was formerly working has some problems. In the execution of the code I had the following call:
$client = new GuzzleHttp\Client([
       'headers' => ['User-Agent' => 'testing/1.0'],
       'verify' => false]);
}

That now generates the following error:
Fatal error: Class 'ApiReddit\GuzzleHttp\Client' not found in
This means that the using of the new namespace is breaking the calls I had to other composer loaded packages. Any idea on how can I solve this?

A: You can do one of two things:
Either be explicit in importing the class in your Searcher file
use GuzzleHttp\Client;

class Searcher {

...

}

or escape the class when calling directly:
$client = new \GuzzleHttp\Client([
       'headers' => ['User-Agent' => 'testing/1.0'],
       'verify' => false]);
}

A: Looks like the problem is that you are using relative namespace. Try changing: new GuzzleHttp\Client to new \GuzzleHttp\Client. The problem should be solved.


text:
Q: Android: boolean value not changing? In my program, a boolean value (called metronomeOn) is supposed to be set to true at the click of one button, and false at the click of a different button. The only class I have (MainActivity) implements Runnable. So after the thread gets started, in the run method, depending on the value of metronomeOn, it's supposed to execute a block of code. My problem is that after the onClick method from the button that is supposed to set metronomeOn to true, metronomeOn's value isn't changed.
ButtonListeners (The method is called in onCreate):
public void ButtonListeners() {
    bStart.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            metronomeOn = true;
        }
    });

    bStop.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            currentBeatIndex = 1;
            tvCurrentBeatIndex.setText("");
            metronomeOn = false;
        }
    });
}

The run method:
if (metronomeOn) {
        tvBpm.setText("IN IF STATEMENT");
        //other code...
    }

I have absolutely no idea why metronomeOn isn't switching values. I know that the run method gets executed, and metronomeOn is only ever changed in onCreate and onDestroy. Any ideas why this isn't working? Thanks in advance!!
EDIT****************************
I've gotten rid of the run method and the implementation of the Runnable class, so there is no problem there, yet metronomeOn still always returns false.
EDIT AGAIN************************
I have no idea why or how, but after deleting the Runnable stuff and restarting Eclipse, it now works. MetronomeOn changes value! Thank you to everyone who gave advice!

A: Multiple possible reasons:

*

*is metronomeOn volatile? If a variable is used across threads, you should mark it.

*does your run method check metronomeOn multiple times? As from the code you posted, it is only checked one time

*is you run method executed as you think it is? As if it does and metronomeOn is set, your Activity will crash, as you are only allowed to access the GUI from the UI thread. Just making an class implement Runnable does not cause a thread to spawn. And you can call the run method directly without a thread.

From the little parts we get to see of your Application, I think you probably want to use Services instead of Threads/Runnables? Services can get started and stopped, run independently of the Activity and may also spawn threads.
As you cannot access the activity from a service, you may do your debug output with the Android logging methods in the Log class.

A: Can't figure out the exact problm, but do try it the other way round. Name them method1 and method2, and use as--
public void method1(View v) {
 \\code for button1
}

public void method2(View v) {
\\code for button2
}

And use in xml for respective buttons:
android:onClick="method1"
android:onClick="method2"


text:
Q: NGINX doesn't load css files (wordpress implementation) I am currently trying to implement a wordpress on a sub-domain using nginx.
I've installed all the dependencies (php 7.2, mariadb, mysql) and configured it all.
When I try to access to the website, here is what I got :

To be more explicit: here's what I did to configure nginx in order to use wordpress:

sudo nano /etc/nginx/conf.d/location.conf

server{
   server_name subdomain.domain.fr;
   root /home/domain/wordpress/;
   location / {
      fastcgi_pass unix:/run/php/php7.2-fpm.sock;
      include fastcgi_params;
      index index.php index.html index.htm;
      try_files $uri $uri/ =404;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param SCRIPT_NAME $fastcgi_script_name;
   }
}

My problem is that when I first use a wordpress website, I'm used to see some CSS on the page. When I inspect this page, I can see that the css files are included, but not used. I dont understand why. I think I have a privilege issue or anything else, but it's my first time using nginx with wordpress so I must have done something wrong:

Thanks for your help

A: I've found a solution that works perfectly:
adding this solved all my problems :
location ~* \.(?:css|js|map|jpe?g|gif|png)$ { }

Thanks for your help


text:
Q: How do I use wget to download images from a list without creating duplicates? I have a list that has urls such as:
http://imgur.com/img1.jpg
http://imgur.com/img2.jpg

(It updates every now and then.)
I currently use wget:
wget -i imglist -P c:/filename/

But if I run it once again, it duplicates the images: if there's already image1.jpg, it names it image1.jpg.1. How can I avoid that?

A: You could compare both files & keep only the newest among both using -N flag
      wget -N -i imglist -P c:/filename/

Here are some use cases for wget:
http://www.editcorp.com/personal/lars_appel/wget/v1/wget_7.html


text:
Q: Android Navigation Drawer on multiple Activities Is there a way to configure only one time the Navigation Drawer, and the display it on multiple Activites?

A: For people wanting an code example with Activities, take a look at my answer over here: https://stackoverflow.com/a/19451842/2767703
If you want a nice transition I would suggest this: When you click on an item in the NavigationDrawer close the navigation drawer and simultaneously use postdelayed with 250 (time it takes to close the NavigationDrawer). Also simultaneously animate the main content's alpha to 0 with 150 milliseconds. Then when an Activity starts animate the main content's alpha to 1 with 250 milliseconds. This gives a great transition. I found it in the Google IO code: https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/BaseActivity.java
By the way, you should also look at the link @Harish Godara gave: http://www.michenux.net/android-navigation-drawer-748.html It works with Fragments but it has a nice way of implementing the NavigationDrawer.
Edit
Since some links are dead here is what I used in my last project to get the animation. It is in Kotlin, but it should make the point clear. This is all code from the BaseDrawerActivity:
private val NAVDRAWER_LAUNCH_DELAY = 250L
private val MAIN_CONTENT_FADEOUT_DURATION = 150L
private val MAIN_CONTENT_FADEIN_DURATION = 250L

-
private var shouldAnimate:Boolean
    set(value) { intent.putExtra("animateTransition", value) }
    get() = intent.getBooleanExtra("animateTransition", false)

-
private fun changeDrawerItem(newClass: Class<*>) {
    runDelayed(NAVDRAWER_LAUNCH_DELAY, {
        startActivity(Intent(this, newClass).apply {
            addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
            putExtra("animateTransition", true)
            putExtra("selectedNav", selectedNavigationItem.name)
        })
        overridePendingTransition(0, 0)
    })

    mainContent.animate()?.alpha(0f)?.duration = MAIN_CONTENT_FADEOUT_DURATION
}

-
override fun onStart() {
    super.onStart()

    if(shouldAnimate) {
        mainContent.alpha = 0f
        mainContent.animate()?.alpha(1f)?.duration = MAIN_CONTENT_FADEIN_DURATION
    } else {
        mainContent.alpha = 1f
    }

    val selectedNav = intent.getStringExtra("selectedNav")
    if(selectedNav != null) {
        selectedNavigationItem = DrawerItem.valueOf(selectedNav)
    }
}

-
override fun onNewIntent(intent: Intent) {
    super.onNewIntent(intent)
    setIntent(intent)

    if(shouldAnimate) {
        overridePendingTransition(0, 0)
    }
}

-
override fun onResume() {
    super.onResume()
    intent.removeExtra("animateTransition")
}

A: For this just create a BaseActivity class that implements the drawer,
and let all your other activities extend this one.


text:
Q: Using Entity Framework 4.3 migrations without a dependency on an actual database The EF migrations seem cool but there is too much "magic" going on and very few explanations as to what it's actually doing.  All I want to do is set migration points and get DDL scripts -- either a "diff" script from one migration to another or the entire create DDL script.
The problem is that all the migration commands seem dependent on an actual database being present to perform a bunch of stuff I'm not interested in. Is there a way to bypass all that and just work with migrations to generate scripts?

A: This was discussed yesterday. Migrations commands are dependent on your working database because they interact with __MigrationHistory table to get actual state and to correctly compute what changes have to be done.
If you just need to create scripts you can do that by using Update-Database with additional parameters:
Create script for whole database:
Update-Database -Script -SourceMigration:$InitialDatabase

Create script for upgrading from migration A to migration B:
Update-Database -Script -SourceMigration:"A" -TargetMigration:"B"


text:
Q: How to update a list in initState() flutter after the api call? So I have a Stateful Widget which has a List variable I want to update from the API call. My issue is that the List is empty even after I do the fetchItems() in the initState().
How can I then update the itemsList with the content of the fetchItems function?
Isnt the function suppose to update itemsList if I use setState().
class _ItemsWidgetState extends State<ItemsWidget> {

  List<ItemsModel> itemsList = [];
  void initState(){
    fetchItems();
  }

  fetchItems() async {
    final response = await http.get(url);

    if (response.statusCode == 200) {
        final fetchedItems = json.decode(response.body);
        for (var item in fetchedItems) {
            ItemsModel item = ItemsModel.fromJson(item);
            setState(() {
                itemsList.add(item);
            });
      }
    } else {
         throw Exception('Failed to load items');
    }
}

A: *

*Avoid calling setState inside loops, call it after your task has done.

*Always call super.initState and mark initState as overrided

class _ItemsWidgetState extends State<ItemsWidget> {

  List<ItemsModel> itemsList = [];

  @override
  void initState(){
    super.initState();

    fetchItems();
  }

  fetchItems() async {
    final response = await http.get(url);

    if (response.statusCode == 200) {
      final fetchedItems = json.decode(response.body);

      for (var item in fetchedItems) {
          ItemsModel item = ItemsModel.fromJson(item);

          /// Remove from setState
          itemsList.add(item);
      }

      /// Tells to Flutter that now something has changed
      setState(() {});
    } else {
         throw Exception('Failed to load items');
    }
}

A: First check fetchedItems is a list type.
   class _ItemsWidgetState extends State<ItemsWidget> {

      List<ItemsModel> itemsList = [];
      void initState(){
        fetchItems();
      }

      fetchItems() async {
        final response = await http.get(Uri.parse(url));

        if (response.statusCode == 200) {
            final fetchedItems = jsonDecode(response.body);
            for (var item in fetchedItems) {
                ItemsModel item = ItemsModel.fromJson(item);
                setState(() {
                    itemsList.add(item);
                });
          }
        } else {
             throw Exception('Failed to load items');
        }
    }


text:
Q: C# iterate through the groupbox themselves Iv been looking around and i havnt really found anything of meaning.
what i am trying to do, is change between groupboxes at the click of a button.
what i have is a windows form with 32 groupbox containers and there are 12 textboxes in each, some of the textboxes will receive a number the rest will remain empty; now where the following code works and i could copy and paste it 31 more times:
foreach (TextBox x in GROUPBOX1.Controls.OfType<TextBox>())
        {
            int A1 = 0;
            int.TryParse(x.Text, out A1);
            TOTAL += A1;   //defined outside of the method
        }

Where it checks all the textboxes in GROUPBOX1 and adds all the ones with values in together and ignores the empty textboxes.
what i would like to do, at the click of a button, is to increment int GP =1 by +1 and thus move to the next groupbox and its set of textboxes so that i can reuse the code in the foreach loop, to look something like this:
foreach (TextBox x in GROUPBOX+GP+.Controls.OfType<TextBox>())
        {
            int A1 = 0;
            int.TryParse(x.Text, out A1);
            TOTAL += A1;   //defined outside of the method
        }

where +GP+ would represent the int GP =1 and its subsequent increments.
now i got the idea from:
this.Controls["GROUPBOX"+box_number].Controls["LABEL"+label_prefix+"_"+label_number+"_LBL"].Text = valueToDisplayInLabel.ToString();
which (with the appropriate assigned int) assigns values to certain labels in different groupboxes.
can this be done this way? all the groupboxes and textboxes have already been created.
what i am trying to accomplish is, the text boxes that receive a number will all be added together and that value will then be stored in a database as well as added to all the other "totals" and too stored in a database.
 foreach(GroupBox gb in Controls.OfType<GroupBox>())
    {
        foreach(TextBox tb in gb.Controls.OfType<TextBox>())
        {
            int A1 = 0;
            int.TryParse(tb.Text, out A1);
            TOTAL += A1;   //defined outside of the method
        }
    }

this works great and all, but it doesnt allow me to get the totals of the combined text boxes per group box, like i want to store each groupbox total individually and add them together at a later stage, where as this takes ALL the textboxes that are in group boxes and dumps them in a list, iv added List<int> TOTAL = new List<int>(); and TOTAL.Insert(0, A1); to try and make this work for me, but now its dumping all the textbox values into the list.
essentially im looking for int GB1TOT, GB2TOT etc etc then int TOTAL = GB1TOT + GB2TOT

A: Use two loops?
        foreach(GroupBox gb in Controls.OfType<GroupBox>())
        {
            foreach(TextBox tb in gb.Controls.OfType<TextBox>())
            {
                int A1 = 0;
                int.TryParse(tb.Text, out A1);
                TOTAL += A1;   //defined outside of the method
            }
        }

A: Is this what you want? Store the total per GroupBox into List GBtotal. Then you can get the total by summing them.
int Total;
List<int> GBTotal = new List<int>()
foreach(GroupBox gb in Controls.OfType<GroupBox>())
{
    int temp = 0;
    foreach(TextBox tb in gb.Controls.OfType<TextBox>())
    {
        int A1 = 0;
        if(int.TryParse(tb.Text, out A1))
        {
           temp += A1;
        }
    }
    GBTotal.Add(temp);
}
Total = GBTotal.Sum();

You technically can use
Total = GBTotal[0] + GBTotal[1] + ....

Or use loop to get the total


text:
Q: 20.04 can't connect to 5Ghz wifi after update About 2 days ago I did a fresh install of Ubuntu 20.04 and everything was working great. This morning I ran apt update and apt upgrade and rebooted and now my wifi won't connect to my 5Ghz network. It will connect to my 2.4Ghz network.
This is on a Lenovo ThinkPad T410.
$ nmcli device
DEVICE   TYPE      STATE         CONNECTION
enp0s25  ethernet  connected     Wired connection 1
wlp3s0   wifi      disconnected  --

info from lspci:
$ lspci -nnk | grep -iA2 net
00:19.0 Ethernet controller [0200]: Intel Corporation 82577LM Gigabit Network Connection [8086:10ea] (rev 06)
    Subsystem: Lenovo 82577LM Gigabit Network Connection [17aa:2153]
    Kernel driver in use: e1000e
    Kernel modules: e1000e
--
03:00.0 Network controller [0280]: Intel Corporation Centrino Advanced-N 6200 [8086:4239] (rev 35)
    Subsystem: Intel Corporation Centrino Advanced-N 6200 2x2 AGN [8086:1311]
    Kernel driver in use: iwlwifi

results of sudo lshw -class network:
  *-network
       description: Wireless interface
       product: Centrino Advanced-N 6200
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: wlp3s0
       version: 35
       serial: 58:94:6b:d9:ac:cc
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=5.8.0-36-generic firmware=9.221.4.1 build 25532 6000-4.uc latency=0 link=no multicast=yes wireless=IEEE 802.11
       resources: irq:31 memory:f2400000-f2401fff

results of lspci:
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6200 (rev 35)

results of rfkill:
1: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no

dmesg output:
[ 2287.166207] perf: interrupt took too long (7719 > 7717), lowering kernel.perf_event_max_sample_rate to 25750
[ 3057.673757] wlp3s0: authenticate with d8:07:b6:b0:ac:be
[ 3057.676517] wlp3s0: send auth to d8:07:b6:b0:ac:be (try 1/3)
[ 3057.751437] wlp3s0: authenticated
[ 3057.753283] wlp3s0: associate with d8:07:b6:b0:ac:be (try 1/3)
[ 3057.754414] wlp3s0: RX AssocResp from d8:07:b6:b0:ac:be (capab=0x11 status=0 aid=7)
[ 3057.757489] wlp3s0: associated
[ 3057.853016] wlp3s0: Limiting TX power to 30 (30 - 0) dBm as advertised by d8:07:b6:b0:ac:be
[ 3102.648706] wlp3s0: deauthenticating from d8:07:b6:b0:ac:be by local choice (Reason: 3=DEAUTH_LEAVING)

result of dmesg | grep -i firmware:
iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-6000-6.ucode failed with error -2

when I try to connect to the 5Ghz it takes a long time, then the error message shows up:
Activation of network connection failed.
Any suggestions?

A: I fixed it.  I went into my routers wifi setup and changed the security to wpa2/wpa3-personal


text:
Q: Cloud Foundry cli commands failing "Error performing request: lame referral" I have single VM cloud foundry setup on azure machine(4cores, 28GB RAM).
Initially the cf cli commands work fine. I am able to login(cf login) to cf and push(cf push) applications and see the hosted apps(cf apps) too.
azure-user@dsapi-boshvm:~$ cf apps

Getting apps in org default_organization / space azure as admin...

OK

name    requested state   instances   memory   disk   urls
myapp   started           3/3         128M     256M   myapp.example.com

After sometime the same command fails
azure-user@dsapi-boshvm:~$ cf apps
Getting apps in org default_organization / space azure as admin...

FAILED

Error performing request: Get https://api.xxx.xxx.xxx.xxx.xip.io/v2/spaces/80d34326-cffc-4b62-98b6-ddd1c087ca59/summary: dial tcp: lookup api.xxx.xxx.xxx.xxx.xip.io on xxx.xxx.xxx.xxx:xx: lame referral

TIP: If you are behind a firewall and require an HTTP proxy, verify the https_proxy environment variable is correctly set. Else, check your network connection.

Later the cf cli commands dont respond at all.
azure-user@dsapi-boshvm:~$ cf apps

Getting apps in org default_organization / space azure as admin...

No Response for the above command.
Not sure if the issue is happening because of machine hardware specifications.

A: xip.io was in my experience (and many others) not a very stable DNS service.
At some point (around Oct 2015, CF v219), domain bosh-lite.com was set up to replace use of xip.io for bosh-lite.
I don't know how your CF has been installed and configured, but it might be as easy as doing a cf api api.bosh-lite.com (possibly with the --skip-ssl-validation flag if you cannot copy your API endpoint's cert to your truststore) and use that as your endpoint instead.
(bosh-lite.com and all its subdomains resolve to 10.244.0.34).


text:
Q: is it possible to dynamically create a query and escape the values too using cfscript+cfquery+cfqueryparam? I'm still new to ColdFusion.  Basically I am dynamically creating a query for Oracle.  I have used cfquery/cfparam in the past but I would really rather use cfscript to accomplish as that is more readable.  It is intended to be a large 'INSERT ALL ... INTO.'
Here's a basic example of what I have so far:
<cfscript>
clinicNIL = structNew();
clinicNIL.ADDRESS1 = 'line 1';
clinicNIL.ADDRESS2 = 'line 2';

myFields = [
     'ADDRESS1'
    ,'ADDRESS2'
];

query = queryNew("");
sql = "INSERT ALL";

for (i=1; i LTE ArrayLen(myFields); i=i+1) {

    sql = sql & "INTO NOTINLIST (SOURCETABLE, SOURCECOLUMN, SOURCEPK, ENTEREDVALUE, INSERTDATE, UPDATEDDATE, INSERTEDBY, UPDATEDBY) VALUES(";
    // [..]

    // How to dynamically escape the value below?
    sql = sql & EscapeTheParameterHere( clinicNIL[ myFields[i] ]);

    // [..]
    sql = sql & ")
";

}

WriteOutput( query );
</cfscript>

Where I have 'EscapeTheParameterHere' I want to be able to have that value escaped somehow.  how can I escape the value?
while I'm here, is there any good resources or references for CF?

A: You can bind parameters using the addParam function of a cfscript query object just like cfqueryparam works. Had to convert your example a bit to work on my MSSQL box and a smaller version of your table but it should give you the general idea.
<cfscript>
clinicNIL = structNew();
clinicNIL.ADDRESS1 = 'line 1';
clinicNIL.ADDRESS2 = 'line 2';

myFields = [
     'ADDRESS1'
    ,'ADDRESS2'
];

query = new query();
//you may need to use the query methods setDatasource, setUsername and setPassword to configure the query

//sql = "INSERT ALL" & chr(13) & chr(10);
sql = "";

for (i=1; i LTE ArrayLen(myFields); i=i+1) {

    query.addParam(name="address"&i,value=clinicNIL[ myFields[i] ],cfsqltype="VARCHAR");

    sql = sql & "INSERT INTO NOTINLIST (ADDRESS) VALUES(";

    sql = sql & ":address" & i;

    sql = sql & ")" & chr(13) & chr(10);

}

queryResult = query.execute(sql=sql);
</cfscript>

The magic is the :paramName in the sql string will have it's associated parameter replaced during the execute call with a properly escaped parameter.

A: here is the solution I came up with using cfquery/cfqueryparam.  I didn't realize you could do a cfloop inside of a cfquery.  By the way, I did find something called 'CF.Query' but apparently it only satisfies a subset of cfquery.
<cfscript>
clinicNIL = structNew();
clinicNIL.ADDRESS1 = 'line 1';
clinicNIL.ADDRESS2 = 'line 2';

myFields = [
     'ADDRESS1'
    ,'ADDRESS2'
];

totalFields = ArrayLen(myFields);

</cfscript>
<cfquery name="insert" datasource="somedatasource">
    INSERT ALL
    <cfloop from="1" to="#totalFields#" index="i">
            INTO NOTINLIST
            (SOURCETABLE, SOURCEPK, SOURCECOLUMN, ENTEREDVALUE, INSERTDATE, UPDATEDATE, INSERTEDBY, UPDATEDBY)
            VALUES(
             'FACULTYADDRESSES'
            , 123
            , <cfqueryparam value = "#myFields[i]#" cfsqltype='CF_SQL_VARCHAR'>
            , <cfqueryparam value = "#clinicNIL[ myFields[i] ]#" cfsqltype='CF_SQL_VARCHAR'>
            , SYSDATE
            , SYSDATE
            , '123'
            , '123'
            )
    </cfloop>
    SELECT * FROM DUAL
</cfquery>


text:
Q: How do I prevent visitors from opening a page outside iframe i need to prevent visitors from opening a page outside iframe
for example
when write on browser :
www.sss.com/index.php

will be open
but when write
www.sss.com/add_news.php

i need to redirect to home page

A: Since an iframe makes a GET request there isn't really any way to distinguish a GET request coming from the browser itself and one coming from an iframe embedded in a page.  In both cases the browser makes the same GET request.  You could probably write some JavaScript code in your "iframe" page that detects whether or not it is loaded in the top window and redirects if it isn't.
From the accepted answer on How to identify if a webpage is being loaded inside an iframe or directly into the browser window?
using the window properties top and self
<script type="text/javascript">
    if (top === self) {
        location = '/index.php';
    }
</script>

A: I suggest you to generate some token eg. "982h2jruhndjf92", store it on server or in cookie then add it as GET param to the in-frame script.
<iframe src="www.sss.com/add_news.php?token=982h2jruhndjf92" />

if url provides same token you show the right view, otherwise redirect user using header() function.

A: using just php you could do it with the header
<?php

   header( 'Location: www.sss.com/index.php' ) ;

?>


text:
Q: Execve problems when reading input from pipe I wrote a simple C program to execute another program using execve.
exec.c:
#include <unistd.h>
#include <stdio.h>

int main(int argc, char** argv) {
        char path[128];
        scanf("%s", path);
        char* args[] = {path, NULL};
        char* env[] = {NULL};
        execve(path, args, env);
        printf("error\n");
        return 0;
}

I compiled it:
gcc exec.c -o exec

and after running it and writing "/bin/sh", it succesfully ran the shell and displayed the $ sign like a normal shell as can be seen in the picture.

Then I did the following: I created a server using nc -l 12345 and ran nc localhost 12345 | ./exec. It worked, but for some reason I can't understand, the $ sign was not displayed this time. I couldn't figure out the reason to this. (demonstrating images attached)

Now, here is the weirdest thing.
When I try to pass the program path AND more input via the pipe at once it seems like the executed process just ignores the input and closes.
For example:

But, if I run the following it works exactly the same way it worked when I piped nc output:

So, to conclude my questions:

*

*I don't understand why the executed shell doesn't print the $ prompt sign when reads input from a pipe instead of stdin.

*Why won't the executed program read input from the pipe when the input is already there and not waiting? It seems like it works only in the cases where the pipe remains open after the command execution.

A: Like AlexP already mentioned, the prompt sign is only displayed, when input comes from a terminal.
The second question was trickier: When you call libc-function scanf, its implementation will not only consume /bin/sh from the pipe, but also store the next input ls its internal buffers. Those internal buffers, will be overwritten by execve, so the shell gets nothing.
Here is your script without scanf to verify this:
#include <unistd.h>
#include <stdio.h>

int main(int argc, char** argv) {
        char path[128];

        read(0, path, 8); // consume `/bin/sh`
        path[7] = '\0';

        char* args[] = {path, NULL};
        char* env[] = {NULL};
        execve(path, args, env);
        printf("error\n");
        return 0;
}

Why did the example with cat work in the first place?
That's (probably) because of buffering also. Try:
(echo /bin/sh; echo ls) | stdbuf -i0 ./exec

I recommend this nice Article about buffering for further reading.


text:
Q: Do I always need RewriteCond? I have this snippet in my .htaccess file:
RewriteCond %{QUERY_STRING} id=([0-9]+)
RewriteRule ^(20\d\d)/page/([0-9]+)/$ ?yearMeasure=$1&page=$2 [L]
RewriteRule ^(20\d\d)/$ ?yearMeasure=$1 [L]
RewriteRule ^category/([A-Za-z0-9-]+)/page/([0-9]+)/$ ?category=$1&page=$2 [L]
RewriteRule ^category/([A-Za-z0-9-]+)/$ ?category=$1 [L]
RewriteRule ^(20\d\d)/([A-Za-z0-9-]+)/$ ?type=post&year=$1&title=$2 [L,QSA]

However, when I remove the first line, the website still behaves in the same way. The URLs still remain "clean." This brings me to my question; what is the significance of RewriteCond in this snippet?
The only RewriteRule this RewriteCond affected was this:
RewriteRule ^page/([0-9]+)/$ ?page=$1 [L]

...when I attempted to visit /page/2/, it didn't work.
When I moved it above the RewriteCond as follows:
RewriteRule ^page/([0-9]+)/$ ?page=$1 [L]

RewriteCond %{QUERY_STRING} id=([0-9]+)
RewriteRule ^(20\d\d)/page/([0-9]+)/$ ?yearMeasure=$1&page=$2 [L]
RewriteRule ^(20\d\d)/$ ?yearMeasure=$1 [L]
RewriteRule ^category/([A-Za-z0-9-]+)/page/([0-9]+)/$ ?category=$1&page=$2 [L]
RewriteRule ^category/([A-Za-z0-9-]+)/$ ?category=$1 [L]
RewriteRule ^(20\d\d)/([A-Za-z0-9-]+)/$ ?type=post&year=$1&title=$2 [L,QSA]

...everything came back to normal. Why?

A: In the docs RewriteRule is defined this way:
RewriteRule Pattern Substitution [flags]

If Pattern matches the url requested (domain.com/path/file.cgi), the url is replaced with the Substitution (either a redirect header is returned or the url is changed internally depending on the flags)
This rewrite rule:
RewriteRule ^(20\d\d)/page/([0-9]+)/$ ?yearMeasure=$1&page=$2 [L]

will check if the url matches the pattern and the replacement will occur only in this case. That's why here such RewriteCond is useless:
RewriteCond %{QUERY_STRING} id=([0-9]+)

It's useful in situations that RewriteRule can't capture like checking the hostname or whether a file exists:
RewriteCond %{HTTP_HOST} !^example.com$ [NC]
RewriteRule .? http://example.com%{REQUEST_URI} [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

http://www.sitepoint.com/apache-mod_rewrite-examples-2/


text:
Q: Syberia not running under Windows 7 I want to run an old game named Syberia on a Windows 7 PC. But whatever I do I get the Error

No 3D accelerator available:
either your graphic card does not reach the requirements for that Game or an error has happened which requires the reboot of your computer.

*

*Windows 7 64 bit

*AMD FX 4100 Quad Core

*AMD Radeon HD 7800 Series

All drivers are up to date. Running in compatibility modes for 98, 2000, and XP has no effect. Setting to 8 bit colors does not help, but it reduces the error message to 3D mode could not initialized.
How can I fix this?

A: *

*Ensure your graphics drivers are updated.

*Install game in XP compatibility mode and run in same mode.

*Try running game as admin.

*Install all game patches.

*Try reducing your resolution to as low as 800x600 if possible.

*If you own the game try a NoCD patch.

*If all else fails a VM might be the only solution.


text:
Q: Distribution of sample statistics taken from bivariate normal $(X_{1},Y_{1}),\,...\,,(X_{n},Y_{n})' (n>2)$ are random samples taken from
$N_{2}((\mu_{1},\,\mu_{2})',\,$$
        \begin{pmatrix}
        \sigma^{2}_{1} & \rho\sigma_{1}\sigma_{2}  \\
        \rho\sigma_{1}\sigma_{2} & \sigma^{2}_{2}  \\
        \end{pmatrix})
$$ $
$r$ is sample correlation coefficient.
Also, $Z_{i}=(X_{i}-\mu_{1})/\sigma_{1},\,W_{i}=[(Y_{i}-\mu_{2})/\sigma_{2}-\rho(X_{i}-\mu_{1})]/\sqrt{1-\rho^{2}}\\ S_{zz}=\sum_1^n(Z_{i}-\overline Z)^{2},\,S_{ww}=\sum_1^n(W_{i}-\overline W)^{2},\,S_{zw}=\sum_1^n(Z_{i}-\overline Z)(W_{i}-\overline W)$
I proved Z & W are independent and $S_{ww}-S^{2}_{zw}/S_{zz}\,=\,W'(I-1(1'1)^{-1}1'-T(T'T)^{-1}T')W,\,\, where\,\, T=(Z-1\overline Z)/\sqrt {S_{zz}}$
I want to show $1)\, S_{ww}-S^{2}_{zw}/S_{zz}$ ~ $\chi^{2}(n-2),$ and independent from Z.
$2)\, S_{zw}/\sqrt {S_{zz}}$ ~ $N(0, 1)$ and independent from Z.
If i consider $\,\,T(T'T)^{-1}T'$ as constant, then it is easy to derive the distribution of $S_{ww}-S^{2}_{zw}/S_{zz}$. However, $\,\,T(T'T)^{-1}T'$ is a function of Z, so that is a random variable, which makes it difficult for me to derive the distribution. Would you help me?


text:
Q: squares that can be divided to two squares There are some squares like 169 that can be divided into two squares(16 and 9). I classify them into two groups:
A:squares that their rightmost number isn't 0(like 169 and 4225)
B:squares that their rightmost number is 0(like 100 and 400)
creating a B type is so easy(we just have to multiply a square by 100),so the problem is:
How to prove that there are an infinite number of A squares?

A: $10a^2+1=b^2$ is an example of Pell's equation that has infinitely many solutions.
http://en.wikipedia.org/wiki/Pell%27s_equation
The first example is $361=19^2$.


text:
Q: Pushforward of measure I have been given the following question:
Let $X = [0, 1]$ and let µ be Lebesgue measure on X. Let $f(x) = x^2$
. Describe the measure
$f∗µ$ ( the pushforward)
a.) by calculating $(f∗µ)([a, b])$ for every interval $[a, b] ⊂ R$
b.) by giving the density of $f∗µ$ with respect to Lebesgue measure.
I tried to solve it , especially part a but for b, I do not undertand how to use definition of density.
for part a I said
 $(f∗µ)([a,b])$ = 0  if $[a,b]∩[0,1] = {c}$ ˝if the intersection is a single point˝ since lesbegue measure of a point is zero.
or $(f∗µ)([a,b])$= $\sqrt{d}-\sqrt{c} \, \, if  [a,b]∩[0,1]=[c,d]$
but for part be I am trying to use Definition of density of measure: Definition 12 (density). If $ν(A) = \int_{A}^{} f dµ$ , we say that
the measure $ν$ has density $f$ with respect to $µ$. should I differentiate $(f∗µ)([a,b])$ in a? any help will be appreciated

A: Hint: To find the density, it is enough to find $g$ such that $\int_0^x g d\mu =(f*\mu)([0,x])=\sqrt{x}$ for all $x \in [0,1]$, this is because of the fact, that the family of sets $\{[0,x] \:|\: x \in [0,1]\}$ generates the borel sigma algebra on $[0,1]$.


text:
Q: Maximum Size of console in C I'm just starting with C, and I've a problem with the size of the console. How can I do, to execute mi program, with the maximum size of the console? Can I adjust that? I need your help!
Thanks!

A: The maximum size of the console is system dependent. The way to programmatically resize the terminal, depends on the system and is not always possible.


text:
Q: How to check if user defined entry in vector in java? I have a vector of entries. Each entry is an instance of this class:
public class Entry implements Comparable<Entry>{

    private String _key;
    private CustomSet _value;

    [...]

    @Override
    public int compareTo(Entry a) {
        return this._key.compareTo(a._key);
    }
}

The vector is declared as shown below:
Vector<Entry> entries = new Vector<Entry>();

After that, the vector is populated. Then I want to check if certain key is somewhere in the vector. So I do this:
Entry sample = new Entry(key, new CustomSet());
if (entries.contains(sample)) {
    // do something
}

This seems not to work. Why? How can I get it to work?
P.S.     CustomSet is another user defined class, irrelevant from my point of view

A: You have to redefine the equals method in your Entry class, because that's what contains relies in to determine if an element belongs to a collection, as the docs say:

Returns true if this vector contains the specified element. More
  formally, returns true if and only if this vector contains at least
  one element e such that (o==null ? e==null : o.equals(e)).

In this case o is contain's method parameter.

A: The problem is that you do not have the same object, but rather two different objects with the same Key.
This:
Entry sample = new Entry(key, new CustomSet());

makes a new object, and if you now call entries.add(sample) and then try to call entries.contains(sample) it will return true, since it is the same object, indeed. However, that would not be the case if you would have something like:
 Entry sample = new Entry(key, new CustomSet());
 Entry sample1 = new Entry(key, new CustomSet());

 entries.add(sample);

 if(entries.contains(sample1)) // It will still return false.

The solution involves the redefinition of the method equals using the keys to differenciate objects. So in the Entry class you should add the following:
 public boolean equals(Object o)
 {
       if(o == null || !getClass().equals(o.getClass()))  return false;
       if(o == this)  return true;

       Entry p = (Entry) o;
       return this.key.compareTo(p.key) == 0;
}


text:
Q: How can I use foreach and array instead of a text file So I need help with "data.php" . How can I make the "data.php"  use foreach and an array instead of writing to text file ?
With this come it makes it so that the information is written down in a txt file
And I need it to be in an Array and to use Foreach .
Weed all of the information to go into an array and then by using Foreach to show it up .
letters.php
<!DOCTYPE html>

        <meta charset="UTF-8">
        <title>Домашна 3</title>

<form method="post">

СЪЗДАВАНЕ НА ПИСМО/A

Име на получател:
<input type="text" id="firstName_Receiver" name="firstName_Receiver" required />

Фамилия на получател:
<input type="text" id="lastName_Receiver" name="lastName_Receiver" required />

Вашето име:
<input type="text" id="firstName_Sender" name="firstName_Sender" required />

Вашата фамилия:
<input type="text" id="lastName_Sender" name="lastName_Sender" required />

Съдържания:

<textarea  name="firstContext" rows="6" cols="60" required></textarea>

<textarea  name="secondContext" rows="6" cols="60" required></textarea>

Послепис:

<textarea name="Afterword" rows="4" cols="40" required></textarea>

<input type="submit" value="Изпрати" name="Submit" />
<input type="reset" value="Изчисти" />

</form>
<?php
require "data.php";
?>

data.php
<?php
if (isset($_POST["Submit"]))
{
    if (!file_exists("letters.txt"))
    {
        $letters = fopen("letters.txt", "w+");
            fwrite($letters,
            "Уважаеми (а), " . $_POST["firstName_Receiver"] . " " . $_POST["lastName_Receiver"] . "
" . "\n" .
            $_POST["firstContext"] . "
" . "\n" .
            $_POST["secondContext"] . "
" . "\n" .
            $_POST["Afterword"] . ", " . $_POST["firstName_Sender"] . " " . $_POST["lastName_Sender"] . "!" . "\n" . "\n"
        );
    }
    else
    {
        $letters = fopen("letters.txt", "a+");
        fwrite($letters,
            "
" . "Уважаеми (а), " . $_POST["firstName_Receiver"] . " " . $_POST["lastName_Receiver"] . "
" . "\n" .
            $_POST["firstContext"] . "
" . "\n" .
            $_POST["secondContext"] . "
" . "\n" .
            $_POST["Afterword"] . ", " . $_POST["firstName_Sender"] . " " . $_POST["lastName_Sender"] . "!" . "\n" . "\n"
        );
    }
    fclose($letters);
    echo file_get_contents("letters.txt");
}

A: You can use session and store the data into a new array. Currently I do not have PHP installed on my computer make sure the syntax is correct please.
Please do not forget that the session should be started at the top of the page.
<form method="post">

СЪЗДАВАНЕ НА ПИСМО/A

                Име на получател :
                <input type="text" id="firstName_Receiver" name="firstName_Receiver" />

                Фамилия на получател:
                <input type="text" id="lastName_Receiver" name="lastName_Receiver" />

                Вашето име:
                <input type="text" id="firstName_Sender" name="firstName_Sender" />

                Вашата фамилия:
                <input type="text" id="lastName_Sender" name="lastName_Sender" />

Съдържания:

                <textarea name="firstContext" rows="6" cols="60"></textarea>

                <textarea name="secondContext" rows="6" cols="60"></textarea>

Послепис:

                <textarea name="Afterword" rows="4" cols="40"></textarea>

                <input type="submit" value="Submit" name="Submit" />
                <input type="reset" value="Изчисти" />
                <button type="submit" name='save'>Save</button>

</form>

<?php
session_start();

if ( (isset($_POST["Submit"]) || isset($_POST['save'])) && !empty($_POST['firstName_Receiver']) ){
    $_SESSION['DaraArray'][] = $_POST;
}

if(isset($_POST['save']) && isset($_SESSION['DaraArray'])){
    //Do what you want and unset the $_SESSION['DataArray'];
    foreach($_SESSION['DaraArray'] as $Data){
        // Your code inside loop
        echo '


text:
Q: Как выкладывать билд на Github? Имеется: исходный код проекта на Python/PyQt5, и желание его выложить на GitHub. Но выложить хочу не только исходный код, а и билды актуальной версии. Как это лучше сделать?
Мне очень нравится организация репозитория вот здесь:
https://github.com/pyfa-org/Pyfa
Как создать такую же страничку с релизами?
https://github.com/pyfa-org/Pyfa/releases

A: На странице releases вашего репозитория есть кнопка draft a new release - там как раз и можно всю красоту навести - есть заголовок, поле ввода для текста с поддержкой markdown разметки и можно прикрепить файлы.


text:
Q: meaning of Rage Kiddies the excerpt below is about life becoming cheap after people began to be cloned because thanks to cloning, people go on living in their new bodies after they die. Can you tell me what is meant by Rage Kiddies? I couldn't find any cultural references to it on the internet.Thanks in advance.
" 'Life became so cheap, when we got cloning' Joanna said. "Euthanize yourself and just skip over terminal illness. Rage Kiddies inventing impossible sports, taking massive risks with their lives because who cares?"
source: Six Wakes by Mur Lafferty

A: Since the K in "kiddies" is capitalized, it's a proper noun.  There is some group or organization or entity named "Rage Kiddies" in the story.  This is underpinned by the fact that the book in German doesn't translate the words "Rage Kiddies" into German but leaves them in English, meaning that is a proper name within the mythos of the story.

»Ein Leben ist so billig geworden«, sagte Joanna.
»Man euthanasiert sich selbst und überspringt einfach eine schlimme
  Krankheit. Die Rage Kiddies...
-Das sechste Erwachen (The Six Wakes)

Based on that, it's impossible to say what "Rage Kiddies" is exactly supposed to mean, but here's what we know:

*

*"Rage" is a term that traditionally means "anger," but in the vernacular, it means "party," like a "rager" is an extremely wild party.

*"Kiddies" is a diminutive form of "kids."
Therefore, in the context of a story about people who essentially have eternal life because of cloning providing them with an endless supply of new bodies, I would imagine that Rage Kiddies is a term for a group of people who never grow old because they party so hard that they destroy the body they're in before it has a chance to get old and so then always have a new, young body to keep on partying hard in.


text:
Q: Combinatorics: Dividing 10 people into 2 groups of 5 simultaneously This is relevant to a video game, where 10 people are found and divided into 2 teams of 5 randomly. Suppose the grouping happens in one go, by that I mean teams are not assigned to participants one at a time.
You and another person, T are among the 10 people. I understand that if given you belong to a certain team (A), then the chances of T being in your team is 4/9.
However, if the grouping of 10 people happen simultaneously, isn't the probability of you two ending up on the same team 1/2?'
Thanks you.

A: People are not equally likely to be on the same team than on different teams, even if they are all assigned their team simultaneously. This is because there are more possible teams given that You and T are on different teams than they are on the same team. This might seem unintuitive, but will make more sense after some analysis.
Let's say You are on Team A and T is on Team B. Team A has four spots other than You and there are eight other players, meaning that there are ${8 \choose 4}$ possible Team As. Now, given a Team A, we always know that the Team B is going to be the other five people, so we don't need to account for the other possibilities on Team A.
Now, let's say You and T are on Team A. Team A has three spots other than You and T and there are eight other players, meaning that there are ${8 \choose 3}$ possible Team As. Again, given a Team A, we always know that the Team B is going to be the other five people, so we don't need to account for the other possibilities on Team A.
Now, we can calculate the probability by dividing the number of possibilities with You and T both on the same team by the total number of possibilities:
$$\frac{{8 \choose 3}}{{8 \choose 4}+{8 \choose 3}}=\frac 4 9$$
Just to be clear, we are talking about possibilities of the final teams. This has nothing to do with assigning You and T's team first and then figuring out everyone else's team. It does not matter if we assign the players to Team A first and then the players to Team B or we do it in the other order or we do it simultaneously. The order of assignment simply does not matter. If we look at possibilities, then we get rid of order entirely and don't have to worry about how the assignment is done because we only care about the final teams. This is a common way I like to think about probability problems because it makes certain problems like these a lot simpler.


text:
Q: Should I work in the blade.php or use a component for a Laravel + Vue web app I'm building a Narrow Casting System that displays tickets from a 3rd party API. The backend is handled with Laravel, and the frontend with Vue.
I am wondering if I should get all the components in the blade.php file or make a Vue component which loads them individually (A wrapper for the components, sort of), and then loading a single component in the blade.php.

A: Loading components individually give you the benefit of lazy loading (async loading), making you app load fast and perform better, saving requests loading a single bundle with all you need.
Putting all components in a blade file is not readable, hard to maintain, you can't say if that component is a dependency of another or is an entry point.


text:
Q: Diacritic Case-Insensitive search Loopback Is there any way to query results on Loopback+MongoDB with Diacritic-Case-Insensitive options?
For example, If I want to search for the query olimpic, and the database contains words like:
Olímpic
olimpic
Olimpic

Then, all of the above should be returned as results.
I have tried with multiple queries listed below and other combinations, but nothing has worked so far.
{"where":{"name.text":{"like":"olimpic","options":"i"}}}
{"where":{"name.text":{"like":"/^olimpic$/i","options":"i"}}}
{"where":{"name.text":{"like":"/.*olimpic.*/i"}}}
{"where":{"name.text":{"regexp":"/.*olimpic.*/i"}}}

Any idea?
Thanks in advance!

A: What you want ought to be possible with text indices as of version 3.1.7 of MongoDB. Please see SERVER-19557 for details. Earlier versions can not deal with diacritics.
Setting up a text index is rather easy: simply create an index on all fields you want to be searched – there can be only one text index per collection:
db.yourCollection.createIndex(
  {"name.text":"text","foo":"text"},
  {"default_language":"french"}
)

Now, to search your index, you simply do the following:
db.yourCollection.find(
  { $text: {$search:"Olimpic"} }
)

which should give you the expected results.
hth


text:
Q: How to get all content posted by a Facebook Group using Graph API I am very new to the Graph API and trying to write a simple python script that first identifies all pages that a user has liked and all groups that he/she is a part of. To do this, I used the following:
To get the groups he has joined:

API: /{user-id}/groups
Permissions req: user_groups

To get the pages he has liked:

API: /{user-id}/likes
Permissions req: user_likes

and
    url='https://graph.facebook.com/'+userId+'/likes?access_token='+accessToken +'&limit='+str(limit)

Now that I can see the id's of the groups in the JSON output, I want to hit them one by one and fetch all content (posts, comments, photos etc.) posted within that group. Is this possible and if yes, how can I do it? What API calls do I have to make?

A: That's quite a broad question, before asking here you should have give a try searching on SO.
Anyways, I'll tell you broadly how can you do it.
First of all go through the official documentation of Graph API: Graph API Reference.
You'll find each and every API which can be used to fetch the data. For example: /group, /page. You'll get to know what kind of access token with what permissions are required for an API call.
Here are some API calls useful to you-

*

*to fetch the group/page's posts-  /{group-id/page-id}/posts

*to fetch the comments of a post- {post-id}/comments

*to fetch the group/page's photos- /{group-id/page-id}/photos
and so on. Once you'll go through the documentation and test some API calls, the things would be much clear. It's quite easy!
Hope it helps. Good luck!

A: Here's an example using facepy:
from facepy import GraphAPI
import json

graph = GraphAPI(APP_TOKEN)

groupIDs = ("[id here]","[etc]")

outfile_name ="teacher-groups-summary-export-data.csv"
f = csv.writer(open(outfile_name, "wb+"))

for gID in groupIDs:
  groupData = graph.get(gID + "/feed", page=True, retry=3, limit=500)

    for data in groupData:
        json_data=json.dumps(data, indent = 4,cls=DecimalEncoder)
        decoded_response = json_data.decode("UTF-8")
        data = json.loads(decoded_response)
        print "Paging group data..."

        for item in data["data"]:
            ...etc, dealing with items...

A: Check the API reference. You should use feed.
You can use /{group-id}/feed to get an array of Post objects of the group. Remember to include a user access token for a member of the group.


text:
Q: Angular ngfor , only displayed a record Hi,
data array displaying on console. but only a record display on view.
users: any[]=[];

ngOnInit(): void {
     this.YukIlan();
}
YukIlan() {
    let controller = this;
    this.orient.command(
      "select * from login",
      function (data) {
        let body = data.json();
        let result = body.result;
        result.forEach((x: any) => {
          controller.addtoUser(x);
        });
      },
      function (e) {
        console.log(e)
      }
    )   }   addtoUser(Data: any) {

    this.users  = [{
        mobilno : Data.mobilno,
        sifre : Data.sifre,
        rid: Data["@rid"]
    }]
    console.log(this.users)

  }

}

views code:
<ul><li *ngFor="let item of users">
                        {{item.mobil}}
                    </li>
</ul>

A: You are pushing data in users array wrong!
This is how you do it:
addtoUser(Data: any) {
    this.users  = [{
        mobilno : Data.mobilno,
        sifre : Data.sifre,
        rid: Data["@rid"]
    }]
    console.log(this.users)
}

but this is the right way
addtoUser(Data: any) {
    this.users.push({
        mobilno : Data.mobilno,
        sifre : Data.sifre,
        rid: Data["@rid"]
    });
    console.log(this.users)
}

Hope it helps!


text:
Q: Creating an interactive map using P5 I am trying to take a map of the US states and have points on the map. When you hover over the point it will tell you the title of the state and a brief synopsis of what you will find out. On the mouse click, it will open up the specified HTML page. I want to use P5 for this project. Any help would be appreciated

A: Considering that you want to use p5, one could infer that you have the basic knowledge of it. So:
function setup() {
  createCanvas(windowWidth, windowHeight); //You choose the width and height.
}
function draw() {
  if (mouseX < 100 && mouseY < 100) { // IF statement would need changing
    rect(x, y, w, h); // undefined variables to be replaced with numbers.
  }
}

The draw runs very frequently and the mouseX and mouseY built-in variables make up the coordinate of the mouse.
Use this to your advantage.
In the example, the rect would be there if the mouse in in the square that extends from 0,0 to 100,100. Maps would be harder because the if statements could be overcrowded.
By the way, you don't need to use the rect, the main point is that the if would run if the user hovered over the specific area.


text:
Q: jQuery Fading Issue I'm doing a minimal-style validation response for my login box. There's not a lot of space, so I change "Login" to say "Invalid Login. Forgot Password?" in a nice fading animation. I had it working previously when I merely inserted "Invalid" before "Login" rather than fading out then in the entire span.
When it comes to my code, the former span doesn't disappear and the latter span just shows up below, as if I am doing .show(). Also, no fading whatsoever occurs, which is odd.
Here's my markup:

Login

Invalid Login · Forgot Password?

Here's the jQuery (this runs on validation error):
if(data == "Invalid")
            {
                $('#oldLoginProblem').fadeOut('slow', function(){
                    $('#newLoginProblem').fadeOut('slow', function(){
                        $('#newLoginProblem').fadeIn('slow');
                    });
                });
            }

Any help?

A: As noted in other answers, you cannot have a block element in an inline element (h3 in a span).
If you change your spans to inline-block, it works, but I don't know if that has other consequences with regard to your layout.
span {
     display: inline-block;
}

A: your fading problem is probably caused by the fact that span is an inline element:
http://jsfiddle.net/proudlygeek/AUC5v/
Update
Here's a snippet containing the fading effect you want:
$('#loginProblem').fadeOut('slow', function() {
    $(this).html("
Invalid Login · Forgot Password?
");
    $(this).css({
        'color': 'red',
        'font-weight': 'bold'
    });
    $(this).fadeIn('slow');
});

See it in action on jsFiddle

A: There appears to be an issue with calling .fadeOut() with an
 element inside a  (which is invalid markup as you can not have a block level element inside of an inline element)
With that being said you can get the fadeOut() effect to work by using .children()
$('#oldLoginProblem').children().fadeOut('slow', function() {
    $('#newLoginProblem').children().fadeOut('slow', function() {
        $('#newLoginProblem').children().fadeIn('slow');
    });
});

Code Example on jsfiddle
Another option would be to simply adjust your markup to be valid and the fadeOut will work correctly.

Login

Invalid Login · Forgot Password?

Code Example on jsfiddle


text:
Q: Spring boot maven build not including artifact version in final jar On building my spring boot app using mvn clean package, the final artifact that is getting built, myapp.jar, is not having the version number included in the jar name.
What change should i do to get the artifact verion number to be part of jar.
The relevant part of pom.xml is as below -
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycomp</groupId>
    <artifactId>myapp</artifactId>
    <version>2.6.0</version>

    <name>myapp</name>
    <description>
        <![CDATA[]]>
    </description>

    <packaging>jar</packaging>

    <properties>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <springboot.version>2.5.6</springboot.version>

    </properties>

    <dependencies>

        <!-- Spring boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <version>${springboot.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.3.12</version>
        </dependency>
        ...
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>3.6.3</version>
        </dependency>

    </dependencies>

    <build>

        <finalName>gitlab-finder</finalName>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.1.2</version>
                </plugin>

            </plugins>
        </pluginManagement>

        <plugins>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${springboot.version}</version>

            </plugin>

        </plugins>

    </build>

</project>

Note: I created a new spring boot project using spring starter (through sts), and for this new project the jar has artifact version included in the jar name by default.  So wondering if this a default feature why is this not the case for my project (by the way, i am maintainer of this project not the creator but i have to add this feature of including version number to jar name.)

A: You are overwriting the default behaviour of generating project names. This is because you define the finalName tag.
From the docs:

finalName: This is the name of the bundled project when it is finally built (sans the file extension, for example: my-project-1.0.jar). It defaults to ${artifactId}-${version}.

In your case it is defined as <finalName>gitlab-finder</finalName> which does not contain the version of the project. You either add ${version} to it <finalName>gitlab-finder-${version}</finalName> or remove the finalName tag.


text:
Q: Laravel in vpc, access sqs without programatic access I have a Laravel app running on an ec2 instance inside a VPC. Now I want to connect to an SQS from the app. Using programmatic access seems to work but I want to use the SQS endpoint, without having to use the key and the secret.
Technically speaking this should be possible with the AWS resources being linked together. Any idea how to set this up in Laravel?

A: Sounds like you need to use an IAM role (basically a set of policies) which you attach to your EC2 instance. The policies you include would have a section for access to your SQS queue (or at least certain actions on it in SQS). This effectively allows temporary credentials to be given to the instance without having to have them in code.
The role might look something like this:
{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Action": [
            "sqs:ReceiveMessage",
            "sqs:DeleteMessage",
            "sqs:GetQueueAttributes"
            ...<any other actions>
        ],
        "Resource": <SQS Queue ARN>
    }
]
}

You attach this role to your EC2 instance in the EC2 console - select instance, go to Instance Settings > Attach/Replace IAM Role


text:
Q: Sharing list between functions I recently asked another question asking how to pass a list from one function to another, which was kindly answered by @Modred. Essentially what I've got now is this:
def run_command():
    machines_off = []
        # Some stuff .....
        machines_off.append(machineName)
        # Some stuff ....
    wol_machines(machines_off)

def wol_machines(machines_off):
    # Some stuff ....

(I've cleared off all the non-essential code for this example as it's 300+ lines).
Now, each function is called by clicking on a tkinter button; the run_command is always run and sometimes will add items to the list 'machines_off'. I only want it to action machines_off if the second function button is clicked. At the moment after clicking on the run_command button, it runs through the whole script, including the second function when I don't want it to. I assume as I'm forwarding the list onto the second function (with the 5th line), it's bypassing the need to click the second functions button.
What do I need to change/add to allow the list from the first function to be available to the second, but not action it until needed??
Many thanks,
Chris.

A: I'm guessing your code looks something like:
from Tkinter import Tk, Button

def run_command():
    machines_off = []
    # Some stuff .....
    machineName = "foo"
    machines_off.append(machineName)
    # Some stuff ....
    wol_machines(machines_off)

def wol_machines(machines_off):
    print "wol_machines was called"
    print "contents of machines_off: ", machines_off
    # Some stuff ....

root = Tk()
a = Button(text="do the first thing", command=run_command)
b = Button(text="do the second thing", command=wol_machines)
a.pack()
b.pack()

root.mainloop()

If you want the functions to execute independently of one another, you shouldn't call wol_machines from within run_command. You'll have to find some other way for both functions to see the list. One way of doing this is to use a global value.
from Tkinter import Tk, Button

machines_off = []

def run_command():
    #reset machines_off to the empty list.
    #delete these next two lines if you want to retain old values.
    global machines_off
    machines_off = []
    # Some stuff .....
    machineName = "foo"
    machines_off.append(machineName)
    # Some stuff ....

def wol_machines():
    print "wol_machines was called"
    print "contents of machines_off: ", machines_off
    # Some stuff ....

root = Tk()
a = Button(text="do the first thing", command=run_command)
b = Button(text="do the second thing", command=wol_machines)
a.pack()
b.pack()

root.mainloop()

This is the simplest change to your original code that can give you your desired behavior, but global values are generally considered a sign of bad design. A more object oriented approach could localize the global into a class attribute.
from Tkinter import Tk, Button

class App(Tk):
    def __init__(self):
        Tk.__init__(self)
        self.machines_off = []
        a = Button(self, text="do the first thing", command=self.run_command)
        b = Button(self, text="do the second thing", command=self.wol_machines)
        a.pack()
        b.pack()
    def run_command(self):
        #reset machines_off to the empty list.
        #delete this next line if you want to retain old values.
        self.machines_off = []
        # Some stuff .....
        machineName = "foo"
        self.machines_off.append(machineName)
        # Some stuff ....

    def wol_machines(self):
        print "wol_machines was called"
        print "contents of machines_off: ", self.machines_off
        # Some stuff ....

root = App()
root.mainloop()


text:
Q: Nested End points with angular resource and server nodejs I have a resource /cars and the endpoint in angular defined as
$resource('/cars/:carsId');
to GET all cars and a specific car.
At the server level, I have also added a middle-ware to check that carsId is always a valid MongoID.
Now I want to define another endpoint to GET all redcars.
My initial though was to add another resource like
$resource('/cars/redcars');
but this does not work since at the server level, my middle-ware will through an error because redcars is not valid MongoID.
My question is what is the best approach in this case ?
I can add a logic at server to check if the MongoID is invalid, but, if the value is redcars then return all redcars.
or there is a better way of doing this.
Thanks
pkpk

A: Typical patterns are:

*

*use query parameters, as in, /cars/search?color=red

*use /cars/types where the /cars/types/:color can be applied

An excellent resource for design patterns in API design is the Apigee API guide.  NOTE: I am not endorsing Apigee by recommending their guide; I simply find that this ebook has many useful patterns collected in one place.


text:
Q: How to 'go to definition' for user defined function in Leksah? I can do this for system functions like const by selecting it, right clicking and choosing search(metadata). The same does not work for user defined functions.
How do you do such a search?
If it is impossible for user defined functions, how do you read an already existing Haskell project and jump between definitions and invocations?
Vim + ctags work for user defined functions only, and are not as powerful as cscope for c/c++ source.

A: I tried what you said with user-defined functions and it works fine for me. I select name of function, right click, search(metadata) and it appears in the search tab to the right. Then i click "go to definition" and it takes me to definition.
Maybe you should try restarting Leksah? I noticed that sometimes it doesn't recognize functions immediately as I write them, but if you restart it, it will recognize them.

A: You need to use 'Update Workspace data' under the 'Configuration' menu -- Leksah doesn't index user-created functions until you do this (or restart the compiler). The default shortcut under Windows is Ctrl+M.

A: This solution may be totally off base because I don't use Haskell, but would ack-grep work for you? I have found it very useful for doing code dives.
I see in the documentation that it supports haskell.
I believe you would use: ack --haskell user_function


text:
Q: Кэшированный ОЗУ
Вот у меня 3 GB ОЗУ.Всего 2804. Кэшировано 1130. доступно только 1642 а еще и свободно 642. Это только антивирус Avast работала(без никаких программ компютер запущено и антивирус и все).В чем проблема?


text:
Q: Missing attachments from specific domain one of our users has problem with receiving PDF attachments from one domain.
The body of the mail is recieved without any change, but there is no sign of attachments. He has this problem only with PDF attachments, zip, office doc etc. delivers fine.
When same sender forwards the e-mail to another Exchange user, it's delivered just fine, with attachments.
Clients computers are with Win7 64bit/Office2010 Business.
Company mail server runs Windows 2003 SBS, Exchange 2003
Pls help :-)
//and before you ask - yes, they sends the attachment every time :-)

A: This sounds a lot like the receiver has some program running that is deleting the attachment.  You need to do more debugging - it sounds like you haven't tried nearly enough conditions to come close to pinpointing where the issue is.
Try logging on to a different system (one that has no problems with attachments) under the user's account and see if the attachment is there.  Also, check their mail rules to make sure no rules are deleting attachments or anything.  Check their spam settings, etc...
Also, check the Exchange server logs.

A: It actually sounds like there is some sort of transport rule preventing certain filetypes from being delivered from one user/domain.
To debug a bit more, have someone else on the sender's domain send the recipient a .pdf, and have the original sender send a .pdf to someone else on the recipient's domain.


text:
Q: Tabular Modeling SSAS Можете доступно объяснить в чем смысл табличного моделирования в SSAS и почему это может быть лучше, чем напрямую брать данные с того же DWH ?
И отличие от многомерной модели, читал сравнения, но они не особо очевидны для человека который только начинает с этим работать.


text:
Q: Copy a dynamically created variable I would like to generalize the names of models in my code.
I have created a parent controller that that automatically loads a model that matches the controller class name.
However, when the model is loaded, it has the name of the model. ex;
$this->load->model('some_model') creates $this->some_model
What I would like to do is create the variable $this->model that would replace the $this->some_model.
I would rather not change the core code, so I am hoping there is some PHP solution I can use in my parent controller.
I tried the following with no luck:
$this->load->model($model_name);
$this->model = ${ $model_name };

This returns a $this->model_name undefined error.
take care,
lee

A:
If you would like your model assigned to a different object name you can specify it via the second parameter of the loading function:
$this->load->model('Model_name', 'fubar');
$this->fubar->function();

http://ellislab.com/codeigniter/user-guide/general/models.html#what


text:
Q: How to get the id of the previous element? Here is the html:

    some text

  other text

And the jquery:
function deleteAnch () {
    var the_id = $(this).prev('a').attr('id');
    //also tried var the_id = $(this).closest('a').attr(id);
    console.log('The id is:', the_id);
}

But in console I get

The id is: undefined

What is it wrong here and how to fix this?
p.s. I know some similar question is being asked but I still can not get it working using other answers hence the question.

A: You need to pass current element content i.e. this to deleteAnch inline click handler.

Modify function as
function deleteAnch (elem) {
    var the_id = $(elem).prev('a').attr('id');
    console.log('The id is:', the_id);
}

However as you are using jQuery, you should bind event using it. Pass the function reference of deleteAnch and get rid of inline click handler
function deleteAnch () {
    var the_id = $(this).prev('a').attr('id');
    console.log('The id is:', the_id);
}

$('i.glyphicon-remove-circle').on('click', deleteAnch);

function deleteAnch() {
  var the_id = $(this).prev('a').attr('id');
  console.log('The id is:', the_id);
}

$('i.glyphicon-remove-circle').on('click', deleteAnch);

    some text
    icon

    other text
    icon


text:
Q: WinForms DataGridView instantly save to Entity Framework table Losing the plot here with what I hear to be a simple operation. I have a basic Winforms application with just a DataGridView in the center.
I have a table in SQL Server connected with Entity Framework db-first.
    private void Form_Load(object sender, EventArgs e)
    {
        BindingSource bs = new BindingSource();
        Global.db.*Entity*.Load();
        bs.DataSource = Global.db.*Entity*.Local.ToBindingList() ;
        dataGridView1.DataSource = bs;
    }

Now my understanding is when I launch this and change a value in any of the cells it automatically updates the DB in the background!
But no dice.
Anyone know a way of doing this without updating the whole table each time (this is going to be a big table)

A: Thanks to Reza, What was missing..
    private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
    {
        Global.db.SaveChanges();
    }


text:
Q: Changing color of a pressed item gradually How can I change background color of a pressed list item gradually (like it's done in default list items)?
Background of an item currently is a selector:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_activated="true" android:drawable="@color/holo"/>
    <item android:state_pressed="true" android:drawable="@color/grey"/>
    <item android:drawable="@color/white"/>
</selector>

But background color changes instantly, not gradually like in simple_list_item_activated1 layout.
Can the gradual color change of a pressed item be done without coding it manually? How can I do it?


text:
Q: How to create a product configurator for an eCommerce store? I want to implement a configurator for an eCommere store.
It should basically look like this: http://urbike.de/singlespeed/Konfigurator.html.
I do not have much experience in web design, what do I need to create such a configurator for an eCommerce store. Are there any simple solutions?

A: The simplest way to do this in magento would be

*

*Create a simple product

*Add 'Custom Option' for each option (eg Frame color, Fork, Front wheel...) with up-charges (if any)

*Create the Images using one of the 2 methods below

*

*Creating a image for each possible combination and use a file naming convention (downside - thousands of images)

*Create a transparent image for each option/layer (eg. fork, front wheel) in each color, then use css to overlay them on to each other (layers must be in the correct order)

*Create javascript functionality to change the images base on current selection and load the default config and reload current option if user choose to edit item in their cart

*You will have to think about how intuitive you want the admin section to be. Should a 'Admin' user be able to upload the all these images and assign color swatches when configuring the product (or just ftp them to the server)

*Think about if you want to display their current config image on order confirmation or just a default image

What you are tying to accomplish is fairly complex, from my past experience of creating simpler features it's going to require a lot of external js coding and knowledge on how magento simple product js work.