text:
Q: Slower response time on server caused by CentOS version We have a number of servers, all in the same datacenter, all similar spec, all run the same application (LAMP ecommerce app), all have similar traffic levels and all have similar average load. However, one of these servers regularly scores much worse than all the other servers in response time reports from Pingdom. All our servers bar this one have response time averages between 190ms - 210ms however one server avaerages between 280ms - 300ms. One of the only differences between these servers is the version of CentOS. On the slower site the version is 4.8 but on the faster servers they are all running 5.5. Is it likely that the OS version is enough to slow down response time on the server or is it likely to be something else?
Thanks

A:
When you have eliminated the
  impossible, whatever remains, however
  improbable, must be the truth.
  -- Sherlock Holmes

If your servers all the same hardware, then the reason must lie within software. Older version of CentOS means older kernel and older LAMP stack (unless you compile your own). CentOS 4.8 runs kernel 2.6.9. CentOS 5.5 is 2.6.18. 2nd factor would be tuning. If you fine-tuned 5.5s, but run an out-of-the-box 4.8, this will factor in as well.
Developers strive to improve speed both of kernel and applications, so yes, OS version may play important role in the speed delta. 30% improvement on identical hardware? Not impossible.
OTOH if your servers don't run on identical or very similar hardware, or if the 4.8 one is the one connected to the rest of the net by that ancient over-heating half-duplex 10 Mb hub locked in the broom shed, then hardware may be the dominating factor explaining the speed difference. CentOS 5.5 on quad Nehalem with 32 GB RAM should be significantly faster than CentOS 4.8 on a P IV.

A: Try running free -m to see if it's using swap space from RAM. Very common on similar builds but different OS.
-edit-
On the last line look for anything above zero in the middle column Swap entries:
total       used       free     shared    buffers     cached
Mem:          3145       2882        262          0        919       1131
-/+ buffers/cache:        831       2313
Swap:          254          0        254
My machine is saying the "262"MB of RAM is free in the Mem line and no swap file has been used with the "0" in the last line which would slow it right down.

A: Perhaps the slower server is sharing his connectivity or other resources, e.g. storage, with high load servers?


text:
Q: Issue trying to redirect old Urls finishing with variables using htaccess I have tried to redirect old website URLs to main domain www.my_domain.tld, but I can't find the right solution.
I have 2 kinds of Url that I want to redirect to my main domain:

*

*http://www.my_domain.tld/blog/?p=125 ("125" could be any number from 1 to 999)

*http://www.my_domain.tld/blog/feed/?p=72 ("72" could be any number from 1 to 999)

A: You can use the following rule in /.htaccess :
RewriteEngine on

RewriteCond %{THE_REQUEST} /blog/\?p=([0-9]+) [OR]
RewriteCond %{THE_REQUEST} /blog/feed/\?p=([0-9]+) [NC]
RewriteRule ^ http://domain.tld? [L,R,NC]

Empty question mark at the end of the destination url is important as it discards the old query strings.

redpajama_set_name: RedPajamaStackExchange


text:
Q: I get undefined when I search using GitHub API with angularjs here is the code
the view code:
<input type="text" class="form-control" ng-model="model.org" />
<input type="button" class="btn btn-primary" value="Load Repos" ng-click="getRepos(model.org)" ng-hide="model.repos" />

         Name
         Language

{{r.name}}
 {{r.description}}

         {{r.language}}
         <input type="button" class="btn btn-success" ng-click="loadDetail(r.name)" value="Detail">

and this is the inside the controller:
$scope.model = {
   number: 0,
   result: 'Ready'
};

$scope.getRepos = getRepos;

function getRepos(org) {
   $http.get('https://api.github.com/orgs/org/repos').then(function(response) {
      $scope.model.repos = response.data;
   }, function(response) {
      alert(response.error);
      $scope.model.repos = 'Error: ' + response.data.message;
   })
}

when I click the button that has the ng-click="getRepos(javascript); I get undefined but if I copied this link https://api.github.com/orgs/javascript/repos to a browser it returns data!
what am I missing here?

A: I think you wanted to pass the parameter to getRepos in your GET url, like:
function getRepos(org) {
   $http.get('https://api.github.com/orgs/' + org + '/repos').then(function(response) {
      $scope.model.repos = response.data;
   }, function(response) {
      alert(response.error);
      $scope.model.repos = 'Error: ' + response.data.message;
   })
}


text:
Q: Angular / RxJS service with http and replay I need to create a SessionService which will contain information about user and should act as a singleton across all components.
I would use it like:
this.sessionService.user$.subscribe(_ => {
 this.greetingsName = _.firstName;
});

It should be lazy loading: first call should get data over http and store it somewhere, any other subscription should replay this stored data.
Can you advice any technique / pattern / best practice for this in Angular / RxJS ?
Thanks!

A: First of all, if you want to have a service that is a singleton you have two options:

*

*set the providedIn property of the @Injectable() to "root"

*include the service in the AppModule or in a module that is only imported by the AppModule
As for the implementation of the service, this can do the http request you need and save the data in a Subject. I would suggest you use a BehaviorSubject to store the data received from the http request.


text:
Q: RDLC Matrix report move grouping column I have an RDCL Matrix report.
Generated in Visual Studio 2013.
In Asp.net MVC5.
I am creating the report for a database based on a range of dates returned in a recordset and bound at runtime to the report. Depening on the dates returned in the dataset the columns in the report are dynamically created (matrix report).
My date range will always be for a months duration so my report is very wide and space is of importance as users want entire months date range to fit on one page.
This is how my report currently looks(sorry i had to mask out data).As you can see i can only fit until the 23 October and then it moves onto other page. I need it all to fit on one page.

This is how it looks in the designer so you can see where the groupings are.

So in order to make it fit all on one page, i was hoping it could easily move the employee row group column above the data rows (only to appear once per instance of that employee) so it doesn't take up the space in the row it currently resides in ? This should allow me to gain a little space.
I have tried to moving this column manually or re-creating the grouping and making it a group header but then all employees appear in a list instead of at the head of each section. I have looked at similar questions such as this but it's not really what i need.
Any help would be appreciated.


text:
Q: Why am I receiving a .class is expected? Trying to call a method in java I'm pretty new to programming feel free to be harsh in your replies. Anything helps.
Basically I'm trying to call in a method LineCount() but when I try to compile the command prompt complains about .class being expected at String[A] (line 8 I believe)
*Thank you guys for all your help! My code works now! I really appreciate all the input
import java.util.Scanner;
import java.io.*;

public class FileCount{

    public static void main(String[] args) throws IOException{

        String[] in = new Scanner(new File(args[0]));
        System.out.println(lineCount(String[] in);

    }

    public static void lineCount(String[] A){

        // check number of command line arguments
        if(args.length != 1){
            System.err.println("Usage: LineCount file");
            System.exit(1);
        }

        // count lines, words, and chars in file
        int lineCount = 0;
        while( in.hasNextLine() ){
            in.nextLine();
            lineCount++;
        }
        in.close();

        System.out.println( args[0]+" contains "+lineCount+" lines" );

    }

}

A: First of all
  System.out.println(lineCount(String[] in); // this is incomplete need to close)

Assuming you did mistake while you putting the question here, Change
 System.out.println(lineCount(String[] in));

To
  System.out.println(lineCount(in));

A: -> There are many mistakes in your code, Besides other answers want to add that, Since you are passing lineCount(in) as an argument  to the linecount() method , then refer to the parameter in lineCount(String[] A) now via A variable and not in.
-> Also you cannot refer to args inside linecount() method since it is a parameter of main() method and hence is limited to it in its scope.
-> You cannot do this String[] in = new Scanner(new File(args[0])); , you are assigning a Scanner instance to an String Array, you have to do it like this
Scanner in = new Scanner(new File(args[0]));

-> You are calling linecount() inside a System.out.println() method , although your method linecount() has a return type of void, Dont put your method inside print() function , because anyways it has got print() statements inside it.
-> Maybe last , there could be more , Since your in variable is of type Scanner , change your method declaration to
 public static void lineCount(Scanner in){

and now call it like lineCount(in) from main().
Edit :- Since you are a beginner i will give you working code for your question:-
import java.util.Scanner;
import java.io.*;

public class FileCount{

    public static void main(String[] args) throws IOException{

      // check number of command line arguments, and check it in main()
       if(args.length != 1){
            System.err.println("Usage: LineCount file");
            System.exit(1);
        }

    Scanner in = new Scanner(new File(args[0]));
    System.out.println( args[0]+" contains "+lineCount(in)+" lines" ); //call this line in main() and not in linecount() as you refer to both args and need the linecount.

    }

    public static int lineCount(Scanner in){

        // count lines, words, and chars in file
        int lineCount = 0;
        while( in.hasNextLine() ){
            in.nextLine();
            lineCount++;
        }
        in.close();

        return lineCount; //return the linecount from method

    }

}

A: Your first problem String[] in = new Scanner(new File(args[0])); creating a Scanner object and asigning it to an array it does not work like this. Change your code to read the file and store it in some arraylist like
    List<String> list= new ArrayList<String>();
    Scanner in = new Scanner(new File(args[0]));

    while (in.hasNextLine()) {
        // find next line
        String line = in.nextLine();
        list.add(line);
    }

Then if you want can convert to list to String array which is not really necessary like this
    String[] strArr = list.toArray(new String[0]);

            System.out.println(java.util.Arrays.toString(strArr));
    lineCount(strArr);

Then call the lineCount() method which counts the lines in the files.
public static void lineCount(String[] A){
    System.out.println("File contains "+A.length+" lines" );

}


text:
Q: Minecraft Villager Breeding I'm playing xbox one and my villagers are not breeding. I am pretty sure I saw green sparkles over their heads and idk what that means, but I haven't seen red hearts over their heads. I have a structure made with a ton of beds. Also, doors above the ceiling and those doors are smooshed together by another layer of blocks on top. There is a ton of light, but no red hearts. I've been waiting for about 20 minutes.

A: Villagers require to be fed in both editions of the game, in order for them to become willing to breed. The best way to do this is to feed them bread, as this is most efficient, however carrots, potatoes and beetroot will also work. Both the villagers need at least 12 of the veggies, or 3 bread to start breeding, but it doesn't hurt to give them a bit more.


text:
Q: return key by value in dictionary I am trying to return the key in a dictionary given a value
in this case if 'b' is in the dictionary, I want it to return the key at which 'b' is (i.e 2)
def find_key(input_dict, value):
    if value in input_dict.values():
        return UNKNOWN            #This is a placeholder
    else:
        return "None"

print(find_key({1:'a', 2:'b', 3:'c', 4:'d'}, 'b'))

The answer I want to get is the key 2, but I am unsure what to put in order to get the answer, any help would be much appreciated

A: Amend your function as such:
def find_key_for(input_dict, value):
    for k, v in input_dict.items():
        if v == value:
            yield k

Then to get the first key (or None if not present)
print next(find_key_for(your_dict, 'b'), None)

To get all positions:
keys = list(find_key_for(your_dict, 'b'))

Or, to get 'n' many keys:
from itertools import islice
keys = list(islice(find_key_for(your_dict, 'b'), 5))

Note - the keys you get will be 'n' many in the order the dictionary is iterated.
If you're doing this more often than not (and your values are hashable), then you may wish to transpose your dict
from collections import defaultdict

dd = defaultdict(list)
for k, v in d.items():
    dd[v].append(k)

print dd['b']

A: Return first matching key:
def find_key(input_dict, value):
    return next((k for k, v in input_dict.items() if v == value), None)

Return all matching keys as a set:
def find_key(input_dict, value):
    return {k for k, v in input_dict.items() if v == value}

Values in a dictionary are not necessarily unique. The first option returns None if there is no match, the second returns an empty set for that case.
Since the order of dictionaries is arbitrary (dependent on what keys were used and the insertion and deletion history), what is considered the 'first' key is arbitrary too.
Demo:
>>> def find_key(input_dict, value):
...     return next((k for k, v in input_dict.items() if v == value), None)
...
>>> find_key({1:'a', 2:'b', 3:'c', 4:'d'}, 'b')
2
>>> find_key({1:'a', 2:'b', 3:'c', 4:'d'}, 'z') is None
True
>>> def find_key(input_dict, value):
...     return {k for k, v in input_dict.items() if v == value}
...
>>> find_key({1:'a', 2:'b', 3:'c', 4:'d'}, 'b')
set([2])
>>> find_key({1:'a', 2:'b', 3:'c', 4:'d', 5:'b'}, 'b')
set([2, 5])
>>> find_key({1:'a', 2:'b', 3:'c', 4:'d'}, 'z')
set([])

Note that we need to loop over the values each time we need to search for matching keys. This is not the most efficient way to go about this, especially if you need to match values to keys often. In that case, create a reverse index:
from collections import defaultdict

values_to_keys = defaultdict(set)

for key, value in input_dict:
    values_to_keys[value].add(key)

Now you can ask for the set of keys directly in O(1) (constant) time:
keys = values_to_keys.get(value)

This uses sets; the dictionary has no ordering so either, sets make a little more sense here.


text:
Q: two UITextFields - slide first Keyboard out and next in so in my viewdidload i got something like
[nameTextField becomeFirstResponder]

now after a button gets klicked, i want to slide out the keyboard of this textfield, and slide another keyboard of another textfield in.
i thought about
[nameTextField resignFirstResponder];
[dateTextField becomeFirstResponder];

but the other keyboard shows up immediately.
commenting the [dateTextField becomeFirstResponder]; out, effects that my nameTextField keyboard slides out as i wanted.
any ideas how to do this?
thanks!

A: Is there a reason why you want to do this? It will obviously increase the time it takes for a user to enter information, which I know would bug me.
But if you do really want this effect, then I would look at something like this:
[dateTextField performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:timeDelay];

Where timeDelay is the amount of time it takes to dismiss the first keyboard.

A: You can register to observe these notifications: UIKeyboardWillShowNotification , UIKeyboardWillHideNotification. That will let you keep track of what is going on, but it can easily get pretty complicated so Tom Irving's suggestion might be easier to work with.

A: To get notifications on keyboard hiding and showing, have a look at
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:)
    name:UIKeyboardDidHideNotification object:[self view].window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:)
    name:UIKeyboardDidShowNotification object:[self view].window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:)
    name:UIKeyboardWillHideNotification object:[self view].window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:)
    name:UIKeyboardWillShowNotification object:[self view].window];

