text:
Q: Doubt about topological neighbourhoods The standard topology I was taught for $\mathbb{R}$ is
$$N(x)=\{[a,b]\mid a<x<b\}$$
And a union  of neighborhoods is also a neighborhood .
But by the second axiom of the definition via neighbourhoods:

If N is a subset of X and includes a neighbourhood of x, then N is a neighbourhood of x. I.e., every superset of a neighbourhood of a point x in X is again a neighbourhood of x.

but, it seems to say that if I add, for example, the point 6 to $[1,3]$ It is still a neighborhood of 2, but that conflicts with the definition.
What am I missing?

A: The $N(x)$ you gave is not the set of all neighbourhoods of $x$, its a base for the neighbourhoods of $x$ (in the usual topology on $\Bbb R$). This means that $U \subseteq \Bbb R$ is a neighbourhood of $x$ iff there is an $N \in N(x)$ such that $N \subseteq U$.
It's easy to check that the collection of all neighbourhoods of $x$ (defined from this base) does form a (co-called) filter (closed under finite intersectiosn (not compositions) and supersets). So $[0,3] \cup \{6\}$ is a neighbourhood of $2$ as it contains $[0,3] \in N(2)$, e.g.
Note that many books and authors define a neighbourhood of $x$ to be an open subset of $\Bbb R$ that contains $x$ and in that case $[0,3]$ is not a neighbourhood of $2$ as it's not open, as witnessed by its non-interior points $0$ and $3$. But it is a neighbourhood in the more relaxed sense that you seem to be using. What matters is that $x$ is in the interior of every $N(x)$ and thus in that of every neighbourhood too.


text:
Q: Storing text from a text file into six different vectors (C++) I need to store text from a text file into several different vectors.
The text file would look something like this:
1111
Dish Washer
20
250.50
550.50
2222
Micro Wave
75
150.00
400.00
3333
Cooking Range
50
450.00
850.00
4444
Circular Saw
150
45.00
125.00
and my vectors are this:
vector<int> iID;
 vector<string> iName;
 vector<int> pOrdered;
 vector<int> pInStore;
 vector<double> manufPrice;
 vector<double> sPrice;

so the information from the text file would have to be iID, iName, pOrdered, pInStore, manufPrice, sPrice in that order but I am not sure on how to implement that kind of code.

A: IMHO, you should stay away from parallel arrays and model the data using a struct:
struct Record
{
    int id;
    std::string name;
    int p_ordered;
    //...
    friend std::istream& operator>>(std::istream& input, Record& r);
};

std::istream& operator>>(std::istream& input, Record& r)
{
    input >> r.id;
    input >> r.name;
    //...
    return input;
}

Your input code could look like this:
std::vector<Record> database;
Record r;
while (infile >> r)
{
    database.push_back(r);
}

One issue with parallel arrays is there is a chance that they can get out of sync.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there a way to remove an item from a jQuery objects selection I'm not sure if I'm using the good terms here, but this is what I want to do :
I select a bunch of items with jQuery, like jQuery('some-items-selected-with-class-or-else');, then I'm working on an other bunch of items (with some of them can be in the two ""bunches"") like jQuery('some-other-items-selected-with-class-or-else');.
My question is : is there a way to remove some items of the second selection from the first one ?
If it can help, I'm working on each item of the second selection with jQuery.each().
This is what I want to do :
var selection1 = jQuery('someitems'),
    selection2 = jQuery('someotheritemswhichcanbethesameornot');

selection2.each(function() {
   // if this item has some specifications (like a specific value or else),
   // we do something on it and it does not belong in selection1 anymore
   // => can I remove it from selection1 ?
});

Thanks

A: You have 2 approaches to do so:
1) Narrow your selection using filter():
jQuery('select.general-class').filter('.with-only-this');

2) Subtract certain elements using not():
jQuery('select.general-class').not('.not-you');


text:
Q: What is the difference between specialization and specialisation? What is the difference between specialization  and specialisation ? where am i use
specialization   and specialisation  what does meaning of both.?

A: There's no difference in meaning (specializing in a certain skill). However, different English-speaking countries have different spelling preferences. "Specialisation" and "specialise" would be used in a British context, whereas Canadians and Americans would use "specialization" and "specialize." This is true of many words ending in -ization or -ize: realize/realise (realization/realisation), organize/organise (organise/organisation), idolize/idolise, etc.


text:
Q: passing a value to a method and then printing it i came across this question in an interview.
public class NuVizzDemo {
    public static void main(String args[]){

        int x=6;
        System.out.println("initial value of x is "+x);
        int y=getX(x);
        System.out.println("value of x after method is executed is "+x);
        System.out.println("value of y is "+y);
    }

    private static int getX(int x) {
        // TODO Auto-generated method stub
        if(x==1){
            System.out.println("value of X is "+x);
            return 0;
        }
        else
            System.out.println("value of x is "+x);
            return 1+getX(x-1);
    }

}

I want to know how come value of y is 1 less than x?

A: Because the function getX is recursive and follows this pattern:
x = 1: 0
x = 2: 1 + getX(1) = 1 + 0 = 1
x = 3: 1 + getX(2) = 1 + 1 + getX(1) = 1 + 1 + 0 = 2
...

Edit: You should make getX more robust by adding a clause for x <= 0. For such a value of x your code will throw a StackOverflowError (which is a Good Thing™ for a question posted on Stack Overflow ☺).

A: Because
return 1+getX(x-1);
will give you the value 1 + 1 + 1 + 1 + 1 + 0 = 5  since when x reaches to the 1 you are expicitly returning 0.

A: So this recursive call will go for 5 times and at the 5th time the returned value will be 0, because it will return 0 when x == 1.
So when:
x = 1 -> 0
x = 2 -> 0 + 1 = 1
x = 3 -> 1 + 1 + getX(1) = 2
x = 4 -> 1 + 1 + 1 + getX(1) = 3
x = 5 -> 1 + 1 + 1 + 1 + getX(1) = 4
x = 6 -> 1 + 1 + 1 + 1 + 1 + getX(1) = 5

So it's y = 5.


text:
Q: Extend a class in Python which is later created I know that it usually recommended to extend classes like this example where the Volvo class is extends the class Car:
import Car
class Volvo(Car):
    do stuff...

In my situation I would like to define the class Volvo before I create the instance of Car. So I would like to do something like this:
class Car:
    def __init__(self, speed_limit):
        self.speed_limit = speed_limit

    def print_current_speed_limit(self):
        print(self.speed_limit)

class Volvo(Car):
    def __init__(self, car, modified_speed_limit):
        self = car
        self.speed_limit += modified_speed_limit

if __name__ == '__main__':
    car = Car(130)
    volvo = Volvo(car, 20)
    volvo.print_current_speed_limit()

However this fails and prints that volvo does not have a print_current_speed_limit function (which is correct). When I run the example in the debugger I see that after self is replaced with car it has the print_current_speed_limit function however not afterwards on the last line of the example.
The code that I'm working with is much more complicated but I tried to make a smaller example here. It is not one simple variable (like speed_limit and the function print_current_speed_limit) in my real example that I would like to use from Car in Volvo.
Maybe I'm just trying to find a solution that does not exist and that I should update my code so I can use the "correct way" of extending classes..

A: do you need something like this?
class Car:
    def __init__(self, speed_limit):
        self.speed_limit = speed_limit

    def print_current_speed_limit(self):
        print(self.speed_limit)

class Volvo(Car):
    def __init__(self, c, modified_speed_limit):
        super(Volvo, self).__init__((c.speed_limit+modified_speed_limit))

if __name__ == '__main__':
    car = Car(130)
    volvo = Volvo(car,20)
    volvo.print_current_speed_limit()   #150

another version:
class Car:
    def __init__(self, speed_limit):
        self.speed_limit = speed_limit

    def print_current_speed_limit(self):
        print(self.speed_limit)

class Volvo(Car):
    def __init__(self, modified_speed_limit):
        super(Volvo, self).__init__(modified_speed_limit)

if __name__ == '__main__':
    car = Car(130)
    volvo = Volvo(car.speed_limit+20)
    volvo.print_current_speed_limit()   #150


text:
Q: How to create an alias for a named SQL Server instance On my developer computer I have an SQL Server instance named developer_2005. In the resource setting files of a C# application we are creating, the instance name is set to foobar (not really, but just as an example). So when I run the application (in debug or realease) it tries to connect to an SQL Server on localhost, named foobar.
I am wondering if it is possible to create an alias or something like that, so that the application actually finds an SQL Server on localhost named foobar, but it is actually connecting to the instance named developer_2005.
The connection string in the config file of the application is Data Source=localhost\foobar;Initial Catalog=barfoo;Integrated Security=True with provider name System.Data.SqlClient. If I change localhost\foobar to localhost\developer_2005 then the application can connect like it should. How can I create an alias so that I won't have to change the string in the file?
I tried, in SQL Server Management Studio, to create a Server Registration with registered server name "localhost\developer", but this didn't seem to do any good. Not even sure what that really did... But then I discovered SQL Server Configuration Manager\SQL Native Client COnfiguration\Aliases. And I kind of assume this is where the solution lies. But I can't quite figure out how to add a new one... When creating a new one, I have to provide Alias Name, Port No, Protocol and Server, and I don't really have a clue what to put in either of them.

A: Alias name: foobar (the name you would like to use)
Server name: the actual name of your computer or the IP address (not localhost or 127.0.0.1)
Protocol: TCP/IP
Port: the default one (1433)
Make sure TCP/IP protocoll is enabled (disabled by default)
Change your connection string to use your new alias  (Data Source=foobar)

A: You are right, what you need to do is defining a new alias in the Native Client configuration.

*

*Alias name: the alias you want to create

*Server name: the actual server name

*Protocol: TCP/IP

*Port: the default one (1433)

Try this:

*

*Alias name: localhost\foobar

*Server name: localhost\developer_2005

*Protocol: TCP/IP

*Port: 1433


text:
Q: np.loadtxt vs np.genfromtxt when I use the following np.loadtxt code to load the data of the format:
2017-07-26,153.3500,153.9300,153.0600,153.5000,153.5000,12778195.00

the data gets loaded just fine, loadtxt code->
a, b, c, d, e, f, g = np.loadtxt("goog.csv",
                                  dtype={'names': ("b'Date", 'Open', 'High', 'Low', 'Close', 'Adjusted_close', 'Volume'),
                                        'formats': ('U10', np.float, np.float, np.float, np.float, np.float, np.float)},
                                  delimiter=',',
                                  skiprows=1,
                                  unpack=True)
print(a)

Output->
['2017-07-26' '2017-07-25' '2017-07-24' ..., '2000-01-05' '2000-01-04'
'2000-01-03']

Process finished with exit code 0