and add appropriate methods like
-(void)keyboardWillShow:(NSNotification*)notif
-(void)keyboardWillHide:(NSNotification*)notif
-(void)keyboardDidShow:(NSNotification*)notif
-(void)keyboardDidHide:(NSNotification*)notif

Then you can connect the animations any way you like.
Be sure to NSLog() all of them, they are not always called when you would expect them (the notorious one being when you go from one field to another, and you receive the willhide and willshow immediately)


text:
Q: Ionic 3 PWA for Android Facebook app issue How to open FB app from the Ionic 3 PWA app for Android. I tried with the below codes which work fine with the hybrid app but not opening FB app from PWA.
window.open("fb://page/?id=" + appid, "_system", "location=no");
window.open("fb://page/" + appid, "_system", "location=no");
window.open("fb://profile/" + appid, "_system", "location=no");

Could you please help me. Thank you so much in advance.


text:
Q: Bayes' Rule broken?!?! This question has been driving me CRAZY for 4 days now. The question comes from the textbook "One Thousand Exercises in Probability", specifically Exercise 3 in section 1.4. The solution does not make sense! The question goes as follows:
"A man possesses five coins, two double-headed, two normal and one double-tailed. The man shuts his eyes, picks a coin at random, and tosses the coin. He opens his eyes, sees a head: what is the probability the lower face is also a head?".
The book gives an answer that is $2/3$. The solution in the book goes as follows:
Event $D$ means a coin is double-headed. Event $N$ means a coin is normal. Event $H_1^U$ means there is a head on first toss on the upper side of coin, whilst event $H_1^L$ means that there is a head on first toss on the lower side of the coin.
Probability of upper head on first throw = $\mathbb{P}{(H_1^U)}=\frac{2}{5}*\frac{1}{2}+\frac{2}{5}*1+\frac{1}{5}*0=\frac{3}{5}$
Bayes rule, reusing the result above, then goes as follows:
Probability of lower-side heads, given upper-side heads = $\mathbb{P}{(H_1^L | H_1^U)}=\frac{\mathbb{P}{(H_1^L \cap H_1^U)}}{\mathbb{P}{(H_1^U)}}=\frac{\mathbb{P}{(D)}}{\mathbb{P}{(H_1^U)}}=\frac{\frac{2}{5}}{\frac{3}{5}}=\frac{2}{3}$
Logical answer: if the man sees heads when he opens his eyes after the first toss, it means the coin must be either double-headed or normal!!! That is our probability space, given that the first toss produces heads on the upper side of the coin. Therefore, the probability that there is heads on the lower side of the coin is the probability that we have a double-headed coin, given that there are 4 possible coins we could be dealing with: two of them double-headed and two of them normal. Therefore, I see exactly 0.5 probability of lower-side being heads, given that the upper side is also heads!
Pls help me solve the logical fallacy here, otherwise I won't be able to sleep at night :). Thank you.

A: The problem is that seeing heads changes your estimate of the probability that you have seen the $HH$ or $HT$ coins.
To see this intuitively, suppose that, instead of coins, you had a pair of trillion sided dice.  Say one die has all $H's$ and the other has one $H$ and all the rest $T$.  You choose a die uniformly at random and toss $H$.  Which die do you have? While it is possible that you have the one with a single $H$, that is astonishingly unlikely.
To the given problem, I've always thought that the easiest way to see the answer was to note that, when you toss a randomly selected coin, each side (of all the coins) is equally likely to come up.  Given that you see a $H$, it's equally likely that it's any given $H$ side.  There are $4$ $H$ sides that come from $HH$ coins, and $2$ that come from $HT$ coins, hence the answer is $$\frac 4{4+2}=\frac 23$$
Applying this logic to the trillion sided dice we see that the probability that you have the all $H$ die is $$\frac {10^{12}}{10^{12}+1}\approx 1-10^{-12}$$

A: The probability space is composed of heads that might be witnessed after the selection and toss.   Every head is equally likely to be witnessed.   If you like, think of each head as being labelled with a unique mark in invisible ink.
There are six heads that the witness could be viewing after the toss, and four of them have another head on the other side of their coin, while two do not.   So the probability that a double sided coin had been selected when given that a head was witnessed is $2/3$.

A: The probability that there is a head on the upper side of the first coin and a tail on the lower side is not the probability that the first coin is normal, but half as much. Indeed if the first coin is normal, then there is an equal chance that the upper side of the first coin be a head or a rail. That corrects your closing computation.
As was said in the comments, while it's true that there are four outcomes in the probability space of coins, given that the first flip was a head, the outcomes are not all equally likely!

A: As perhaps a more simple explanation, the probability of seeing a head on the coin with two heads is much higher than the other, because there are more heads. So the fact that you saw the head gives you information. If you look at the outcomes as just heads and tails, not coins. There are 6 heads, 4 of which are on coins with two heads, so if you see a heads the probability it came from a coin with two heads, is 4 out of 6 (or 2/3).


text:
Q: Rename fails because it represents a path or device name When I run the following command:
Rename-Item some\long\path\fileName.txt some\long\path\newName.txt

I receive the following error message:

Cannot rename the specified target, because it represents a path or device name.

I've tried wrapping the paths in quotes and that doesn't succeed either.

A: For me the issue was different
The file name was the issue:
I have tried to put the following file name:

Old_2016-02-17T13:52:28_Stage1.txt

But only After changing it to:

Old_17022016_0154_Stage1.txt

it worked

A: For the second argument, just use the new name not the full path. That is, do this:
Rename-Item some\long\path\fileName.txt newName.txt

From the docs, it says of -NewName<String>

Enter only a name, not a path and name. If you enter a path that is different from the path that is specified in the Path parameter, Rename-Item generates an error.


text:
Q: How to get input either from a form or as uploaded input file in Django? I have written a view which takes input either from a form where you can post your data directly or you can upload a ".csv" file like this given below:
views.py
def Some_view(request):

    if request.method == 'POST':
        form = My_form(request.POST)

    else:
        request.method == 'POST' and request.FILES['myfile']
        myfile = request.FILES['myfile']
        fs = FileSystemStorage()
        filename = fs.save(myfile.name, myfile)
        uploaded_file_url = fs.url(filename)
        return render(request, 'myapp/des.html')

    return render(request, 'myapp/des.html', {'form': form})

html template: des.html is like this:
{% extends 'protocol/base.html' %}
{% load staticfiles %}

<!DOCTYPE html>

        <title></title>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

{% block content %}

                <form action="/result_view/" method="post">
                    {%csrf_token%}
                    {% for error in form.non_field_errors %}

                        {{error}}

                    {% endfor %}
                    {% for field in form %}

                        {{field.errors}}

                    {% endfor %}

                         {{form.AA}}

                        <button class="btn btn-primary" style="width:100%; margin-bottom: 30px ">Submit</button>

 or

 <form method="post" enctype="multipart/form-data">

    {% csrf_token %}
    <input class="input" type="file" name="myfile">
    <button class="button" type="submit">Upload</button>
  </form>

  {% if uploaded_file_url %}