BUT upon using the corresponding np.genfromtxt code gives the ValueError: too many values to unpack, I used the following genfromtxt code->
a, b, c, d, e, f, g = np.genfromtxt('goog.csv',
                                    dtype={'names': ("b'Date", 'Open', 'High', 'Low', 'Close', 'Adjusted_close', 'Volume'),
                                           'formats': ('U10', np.float, np.float, np.float, np.float, np.float, np.float)},
                                    delimiter=',',
                                    skip_header=1,
                                    unpack=True)
print(a)

Output->
Traceback (most recent call last):
File "C:/Users/sonika jha/PycharmProjects/csvCheck/csvCheck.py", line 84, in <module>
download_stock_data()
File "C:/Users/sonika jha/PycharmProjects/csvCheck/csvCheck.py", line 66, in download_stock_data
unpack=True)
ValueError: too many values to unpack (expected 7)

Process finished with exit code 1

My final goal was to load the date in string datatype and the rest in float using genfromtxt.

A: loadtxt and genfromtxt handle unpacking from structured data differently
loadtxt docs:

unpack : bool, optional
If True, the returned array is transposed, so that arguments may be
      unpacked using x, y, z = loadtxt(...).  When used with a structured
      data-type, arrays are returned for each field.  Default is False.

genfromtxt docs:

unpack : bool, optional
If True, the returned array is transposed, so that arguments may be
      unpacked using x, y, z = loadtxt(...)

The loadtxt in this last quote is a typo.
If I replicate your sample line 3 times, and run genfromtxt (with unpack=False):
I get a (3,) array with the defined dtype:
In [327]: data
Out[327]:
array([('2017-07-26', 153.35, 153.93, 153.06, 153.5, 153.5, 12778195.),
       ('2017-07-26', 153.35, 153.93, 153.06, 153.5, 153.5, 12778195.),
       ('2017-07-26', 153.35, 153.93, 153.06, 153.5, 153.5, 12778195.)],
      dtype=[('bDate', '<U10'), ('Open', '<f8'), ('High', '<f8'), ('Low', '<f8'), ('Close', '<f8'), ('Adjusted_close', '<f8'), ('Volume', '<f8')])

loadtxt produces the same thing
But loadtxt with unpack ends up doing
a = data['bDate`]
b = data['Open']
etc.

that is, assigning one field to each of the variables.
But genfromtxt does
a = data[0]
b = data[1]
etc

That is, one row or element of the 1d array to each variable.  With many more elements than your 7 variables, it complains about to too many values to unpack.
So either stick with loadtxt, or don't use unpack with genfromtxt.
I think loading the structured array, without unpack gives you more options when doing further processing.


text:
Q: How can serialize a GPIO list to json? I have the following setup
LEDS = {"green": 16, "red": 18}

@app.route('/leds/', methods=["GET"])
def api_leds_state():
    return {"green": GPIO.input(LEDS["green"]), "red": GPIO.input(LEDS["red"])}

which returns the pins state
{
    "green": 0,
    "red": 0
}

Unfortunately the code above is hardcoded. How can i get the desired json response with a loop or serialization or something?

A: Not exactly sure that's what you're asking for, but here's a dictionary comprehension to overcome the hardcoded keys in your return dict:
return {color:GPIO.input(pin) for color, pin in LEDS.items()}

Iterating over LEDS.items() gives you both the key and value of a pair in LEDS, which is what you need to create each new pair in your result dict.


text:
Q: Unable to update the boolean value using retrofit post I'm trying to make post request using retrofit:
class PostContentModel {

    @SerializedName("createdBy")
    var createdBy: UserDTO? = null

    @SerializedName("postID")
    var postID: String? = null

    @SerializedName("isMemory")
    var isMemory: Boolean?= false
}

    @POST("v1/posts")
    fun postContent(@Body map: PostContentModel?): Call<ResponseBody>

now in my main activity when i try sending data using retrofit, the createBy and and postID fields are getting updated but the isMemory(boolean) is not getting updated if i set it to true.
    val postContentModel: PostContentModel? = PostContentModel()

postContentModel?.createdBy = "xyz"
postContentModel?.postID= "5"
postContentModel?.isMemory= true
ApiCall.postContent(postContentModel)

so now when i check the server the first 2 values have updated but the isMemory is still left at default false value which was preset in the server.

A: you can try calss as data class
 data class PostContentModel (

    var createdBy: UserDTO? = null,

    var postID: String? = null,

    var isMemory: Boolean?= null,
)

you can use apply scope function to add modification on object
    val postContentModel=PostContentModel().apply {
        createdBy=null
        postID=""
        isMemory=true
    }

will work with you


text:
Q: Sending raw TCP data from Linux to Windows server I am planning to forward raw TCP data that is received on the local port of a Linux machine to a Windows server.
The forwarding is done by a Java application running on a Linux machine. A .NET application running on the Windows server receives this raw data and processes it.
I have read somewhere that the handling of LF and CR is different in Linux and Windows. Have someone encountered any problems in transferring raw TCP data between Linux and Windows?

A: You can send specially crafted packets with a tool like nping. In linux a newline \n will go to the next line, in windows newline and carriage return go to the next line \r\n

A: This would only be an issue if the data was read and/or written on a line by line basis, which you wouldn't do when forwarding raw data. If it's simply forwarded on a packet per packet basis, no processing would be performed and the data would be exactly the same.
For the same reason, since data is read as bytes and not by a "text reader" or similar, neither line endings nor potential encoding (e.g. UTF-8) would make a difference.


text:
Q: Apache cannot write to directory I am using an Amazon EC2 server for hosting my sites. I've setup apache to run as the user ec2-user. I've chown'ed and chmod'ed all the directories starting from /var.
As you can see below:
drwxr-xr-x.  21 ec2-user ec2-user 4096 Oct 24 10:55 var

drwxrwxr-x.  8 ec2-user ec2-user 4096 Nov  2 20:23 www

both /var & /var/www are owned by ec2-user.
This is the output of ps -ef | egrep '(httpd|apache)'
root      5152     1  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5154  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5155  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5156  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5157  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5158  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5159  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5160  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5163  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5164  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5165  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5166  5152  0 02:50 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

ec2-user  5182  5055  0 02:57 pts/1    00:00:00 egrep --color=auto (httpd|apach )

But I am still getting a permissions denied error. What am I doing wrong? I am at my wits end.
Any help would be greatly appreciated.
Thanks in advance,
[Edit]:
I tried doing a simple file_put_contents to test the permissions and I am getting the following error:
 failed to open stream: Permission denied [file]
[Edit2}:
I even tried changing all permissions on the directories (all the way up to /var) to 777, still getting the same error.

A: You appear to be using Selinux -- the dot in drwxr-xr-x.  says there is more to your permissions problem than you think - you have to use Selinux to let ec-user in to those directories, too.


text:
Q: new PowerShell code does not get executed | Visual Studio Code I have a really wierd problem when I write a PowerShell script using Visual Studio Code.
After I finish executing my script I make some changes to the script, but when I start the script again, these changes do not get executed.
I thought maybe I have to little RAM, but I use a Lenovo T570 with 8GB.

Also sometimes during debugging my script I get a error message which says: PowerShell terminated unexpectedly.
 does anyone have any idea what the problem might be?I use VS Code 1.30 and the latest PowerShell Add-In

A: If the Powershell script is using a module that you have changed, these changes will not take effect once that module was already loaded into memory.
You can try and force the updated module to reload by adding
Remove-Module xxx

before importing it with
Import-Module xxx

You can also try using the -Force parameter on the Import-Module cmdlet:
Import-Module xxx -Force


text:
Q: Alation APIs for getting column level metadata How can I get column level metadata in Alation? I was able to do it for datasource and schema level using Alation APIs but I facing difficulties in getting to the column level. Please help me on this.

A: got it.. It's given in their documentation for API under data source browsing.. the link for the same is
https://customerportal.alationdata.com/docs/MetadataGETAPI/index.html


text:
Q: formatting the x-axis in Python I'm trying to format my x-axis to show only dates. Here's my code:
start = datetime(2017, 1, 1)

end = datetime(2018, 3, 9)

stock = web.DataReader('AAPL', 'morningstar', start, end)

daily_close = stock[['Close']]

stock['Close'].plot(figsize=(12,8))

plt.xlabel('Date')

plt.xticks(rotation=30)

plt.show()

A: Place these lines before plt.show()
date_labels = [dt.strftime('%Y-%m-%d') for dt in stock.index.get_level_values('Date')]
ticks, labels = plt.xticks()
new_labels = [date_labels[int(i)] for i in ticks if i < len(date_labels)]
new_ticks = ticks[0:len(new_labels)]
plt.xticks(new_ticks, new_labels)

The code converts the datetime from the index to a list of strings representing dates and overwrites the tick labels on the X axis with the corresponding dates.


text:
Q: Is it good idea combine Meteor and AngularJS? There are examples where Meteor and AngularJS are combined, but is it necessary?

A: It depends on what you want to do. You can make a project with one, the other or both.
If you want a concrete answer, you should help us and tell what's the project or why you should (or not) use them both.
so it's not necessary to use both, but it can be usefull ...


text:
Q: How do I remove input placeholder text on focus with jQuery? This is my HTML:

        <input type="text" name="company-name">

    ::after

I'm having trouble writing a jQuery snippet to remove/hide the ::after pseudo element when the input comes in focus. Specifically traversing the DOM up and out of the input.
$('.testimonial-form__field input').css( "display", "none" );

That is about the extent of my JS knowledge. I know I need to start by selecting the input and end by applying a hide on the pseudo element. I just don't know how to write that function.

A: I suggest on input focus you simply add a class to the .testimonial-form__company-name div element. When that happens, you just add a CSS class to hide the ::after psuedo element.
Check out: http://jsfiddle.net/c5a19byk/

     Input: <input type="text" name="company-name">


text:
Q: service method not returning a promise At the moment in my angular 8 application, promise call isnt returning me an exception when an exception occurs. Could somebody tell me how do i make getRepApprovedName to return a promise . If i use return http.get I am getting a syntax error saying brace bracket expected.
Component
 private getRepCode = (repCode: string) => {
    this.loading = true;
    const repToSend = fromGenistarCode(repCode);
    if (repToSend === 0) {
      this.splitSaleDetails.repName = '';
      return;
    }
    this.inviteService.getRepApprovedName(repToSend, this.currentUserId).then(rep => {
      if (rep) {
        this.splitSaleDetails.repName = rep.name;
      } else {
        this.splitSaleDetails.repName = '';
      }
      this.fieldDataChanged(new SetSplitSaleDetails(this.splitSaleDetails));
      this.loading = false;
    }).catch((err) => {
        console.log(err.message);
      return this.messageService.add(err.message, 'warning', true);
    });

Service
public getRepApprovedName = (repId: number, loggedInUserId: number): Promise<any> =>
      this.http.get(`${this.baseUrl}representative-name/${repId}/${loggedInUserId}`).toPromise()

Proposed solution
  this.inviteService.getRepApprovedName(repToSend, this.currentUserId).subscribe(rep => {
      if (rep) {
        this.splitSaleDetails.repName = rep.name;
      } else {
        this.splitSaleDetails.repName = '';
      }
      this.fieldDataChanged(new SetSplitSaleDetails(this.splitSaleDetails));
      this.loading = false;
    },
    error => {
      this.messageService.add(error.message, 'warning', true);
   });

       public getRepApprovedName = (repId: number, loggedInUserId: number): Observable<any> =>
      this.http.get(`${this.baseUrl}representative-name/${repId}/${loggedInUserId}`)

A: You should use Observable with HttpClient and subscribe method.
this.inviteService.getRepApprovedName(...).subscribe(
  result => {
     // ok
  },
  error => {
     // catch error
  }
);

Your get method:
getRepApprovedName(...): Observable<YourResultType> {
  return this.http.get<YourResultType>(...your url...);
}

HttpClient get method returns an Observable and will automatically catch an error in case of any issue.


text:
Q: Is there a way to display the directory / folder size? So, I've been searching everywhere for what I'm looking for and a few times I thought I struck gold but 99% of the time it wasn't in the correct language.
Does anyone know how I can output the size of my site's directory folder in HTML using JS. I tried using var x = new Date(document.lastModified);document.write(document.lastModified) but instead of document.lastModified I tried document.size but no, that didn't work.
And 50% of what I did manage to find that I thought would work, as well didn't.


text:
Q: GET Request for Users Salesforce.com Status (Integrated / Not)? As the title says, I'm wondering if anyone knows the URL to query if a user is Integrated with SF in MC or not?
I thought maybe I could find that info with "platform/v1/accounts/{mid}/users" but its just returned some basic info.
Any help would be greatly appreciated!
Thanks

A: The endpoint you are referring to is unofficial and undocumented, so I wouldn't depend on using it in a production setup.
User info is available through SOAP API, but unfortunately there are no objects that hold the information about Salesforce integration status.
Below is a list of all information queryable from the SOAP object AccountUser:

AccountUserID - Specifies the Marketing Cloud identifier of an account
user
ActiveFlag    - Specifies the status of an account user
AssociatedBusinessUnits   -   Indicates the business units the account
user is associated with and can access. This property is
non-retrievable.
BusinessUnit  -   Specifies the account identifier of the business unit
ChallengeAnswer   -   Specifies the challenge answer for login assistance
ChallengePhrase   -   Specifies the challenge answer for login assistance
Client    -   Specifies the account ownership and context of an object.
CorrelationID -   Identifies correlation of objects across several
requests.
CreatedDate   -   Read-only date and time of the object's creation.
CustomerKey   -   User-supplied unique identifier for an object within an
object type. This property corresponds to the external key assigned to
an object in Marketing Cloud.
DefautApplication -   Specifies app the account user initially accesses
DefaultBusinessUnit   -   Indicates that business unit account user
initially accesses
DefaultBusinessUnitObject -   Specifies the default business unit for a
user.
Delete    -   Indicates whether an object gets deleted.
Email -   Default email address for object. Indicates if subscriber
information can be used for email sends.
ID    -   Read-only identifier for an object. Some objects use the ObjectID
property as the Marketing Cloud unique ID.
IsAPIUser -   Indicates if a user can use the API. A value of true
indicates that the user's password remains the same until actively
changed.
IsLocked  -   Indicates if account user can or cannot log into their
account LanguageLocale    Locale  Defines language preferences associated
with a account, business unit, or user.
LastSuccessfulLogin   -   Indicates data and time user last successfully
logged in (read-only). Locale Locale  Contains the locale information
for an Account. If no location is set, Locale defaults to en-US.
ModifiedDate  -   Indicates the last time object information was
modified.
MustChangePassword    -   Indicates whether user must change password on
next login
Name  -   Name of the object or property.
NotificationEmailAddress  -   Indicates email address to which to send
notifications
ObjectID  -   System-controlled, read-only text string identifier for
object.
Owner -   Describes account ownership of subscriber in an on-your-behalf
account.
PartnerKey    -   Unique identifier provided by partner for an object. This
property is accessible only via API.
PartnerProperties -   A collection of metadata supplied by the client
and stored by the system. These properties are accessible only via
API.
Password  -   Property definition.
Roles -   Collection of roles defined for an account.
SsoIdentities -   Identifies single sign-on identities associated with
the account user.
TimeZone  -   Contains time zone information for an Account. For Create
and Update calls, this property defines the time zone for an Account
object. On a Retrieve call, TimeZone indicates which time zone is in
effect for the Account object in question. Without a specific time
zone, the Account defaults to Central Standard Time.
Unlock    -   Indicates whether user gets unlocked
UserID    -   Indicates username for an account.
UserPermissions   -   For internal use only

See more here: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/accountuser.html


text:
Q: Where can I view tools or packages availble in Homebrew I am trying homebrew for the first time. I used to use macports.
In macports, it is quick clear which ports are available, and their versions (http://www.macports.org/ports.php).
Is there any such website / tools in hombrew?
Thanks!

A: You can browse the Formula directory on GitHub. Or type brew search.
There is even a website braumeister.org.

A: Following Jerome Mahuet's answer, I could not find how to locate various versions of a particular formula.
here is what my problem was:

*

*I installed homebrew as instructed on the website

*This installed the very basics of homebrew, but did not install the .git repository folder

*As a result, brew versions ruby did not work

*to fix this, simply type brew update

You can then view the versions via
brew versions ruby


text:
Q: Get addressbook group for particular contact In my app i am getting contacts like this..
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);
for( int i=0;i< nPeople;i++)
{
        ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i);
        CFStringRef firstName = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
        .....
        and so on
}

can anyone suggest me how to get the group for nPeople.

A: Check the following documentation
http://developer.apple.com/library/mac/#documentation/UserExperience/Reference/AddressBook/Classes/ABPerson_Class/Reference/Reference.html#//apple_ref/occ/instm/ABPerson/parentGroups
There is a method parentGroups which returns the array of groups to which the person belongs...........


text:
Q: ISP IP address confusion I am using static IP provided by my ISP.
Recently I required to setup a host for video call conference by Polycom RealPresence Desktop, which required Static IP.
I had 1 ip already  ***.***.88.205. Then I asked my ISP to provide me an additional IP.
Now they emailed me that please use the below LAN subnet ***.***.88.224/30, now I am confused how to use this IP.

A: Tl;dr ask your ISP prior to making changes and consult the camera vendor since you may have an XY problem
If you have a security or risk management department, consult with them too. There are real security implications to each of the possible configurations.
The subnet xx.xx.88.224/30 has the following characteristics:
88.224 is the "network ID" and 88.237 is the "broadcast ID"
The "usable IPs" 88.225 and 88.226 are left over, but the question remains of who is meant to use them, you or your ISP?
There are a few possibilities:

*

*They want you to use 88.225 and 88.226 by putting them on your router's DMZ or otherwise introducing an internal route to the 88.224/30 subnet.
In turn the ISP will be routing external traffic to your router based on some other address.
The ISP I work with would use your old static IP of 88.205 for this purpose, meaning you would not need to change your router's WAN configuration.
I suspect that they could also begin to assign DHCP to your router, and bind your subnet to that IP, but that's enough of a headache that it's unlikely.

*Ask them before trying this configuration--they will NOT be happy if you cause a broadcast storm!
Your ISP presumably provides one physical connector. They may mean to have you bridge the device that's plugged into that connector, or install a switch, and continue to use 88.205 with your current gateway and netmask on one device and additionally program the second device or router to use the following information:
IP: xx.xx. 88.226
Gateway: xx.xx.88.225
Subnet Mask: 255.255.255.252

*This configuration is incredibly obnoxious to implement.
Your ISP may expect you to use both usable IPs similar to option 1, but without a third IP on your router's WAN. To make this work, they would provide a gateway that's outside of your subnet like some hosting providers.
You also need more clarity from your video conferencing vendor.
Often, needing "a static IP" is not the same as needing "a unique public static IP for just this device." Odds are, you can achieve the objective without needing to pay for two public IPv4 addresses.
Consider the following diagram:
ISP > your router using 88.205 publicly > the device that caused you to rent the first static IP AND other devices that don't care what kind of public address they get.
If that diagram sounds familiar you can probably use whatever method your first device is working with to configure the video system so that they're both behind the existing public static.
How:
By default your router is probably NATing the internal subnet 192.168.0.0/24. Your router listens on .1 as the gateway.
DHCP scope beginning .2 ending .254 (not .255 because .255 is the broadcast address)
Whatever device/service currently requires you to have a static is probably either given a "DHCP reservation" in the router to assure that it always gets the same internal address, or you have been real lucky.
Rather than reservations, you could change the DHCP scope to .4-.254 and program your existing device to use .2 statically and use .3 statically on the new video system.
Even better, pull from the high end of the subnet so that if your router gets factory reset it doesn't immediately vend a conflicting IP. *

[*] yes it's supposed to arp first but I've seen that fail too often to trust


text:
Q: Facebook API: AppID|AppSecret token? I am using JS to fetch a page feed using the facebook graph API, but in order to fetch the page's feed I need an access token. My current access token is set to expire in an hour, but I can use AppID|AppSecret as a permanent access token.
My question is: Since viewing the page source will show the acess token, is using the appID|appSecret combination a safe approach to having a permanent access_token?

var facebookFeed = [];
window.fbAsyncInit = function () {
    FB.init({
        appId: '173668203065748',
        xfbml: true,
        version: 'v2.7'
    });
    FB.api(
        '/officialstackoverflow/feed',
        'GET', {
            "access_token": "EAACEdEose0cBACP92ZBJexyw6OhDqs7SbBIme4CSisaI4UDgbJHDOa0NVjoXOXSJB7SD6549CB6M3KAdV11ySAn6wlJAMI4YEFEdfw2cM9JpovUG4NZC3VsCWcajbXfXWSWMmQQDR1fM9bzk6YPxMUYOiqBQnWrEm0IzbaCQZDZD",
            "fields": "full_picture,message,created_time,type,link,id"
        },
        function (response) {
            writePosts(response.data);
        }
    );
};

(function (d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {
        return;
    }
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

function writePosts(facebookFeed) {
    for (i = 0; i < facebookFeed.length; i++) {
        var currentPost = facebookFeed[i];
        var myDate = new Date(currentPost.created_time);
        if (currentPost.type == "photo" || currentPost.type == "status") {
        if(!currentPost.link)currentPost.link="http://facebook.com//"+currentPost.id;
            console.log(currentPost);
                   }
    }
}
.facebookText {
 font-size: 16px;
 font-weight: 600;
 font-family: sans-serif;
}

.facebookImage {
 width: 100%;
 border:1px solid rgba(0,0,0,0.1)
}

.facebookPost {
 width: 400px;
 border-bottom: 1px solid rgba(0, 0, 0, 0.3);
 box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.3);
 margin-bottom: 20px;
 padding: 10px 5px 3px 5px;
 transition: 0.3s ease all;
}

.facebookPost:hover {
 cursor: pointer;
 box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.5);
}

.facebookTime {
 font-size: 12px;
 font-style: italic;
 padding: 5px 0px;
}

A: It is called "App Secret" for a reason, you should not expose it on the client. You should not expose any Token to other users anyway. You need to do that server side, and you should implement some caching - just in case you get many users and hit an API limit.


text:
Q: Formatting a paragraph to conform to 80% of the browser size not 100% I'm creating pages for a site, and I've been having to use
 scripts to conform the text to make it readily readable on smaller devices as well as larger.
Is there a way to constrain the text to a percentage of the page without altering the other content? (at 80% of the browser window) much like an image can be constrained to the size of the browser page. Would I need to create an actual text document and insert it as an image?
I've tried using "textarea", "body", "hgroups", and "p" to no avail. I'm referring to using something like:

but with a text area, box, etc. and allowing it to expand vertically as an inverse proportion to the width. I'm not really picky so long as it doesn't need a scroll bar and can display the entire paragraph. I'm not looking to change the size of the text itself.
In a sense that makes the width and height inverse properties so that all the text will be viewable. It should still conform to the browser window at a certain percentage of the window rather than the default 100%. I've also tried using borders, margins, and padding. I have the feeling I'm just missing a key component.

A: #some_div{
  width:80%;
  margin-left:none;
 }