File uploaded successfully.

  {% endif %}

            </form>

   {% endblock %}

forms.py
from django import forms

class My_form(forms.Form):

    AA = forms.CharField(widget=forms.Textarea(attrs={'class':'form-control','placeholder':'Ex.: ARNDCEQGHILKMFPSTWYV'}))

class Meta:
    fields = ['AA']

The form is working fine but in my case upload method is not working, when I use to upload file method alone if works fine but with form method, it is not working please help me out in this regards thanks.

A: i think you need to change if condition sequence:
if request.method == 'POST' and request.FILES.get('myfile'):
    # You code here

elif request.method == 'POST':


text:
Q: FTP account for every system user I am for the first time venturing on server configurations, I'm using Ubuntu.
I created a script that I give a domain name and a password that automatically makes the following functions:

*

*User creation in the system.

*User directory creation in the home folder.

*Create the folder public within the newly created user directory.

*Creation of the index.html file of welcome in the public folder of the user.

*Creation of custom configuration of Virtual Host Nginx file.

*Restart Nginx to start the new Virtual Host.

And now I have the following goal:

*

*For every new user created by the script, also create a customized FTP 'server/user' for that user and give access only to its own directory inside the folder home in the system.

But all content found on the internet only speaks of the creation of a single FTP user. Do you know any way to do something like this?


text:
Q: Minified react error 130 for the full message in react native I am learning react-native programming, my below program is working well if I remove button, when I add button then it gives an error.
import React from 'react';
import {
  registerComponent,
} from 'react-native-playground';
import {
  StatusBar,
  StyleSheet,
  Text,
  View,
  TextInput,
  Alert,
  Button
} from 'react-native';

class TextInputDemo extends React.Component {
  render() {
    return (
      <View style={{flex:1, marginLeft:10, marginTop:40}}>

        <Text>Name</Text>
        <TextInput style={{height:50, flexDirection:'row'}} placeholder="Enter a name" />

        <Text>Age</Text>
        <TextInput style={{height:50, flexDirection:'row'}} placeholder="Enter a age" />

        <Text>Email</Text>
        <TextInput style={{height:50, flexDirection:'row'}} placeholder="Enter a email" />

        <Button title="REGISTER" style={{height:50, flexDirection:'row'}} />

      </View>
    );
  }
};

registerComponent(TextInputDemo);

How can I fix this. Thanks in advance.

A: You are importing the component incorrectly. It should be:
import Button from 'react-native-button';

This is because Button.js is exporting the component using export default class instead of module.export. More information here regarding export.