Add width as 80% and take out left margin and also padding if possible.

A: I'm not sure I understood you quite well. Is it making a text be like a background image? To be behind of all the content and adjust according to the window size?
If so, maybe this?
div.text-bg-container {
  position:absolute;
  width:100%
  height:100%;
  font-size:80%
  z-index:-1;
}

A: Simplest way I can think of:
p.full-width {
    width:80%;
    padding: 0 20% 0 20%;
    text-align:left;
}

A: HTML: structure (which boxes are within other boxes)
CSS: styling (setting widths, borders, animations)
JS: interaction (add click listeners, send JSONs over http://, etc)

Target your HTML
 tag or whatever with DOM selectors:
CSS:
.someDivClass {
    width: 80%
}
#someDivID {
    left: 0%,
    right: 20%
}

JS:
var element = document.querySelector(".someDivClass")
or
var element = document.querySelector("#myID")
then
element.setAttribute("style", "width:80%");
or
element.addEventListener("click", function (e) {
    alert('hello')
});
for example

Only one element can have a unique ID id="myDivID", where as many elements can have the same class="myDivClass" defined in their
 tag (div is the most basic DOM element, and most every DOM element is a div with additional, baked in functionality by default)
Good luck!

A: If you need to set the size of an element relative to browser window, you can use Viewport-percentage lengths. Something like:
p {
    font-size: 10vw;
}

Here is a simple jsFiddle example. Resize your browser window to see the difference.


text:
Q: How can I ask for an input again instead of just having an error So I want to ask the user for an input. The thing is that I also want the program to give an error message and ask for an input again if the user, instead of a number, try and type something that's not a number.
public class Mystuff {
    public static void main(String[] args) {
        System.out.println("Write your string");
        String s = SubProgram.string();
        System.out.println("The string: " +s);
        int i = SubProgram.getInt();
        System.out.println("The int: " +i);
    }
}

Classes:
import java.util.Scanner;

public class SubProgram {
    private static final Scanner INPUT = new Scanner(System.in);

    public static String string() {
        String s = INPUT.nextLine();
        return s;
    }

    public static int getInt(){
            System.out.println("Write your number");
            int num = INPUT.nextInt();
            return num;

}
}

A: To repeat something, use a loop.
The basic pattern is:
 do {
    print a prompt;
    read input;
    validate input;
    if not valid, print error message;
 } while (valid input has not been provided);

A reasonable approach is to set some flag (say, valid) true or false in the "validate input" step, and then the loop is while (!valid).
For use of nextInt(), it will throw an exception if the input is not a valid integer. You'll need to catch that exception (see try-catch statement) and use that to set "not valid".
  do {
      try {
         ..blah blah
         n = scanner.nextInt();
         valid = true;
      }
      catch (NumberFormatException ex) {
         print error here;
         valid = false;
      }
 }  while (!valid);

I trust that, with these sketches of a solution, you can write the actual code.

A: As you have already been informed, use a loop, for example:
public static int getInt(){
    String num = null;
    while (num == null) {
        System.out.println("Write your number");
        num = INPUT.nextLine();
        if (!num.matches("\\d+")) {
            System.err.println("Invalid number supplied! (" + num + ")");
            num = null;
        }
    }
    return Integer.valueOf(num);

}


text:
Q: How to Use Timers in Windows What are the various ways that a timer can be set up using the Windows API. What are the pros and cons of each method?
I'm using MS DevStudio's C++.

A: There are two timer related functions on the Windows system: SetTimer and KillTimer (I know, the names are odd - CreateTimer and DestroyTimer would be more sensible, as in CreateWindow and DestroyWindow, but that is what is available).
SetTimer can function in one of two modes: the timer event can trigger a user defined callback or it can post a message to a window. The format of this function is:
timer_id = SetTimer (window, event_id, interval, callback);

To use a callback:
timer_id = SetTimer (NULL, NULL, interval_in_milliseconds, callback);

To get a WM_TIMER message to a window:
timer_id = SetTimer (window, event_id, interval_in_milliseconds, NULL);

In both cases, the calling thread needs to have a message queue as both variants issue a WM_TIMER message, the default handler calls the callback function.
Depending on the OS you're using the value of interval has upper and lower bounds. See the API documentation for more details.
To release the timer after you're finished with it do the following if you provided a window handle:
KillTimer (window, event_id); // event_id is important!

and if you used a callback:
KillTimer (NULL, timer_id);

A single window can have many timers associated with it, use a different event_id for each timer. Reusing an event_id stops the first instance of the timer without posting the WM_TIMER message.
Pros: fairly easy to use.
Cons: latency between interval end and processing of WM_TIMER message, resolution is large, requires a message processing loop.

A: Another method for handling timers is to use waitable timer objects. These don't require any message processing, don't use WM_TIMER or callbacks. As such, they're a bit more complex. Understanding the Windows event system will be helpful.
There are three types of timer objects: manual-reset, synchronisation and periodic; and there are four functions for handling the timer objects: CreateWaitableTimer, SetWaitableTimer, CancelWaitableTimer and CloseHandle (there is a fifth, OpenWaitableTimer but that is unlikely to useful to many people). There are also a set of functions required for notification of when a timer expires: WaitForSingleObject, MsgWaitForSingleObject, WaitForMultipleObjects and MsgWaitForMultipleObjects being the most useful.
The usual method for using these timers is:
CreateWaitableTimer (...)
SetWaitableTimer (...)
WaitForSingleObject (...)
CloseHandle (...)

Compare this to SetTimer - the only way to know if a timer has expired is to poll it, either in a loop or with an infinte timeout (i.e. suspend the thread until the timer elapses).
Pros: very flexible, no need to have a message queue.
Cons: hard to use

A: Usually, look at the API you are going to use, for example MFC, Qt or GTK; they all have timer classes.
If you're not going to use a GUI API, I personally like boost::timer (www.boost.org)

A: For high resolution timers, use queryperformancecounter


text:
Q: What's the best method to identify outliers and influential cases for linear mixed models? I've seen many many many different questions on how to extract Leverage and Cook's distance for Lmers. I'm able to do that with different packages and functions by now, but how should I interpret them ? I've seen many different answers to that ...
A more general question should be: What's the best method to identify outliers and influential cases for linear mixed models?. For now, I believe Leverage and Cook's distance would do the job, but I'm open to better methods.

*

*A reproducible example:

### fit model:
ModAdditive <- lmer(SCORE ~ PROFICIENCY_c + TASK_TYPE + (1|ID),
     data = data, REML = FALSE)

*

*extracting Leverage and Cook's values:

### Check for outliers and influential cases:

### Check for general outliers:

data %>% dplyr::select(ID, SCORE, PROFICIENCY_c, TASK_TYPE) %>%
  group_by(TASK_TYPE) %>% rstatix::identify_outliers(SCORE)

### leverage: ###

library(HLMdiag) ## or
library(influence.ME) ## or

# with: library(HLMdiag):

influential <- HLMdiag::hlm_influence(ModAdditive, value = fixef)

### with lme4:
hatvalues(ModAdditive)

### with influence.ME:

influence(ModAdditive, obs = TRUE)

### Cook's distance ###

### Calculate Cook's distance:

cooksd <- cooks.distance(ModAdditive) ## with stats

HLMdiag::hlm_influence(modAdditive) ## with hlm

*

*Questions:

*Question1: is this the best approach to account for outliers in the data?

*Question2: For Cook's distance, I've seen that no obs should have and absolute value greater than 1, so would this be correct:
### check if there is any value bigger than 1:
### ref: no greater than 1 (FIELD, 2012) or 4/n (the whole internet)

if (any(abs(cooksd) > 1)) {
  print('yey')
} else {
  print('no')
}

*

*Question 3 : for Leverage values, I've seen: # Leverage values can lie between 0 (indicating that the case has no influence whatsoever) # and 1 (indicating that the case has complete influence over prediction). If no cases exert undue influence over the model then we would expect all of the leverage values to be close to the average value ((k + 1)/n). (FIELD, 2012)
So, should I check if any values in influential$leverage.overall is > 1 ? Would that be enough? How should I interpret influential$mdffits influential$covtrace influential$covratio ?

*

*Question4 : how good is performance check_outilers() function?

*data:

dput(data)
structure(list(ID = structure(c("PART_1", "PART_1", "PART_2",
"PART_2", "PART_3", "PART_3", "PART_4", "PART_4", "PART_5", "PART_5",
"PART_6", "PART_6", "PART_7", "PART_7", "PART_8", "PART_8", "PART_9",
"PART_9", "PART_10", "PART_10", "PART_11", "PART_11", "PART_12",
"PART_12", "PART_13", "PART_13", "PART_14", "PART_14", "PART_15",
"PART_15", "PART_16", "PART_16", "PART_17", "PART_17", "PART_18",
"PART_18", "PART_19", "PART_19", "PART_20", "PART_20", "PART_21",
"PART_21", "PART_22", "PART_22", "PART_23", "PART_23", "PART_24",
"PART_24", "PART_25", "PART_25", "PART_26", "PART_26", "PART_27",
"PART_27", "PART_28", "PART_28", "PART_29", "PART_29", "PART_30",
"PART_30", "PART_31", "PART_31", "PART_32", "PART_32", "PART_33",
"PART_33", "PART_34", "PART_34", "PART_35", "PART_35", "PART_36",
"PART_36", "PART_37", "PART_37", "PART_38", "PART_38", "PART_39",
"PART_39", "PART_40", "PART_40", "PART_41", "PART_41", "PART_42",
"PART_42", "PART_43", "PART_43", "PART_44", "PART_44", "PART_45",
"PART_45", "PART_46", "PART_46", "PART_47", "PART_47", "PART_48",
"PART_48", "PART_49", "PART_49", "PART_50", "PART_50", "PART_51",
"PART_51", "PART_52", "PART_52", "PART_53", "PART_53", "PART_54",
"PART_54", "PART_55", "PART_55", "PART_56", "PART_56", "PART_57",
"PART_57", "PART_58", "PART_58", "PART_59", "PART_59", "PART_60",
"PART_60", "PART_61", "PART_61", "PART_62", "PART_62", "PART_63",
"PART_63", "PART_64", "PART_64", "PART_65", "PART_65", "PART_66",
"PART_66", "PART_67", "PART_67", "PART_68", "PART_68", "PART_69",
"PART_69", "PART_70", "PART_70", "PART_71", "PART_71"), class = c("glue",
"character")), SCORE = c(65.7, 65.08, 65.8, 61, 74.45, NA, 68,
71.18, NA, 68.46, NA, NA, 53.75, 62.75, 73.94, 66.32, 67.24,
73.42, 58.22, 59.83, NA, NA, NaN, 51.8, 71.07, 64.77, 68.07,
67.88, NaN, NaN, 69.88, 72.27, 71.32, 64.25, 62.18, NaN, 58.65,
62.6, 76.45, 54.75, 71.13, 64.74, 67.25, NA, NaN, NaN, 51.76,
51.58, 69.33, 67.05, 68.17, 62.38, 58, 64.57, 54.27, NA, 68.05,
65.56, NaN, NaN, NA, NA, 61, 70.71, 61.67, NA, NA, NA, 67.79,
68.1, 65.93, NA, NA, 58.43, NA, NA, 59.27, 55, 69.67, 65.29,
71.38, NA, 70, 58.86, NaN, NaN, 64.88, 64.18, 68.19, NA, 62.06,
70.33, 61, 58.5, 55.48, 64.84, 65.67, 65.19, 67.72, 63.14, 68.47,
59.12, 64, NaN, 65.11, 62.75, 66, NA, 67.5, NaN, 66.33, 68.82,
NA, 65.04, 69.61, 66.78, 69.33, 64.86, 75.67, 69.06, 68.17, 69.94,
63, 59.31, NA, 65.15, 58.81, 55.83, NA, 67.71, NA, NA, NA, NA,
66.5, 69, 62.33, 58.83, 65, 60.65, NA, NA), PROFICIENCY_c = c(41.32,
41.32, -22.68, -22.68, -26.68, -26.68, 37.32, 37.32, -47.68,
-47.68, -46.68, -46.68, -26.68, -26.68, 13.32, 13.32, 41.32,
41.32, 5.32, 5.32, -56.68, -56.68, -39.68, -39.68, 40.32, 40.32,
27.32, 27.32, 1.32, 1.32, 49.32, 49.32, 36.32, 36.32, -23.68,
-23.68, 1.32, 1.32, -49.68, -49.68, 19.32, 19.32, 2.32, 2.32,
2.32, 2.32, 8.32, 8.32, 46.32, 46.32, 40.32, 40.32, -7.68, -7.68,
-37.68, -37.68, 6.32, 6.32, -28.68, -28.68, -57.78, -57.78, 18.32,
18.32, -4.68, -4.68, -44.68, -44.68, 44.32, 44.32, -10.68, -10.68,
-57.98, -57.98, -56.68, -56.68, -19.68, -19.68, 35.32, 35.32,
21.32, 21.32, -50.68, -50.68, -28.68, -28.68, 44.32, 44.32, 54.32,
54.32, 32.32, 32.32, 0.32, 0.32, -2.68, -2.68, 27.32, 27.32,
40.32, 40.32, 13.32, 13.32, -24.68, -24.68, -26.68, -26.68, -52.68,
-52.68, -14.68, -14.68, 40.32, 40.32, 6.32, 6.32, 39.32, 39.32,
51.32, 51.32, 43.32, 43.32, 28.32, 28.32, -8.68, -8.68, 30.32,
30.32, -22.68, -22.68, 34.32, 34.32, -50.68, -50.68, -47.68,
-47.68, 19.32, 19.32, -10.68, -10.68, 18.32, 18.32, -54.68, -54.68
), TASK_TYPE = structure(c(2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L), .Label = c("N", "A"), class = "factor")), row.names = c(NA,
-142L), class = c("tbl_df", "tbl", "data.frame"))

A: Since doing anything about these findings can distort inference, you have to question why do them.  (That is especially true for outliers).  Best to use methods that are not greatly effected by outliers or high leverage points.  For outliers, semiparametric ordinal models can be used (see here) and for collinearities, reformulate the model using unsupervised learning (data reduction) techniques such as variable clustering.  I go into this in Chapter 4 of RMS.