text:
Q: To map the application key to right-click at caret position using Karabiner-Elements To map the application key to right-click using Karabiner-Elements one can use:
"simple_modifications": [
    {
        "from": {
            "key_code": "application"
        },
        "to": {
            "pointing_button": "button2"
        }
    },

However, this will perform a right-click at the position of the mouse pointer. I want it to move the pointer to the position of the caret and then perform the right-click.
Presumably, to do this I need to use "complex_modifications" rule.
My main problem is I don't know how to change the mouse pointer position to the caret position.
Using AutoHotkey there's an answer here  Moving the mouse pointer to the cursor
I can't say I really understand the answer there but anyway I'm looking to do this with Karabiner-Elements

A: I think that you can move the mouse cursor to a specified position in newer 13+ versions of Karabiner-Elements (which I can't use with MacOS High Sierra).
I fear though, that it's very difficult to get x- an y-values of a selection, first.
BUT:
You can use the AppleScript UI attribute "AXFocusedUIElement" to right-click on selected UI elements.
(This DOES work fine for Finder windows files&folders and TextEdit selections, e.g., but sadly does not for Safari selections and files on Finder's desktop.)
If your main goal is to navigate inside Finder's windows this script* works perfectly.
{  "description": "Right-click via Karabiner-Elements/shell-command/AppleScript",
   "manipulators": [ {
            "type": "basic",
            "from": {
                "key_code": "left_arrow",
                "modifiers": {"mandatory": "left_control" }
                    },
              "to": [  {
 "shell_command": "osascript -e 'tell application \"System Events\" to set _/¯
  activeApp to name of first process whose frontmost is true \n tell application _/¯
  \"System Events\" to tell application process activeApp \n set mySelect _/¯
  to value of attribute \"AXFocusedUIElement\" \n tell mySelect to perform _/¯
  action \"AXShowMenu\" \n end tell'"
}  ]  }  ]
}

Notice that the entire osascript ( "osascript -e ' … >> … end tell'" ) needs to be a one-liner (I inserted "_/¯" for better readability).
(* the AppleScript "tell application … end tell" part is found in several variations on the net.
AND: Of course you can change my Ctrl-LeftArrow shortcut to any one you like.)


text:
Q: Precompilation breaking on heroku, works locally I did some restructuring of our less files. Everything works locally (e.g. rake assets:precompile), but on Heroku my push fails with the following:
Running: rake assets:precompile
       adding placeholder
       rake aborted!
       Less::ParseError: variable @brand-primary is undefined
       (in /tmp/build_24298d78-579f-44a3-ae43-c4d82b9dde9d/app/assets/stylesheets/lectures/lectures.less)
       at /tmp/build_24298d78-579f-44a3-ae43-c4d82b9dde9d/vendor/bundle/ruby/2.1.0/gems/less-2.5.1/lib/less/js/lib/less/parser.js:604:31

After much poking around, I decided to remove the import statement for the offending file (lectures.less) to see what breaks next. With the change committed and pushed to Github, I tried pushing again to Heroku, and got the exact same error -- the precompilation is now breaking on a file that shouldn't be imported any more.
Details pasted below; anyone got any tips? I've tried both heroku run rake assets:clean and heroku run rake tmp:clear, but I didn't expect them to work anyway.
My application.css is barebones:
...
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require main
 */

PREVIOUSLY I was requiring the lectures file and some others in application.css, but moved it into the main.less.
My main.less has the rest of the imports:
@import "settings";
@import "variables";
...
@import "lectures/lectures.less";
...

Relevant environment settings:
development.rb
config.assets.precompile                           += %w( admin.js admin.css )
config.less.dumpLineNumbers                        = 'all'
config.assets.debug                                = true
config.serve_static_assets = true
config.assets.compile = true
config.assets.raise_runtime_errors                 = true

staging.rb
config.assets.precompile += %w( admin.js admin.css )
config.serve_static_assets = true
config.assets.compile = false
config.assets.digest = true
config.assets.version = '1.0'

relevant gems:
ruby '2.1.2'
gem 'rails', '>= 4'
gem 'less-rails', github: 'metaskills/less-rails'

A: We appeared to have fixed the issue by bumping the config.assets.version setting in production.rb, e.g.
- config.assets.version = '1.0'
+ config.assets.version = '1.1'

It's not clear in the slightest to me why heroku didn't recognize the changes and why heroku run rake assets:clean didn't do it, but there you go.
EDIT #################
It's been a while since this, and to keep from having the issue on a regular basis, we wound up tying the version # to our commit sha. Something like this:
whatever.rb
heroku = Heroku::API.new(api_key: ENV['HEROKU_API_KEY'])
$asset_version = heroku.get_releases(ENV["HEROKU_APP_NAME"]).body[-1]["commit"]

production.rb
config.assets.version = $asset_version


text:
Q: Difference between Arena::CreateMessage and Arena::CreateMaybeMessage When I using Protocol Buffer with Arena, what is the difference between those 2 functions
google::protobuf::Arena::CreateMaybeMessage<LPD::MyObj>();

And
google::protobuf::Arena::CreateMessage<LPD::MyObj>();


text:
Q: how to save the new excel with the same style in every cell using openpyxl I have one big excel,including several sheets. Now I need to save every sheet in one excel. Now, I finish and some cells which have formulas have value in the new excel. But I find one new problem,how can I save every sheets which keeps the original style (format) such as red background?I checked the former question, but still get no answer. Editing workbooks with rich text in openpyxl
from openpyxl import load_workbook,Workbook
wb = load_workbook("test11.xlsx",data_only=True)
sheetnames = wb.sheetnames
for name in sheetnames:
    ws = wb.get_sheet_by_name(name)
    print(ws)
    wb2 = Workbook()
    ws2 = wb2.active
    for i,row in enumerate(ws.iter_rows()):
        for j,cell in enumerate(row):
            ws2.cell(row=i+1, column=j+1, value=cell.value)
            ws2.title = name
    wb2.save(name + ".xlsx")

A: Every cell in openpyxl has a .style attribute that you can call and set. Your code would be this:
from openpyxl import load_workbook,Workbook
wb = load_workbook("test11.xlsx",data_only=True)
sheetnames = wb.sheetnames
for name in sheetnames:
    ws = wb.get_sheet_by_name(name)
    print(ws)
    wb2 = Workbook()
    ws2 = wb2.active
    for i,row in enumerate(ws.iter_rows()):
        for j,cell in enumerate(row):
            c = ws2.cell(row=i+1, column=j+1, value=cell.value)
            c.style = cell.style
            ws2.title = name
    wb2.save(name + ".xlsx")

A: You could consider the following option instead.
Basically this code makes a copy of the original xlsx file and deletes the unwanted sheets before saving with the sheet name. Since it is a copy of the original it should retain all the styling etc of each sheet.
from openpyxl import load_workbook

sheetnames = load_workbook('test11.xlsx').sheetnames

for name in sheetnames:
    wb = load_workbook("test11.xlsx")
    print(wb[name])

    for delsheet in sheetnames:
        if delsheet != name:
            del wb[delsheet]

    wb.calculation.calcMode = 'auto' # set formula calculation to auto
    wb.save(name + ".xlsx")


text:
Q: fatal: pathspec 'README.txt' did not match any files Really getting stuck on this one.  I've googled a lot and can't figure out what I've done wrong...
I'm trying to create a new file, via the git add README.txt command in terminal...
(So far I've created a new folder Fundamentals. Created a sub-folder git-practice.  And created a git repo via git init command)
However, when I try and add a file in fundamentals/git-practice, i get the following error..
fatal: pathspec 'README.txt' did not match any files

Not sure what I'm doing wrong.. everything seems to make sense.  Here's the code:
Reenas-MBP:~ reenaverma$ cd ~

Reenas-MBP:~ reenaverma$ ls
72.png          GitHub          flask-workshop
Applications        Library         fundamentals
Creative Cloud Files    Movies          funny_things
Desktop         Music           get-pip.py
Documents       Pictures        world
Downloads       Public          wwlc
Dropbox         Retrieved Contents

Reenas-MBP:~ reenaverma$ cd fundamentals

Reenas-MBP:fundamentals reenaverma$ ls
git-practice

Reenas-MBP:fundamentals reenaverma$ cd git-practice

Reenas-MBP:git-practice reenaverma$ ls -a
.   ..  .git

Reenas-MBP:git-practice reenaverma$ pwd
/Users/reenaverma/fundamentals/git-practice

Reenas-MBP:git-practice reenaverma$ git add README.txt
fatal: pathspec 'README.txt' did not match any files

Reenas-MBP:git-practice reenaverma$

A:
I'm trying to create a new file, via the 'git add README.txt' command in terminal...

git add does not create a new file. It adds an existing file to be indexed by git. You'll need to create the file first.

A:
fatal: pathspec 'README.txt' did not match any files

You get this error because there is no file named README.txt in the current directory. Git is in the business of managing files that you create with other programs, usually a text editor or IDE. git add only adds the file to the index. It does not create any files directly. You need to use another tool to do so. Use your favorite text editor (I suggest Notepad++, Sublime Text 3, or Atom) and create a file with some text.

A: Just type in your terminal (e.g. in git bash):
git >> README.md
git add README.md

A: I had the same problem and after typing ls I had git display all the files I had in the folder, then I found that I had saved the readme file as readme.txt.txt. Hence I had to rename the file to readme.txt and then I was able to add it successfully.

A: The following code works for me
git add README.txt

A: I do following this command (windows10) in terminal and everthing is working

*

*
git init
  git add README.txt
  git commit -m "first commit"
  git remote add origin https://github.com/your_github/github_project.git So I create my token in github then git push origin master


text:
Q: DispForm.aspx looks different for different items for the same sharepoint list I have a SharePoint list and a DispForm.apx associated with it. whenever any item is clicked in the list, the dispForm opens.
The issue that we are facing is that the dispForm.aspx looks a bit different for different items. Everything is same except that for some the view ribbon is enabled and for some it is disabled(ie, greyed out).
Any idea as to why it is behaving in this way since the same form is being used for all the items?
I am new to SharePoint so any help is much appreciated.
Thanks
the one working fine
the one with greyed out ribbon


text:
Q: How to upload file from MFC client (CInternetSession) to ASP.NET MVC I am using the MVC app as a service, so i have deleted the views. I am able to make calls to the controller:
public class HomeController : Controller
{
    // GET: /Home/
    public string Index(string param1, string param2) {
       ...
    }

from the MFC app:
string URL(_T("http://localhost:2374/home/index/myparam1/myparam2"));
pHttpFile = dynamic_cast<CHttpFile*> (m_Session.OpenURL(URL));
if (pHttpFile) {
    CHAR szBuff[1024] = { 0 };
    while (pHttpFile->Read(szBuff, 1024) > 0) {
        info += szBuff;
        ...

Now to upload an XML file, i am trying this on the MFC client:
CHttpConnection *pHttpConn = m_Session.GetHttpConnection(_T("localhost:2374"));
if (pHttpConn)
{
    CHttpFile *pHttpFile = pHttpConn->OpenRequest(
        CHttpConnection::HTTP_VERB_POST,
        _T("file.xml"));
    DWORD dwRet = 0;
    pHttpFile->QueryInfoStatusCode(dwRet);
    if (dwRet == HTTP_STATUS_OK)
    {
        CString headers(_T("Content-type: text/xml; charset=utf-8"));
        if (pHttpFile->AddRequestHeaders(headers))
        {
            if (pHttpFile->SendRequestEx(xml.GetLength(), HSR_SYNC | HSR_INITIATE))
            {
                pHttpFile->Write(xml, xml.GetLength());
                pHttpFile->EndRequest(HSR_SYNC);
                ...

and this on the MVC side:
    [AcceptVerbs(HttpVerbs.Post)]
    public void FileUpload(HttpPostedFileBase uploadFile)
    {

The client executes without error, but nothing happens on server side. I am not sure how to get FileUpload() called in the Controller. Do i use MapRoute(), if so how?

A: There is no change nessecary on your server side.
The problem is the c++ client. The url you should call to upload the file is http://localhost:2374/home/fileupload. If the method fileupload is in the home controller. You don't need any other route for it.
I found a code sample for upload a file with winnet at code project http://www.codeproject.com/KB/library/lyoulhttpclient.aspx. I'm not a c++ guy, may be there are more. But this one looks good.


text:
Q: Passing HTTP Headers to a Cloud Foundry App I am trying to deploy a PHP application to a public Cloud Foundry app on IBM Cloud. This app uses an Authorization header with a Bearer token to authenticate API calls. However, this token is stripped off before it reaches my code which is preventing the API from working.
In the Cloud Foundry app's router logs, I can see that none of the original headers on the original request made to the app have been included. Is there a way to have the original headers included with these HTTP requests?
I can't seem to find anything that would enable this so far but wondering if anyone else has had this issue.

A: Authorization is a special header which can contain sensitive information. By default, Apache HTTPD which is what the PHP buildpack on Cloud Foundry will configure, is not going to pass Authorization along to scripts because this could leak sensitive information to the script.
You should be able to allow it by adding this setting: https://httpd.apache.org/docs/2.4/en/mod/core.html#cgipassauth
If you add a .htaccess file to your app & put CGIPassAuth On in that file, that should make the Authorization header pass through. Alternatively, you can configure this way -> https://docs.cloudfoundry.org/buildpacks/php/gsg-php-config.html#engine-configurations
Alternatively, you can enable mod_openidc which is present out-of-the-box when using the PHP buildpack. It's a pretty straightforward way to enable OAuth2 based login. https://github.com/zmartzone/mod_auth_openidc
Ex: https://github.com/dmikusa-pivotal/static-site-oidc-example
Hope that helps!
Ref: https://github.com/cloudfoundry/php-buildpack/issues/190#issuecomment-433998851


text:
Q: How to hide specific variables in Pojo classes while generating JSON responses I am trying to hide some fields in a Pojo class while generating Json responses. Assume there are 4 variables in my java class. In the first response, I need all variables to be generated in the json object. For the next response, I only need 3 variables in the json object.
(The hiding part possibly be implemented when object creation and not inside the class implementation.) Is there a way to do this?

A: This can be achieved with @JsonView feature. This feature allows you to define multiple "views" = set of attributes, for a given class.
Each view is a simple marker class. for convinience, you can put them all inside one wrapper class (it can even be the pojo class itself)
public class PojoViews {
    public static class Response1{}
    public static class Response2{}
    public static class Response3{}
}

The view classes are specified as annotation for every attributre that is to be included in seralization
public class Pojo {

    @JsonView({PojoViews.Response1.class, PojoViews.Response2.class, PojoViews.Response3.class})
    public String attr1;
    @JsonView({PojoViews.Response1.class, PojoViews.Response2.class, PojoViews.Response3.class})
    public int attr2;
    @JsonView({PojoViews.Response1.class, PojoViews.Response2.class})
    public double attr3;
    @JsonView(PojoViews.Response1.class)
    public boolean attr4;
}

at runtime, you can assign a particular view to produce desired set af attributes
ObjectMapper mapper = new ObjectMapper();
Class<?> view = Pojo.Response2.class;  // runtime assignment of view
mapper.writerWithView(view).writeValue(System.out, pojo);


text:
Q: Angular 13: 'ng serve' does not proxy multiple websocket connections and results in 'Invalid frame header' errors When I try to start my application in development mode, it is throwing me the below issue which is related to the web socket

I'm using Angular 13 and below mentioned package versions
"@angular-builders/custom-webpack": "^13.1.0"
"@angular-devkit/architect": "^0.1303.2"
Also, I'm adding the GitHub issue discussion which is gone inactive about the same issue I'm facing
https://github.com/angular/angular-cli/issues/22260
My proxy.config.js file

const PROXY_CONFIG = [
    {
        context: ['/api',],
        target: 'https://localhost:7000',
        secure: false
    },
    {
        context: ['/ws'],
        target: 'wss://localhost:7000',
        secure: false,
        ws: true
    }
];

module.exports = PROXY_CONFIG;

Angular.json

                "serve": {
                    "builder": "@angular-builders/custom-webpack:dev-server",
                    "options": {
                        "browserTarget": "amat-solution-ui:build",
                        "proxyConfig": "src/proxy.conf.js"
                    },
                    "configurations": {
                        "production": {
                            "browserTarget": "amat-solution-ui:build:production"
                        }
                    }
                },

How can I resolve this issue?
Stackblitz Demo App


text:
Q: Solving inverse Laplace Transform with convolution theorem. Ok so I have recently found a transform that produced.
$$x\left( s \right) = \frac{\pi }{2}\frac{{\log s}}{{{s^2} - 1}}$$
However the function was given in an integral parametric form so to call it, (i.e. an integral depending on a parameter) so I want to express the integral in a closed form using the inverse transformation. Since I have proven
$$\mathcal{L}\left( {\log t} \right)\left( s \right) =  - \frac{{\gamma  + \log s}}{s}$$ where $\gamma$ is Euler's constant.
I wrote the following:
$$x\left( s \right) = \frac{\pi }{2}\frac{s}{{{s^2} - 1}}\frac{{\gamma  + \log s}}{s} - \frac{\pi }{2}\frac{\gamma }{{{s^2} - 1}}$$
Thus taking the inverse Laplace produces
$$x\left( s \right) =  - \frac{\pi }{2}\cosh t * \log t - \frac{\pi }{2}\gamma \sinh t$$
Where $ * $ denotes convolution. I'm guessing I can solve the convolution by splitting the hyperbolic cosine into exponentials, but I'd like to know if anyone can give me a nice straight forward method to solve this. Thanks in advance.

A: Unfortunately, the convolution in above cannot directly solve as it contains some divergent integrals, so you should consider on this approach instead.
With the result of http://eqworld.ipmnet.ru/en/auxiliary/inttrans/LapInv7.pdf,
$\mathcal{L}^{-1}_{s\to t}\left\{\dfrac{\pi}{2}\dfrac{\log s}{s^2-1}\right\}$
$=\mathcal{L}^{-1}_{s\to t}\left\{\dfrac{\pi}{2}\dfrac{\log s}{s^2\left(1-\dfrac{1}{s^2}\right)}\right\}$
$=\mathcal{L}^{-1}_{s\to t}\left\{\dfrac{\pi}{2}\sum\limits_{n=0}^\infty\dfrac{\log s}{s^{2n+2}}\right\}$
$=\dfrac{\pi}{2}\sum\limits_{n=0}^\infty\sum\limits_{k=1}^{2n+1}\dfrac{t^{2n+1}}{(2n+1)!k}-\dfrac{\pi}{2}\sum\limits_{n=0}^\infty\dfrac{t^{2n+1}(\gamma+\log t)}{(2n+1)!}$
$=\dfrac{\pi t}{2}+\dfrac{\pi}{2}\sum\limits_{n=1}^\infty\sum\limits_{k=1}^n\dfrac{t^{2n+1}}{(2n+1)!2k}+\dfrac{\pi}{2}\sum\limits_{n=0}^\infty\sum\limits_{k=0}^n\dfrac{t^{2n+1}}{(2n+1)!(2k+1)}-\dfrac{\pi(\gamma+\log t)\sinh t}{2}$
$=\dfrac{\pi t}{2}+\sum\limits_{k=1}^\infty\sum\limits_{n=k}^\infty\dfrac{\pi t^{2n+1}}{4^{n+1}n!\left(\dfrac{3}{2}\right)_nk}+\sum\limits_{k=0}^\infty\sum\limits_{n=k}^\infty\dfrac{\pi t^{2n+1}}{4^{n+1}n!\left(\dfrac{3}{2}\right)_n\left(k+\dfrac{1}{2}\right)}-\dfrac{\pi(\gamma+\log t)\sinh t}{2}$ (according to http://mathworld.wolfram.com/PochhammerSymbol.html)
$=\dfrac{\pi t}{2}+\sum\limits_{k=0}^\infty\sum\limits_{n=0}^\infty\dfrac{\pi t^{2n+2k+3}}{4^{n+k+2}(n+k+1)!\left(\dfrac{3}{2}\right)_{n+k+1}(k+1)}+\sum\limits_{k=0}^\infty\sum\limits_{n=0}^\infty\dfrac{\pi t^{2n+2k+1}}{4^{n+k+1}(n+k)!\left(\dfrac{3}{2}\right)_{n+k}\left(k+\dfrac{1}{2}\right)}-\dfrac{\pi(\gamma+\log t)\sinh t}{2}$
$=\dfrac{\pi t}{2}+\sum\limits_{n=0}^\infty\sum\limits_{k=0}^\infty\dfrac{\pi t^{2n+2k+3}(1)_k}{2^{2n+2k+3}3(2)_{n+k}\left(\dfrac{5}{2}\right)_{n+k}(2)_k}+\sum\limits_{n=0}^\infty\sum\limits_{k=0}^\infty\dfrac{\pi t^{2n+2k+1}\left(\dfrac{1}{2}\right)_k}{2^{2n+2k+1}(1)_{n+k}\left(\dfrac{3}{2}\right)_{n+k}\left(\dfrac{3}{2}\right)_k}-\dfrac{\pi(\gamma+\log t)\sinh t}{2}$


text:
Q: How to make SVN post-commit hook while using SVN:SSH method I have a Centos server on which SVN has been configured in SVN+SSH mode. Also website is running on same server. Users work on Windows systems and using Tortoise SVN client to checkout/commit code.
I want whenever a user commit code over SVN from Windows local system it should get updated automatically on the website on Linux server (SVN and website both are on same Linux server). So I was trying to make a post-commit hook. But it is not working.
Location for svn on server is "/var/svn/repos" and location for website is "/var/www/html/website".

A: *

*Post-commit hook (any SVN hook) is running on empty environment, i.e with at least empty PATH. You must to use full-path always inside script of hook

*Script must have executable bit enabled and (if shell-script used) correct shebang-string

*Script (user, under which it running: this is ssh-user for connection to server) must have RW-permissions for /var/www/html/website
Can't recall any additional problems here.


text:
Q: Forcing format_to_n to use terminating zero Beside most common (format) function C++20 also comes with format_to_n that takes output iterator and count.
What I am looking for is the way to make sure that in case I ran out of space that my string is still zero terminated.
For example I want the following program to output 4 instead of 42.
#include<string>
#include<iostream>
#define FMT_HEADER_ONLY
#include <fmt/format.h>
void f(char* in){
    fmt::format_to_n(in, 2,"{}{}", 42,'\0');
    std::cout << in;
}

int main(){
    char arr[]= "ABI";
    f(arr);
}

Is this possible without me manually doing the comparison of number of written chars and max len I provided to function?
If you are wondering why I use '\0' as an argument:
I have no idea how to put terminating char in format string.
note: I know that for one argument I can specify max len with :. but I would like a solution that works for multiple arguments.

A: format_to_n returns a result. You can use that struct:
void f(char* in){
    auto [out, size] = fmt::format_to_n(in, 2, "{}", 42);
    *out = '\0';
    std::cout << in;
}

Note that this might write "42\0" into in, so adjust your capacity as appropriate (2 for a buffer of size 3 is correct).

A: format_to_n returns a struct containing, among other things, the iterator past the last character written. So it's quite easy to simply check the difference between that iterator and the original iterator against the maximum number of characters, and insert a \0 where appropriate:
void f(char* in)
{
  const max_chars = 2;
  auto fmt_ret = fmt::format_to_n(in, max_chars,"{}", 42);
  char *last = fmt_ret.out;
  if(last - in == max_chars)
    --last;
  *last = '\0';

  std::cout << in;
}

Note that this assumes that the array only holds exactly the number of characters (including the NUL terminator) as the number you attempted to pass to format_to_n. The above code will therefore overwrite the last character written with a NUL terminator, essentially doing further truncation.
If instead you pass to format_to_n the number of characters in the array - 1, then you can simply always write the NUL terminator to fmt_ret.out itself.


text:
Q: Not able to localize the datepicker using moment.locale() I used moment.locale() for localize the datepicker depending on the language which user select.
1) When I use global instance of moment (Not injecting the moment in a component) and calling  moment.locales() its returning as
["en", "de", "es", "fr", "it", "ja", "nl", "pt-br", "ko", "zh-cn", "zh-tw"]

After that I tried to set the moment.locale("fr"), it is working fine as expected.
2) When I am using local instance of moment (Injecting moment in the component) and calling  moment.locales() its returning as
 ["en"]

After that I tried to set the moment.locale('fr'), it is always set as 'en'.
The same issue is happening for me when I try to get the timezones.
1) moment.tz.names() is returning all the timezone name as an array if I am using global instance of moment.
2) moment.tz.names() is returning undefined  if I am using local instance of moment.
Please help me to sort out this issue.


text:
Q: How to react to a code pair reviewer pointing out way too many small details I recently came to a situation where I could not really figure out how to react. During a project, in a paired code review, the software architecte began pointing out even the smallest detail of my code before aproving the PR, even when production day is really really close. It would seem fair, if not for the fact that when I went to the data collected by SonarQube, he has more than 160 bad practices detected, and I have only 7, of which, 4 are TODOs because fonctional spec are not ready.
So, I could really need help knowing how to react. Does it makes sense to correct the smallest detail in my code, or should I engage in a philosophical argument pointing out that his annotations are a waste of time given the close timetable on our hands ?
Juste to point out, we need the code to be merged because we need feedback from the clients in order to proceed with the code in TODO.

A:
Does it makes sense to correct the smallest detail in my code [?]

What precisely is the smallest detail? There is no objective measure of size, nor a degree to where you have the superlative "smallest possible detail". You're manipulating your words to change perception of the issue, though I cannot say whether this is intentional or subconscious.
This entire question is grasping at straws for any reason (valid or not) for not fixing something that you don't even disagree is an actual issue. Nothing in this question argues against the flaws being pointed out being incorrect.

the software architect began pointing out even the smallest detail of my code before aproving the PR, even when production day is really really close
... should I engage in a philosophical argument pointing out that his annotations are a waste of time given the close timetable on our hands ?

If the deadline decides the standard of code quality that should be reviewed, then there are severe misconceptions at play here about the purpose of code quality and reviewing it.
This is a red flag for you either not understanding or outright dismissing clean coding practices.

It would seem fair, if not for the fact that when I went to the data collected by SonarQube, he has more than 160 bad practices detected, and I have only 7, of which, 4 are TODOs because fonctional spec are not ready.

That is the fallacy of relative privation, also known as the "not as bad as" fallacy; though in this case you are pushing it into ad hominem territory.
Someone having made mistakes of their own does not somehow invalidate their point about a completely different subject.
Secondly, quantifying the alleged mistakes is pointless as it deprives the argument of reasonable context, such as hours worked, seniority, ...
Assuming similarly sized change requests for the sake of example, a developer who tackles one flawed CR a week does not somehow become "better" than a developer who pushes out multiple CRs a week, with more than one being flawed.
Let's assume for a second that the reviewer is being hypocritical and in fact makes the same mistakes that he's pointing out in your code. That just means that you both have things to fix. Nothing about this somehow invalidates the fact that you still have to fix your code.
What the basis for your argument here? If there's any mistake, then all bets are off for code quality reviews?
Well, in that case, I don't think the police should be fining me for speeding while there's still a bank robber at large - because that is clearly a more pressing matter, no?

I have only 7, of which, 4 are TODOs because fonctional spec are not ready

Agreeing that something is a flaw is not the same as agreeing you need to immediately fix it. If something is known to be a TODO or WIP, then it shouldn't even be reviewed yet.
However:

before aproving the PR

When you open a pull request, you are stating that the code is finished, yet you just stated that it's still a TODO and you don't even have the spec yet.
Why on Earth would you try to put unfavorably reviewed code that isn't even finished yet to the source branch?

I have only 7 [bad practices], of which, 4 are TODOs because fonctional spec are not ready

If you're waiting for the spec anyway, that clearly means you are able to look at things that are actually fixable. While the 4 TODOs are awaiting further information from the analysts, that gives you time to address the other 3 issues.

And lastly, Pieter B's comment deserves a bigger spotlight:

If he doesn't point them out now, when should he? Because your immediate reply would be: "why is this now a problem? When last week you were ok with it." Damned if you do, damned if you don't.

When exactly would be an appropriate time for you to fix the flaws in your code? After the pull request is merged? After a production release? When you don't have other duties to attend to? Whenever there is work time but no work?
You're trying to dodge having to fix your code without any practical argument as to why or when it will actually be addressed should it not be done right away (which it should be).


text:
Q: TypeError: unhashable type: 'OptimizeResult' while Parallel processing I am trying to run Parallel programming in python using pp package, but it is running through some iterations and then, throwing an error :
Please help
ppservers = ()

if len(sys.argv) > 1:
  ncpus = int(sys.argv[1])
  # Creates jobserver with ncpus workers
  job_server = pp.Server(ncpus, ppservers=ppservers)
else:
  # Creates jobserver with automatically detected number of workers
  job_server = pp.Server(ppservers=ppservers)

print "Starting pp with", job_server.get_ncpus(), "workers"

start_time = ti.time()

jobs = []
for new_data_set in many_isotopomer_data:
  jobs.append(job_server.submit(optimzation(ob.objective, input_dict, method ='SLSQP', args=(system_ode, params_val_dict, initial_cond, time, new_data_set, id_name, input_dict), constraints=None, niter=1, bound=bnds)))

print "Time elapsed: ", ti.time() - start_time, "s"
job_server.print_stats()

So, it is running the initial iterations, however, it throws the following error :
[Error Message, after some iteration are done][1]

chi square error - 1.4150205992
chi square error - 1.4150206112
chi square error - 1.41502057127
chi square error - 1.41502059919
Traceback (most recent call last):
  File "carlos_test.py", line 218, in <module>
new_data_set, id_name, input_dict), constraints=None, niter=1, bound=bnds)))
  File "/Users/bhavyabhushan/virtualenvs/elf/lib/python2.7/site-packages/pp.py", line 460, in submit
sfunc = self.__dumpsfunc((func, ) + depfuncs, modules)
  File "/Users/bhavyabhushan/virtualenvs/elf/lib/python2.7/site     packages/pp.py", line 636, in __dumpsfunc
   hashs = hash(funcs + modules)
 TypeError: unhashable type: 'OptimizeResult'


text:
Q: mongod memory usage doesn't decrease I'm using mongodb for saving log data.
When I have to find something from log data, which could be over than 1,000,000 documents, all the process work properly but the issue is that memory usage doesn't get down even though the process has been finished.
When I enter 'top' command on the server that runs mongod process, it shows resource information like below screenshot.
Memory usage for the mongod process was less than 10%, but after using a lot of find() queries, it increased to 38.9% and never decreasing. What causes this kind of issue and what do I do to decrease the memory usage of mongod process except restarting?

I didn't know that this question is not appropriate for stackoverflow site, but when I asked the same question in stackoverflow someone replied me like this.
"Of course it doesn't, it's a database. They are meant to consume memory and hold on to it"
But what I did with my code was just using .find() query, nothing was added to database. Does it mean that only using find() query could have caused increasing of  memory usage and not releasing it? I don't understand help me please

A: MongoDB use all memory, always! Reason why find increases memory usage (compare to fresh started machine) is that with every find, mongod will fill it's cache more to server clients better. It tries to keep active indexes and data in the memory, if possible.


text:
Q: How to return from "partial curl" type segue I am attempting to use a partial curl segue to reveal an options view underneath my main view. This is identical to touching the "page curl" button in the bottom right corner of the Maps app.
I can successfully execute the segue to the option view, my problem is returning to the main view. I'm hoping to replicate the reverse animation effect of the Maps app as the edge curls back flat and the main view is shown.
It doesn't seem logical to create another segue to return back to the main view (what I would do if I were not using the partial curl segue) because the return segue is associated with the original segue.
Thanks in advance for any help!

A: try
-(IBAction) buttonPressed{
    [self dismissModalViewControllerAnimated:YES];
}

This should work!
Or i believe you can press the back side of the turned page and it will return automatically with out adding any code! Hope that helps!

A: In Swift dismissModalViewControllerAnimated has been renamed:
@IBAction func handleAddButton(_ sender: Any) {
    self.dismiss(animated:true, completion: {})
}


text:
Q: How to add generic for styled function in emotion css? In the official document we can see the API for ListItemButton, It includes a "component" property, Portal: enter link description here
and Im trying to wrap the component with styled function, my code is like this:
import {ListItemButtonProps} from "@mui/material/ListItemButton/ListItemButton";
import {styled} from '@mui/material/styles';

cosnt ExampleComponent: FC = () => {
  return (
    <ListItemStyle
      component={RouterLink}
      to={path}
      sx={{
        ...(isActiveRoot && activeRootStyle),
      }}
    >
      <ListItemIconStyle>{icon && icon}</ListItemIconStyle>
      <ListItemText disableTypography primary={t(title)}/>
      {info && info}
    </ListItemStyle>
  )
}

Then I see this error
[enter code here][2]

of course you call replace ListItemButtonTypeMap with any to fix this issue, but Im trying to figure out the right way to use this function
link to emotion document: enter link description here


text:
Q: If $g(x) = \dfrac{2x}{x+1}$, find $\dfrac{g(x+h)-g(x)}{h}$ Solve the following:

If $g(x) = \dfrac{2x}{x+1}$, find:
  $$\dfrac{g(x+h)-g(x)}{h}$$

A: If $$g(x)=\frac{2(x)}{(x)+1},g(x+h)=\frac{2(x+h)}{(x+h)+1}$$
So, $$g(x+h)-g(x)=\frac{2(x+h)}{x+h+1}-\frac{2x}{x+1}=\frac{2(x+h)(x+1)-2x(x+h+1)}{(x+h+1)(x+1)}=\frac {2h}{(x+h+1)(x+1)}$$
So, $$\frac{g(x+h)-g(x)}h=\frac2{(x+h+1)(x+1)}$$
If you know, $g'(x)=\lim_{h\to0}\frac{g(x+h)-g(x)}h,$
$$g'(x)=\lim_{h\to0}\frac2{(x+h+1)(x+1)}=\frac2{(x+1)^2}$$


text:
Q: What is the best way to handle the Angular material reactive form error messages? In our project we are using Angular material forms. Coming to the validation
<form class="example-form">
  <mat-form-field class="example-full-width">
    <mat-label>Email</mat-label>
    <input matInput [formControl]="emailFormControl"
           placeholder="Ex. pat@example.com">
    <mat-hint>Errors appear instantly!</mat-hint>
    <mat-error *ngIf="emailFormControl.hasError('email') && !emailFormControl.hasError('required')">
      Please enter a valid email address
    </mat-error>
    <mat-error *ngIf="emailFormControl.hasError('required')">
      Email is required
    </mat-error>
  </mat-form-field>
</form>

Angular material    component defaully it self checking that field is touched/ submitted validation states. and applying invalid red color to the field and error message.
No need to do anything.
Generally documentaion suggest above approach. But instead of wirte error message directly in html and to reduce number of lines
we are passing that though service like this. But this is not a best practice that calling a function or service directly from html.
<mat-form-field class="example-full-width">
    <mat-label>Email</mat-label>
    <input matInput formControlName="emailFormControl"
           placeholder="Ex. pat@example.com">

    <mat-error>

    </mat-error>
  </mat-form-field>

I know Calling a function in html thought component or service to bind data is impact the performence according to the change detection.
Check the following link for reference Example material reactive form
So What is alternate and best approach?

A: mat-error elements are managed by MatFormField so they don't need to be explicitly shown/hidden unless you have more than one. On top of that, errors are always triggered by a change of some sort, so you can subscribe to status and value changes on form objects and set error messages as needed, using only one mat-error. For example:
<mat-error>{{emailErrorMsg}}</mat-error>
...
emailErrorMsg: string = '';
...

ngOnInit() {
  ...
  this.exampleForm.statusChanges.subscribe(() => this.setErrors());
}

setErrors() {
  if (exampleForm.controls['emailFormControl'].hasError('required')) {
    this.emailErrorMsg = "Email is required";
  }
  else if (exampleForm.controls['emailFormControl'].hasError('email')) {
    this.emailErrorMsg = "Please enter a valid email address";
  }
};

This works well except for "required" which can be triggered without any value or status change. In those cases, a blur listener can be used on the inputs:
<input (blur)="setErrors()">


text:
Q: How to set countdown timer for playing song by using streaming in android I am trying to set count down timer for streaming song from url.Countdown timer is Working, but when data is not buffered because of slow internet speed the countdown timer is not stopped. If anyone have idea about that please help me.
thanks.

A: You can get total duration and current duration for media player like this
long totalDuration = mediaPlayer.getDuration()/1000; // converted to seconds

long currentDuration = mediaPlayer.getCurrentPosition()/1000;

and to get count down timer you can use this
long  counDown = currentDuration  - totalDuration ;

Hope this helped you.


text:
Q: Unable to solve Ensure text remains visible during webfont load I have tested my code with LightHouse on chrome and I am unable to solve the Error -
Ensure text remains visible during webfont load.
Leverage the font-display CSS feature to ensure text is user-visible while webfonts are loading.

I have introduced this css code in style.css ,style.scss inside assets , index.html and every .css file of component in angular7 template.
My css code is -
@font-face {
    font-family: "Open Sans Regular";
    font-style: normal;
    src: url("../font/opensans-regular-webfont.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
  }

Whichever place I kept the css, I am unable to solve the error.


text:
Q: Staircase table with TiKz
I would like to make a table with the following staircase pattern (preferably with TiKz). In addition for each of the cells there should be a mini-box. The minibox has further data such as a pH level while the main box has a solubility (s) or in soluable.

A: These are both fun exercises in using \foreach. The macros \LabGrid and \ChemGrid, defined below, both accept a variable number of rows/columns and \LabGrid has an optional argument for the colour. The MWE below produces:

Here is the code:
\documentclass{article}
\usepackage{tikz}

%usage: \LabGrid[colour]{CAPITAL letter for last row/column}
\newcommand\LabGrid[2][purple]{%
    \begin{tikzpicture}[xscale=1]
        \foreach \row [count=\r,remember=\r] in {A,...,#2} {
           \draw[fill=#1!10!white](0,-\r) rectangle ++(2,1);
           \node at (1,0.5-\r){$\row$};
           \foreach \c in {1,...,\r} {
              \draw[thick](2*\c,-\r) rectangle ++(2,1);
           }
        }
        \draw[fill=#1!10!white](0,-1-\r) rectangle ++(2,1);
        \foreach \row [count=\c] in {A,...,#2} {
            \draw[fill=#1!10!white](2*\c,-1-\r) rectangle ++(2,1);
            \node at (2*\c+1,-0.5-\r) {\row};
        }
    \end{tikzpicture}%
}

% usage: \ChemGrid{comma separated list of chemicals}
\newcommand\ChemGrid[1]{%
  \begin{tikzpicture}[xscale=1.8,
      header/.style={rectangle,minimum width=2cm,minimum height=1cm}]
     \foreach \row [count=\r, remember=\r] in {#1} {
       \node[header] at (1.5,0.2-2*\r){\row};
       \draw(1,-2*\r)rectangle++(1,2);
       \foreach \chem [count=\c] in {#1} {
          \draw[thick](2*\c,-2*\r)--++(2,0)--++(0,2);
          \draw(2*\c+1,2-2*\r)--++(0,-1)--++(1,0);
       }
     }
     \foreach \row [count=\c, remember=\c] in {#1} {
       \node[header] at (2*\c+1,-0.3-2*\r) {\row};
       \draw(2*\c,-0.5-2*\r)--++(0,0.5);
     }
     \draw(2*\c+2,-0.5-2*\r)--++(0,0.5);
  \end{tikzpicture}
}
\begin{document}

  \LabGrid{C}\bigskip

  \LabGrid[green]{E}\bigskip

  \ChemGrid{NH$_4$O$_2$, BACl$_2$, CuSo$_4$}

\end{document}

Edit
I realised that the nodes did not scale with xscale and yscale. I have fixed this.
As shown, the easiest way to fine-tune the sizes of the boxes is by setting xscale and yscale in the tikzpicture environment.


text:
Q: QuickBlox notifications not working for Android I've been using QuickBlox sample-pushnotifications (link) and it's not working - both with test data from sample and mine. Steps are following:

*

*Setup keys in Application

*createSession with user credentials

*createSubscription (I added this by myself - it's working and my user is present in dashboard)

*register receiver (from sample and custom)

*The app is running, time to send a message.

*createEvent.

All of QB operations are successful (by that I mean "all onSuccess methods are invoked"), but I don't receive any notifications at all. Receiver's onReceive method is not invoked. I have also tried to send them via dashboard. They appear in Push Notifications->Queue with status "sent", but still - no action on device side.


text:
Q: Hibernate Query returns null value when stored procedure is called I am trying to call postgreSQL stored  procedure to retrieve details of employee .
When i run this method , it returns null value .
public List<EmployeeAttendanceVO> getdata(String ListempIdString)
{

String startDayTime = "2020-05-22 00:00:00.000";
String endDayTime = "2020-05-22 23:59:59.999";
String ListempIdString = "'P1200',P1201',P1202',P1203',P1204',P1205'";
Session session = sessionFactory.getCurrentSession();

//Calling GETEMPDATA PostgreSQL Stored Procedure
SQLQuery query = session.createSQLQuery("SELECT * FROM GETEMPDATA (ARRAY[:ListempIdString], :startDayTime , :endDayTime)");

query.setString("ListempIdString", ListempIdString);
query.setString("startDayTime",startDayTime);
query.setString("endDayTime", endDayTime);
query.addEntity(EmployeeAttendanceVO.class);
List<EmployeeAttendanceVO> queryResult = query.list();

return queryResult;

 }

It returns data when i run it in this way :
public List<EmployeeAttendanceVO> getdata(String ListempIdString)
     {

String startDayTime = "2020-05-22 00:00:00.000";
String endDayTime = "2020-05-22 23:59:59.999";
Session session = sessionFactory.getCurrentSession();

//Calling GETEMPDATA PostgreSQL Stored Procedure
SQLQuery query = session.createSQLQuery("SELECT * FROM GETEMPDATA (ARRAY['P1200',P1201',P1202',P1203',P1204',P1205'], :startDayTime , :endDayTime)");

query.setString("startDayTime",startDayTime);
query.setString("endDayTime", endDayTime);
query.addEntity(EmployeeAttendanceVO.class);
List<EmployeeAttendanceVO> queryResult = query.list();

return queryResult;

      }


text:
Q: Parse a very simple XML string into an NSDictionary I want to parse a very simple XML string into an NSDictionary so that I can easily access the attributes.
RecurrenceInfo: "<RecurrenceInfo Start="12/24/2013 01:00:00" End="01/03/2014 01:00:00" DayNumber="24" WeekOfMonth="0" WeekDays="62" Id="49409301-c3ec-43f0-8571-ca42258e8a6f" Month="12" OccurrenceCount="9" Range="1" />",

I was looking around and found some libraries, but then I still need to implement lot of things. Anybody know if this can be done more easy ?
kind regards

A: There is a good wrapper class written on top NSXMLParser. Just pass the XML String. It will convert into NSDictionary.
https://github.com/amarcadet/XMLReader

A: Don't use a third party library. Use one of the built in ones:

*

*NSXMLParser

*libxml2

For this case, you'd be better off using NSXMLParser, there are plenty of examples available, but the official documentation is at: https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/XMLParsing/XMLParsing.html#//apple_ref/doc/uid/10000186i
You should create a class of your own specifically to parse your type of XML string using NSXMLParser. It could return an instance of itself or perhaps an NSDictionary. Up to you.

A: Create the object of NSXMLParser.
NSXMLParser *myParser = [[NSXMLParser alloc] initWithData:xmlData];
[myParser setDelegate:self];
[myParser setShouldResolveExternalEntities: YES];
[myParser parse];
[myParser release];

In the delegate method you will find attribute dictionary.
-(void)parser:(NSXMLParser*)parser
didStartElement:(NSString*)elementName
 namespaceURI:(NSString*)namespaceURI
qualifiedName:(NSString*)qualifiedName
   attributes:(NSDictionary*)attributeDict;

Here attributeDict will have all the attributes.


text:
Q: How do I keep my team involved and motivated? I am currently a grad student, but I was in the industry for a few years before going back to school.
I am in a class which involves teams of 4 working on fairly ambitious projects.  As a result of having been in the industry, I have a lot of "software engineering" experience my fellow teammates lack (they are using SVN for the first time this semester).  They are all very good programmers; but they don't have a lot of experience in building "real stuff".
Since I had a fairly concrete vision for a project, and my teammates did not, my idea is the one we will spend this semester working on. On top of that, as a result of my experience, plus the fact that I admittedly have a somewhat strong personality, I've become a de-facto team lead -- established weekly meeting times, assigned initial tasks, etc.
I want to avoid the trap of being so forceful with my ideas for what we should be doing and how we should be doing it, that my teammates feel like they have no say and become uninvolved and detached.
So here is the question:
How can I keep my team of undisciplined but talented programmers motivated while enforcing basic best practices (version control, milestones, etc) and a coherent project vision?
Edit: Thanks to everyone who answered so far. I think I've overemphasized the "software engineering" aspect of things; I'm also looking for ideas for how to encourage my teammates to contribute to the design, and feel ownership in the project which is at the moment a little bit "The SquareCog (and friends) Show!"

A: The best method I've found has nothing to do with code: team lunches.
Get together in an informal setting where you each talk about your problems, concerns, ideas, etc.  This helps team unity in a way that very little else does.
As for the actual code side of it, minimize the amount of work they have to do to work inside the framework you want them to.  If you want them to use tickets, do the actual management side of things for them -- have them tell you what the ticket is and have you do the actual legwork of managing these things.  This seems like it'd take a long time, but overall it's minimal compared to the cost of poor communication and coordination.  It pays off very quickly.
For version control, show them why it truly benefits them.  Programmers pick up on ideas and run with them when they see they actually help them rather than just being a PITA.

A: I think developers are really practical people.
Play with those traits of typical developer personality:
1. Creativity
2. Curiosity
3. Practicality
Following your direct example, source control:
Most of us (I mean by my own experience) will fail to see the point in source control in the beginning (just because), so always keep them aware of the reason behind using source control.
Another thing is.. who decided to go on SVN? There are alternatives, I for one would fight to the teeth not to have SVN because I am a Git! (pun intended)
Instead of pulling them by the nose, you should/could have explained to them:
We need source control, find one you like and lets vote it out what we use to control the source.. this way there is a common ownership..and not just a follow the leader exercise.
Another thing is, be flexible in what you implement.
Draw out a plan on necessities, but try to be ready to implement them as the need arises, or as it becomes obvious to all that x, y or z practice should be implemented.
Have them need to implement the tools and resources and planning techniques you know by having them come to you for advice. (this doesn't mean you can't lay out a best practices blog internally or some other way of giving them access to this information beforehand)
Developers like to learn and grow, but we need ownership and understanding in the direction we are going.
If you try to force feed and drive them too much, both you and them will just lose motivation, enlightenment requires self driven forces.

A: I've been in a similar position a number of times.
Sometimes I just take charge, and be damned. Fair enough.
And many times, I resist the urge; I try to encourage my colleagues to take the lead. Sometimes this works, sometimes not.
And sometimes, I just come clean. "I seem to be taking over, as is my nature. But I don't want to railroad you guys. Anyone else fancy taking the lead? If not, are you happy with what I have already suggested? Speak up if you have any good ideas...". Again, sometimes this works, but not always.
Ultimately, you can 'lead the horse to water'... Projects need the lead, if no-one else rises to the challenge, it is better that you do.
Once you have the lead, lead by example...

A: How about the Scrum (even if you don't call it that). Gives everyone a chance to have their say, and you listen. As the forceful personality giving the others a real chance to communicate what's on their mind (not yours) is a good step towards harmony.
On top of that they will learn from your tech experience, you will learn from their ideas and enthusiasm. A good leader is always open to communication, you set the direction and vision (and you did choose the project) they come up with the clever ways of doing it.

A: offer non-monatary prizes or awards
Give them their own areas to "own."  Even though they may not take pride in the project, they will want to make their own areas excel.  Make they question, can their area be refactor or improved.  It will make them learn new techniques or practices.
Allow them to learn by fire (in small phases) and then show them the correct way.  Let them fail doing it their way, but allow time for them to do it the proper way.
Update:
Sorry to make the above sound like the team-leader would be the one in control of what is correct.  It is mean to be more of a code-review that can be done by any one on the teams. They can move forward with the changes/refactor together as a team.

A: *

*The project should be interesting enough to keep them involve

*the technology should be also recent

*let them know this is how the industry moves and that they will gain the necessary experience to be in top of other programmers

*offer prizes and punish those who break the build

*rotate the positions let them test their ability to lead

A: I am doing my masters degree currently and have had frequent group projects.  It is not unusual to have only 1 or 2 members of the group doing the project.  Not just from my projects but talking with other people.  Basically what you said about the "SquareCog" and friends show is not unrealistic.
Really the more people you have on the group the lazier people will be.  Also the more time lost communicating with them as they invent tons of ideas that they have no intention of following through with.  It is well known that there is a point where extra programmers do not help the project anymore.  There is only so much you can break something up.  Over doing it will slow things down more than just giving a part to one person and create more dependencies.
Also the average student has a comfort zone, so even if you can get them to do some work, the will stay within their comfort zone.  Someone has to leave their comfort zone for most projects (unless someone already knows the information in the class) to succeed.  Most of the time I find that I am the only one willing to do that in my group, and some groups have no one.  The most radical example was a 7 person project where almost no one did anything.  One other guy was willing to do some light sys admin tasks and then the web design, that were within his comfort zone.  One girl did some database design (and I do mean some because I basically did the design as a high level outline that she formalized with column names/data types).  The rest did absolutely nothing.  The class was distributed systems, so someone needed to learn JBoss (and Enterprise Java Beans), Amazon Web Services, etc...  But it doesn't matter the class.  In a data mining class, someone will have to figure out which techniques to use and how to use the toolkit.
Also many students are not good programmers.  In fact there was someone in one of my groups who couldn't program at all.  Really based on his description an MBA sounded like the right degree for him, but anyway he went through with the Masters in CS by farming out his programming to friends/contractors...  Many are just terrible programmers and not just in style, they couldn't debug hello world with visual studio....  Rather than understand what went wrong they will just keep adding code until it works by coincidence.
One thing that happens quite often is that people come up with fairly ambitious projects that are not realistic for a semester.  Usually I end up taking he scissors and cutting it to a barebones project and offer that once we finish the barebones part, then we can refine it and add the more advanced stuff.  What almost always ends up happening is that people drag out finishing it and in the end after we get the barebones done no one wants to do anything additional.
There are 2 types of grad students.  Full time grad students who take 4-5 classes, in which case they cannot afford to spend 40/80 or even 20 hour work weeks working on the project.  Or part time grad students who have a day job, in which case they take 1 or 2 classes and have a full time job so they have even less time.  I would say as a general estimate you can figure 6 hours of homework per graduate class (most will spend less).  Assuming a normal class, probably 3-4 or that needs to be spent on studying/reading for the class.  This leaves 2-3 hours per week per person to work on the project.  Even getting that much would be good.
Some of the ideas floated like team lunches are not realistic at all.  Many grad classes have group projects, and the full timers can't do 4 or 5 team lunches per week, that is like 5 hours of wasted time per week that could be spent on a rpoject.  Also there may be money issues if you go to restaurants and expect all to buy lunch.  And for someone who goes part time like me, I'm not going to do a team lunch because I work 9-6+ or 8-5 on college nights.
Probably your best bet is to find people's comfort zones and figure out tasks you can assign to them.  Also to identify the freeloaders and not waste your time with them.
Also using version control for a school project seems like overkill.  If the whole class is just the project maybe not.  But assuming it is a normal class with lectures, exams, and homework assignments with the project done on the side, then any time spent on infrastructure is time you are not getting the project done.  Really, though unrealistic for a professional environment, school projects are like start ups.  Get them done, even if the code is a mess.  You can always clean up later.  But if you don't get it done, your grade will suffer.  And in reality once it is done, I don't want to clean it up and no one else does either....  Getting everyone to use source control (unless you share a machine) would waste a lot of time with set up issues, and adjusting people to using it.  i don't know what your project is.  But with many graduate projects you have to do some research/experimentation and then the programming code is relatively simple.  One class got me with a 5,000 line project, lucky it wasn't a group project.
Again on the project keep it simple.  You can just coordinate the parts, assign the different parts and as they are done check/test it and then integrate it with your version control and leave them free to work on the project whatever is most comfortable.
Many will be happy to let you design the thing, implement the thing, and then learn absolutely nothing and just get the grade.  It is their loss because they won't get the lessons of the project.  But they are quite happy with squarecog and friends being just squarecog.  Some will want to contribute something, but they are in the minority.  If you get one of them great for you!!!  Also watch out for over engineering.  You have to look at things realistically.  3 hours per week per group member would be great, but I find even that is unrealistic.  When a project is due sometimes you might get 5 or 10 hours per week from someone who slacked off.  But you can't expect more.

A: How to Win Friends and Influence People has the following suggestions:

Fundamental Techniques in Handling
  People

*

*Don't criticize, condemn, or complain.

*Give honest and sincere appreciation.

*Arouse in the other person an eager want.

  Six Ways to Make People Like You

*

*Become genuinely interested in other people.

*Smile.

*Remember that a man's Name is to him the sweetest and most important
  sound in any language.

*Be a good listener. Encourage others to talk about themselves.

*Talk in the terms of the other man's interest.

*Make the other person feel important and do it sincerely.

  Twelve Ways to Win People to Your Way
  of Thinking

*

*Avoid arguments.

*Show respect for the other person's opinions. Never tell someone
  they are wrong.

*If you're wrong, admit it quickly and emphatically.

*Begin in a friendly way.

*Start with questions the other person will answer yes to.

*Let the other person do the talking.

*Let the other person feel the idea is his/hers.

*Try honestly to see things from the other person's point of view.

*Sympathize with the other person.

*Appeal to noble motives.

*Dramatize your ideas.

*Throw down a challenge & don't talk negative when the person is
  absent, talk about only positive.

  Be a Leader: How to Change People
  Without Giving Offense or Arousing
  Resentment

*

*Begin with praise and honest appreciation.

*Call attention to other people's mistakes indirectly.

*Talk about your own mistakes first.

*Ask questions instead of directly giving orders.

*Let the other person save face.

*Praise every improvement.

*Give them a fine reputation to live up to.

*Encourage them by making their faults seem easy to correct.

*Make the other person happy about doing what you suggest.

In addition to this, "Top Three Motivators For Developers (Hint: not money!)" notes the Autonomy, Mastery, and Purpose ideas that can also be great motivators for people when it comes to creative work.


text:
Q: Strange java.lang.OutOfMemoryError -- process does not crash I'm seeing a strange java.lang.OutOfMemoryError error (partial stack trace below). The thing is that the java process does not crash. I see this error in the logs but the process seems to stall but does not exit.
Thanks.
Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:691)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:943)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1325)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132)
at com.amazonaws.services.s3.transfer.internal.UploadMonitor.<init>(UploadMonitor.java:126)
at com.amazonaws.services.s3.transfer.TransferManager.upload(TransferManager.java:384)
at com.amazonaws.services.s3.transfer.TransferManager.upload(TransferManager.java:344)
at com.amazonaws.services.s3.transfer.TransferManager.upload(TransferManager.java:272)

A: java.lang.OutOfMemoryError: unable to create new native thread

This is due to the fact that no more native threads could be created from your app.

*

*Check the number of Threads your app is spawning. Most likely this is the culprit.
You can take a Thread dump for analyzing this.

*Then check your stack size. Xss param will give you that. Try tweaking it.
Increasing Xmx won't help you here. In fact on 32 bit JVMs it will exacerbate the issue.
The reason why your process is not stopping is because of the fact that Uncaught Exceptions only terminate their own thread, not the entire application as mentioned by Jan in the comments.

A: An OutOfMemoryError, or any Error for that matter, does not make the JVM crash. It might make it exit if you only have one Thread where you don't catch Errors (not very useful anyway), for example. If the JVM doesn't exit, it will be in a unstable state anyway, and should be restarted.


text:
Q: Windows Administrator doesn't have permission on SQL Server My previous system administrator created a SQL Server 2008 instance on my local machine with his domain User.
Now, I cannot create, delete, or view any databases or tables on that instance. Even with my domain User, or Windows local administrator.
It says "CREATE DATABASE permission denied in master".
The users section in Management studio shows only two users 'BUILTIN\Users' and 'sa' which is disabled. 'Builtin\Users' has only public role.
It seems no user have permission to this instance. How can my Local Administrator get permission to it ?
I cannot delete the instance as it has important databases.


text:
Q: d3.transition().attr('x', y) does not work when d3.attr('x', y) does The following works (the circle will move to the new location at the point(s) provided)
d3target
  .attr('cx', newCX )
  .attr('cy', newCY )

but these do not:
d3target
  .transition()
  .attr('cx', newCX )
  .attr('cy', newCY )
   // .duration(1000) // Still doesn't work with or without the duration

and nor does this: (by providing a starting value as suggested by API docs)
d3target
  .attr('cx', originalCX )
  .attr('cy', originalCY )
  .transition()
  .attr('cx', newCX )
  .attr('cy', newCY )
   // .duration(1000) // Still doesn't work with or without the duration

The circles do not animate, nor move at all. We tried manually setting the dur to 1 second to ensure that the animation wasn't finishing or skipping because it was too small for it to be noticed or skipped or the like.
We have tried and looked at lots of possibilities as to why, so any thoughts as to why or what else to try is greatly appreciated.
Basic info for reference:
The d3Target looks as follows, and to what we know is correct, given that the first code block works by just adjusting the attrs directly without a transition() call.

A: First assign you transiton ( return of the transition method ) to a variable, then try console.log(transition_selection.empty()). If it's false then you know that you have something to transition.
Second try: transition_selection.each('start', function(){ console.log('started'); }).each('interrupt', function() {console.log('interrupted');}).each('end', function(){ console.log('ended'); });
This way you'll be able to see if transition was started and was interrupted.
Third try:  transition.attr('cx', function (d) { console.log( 'attr got assigned'); ) });
This way you will know if the value you provided for 'cx' was read.
Actually try all of the above in the same run. So that you can see what happens in what order.
Always try naming you transitions. d3traget.transition('somename')
This way you can run many transitions on the same selection in parallel. If you run more than one "unnamed" transitions on the same selection, the second transition will stop the first one.
Hope any of what I've given to you will help you resolve your problem. Good luck!

A: The transition works using the following simplified code:
html:
  <svg height='500' width='500'>
        <circle id='circ' cx='50' cy='50' r='10'></circle>
    </svg>

js:
var d3target = d3.select('#circ');

d3target
  .transition()
  .attr('cx', 100 )
  .attr('cy', 100 )

fiddle
This means there is something else in the code that is stopping your transition from working.
Following the link to your code, as far as I can see this is where you have the transition going on:
 if(this.parentMeasureModel.get('timesRecorded') !== 0) {
    d3target
      .attr('cx', newCX )
      .attr('cy', newCY )

    setTimeout(function(){
      d3target
        .attr('cx', originalCX )
        .attr('cy', originalCY )
    }, dur);
  // Otherwise we use the standard method
  } else {
    d3target.transition()
      .attr('cx', newCX )
      .attr('cy', newCY )
      .duration(dur)
      .each('end',function() {                   // as seen above
        d3.select(this).                         // this is the object
          transition()                           // a new transition!
            .attr('cx', originalCX )    // we could have had another
            .attr('cy', originalCY )    // we could have had another
            .duration(dur);                  // .each("end" construct here.
       });
  }
}

The difference between the two is the dur variable and the each method. Try using an actual value for the dur variable and removing the each method. If it works then your issue lies there.


text:
Q: CSS div contained in parent incorrectly with IE I am having a problem with this website displaying incorrectly with IE.
http://outlawstar.zymichost.com/
I think that the problem is that menu_bar is not contained within the head div.  However, the code works properly in both chrome and firefox.  Any suggestions?  Thanks!

A: Well one of the problems is that the combination of your logo div and menu_bar div exceeds the width of your head div. If I set your menu_bar div to 740px it fits just fine. The other thing you should do is add a div after menu_bar like the following:

. That way you clear your floats that you set inside the head div.
Edit:
Also, there seems to be an issue with the li set to display: inline-block in IE. To get it to work there you want to set it to just display: inline but this unfortunately messes with the li style in firefox. It might be prudent to set up a different stylesheet just for IE.