text:
Q: OTP Google Acc. Compatible I'm working on the implementation of a OTP Google Acc. compatible.
So far, I've been using
-RFC2104(http://www.ietf.org/rfc/rfc2104.txt),
-RFC4226(http://www.ietf.org/rfc/rfc4226.txt),
-RFC6238(https://www.rfc-editor.org/rfc/rfc6238), and following this schema :
[Pseudo code Time OTP] (http://en.wikipedia.org/wiki/Google_Authenticator#Pseudocode_for_Time_OTP)
function GoogleAuthenticatorCode(string secret)
 key := base32decode(secret)
 message := floor(current Unix time / 30)
 hash := HMAC-SHA1(key, message)
 offset := value of last nibble of hash
 truncatedHash := hash[offset..offset+3]  //4 bytes starting at the offset
 Set the first bit of truncatedHash to zero  //remove the most significant bit
 code := truncatedHash mod 1000000
 pad code with 0 until length of code is 6
 return code

Until "  hash := HMAC-SHA1(key, message)  " everything is ok. I checked multiple time the result through other HMAC-SHA1 converters. (Well, I think so).
But then, I think something must go wrong ... because obviously I'm not getting the same code as my google-authenticator app (android). (At least it's still a 6-digits value).
The part I'm not quiet sure to understand well is :
 offset := value of last nibble of hash
 truncatedHash := hash[offset..offset+3]  //4 bytes starting at the offset
 Set the first bit of truncatedHash to zero  //remove the most significant bit

Could someone give me a more detailed explanation on this ?
Thanks,

A: My guess would be that you may take the value of offset incorrectly.
The statement

value of last nibble of hash

is pretty vague if you don't have a proper definition of bit and byte ordering.
Quoted wikipedia page has links to a number of implementations, I think this Java implementation is something to check your code against:
byte[] hash = ...

// Dynamically truncate the hash
// OffsetBits are the low order bits of the last byte of the hash
int offset = hash[hash.length - 1] & 0xF;


text:
Q: XSLT How to apply recursion to transform from a flat file to a nested tree I know that there are several other question/answers similar to this, but I haven't read one that addresses my confusion over this transform. I need to move an XML document from this format:
<root>
    <row>
        <t0>1</t0>
        <title>Main Title</title>
    </row>
    <row>
        <t0>2</t0>
        <title>Secondary Title</title>
        <note>Note</note>
    </row>
    <row>
        <t0>3</t0>
        <title>Tertiary Title</title>
    </row>
    <row>
        <t0>3</t0>
        <title>Another Title</title>
    </row>
    <row>
        <t0>2</t0>
        <title>A Second Secondary Title</title>
        <note>Note</note>
    </row>
    <row>
        <t0>3</t0>
        <title>Third Level Title</title>
    </row>
    <row>
        <t0>3</t0>
        <title>Title at Level Three</title>
    </row>
</root>

to this format:
<root>
    List
    <t01>
        <title>Main Title</title>
        <t02>
            <title>Secondary Title</title>
            <note>Note</note>
            <t03>
                <title>Tertiary Title</title>
            </t03>
            <t03>
                <title>Another Title</title>
            </t03>
        </t02>
        <t02>
            <title>A Second Secondary Title</title>
            <note>Note</note>
            <t03>
                <title>Third Level Title</title>
            </t03>
            <t03>
                <title>Title at Level Three</title>
            </t03>
        </t02>
    </t01>
</root>

I'm using XSLT 2.0 and I'm getting hung up on applying for-each-group recursively. Thanks for your time & trouble.

A: With XSLT 2.0 I would strongly suggest to use the for-each-grouping together with a recursive function or template; below is a sample using a function:
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="2.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:mf="http://example.com/mf"
  exclude-result-prefixes="xs mf">

<xsl:output indent="yes"/>

<xsl:function name="mf:group" as="element()*">
  <xsl:param name="elements" as="element(row)*"/>
  <xsl:param name="level" as="xs:integer"/>
  <xsl:for-each-group select="$elements" group-starting-with="row[t0 = $level]">
    <xsl:element name="t{format-number($level, '00')}">
      <xsl:copy-of select="* except t0"/>
      <xsl:sequence select="mf:group(current-group() except ., $level + 1)"/>
    </xsl:element>
  </xsl:for-each-group>
</xsl:function>

<xsl:template match="root">
  <xsl:copy>
    List
    <xsl:sequence select="mf:group(row, 1)"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>

A: Please give this a try:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes"/>

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

  <xsl:template match="/root">
    <root>
      List
      <xsl:apply-templates select="row[t0 = 1]" />
    </root>
  </xsl:template>

  <xsl:template match="row">
    <xsl:variable name="level" select="t0" />

    <xsl:element name="{concat('t0', $level)}">
      <xsl:apply-templates select="title | note" />
      <xsl:variable name="nextPeer"
            select="following-sibling::row[t0 <= $level]" />
      <xsl:variable name="children"
            select="following-sibling::row[t0 = $level + 1][not($nextPeer)
                 or (count(preceding-sibling::row) < count($nextPeer[1]/preceding-sibling::row))]" />

      <xsl:apply-templates select="$children" />
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>


text:
Q: Neo4j : Retrieving All Nodes and Relationship connected to a Node in Neo4j Rest OR through Cypher I want to Retrieve all nodes and relationship connected to a node.
I Tried to do this in two ways:
1st Through Neo4j REST API i Tried this
URI traverserUri = new URI( startNode.toString() + "/traverse/node" );
WebResource resource = Client.create()
        .resource( traverserUri );
String jsonTraverserPayload = t.toJson();
ClientResponse response = resource.accept( MediaType.APPLICATION_JSON )
        .type( MediaType.APPLICATION_JSON )
        .entity( jsonTraverserPayload )
        .post( ClientResponse.class );

System.out.println( String.format(
        "POST [%s] to [%s], status code [%d], returned data: "
                + System.getProperty( "line.separator" ) + "%s",
        jsonTraverserPayload, traverserUri, response.getStatus(),
        response.getEntity( String.class ) ) );
response.close();

And get Following Response :
[ {
  "outgoing_relationships" : "http://localhost:7474/db/data/node/82/relationships/out",
  "data" : {
    "band" : "The Clash",
    "name" : "Joe Strummer"
  },
  "traverse" : "http://localhost:7474/db/data/node/82/traverse/{returnType}",
  "all_typed_relationships" : "http://localhost:7474/db/data/node/82/relationships/all/{-list|&|types}",
  "property" : "http://localhost:7474/db/data/node/82/properties/{key}",
  "all_relationships" : "http://localhost:7474/db/data/node/82/relationships/all",
  "self" : "http://localhost:7474/db/data/node/82",
  "properties" : "http://localhost:7474/db/data/node/82/properties",
  "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/82/relationships/out/{-list|&|types}",
  "incoming_relationships" : "http://localhost:7474/db/data/node/82/relationships/in",
  "incoming_typed_relationships" : "http://localhost:7474/db/data/node/82/relationships/in/{-list|&|types}",
  "create_relationship" : "http://localhost:7474/db/data/node/82/relationships"
}, {
  "outgoing_relationships" : "http://localhost:7474/db/data/node/83/relationships/out",
  "data" : {
  }]

But the problem is if i want to see the relationship of this node again i will have to hit the link "http://localhost:7474/db/data/node/82/relationships/all"
Cant we get Data in which Node and its relationship are shown directly instead of link to relationship without hitting the link again????
2nd thing I have tried to do is to get this from cypher query  :
START a=node(3)
MATCH (a)-[:KNOWS]->(b)-[:KNOWS]->(c)-[:KNOWS]->(d)
RETURN a,b,c,d

But this also didn't work because at (b) and (c) there will be multiple values as a result for which i will have to iterate and write another query
Cant we get this done in single query because i have so many connected relationship that it is getting hard to iterate again and again. Any Help would be Appreaciated.

A: It's easy to get all nodes connected to a given node with Cypher
START a=node(3)
MATCH (a)-[:KNOWS*]->(d)
RETURN distinct d

But if you have large number of connected nodes and deep connections, you might not get a good performance.
If you know the bounds of the connections, specify it explicitly in the query would be helpful for performance,
START a=node(3)
MATCH (a)-[:KNOWS*1..3]->(d)
RETURN Distinct d

A: Regarding the question about multiple nodes, or duplicate nodes. I understand what you mean. Here is something I did with such a query to weed out duplicates. More about if a KNOWS b which KNOWS c, but c is really a. Kind of like that. We can use something like WHERE NOT
start player=node({0})
          match player-[:player.active*2..2]-friendsOfFriends,
          where not(player-[:player.active]-friendsOfFriends) and player <>     friendsOfFriends
          return distinct friendsOfFriends
          order by friendsOfFriends.username asc

A: If you make your query
MATCH (a)-[r1:KNOWS]->(b)-[r2:KNOWS]->(c)-[r3:KNOWS]->(d) RETURN a,r1,b,r2,c,r3,d;

The r(x) will return the respective details regarding the relationship. There will be a "row" for each path that matches the query.
If you define your deserializer so it recognizes the r(x) and constructs a relationship rather than an entity then you should be able to do it all in one query.


text:
Q: how to share video in twitter with UIActivityViewController When i share a video using the UIActivityViewController, the twitter post does not show the video. However, if it take the same video and post it using the twitter app, the video shows and plays embedded in the post.
I am using this code:
 MyActivityItemProvider * videoItem = [[MyActivityItemProvider alloc] initWithPlaceholderItem:@""];

    NSArray * activityItems = [NSArray arrayWithObjects:
                               videoItem,
                               nil];

    UIActivityViewController *activityViewController = [[UIActivityViewController alloc]
                                                        initWithActivityItems:activityItems
                                                        applicationActivities:nil];

    [self presentViewController:activityViewController animated:YES completion:nil];

And in MyActivityItemProvider, I have this:
@implementation MyActivityItemProvider

- (MyActivityItemProvider * )initWithPlaceholderItem:(NSString *)placeholderItem
{
    self = [super initWithPlaceholderItem:placeholderItem];

    return self;
}
- (id)item
{
    NSString * path = [[NSBundle mainBundle] pathForResource:@"video_name" ofType:@"mp4"];

    NSURL * fileURL = [NSURL fileURLWithPath:path];

    return fileURL;
}

@end

Is it possible for a twitter video post to have the video embedded in it (as if I posted it using the twitter app) when posting using the UIActivityViewController?? Any suggestions on how to achieve this (what it looks) rather simple task?
The video is .mp4 and it is 3.1 MB (like I said, appears to post just fine using the Twitter app and I can send the video via txt message fine).

A: Video cannot be shared with UIActivityViewController.
Thanks to the uploading media new API, you can share video to twitter by it. And I have tried it, it works.
Please check this: https://github.com/liu044100/SocialVideoHelper
You just need to call this class method.
+(void)uploadTwitterVideo:(NSData*)videoData comment:(NSString*)comment account:(ACAccount*)account withCompletion:(VideoUploadCompletion)completion;

A: Try this :
+ (void)shareOnTwiiterFromView:(UIViewController *)vc userTitle:(NSString *)title shareURL:(NSString *)urlString
{
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:
                                               SLServiceTypeTwitter];

        tweetSheet.completionHandler = ^(SLComposeViewControllerResult result)
        {
            switch(result)
            {
                case SLComposeViewControllerResultCancelled:
                    break;
                case SLComposeViewControllerResultDone:
                    break;
            }
        };

        NSString *twTitle = [NSString stringWithFormat:@"%@ %@",title,@"Your App Name"];
        [tweetSheet setInitialText:twTitle];

        if (![tweetSheet addURL:[NSURL URLWithString:urlString]])
        {
            NSLog(@"Unable to add the URL!");
        }

        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
        {
            UIPresentationController *control = tweetSheet.presentationController;
            [tweetSheet setModalPresentationStyle:UIModalPresentationFormSheet];

             [vc presentViewController:control.presentedViewController animated:YES completion:^
             {
                 NSLog(@"Tweet sheet has been presented.");
             }];
        }
        else
        {
             [vc presentViewController:tweetSheet animated:NO completion:^
             {
                 NSLog(@"Tweet sheet has been presented.");
             }];
        }
    }
    else
    {
        [APP_DEL showErrorAlert:@"No Twitter Account" description:@"There are no twitter accounts configured. You can add or create a Twitter account in Settings."];
    }
}


text:
Q: How to enable su logging in CentOS release 6.6 how can i enable logging to a file every time as user uses the su command to switch to root or any other user?
Previously i was achieving this by adding an entry to cs-auth file as below
echo "session required pam_unix.so" >> /etc/pam.d/cs-auth

But in the CentOS release 6.6 release i have a system-auth file so what change needs to be made to system-auth file such that i can enable su logging?
Found a similar question but no suitable answer.
Linux Log all the su to root messages

A: su logging is by default present in centos 6.6 machine and can be added by adding the below entry
echo "session required pam_unix.so"

to /etc/pam.d/system-auth and logs are present in the file /var/log/secure.


text:
Q: Why can't I which pushd I've been using pushd and popd for a long time while writing bash script. But today when I execute which pushd, I get nothing as output. I can't understand this at all. I was always thinking that pushd is simply a command, just like cd, ls etc.
So why does which pushd give me nothing?

A: popd and pushd are commands built into Bash, they're not actual executables that live on your HDD as true binaries.
excerpt bash man page
   DIRSTACK
          An array variable (see Arrays below) containing the current
          contents of the directory stack.  Directories appear in the stack
          in the order they are displayed by the dirs builtin.  Assigning to
          members of  this  array variable may be used to modify directories
          already in the stack, but the pushd and popd builtins must be used
          to add and remove directories.  Assignment to this variable will
          not change the current directory.  If DIRSTACK is unset, it loses
          its special properties, even if it is subsequently reset.

The full list of all the builtin commands is available in the Bash man page as well as here - http://structure.usc.edu/bash/bashref_4.html.
You can also use compgen -b or enable to get a full list of all these builtins:
compgen
$ compgen -b | grep -E "^push|^pop"
popd
pushd

enable
$ enable -a | grep -E "\bpop|\bpus"
enable popd
enable pushd

Additionally if you want to get help on the builtins you can use the help command:
$ help popd | head -5
popd: popd [-n] [+N | -N]
    Remove directories from stack.

    Removes entries from the directory stack.  With no arguments, removes
    the top directory from the stack, and changes to the new top directory.

$ help pushd | head -5
pushd: pushd [-n] [+N | -N | dir]
    Add directories to stack.

    Adds a directory to the top of the directory stack, or rotates
    the stack, making the new top of the stack the current working


text:
Q: mdadm RAID0 array recovery I have a Linux file server with two 12-disk MD1000 disk arrays attached to a RAID controller. Unfortunately, a power blip has caused a loss of configuration data on the RAID controller and it is now reporting no disk configuration. I have no backup or record of the original configuration.
Looking at the server log from the last time it successfully booted, it uses mdadm to construct a RAID0 array of 4 devices (although there is no mdadm.conf file anywhere, so i guess it autodetects) and each device is a hardware RAID5 array.
To try to recover the configuration and data: I did a dd of each disks and used the ReclaiMe (Windows) tool to establish that the original configuration was RAID50 with 4 hardware RAID5 arrays (combined using mdadm) -- plus 4 spares.
ReclaiMe has also recovered images of the 4 RAID5 arrays (into files labelled 1.img, 2.img, 3.img, 4.img) and specified the following config information for the RAID0 construction:

*On the right side of the R-Studio window, set "RAID type" to "RAID0 (Stripe set)".

*Below that, set "Block size" to "256 KB".

*In the "Parents" table, enter "63 Sectors" as "Offset" in all rows.

I have used R-studio with these parameters to verify the data is there and I am now trying to assemble the RAID0 array using mdadm so I can mount the original filesystem. It is at this point that I am slightly stuck. I have mounted the (NTFS-formatted) physical disks containing the images (1 physical disk per image) and then mounted the images themselves as loop devices:
# losetup /dev/loop1 /media/ubuntu/disk1/1.img
# losetup /dev/loop2 /media/ubuntu/disk2/2.img
# losetup /dev/loop3 /media/ubuntu/disk3/3.img
# losetup /dev/loop4 /media/ubuntu/disk4/4.img

Running an fdisk on an loop device:
# fdisk -l /dev/loop2
Disk /dev/loop2: 2000.4 GB, 2000435544064 bytes
255 heads, 63 sectors/track, 243205 cylinders, total 3907100672 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
/dev/loop2p1              63  3902798969  1951399453+  fd  Linux raid autodetect

When I try to automatically assemble,I get:
# mdadm --assemble --scan -v
mdadm: Cannot assemble mbr metadata on /dev/loop4
mdadm: Cannot assemble mbr metadata on /dev/loop3
mdadm: Cannot assemble mbr metadata on /dev/loop2
mdadm: Cannot assemble mbr metadata on /dev/loop1

When I try to do it manually:
# mdadm --create /dev/md0 -v --level=0 --assume-clean --raid-devices=4 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4
mdadm: chunk size defaults to 512K
mdadm: /dev/loop1 appears to be part of a raid array:
level=raid0 devices=0 ctime=Thu Jan  1 00:00:00 1970
mdadm: partition table exists on /dev/loop1 but will be lost or
   meaningless after creating array
mdadm: /dev/loop2 appears to be part of a raid array:
level=raid0 devices=0 ctime=Thu Jan  1 00:00:00 1970
mdadm: partition table exists on /dev/loop2 but will be lost or
   meaningless after creating array
mdadm: /dev/loop3 appears to be part of a raid array:
level=raid0 devices=0 ctime=Thu Jan  1 00:00:00 1970
mdadm: partition table exists on /dev/loop3 but will be lost or
   meaningless after creating array
mdadm: /dev/loop4 appears to be part of a raid array:
level=raid0 devices=0 ctime=Thu Jan  1 00:00:00 1970
mdadm: partition table exists on /dev/loop4 but will be lost or
   meaningless after creating array
Continue creating array? N

I wondered if the offset mentioned in the ReclaiMe output and corresponding to the Start 63 in the fdisk output required different losetup, so tried instead (because 63 * 512 = 32256):
# losetup /dev/loop1 /media/ubuntu/disk1/1.img -o 32256
# losetup /dev/loop2 /media/ubuntu/disk2/2.img -o 32256
# losetup /dev/loop3 /media/ubuntu/disk3/3.img -o 32256
# losetup /dev/loop4 /media/ubuntu/disk4/4.img -o 32256

Then:
# mdadm --assemble --scan -v
mdadm: no recogniseable superblock on /dev/loop4
mdadm: no recogniseable superblock on /dev/loop3
mdadm: no recogniseable superblock on /dev/loop2
mdadm: no recogniseable superblock on /dev/loop1

So, I tried to manually create again:
# mdadm --create /dev/md0 -v --level=0 --assume-clean --raid-devices=4  /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4
mdadm: chunk size defaults to 512K
mdadm: /dev/loop1 appears to contain an ext2fs file system
    size=-784337920K  mtime=Wed Dec  4 12:34:29 2013
Continue creating array? N

At this point, i don't know what to do. I have already had to restore the 4 img files (totalling 8TB) from a backup a couple of times by trying options that didn't work.
[Also, is there any way to ascertain the metadata version or chunk size?]


text:
Q: RavenDB: How to create a collection? I set up a free Database "TestDB" in ravendb and there is the default @empty collection when you create some documents. But how can I create my own collection? There is no documentation about that, and no API apparently to do this from their npm ravendb package...?
Here is my code:
import { DocumentStore } from 'ravendb'
import * as fs from 'fs'

// load certificate and prepare authentication options
const authOptions = {
    certificate: fs.readFileSync(
        'C:/Users/asdasd/Desktop/testravendb/free.asdasdasd.client.certificate.pfx'
    ),
    type: 'pfx', // or "pem"
    password: '',
}

const store = new DocumentStore(
    ['https://a.free.asdasdasd.ravendb.cloud'],
    'TestDB',
    authOptions
)
store.initialize()

console.log(store)
const session = store.openSession()
console.log(session)

let product = {
    title: 'iPhone X',
    price: 999.99,
    currency: 'USD',
    storage: 64,
    manufacturer: 'Apple',
    in_stock: true,
    last_update: new Date('2017-10-01T00:00:00'),
}
async function save() {
    await session.store(product, 'products/')
    console.log(product.id) // Products/1-A
    await session.saveChanges()
}
save()

async function getData() {
    const query = session.query({ collection: '@empty' })
    const results = await query.all()
    //let product2 = await session.load('products')
    console.log(results) // iPhone X
}

getData()

It works as long as I use the @empty collection..

A: You can use a field from the document in order to set the collection.
const store = new DocumentStore(urls, database);
store.conventions.findCollectionNameForObjectLiteral = entity =>
entity["collection"];
// ...
store.initialize();

https://ravendb.net/docs/article-page/5.2/nodejs/client-api/session/storing-entities

A: To create a collection you need to create an entity with instance of a Class as parameter.
More than that, if you pass an intance of a class it will generate a uniqe slug for you instead of long UUID.
const { User } = require('./user.js')

const store = new DocumentStore(url, db);
store.initialize();

const add = async () => {
    const user = new User({ email@gmail.com, John, 32 })
    await session.store(user);
    await session.saveChanges();
}

execute add() to add a new document inside Users collection.
It will even name the collection as Users although the class you created is User.
user.js:
class User {
    constructor({ email, name, age}) {
        this.email = email;
        this.name= name;
        this.age= age;
    }
}

module.exports {
    User
}


text:
Q: Titanfall "I've seen it all achievement" still track if you regenerate (prestige) At level 50, I've unlocked all equipment for the "All the Hardware" achievement and kept track of the levels I've played so far but i want to make sure I can now regenerate.
Looking around I've found a lot of people say "it's probably fine" and one person say "it's not fine" but with no more explanation.
Anyone have any experience of this or any proper evidence?

A: All the counter achievements carry across generations.
The only one that doesn't is "Unlock Everything", which I think is badly worded. You have to have everything unlocked at once, so regenerating wipes out your progress.


text:
Q: How can I stick an image to an other with jQuery? Preposition:
I have a HTML code with many fix positioned div tags, for example: head, content, content _text, graph1, graph2 etc.
In this case the #content div is vertically under the #head div. The #content_text is in #content and #content has the overflow:auto CSS property.

Now the problem is when I add a new img tag to the 'body' tag and this img give position:absolute, then top and left work fine, the image is there I want to be.
When I scroll the #content_text this new img is stay when I set up, but I can reposition it with jQuery $('#content_text').scroll(...) function.
And here is the real question:
When I scroll and reposition the new img tag, there is over the #head element and not hiding when it scrolled out the #content_text.
I tried to find z-index property of the original image, but it get 'auto'.
Anybody has some idea?


text:
Q: Getting com.amazonaws.services.s3.model.AmazonS3Exception where all the returned response values from S3 is either null or 0 I am getting the below exception while downloading some files from S3. All the returned response values from S3 is either null or 0
com.amazonaws.services.s3.model.AmazonS3Exception: Problem while downloading chunks (Service: null; Status Code: 0; Error Code: null; Request ID: null), S3 Extended Request ID: null

What could be the possible reason for this issue? Am unable to track as Status Code returned cannot comply with AWS S3 error list.


text:
Q: Error opening sqlite connection ConnectionStringSettings connectionString = ConfigurationManager.ConnectionStrings["test"];
SQLiteConnection.CreateFile("MyDatabase.sqlite");
var dbFact = DbProviderFactories.GetFactory(connectionString.ProviderName);

using (var conn = dbFact.CreateConnection())
{
    conn.Open(); // Exception gets thrown here
}

Whenever I execute this code I get the following exception : |
An unhandled exception of type 'System.ArgumentException' occurred in System.Data.SQLite.dll

Additional information: Invalid ConnectionString format, cannot parse: string value to split cannot be null

Here's my app.config :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite"/>
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data   Provider for SQLite"
      type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="test" connectionString="Data Source=MyDatabase.sqlite;Version=3" providerName="System.Data.SQLite"/>
  </connectionStrings>
</configuration>

Can you help me with this, thank you advance.

A: Turns out that I need to pass explicitly the connection string in the connection before opening it :
ConnectionStringSettings connectionString = ConfigurationManager.ConnectionStrings["test"];
SQLiteConnection.CreateFile("MyDatabase.sqlite");
var dbFact = DbProviderFactories.GetFactory(connectionString.ProviderName);

using (var conn = dbFact.CreateConnection())
{
    conn.ConnectionString = connectionString.ConnectionString;
    conn.Open(); // Exception gets thrown here
}


text:
Q: Accessing database outside of localhost with PHP and Wampserver I am trying to access a database that is not in my localhost or in my network. I am WampServer so I can open the PHP file. I am trying this code bellow, just to see the connection working. but never works.
<!DOCTYPE html>
<?php
        $DBConnect = @mysql_connect("xx.xx.xx.173:22289", "sa", "123456")
            Or die("
The database server is not available.
"."
Error Code" .mysql_connect_erno(). ":". mysql_connect_error());
        echo "
Successfully connected to the database server.
";

        $DBName = "Database01";
        @mysql_select_db($DBName)
            Or die("
The database is not available.
" . "
Error Code" . mysql_erno($DBConnect). ":" . mysql_error($DBConnect));
        echo "
Successfully opened the database.
";
mysql_close($DBConnect);
?>

This port number they specified for me to use to access their database. I can connect in their virtual machinne trought this ip address, and inside the virtual machine I can access the database using the same ip adress and the the port im using in the code. login and password are, because I can log in in to the database using Microsoft SQL Server.
I tried to change the IP to xx.xx.xx.173,22289 and also did not work.
The webpage takes like 7min to load and when it loads, show just the HTML part.
How I can access the database outside through the php file?
If is not possible to access a database especifing an IP adress with WampServer, how should I test the php files?

A: The first thing you want change is the mysql* functions, they are depreciated.
http://www.php.net/mysql_select_db
You want to use PDO for your database connections in PHP:
http://php.net/pdo
try {
    $pdo = new PDO('mysql:host=localhost;dbname=test;', 'user', 'pass');
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $pdo->prepare('INSERT INTO DoesNotExist (x) VALUES (?)');
}
catch(Exception $e) {
     echo 'Exception -> ';
     var_dump($e->getMessage());
}

Example error:
     Exception -> string(91) "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test.doesnotexist' doesn't exist"

A: If you want to connect to your server, follow this:

*

*before login to whm

*click SQL Services

*click Additional MySQL Access Hosts

*add your ip

*click to save

*click again Additional MySQL Access Hosts

*and click to configure from all users (...configure access from all
users' accounts, Click Here)
$mysql_link = mysql_connect('your_host', 'your_u_name', 'your_pass') or die ('Server bağlantı hatası!');
No need to write the port number. good luck..


text:
Q: UnicodeDecodeError: 'utf8' in Python 2.7 I have a large file that has many lines, most of the lines are utf8, but looks like a few of lines are not utf8. When I try to read lines with a code like this:
 in_file = codecs.open(source, "r", "utf-8")
     for line in in_file:
         SOME OPERATIONS

I get the following error:
    for line in in_file:
  File "C:\Python27\lib\codecs.py", line 681, in next
    return self.reader.next()
  File "C:\Python27\lib\codecs.py", line 612, in next
    line = self.readline()
  File "C:\Python27\lib\codecs.py", line 527, in readline
    data = self.read(readsize, firstline=True)
  File "C:\Python27\lib\codecs.py", line 474, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd8 in position 0: invalid continuation byte

What I would like to do is that for lines that are not utf8 do nothing without breaking the code, and then go to next line in the file and do my operations. How can I do it with try and except?

A: Open the file without any codec. Then, read the file line-by-line and try to decode each line from UTF-8. If that raises an exception, skip the line.
A completely different approach would be to tell the codec to replace or ignore faulty characters. This doesn't skip the lines but you don't seem to care too much about the contained data anyway, so it might be an alternative.


text:
Q: Improving Availability vs Mean Time Between Failures Let's assume that I have to deal with an unreliable system accessed by many users that goes down/fails, let's say, X times for X minutes weekly. If only one of the following can be improved due to whatever reason, what's more important: ensuring double the availability of the service or double the mean time between failures?
Interested to hear your opinion.
Thanks
Claudio

A: If your systems falls down for T minutes X times per week, and assuming a 7/7 24/24 operation:

*

*its total downtime in the week is T*X.

*its relative availability A is 1-(T*X)/(7*24*60) (absolute is 7*24*60-T*X)

*its MTBF is (A * 7*24*60)/X or 7*24*60/X-T
In other words,

*

*increasing A means to decrease T or X or both

*increasing MTBF means to decrease X or T or both

So both are just two sides of the same coin and whatever you do to improve one will benefit the other
Edit: I didn't notice the "double" in your question:
I'll assume that T is rather constant (e.g. time to reboot the server):

*

*You can't double availability if its above 50%.  But if availability is lower, doubling it means achieving a very high improvement.

*You can always double the MTBF.  All it takes is approximately halving X.

A: [This started as a comment, but I ran out of room.  So, I'm posting as an answer.]

If only one of the following can be improved due to whatever reason, what's more important: ensuring double the availability of the service or double the mean time between failures?

The relative importance of availability vs. MTBF depends on the usage of the system.  I'm going to assume that user's work is lost when failures occur.
If the users work in short sessions (much shorter than MTBF), then work is rarely lost to failures.  In this case, the uses might not even notice failures.  In this case, availability may be a greater issue than MTBF.
If the users work in long sessions (comparable in length to MTBF), then work is more likely to be lost due to failures.  Loss of work tends to be more annoying than unavailability of the system.  In this case, MTBF may be a greater issue than availability.


text:
Q: Casting from an abstract base class reference to derived class reference I have following C++ code
AbstractClass_01.h
class AbstractClass_01 {
public:
    virtual void method_01() = 0;
};

AbstractClass_02.h
class AbstractClass_02 {
public:
    virtual void method_02() = 0;
};

ClassA.h
#include "AbstractClass_02.h"

class ClassA : public AbstractClass_02{
    public:
        void method_02();
        void method_03();
};

ClassA.cpp
#include "ClassA.h"

void ClassA::method_02() {}

void ClassA::method_03() {}

ClassB.h
#include "AbstractClass_01.h"
#include "AbstractClass_02.h"

class ClassB : public AbstractClass_01 {
public:
    ClassB(AbstractClass_02& _obj);
    void method_01();
private:
    AbstractClass_02 &obj;
};

ClassB.cpp
#include "ClassB.h"
#include "ClassA.h"

ClassB::ClassB(AbstractClass_02& _obj) : obj(_obj) {}

void ClassB::method_01() {
    static_cast<ClassA&>(obj).method_03();
}

main.cpp
#include "ClassA.h"
#include "ClassB.h"

int main(int argc, char** argv) {

    ClassA a;
    ClassB b(a);

    b.method_01();

    return 0;
}

My question is whether the casting which I have done in the ClassB::method_01 is common C++ construct whether it is a sign of wrong design?
EDIT:
The reason why the ClassB constructor accepts references to the AbstractClass_02 instead of the ClassA is that I need to pass references to various objects which all have common interface AbstractClass_02. The problem is that this interface doesn't contain the method_03. One possible solution could be to append that method into the interface AbstractClass_02 but that method isn't cohesive with the method_02.

A: This is known as downcasting and is typically a sign of bad design. Based on the limited knowledge we have, it seems obvious that you should take ClassA in constructor instead of AbstractClass_01
#include "AbstractClass_01.h"
#include "ClassA.h"

class ClassB : public AbstractClass_01 {
public:
    ClassB(ClassA & _obj);
    void method_01();
private:
    ClassA &obj;
};

But we don't know your real problem and why did you decide to go with casting or accepting interface in the first place.


text:
Q: Why my NodeJS app after packing with Zeit pkg is running as a background process in Linux mint cinnamon 19.1 Hello!
I am using Linux mint cinnamon 19.1 and I have some NodeJS project and want packing to a single executable using zeit pkg targeting to platform Linux and Windows. Process packaging is running well, but...
The problem is
When I open that executable with double click the app is running in background process automatically in Linux mint cinnamon 19.1 it didn't show the terminal, the error, also is hard to stop the process I have to do some netstat and kill processid
I found the same issue and also this issue and have not been answered
My solution
I have a solution that comes to mind with child_process modules, and spawn('gnome-terminal').exec('node my-node.app') and of course it didn't work because .exec() diferrent prototype, and for now I am still can't find how to do spawn terminal and exec the command How to do spawn terminal and exec the command in the terminal that I have spawned

A: You just only need use .exec() not .spawn()
See this for more detail
const os = require('os');
const child_process = require('child_process');

if (os.platform() === 'linux') {
    child_process.exec('gnome-terminal -x bash -c "node your-node.js; exec bash"',
    function(err, out, derr) {
        console.log(err);
        console.log(out);
        console.log(derr);
    });
}


text:
Q: react-redux store mapping issue between components I am working on my first 'big' react-redux application. I am trying to map react-redux state between components but it seems that I missed something.
Everything works like a charm except one thing: my menu with react-route navigation works fine, my components are rendered, button onClick events are okay, my rest api is called and I get back http 200 with the proper json data which is added to the redux store (I guess).
The only one thing which does not work is that this.state is null in TableRenderer.js.
The error what I get is related to redux state mapping:

Uncaught TypeError: Cannot read property 'json' of null

App.js (main class)
const store = createStore(
    combineReducers({
        ...reducers,
        routing: routerReducer
    }),
    applyMiddleware(thunk)
)

const history = syncHistoryWithStore(browserHistory, store)

ReactDom.render(
    <Provider store={store}>
        <Router history={history}>
            <Route path='/' component={MainLayout}>
                <Route path='about' component={About}/>

                <Route path="list">
                    <Route path="people" component={PeopleList}/>
                </Route>

                <Route path='*' component={NotFound}/>
            </Route>
        </Router>
    </Provider>,
    document.getElementById('root')
);

PeopleList.js (my main component)
export default class PeopleList extends React.Component {
    render() {
        return (
            <TableRenderer title='My 1st people list' />
        );
    }
}

TableRenderer.js (reads data from redux store and render it)
export default class TableRenderer extends React.Component {
    render() {
    return (

{this.props.title}

        <ActionBar />

                id
                field 1
                field 2
                field 3

            {this.state.json.map(row => {
                return <RowRenderer key={row.id} row={row} />
            })}

        <ActionBar />

    );
    }
}

ActionBar.js (it holds the buttons and dispatch actions)
class ActionBar extends React.Component {
    render() {
        return (

                <Button bsSize="xsmall"
                        onClick={() => this.props.doRefresh()}>
                    Refresh
                </Button>
                <Button bsSize="xsmall">Clear all from database</Button>

        );
    }
}

const mapStateToProps = (state) => {
    return {
        json: state.json
    };
};

const mapDispatchToProps = (dispatch) => {
    return {
        doRefresh: () => dispatch(fetchData())
    };
};

export default connect(mapStateToProps, mapDispatchToProps)(ActionBar)

TableAction.js (my action class)
const loadDataAction = (json) => {
    return {
        type: ActionType.GET_DATA,
        json: json
    }
};

export function fetchData() {
    return (dispatch) => {
        dispatch(loadDataAction(''));

        axios({
            baseURL: UrlConstant.SERVICE_ROOT_URL,
            url: 'list/people',
            method: 'get'
        })
            .then((response) => {
                if (response.status == 200) {
                    dispatch(loadDataAction(response.data));
                }
            })
            .catch((error) => {
                if (error.response) {
                    dispatch(loadDataAction(''));
                }
            });
    }
}

Reducers.js
const initialState = {
    json: ''
};

export default (state = initialState, action) => {
    return Object.assign({}, state, {
        json: action.json
    });
}

UPDATE:
Thank you for Max Sindwani's help this issue is solved. There was many things to fix.
App.js (main class)
My store definition was not correct
const store = createStore(
    combineReducers({
        response: reducer,
        routing: routerReducer
    }),
    applyMiddleware(thunk)
)

TableRenderer.js
{this.props.json} needs to be used instead of {this.state.json}

A connect staff was missing from this class. It bounds data between redux store and class locale props (if I am correct):
class TableRenderer extends React.Component {
    render() {
        return (

                ...

        );
    }
}

const mapStateToProps = (state) => {
    return {
        json: state.response.json
    };
};

export default connect(mapStateToProps)(TableRender)

Reducers.js
My reducer was also wrong because without switch statement, during the initial phase the store was initialized on a wrong way by redux. And the type of json needs to be array because it holds multiply items.
const initialState = {
    json: []
};

export default (state = initialState, action) => {
    switch (action.type) {
        case ActionType.GET_DATA:
            return Object.assign({}, state, {
                json: action.json
            });
        default:
            return state;
    }
};

export default reduces;

That's it :)

A: The error seems to relate to the fact that state will be null (since there is no initial local state defined). Redux is meant to provide uni-directional data flow from the provider component. You'll need to pass props down or connect from the component (although it is recommended that you connect only top-level components to avoid losing track of where data is coming from). Any time the reducer returns a new/updated state, the provider passes down props to its children again and causes them to re-render. Try connecting the TableRenderer. Something like this should work:
class TableRenderer extends React.Component {
    render() {
    return (

{this.props.title}

        <ActionBar />

                id
                field 1
                field 2
                field 3

            {this.props.json.map(row => {
                return <RowRenderer key={row.id} row={row} />
            })}

        <ActionBar />

    );
    }
}

const mapStateToProps = (state) => {
    return {
        json: state.json
    };
};

export default connect(mapStateToProps)(TableRenderer);

Notice that after connecting and mapping the state, the state exists as props in the component. Also note that you'll want to change json (if it isn't already) to an array if you use map, and keep the initial state as empty array.
Furthermore, check to make sure that your reducer is included. It doesn't look like you've associated a key with the json reducer (assuming routingReducer is from https://github.com/reactjs/react-router-redux). Try something like this -- https://jsfiddle.net/msindwan/bgto9c8c/